Skip to content

Commit

Permalink
Remove updateValueInt, use updateValue< long > instead
Browse files Browse the repository at this point in the history
  • Loading branch information
stinebuu committed Mar 22, 2022
1 parent 736f404 commit 65277cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
4 changes: 2 additions & 2 deletions models/quantal_stp_synapse_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ quantal_stp_synapse< targetidentifierT >::set_status( const DictionaryDatum& d,
updateValue< double >( d, names::u, u_ );
updateValue< double >( d, names::tau_rec, tau_rec_ );
updateValue< double >( d, names::tau_fac, tau_fac_ );
updateValueInt( d, names::n, n_ );
updateValueInt( d, names::a, a_ );
updateValue< long >( d, names::n, n_ );
updateValue< long >( d, names::a, a_ );
}

} // of namespace nest
Expand Down
34 changes: 0 additions & 34 deletions sli/dictutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,40 +270,6 @@ updateValue2( DictionaryDatum const& d, Name const n, C& obj, void ( C::*setfunc
}
}

/** Update an int or a double from a dictionary entry if it exists, and convert it to an int.
* Skip call if it doesn't exist.
* @ingroup DictUtils
* @throws TypeMismatch The entry is neither int nor double.
* @returns true if the property was found (and updated) in the dictionary, false otherwise
*/
inline bool
updateValueInt( const DictionaryDatum& d, Name propname, int& prop )
{
if ( d->known( propname ) )
{
Datum* dat = ( *d )[ propname ].datum();
IntegerDatum* intdat = dynamic_cast< IntegerDatum* >( dat );
if ( intdat != nullptr )
{
prop = static_cast< int >( intdat->get() );
return true;
}
DoubleDatum* doubledat = dynamic_cast< DoubleDatum* >( dat );
if ( doubledat != nullptr )
{
prop = static_cast< int >( doubledat->get() );
return true;
}
else
{
throw TypeMismatch();
}
}

return false;
}


/** Create a property of type ArrayDatum in the dictionary, if it does not
* already exist.
* @ingroup DictUtils
Expand Down

0 comments on commit 65277cd

Please sign in to comment.