NEST  2.6.0,not_revisioned_source_dir@0
Functions
How to access the value contained in a Token contained in a dictionary.

Class Dictionary defines the standard user interface for accessing tokens from dictionaries (see there). More...

Functions

template<typename FT >
FT getValue (const DictionaryDatum &d, Name const n)
 Get the value of an existing dictionary entry. More...
 
double get_double_in_range (const DictionaryDatum &d, Name const n, double min, double max, int mode=2)
 Get the value of an existing dictionary entry and check that it is in a specified range. More...
 
long get_long_in_range (const DictionaryDatum &d, Name const n, long min, long max, int mode=2)
 Get the value of an existing dictionary entry and check that it is in a specified range. More...
 
template<typename FT , class D >
void def2 (DictionaryDatum &d, Name const n, FT const &value)
 Define a new dictionary entry from a fundamental type. More...
 
template<typename FT >
void def (DictionaryDatum &d, Name const n, FT const &value)
 Define a new dictionary entry from a fundamental type. More...
 
template<typename FT , typename VT >
bool updateValue (DictionaryDatum const &d, Name const n, VT &value)
 Update a variable from a dictionary entry if it exists, skip call if it doesn't. More...
 
template<typename FT , typename VT , class C >
void updateValue2 (DictionaryDatum const &d, Name const n, C &obj, void(C::*setfunc)(VT))
 Call a member function of an object, passing the value of an dictionary entry if it exists, skip call if it doesn't. More...
 
void initialize_property_array (DictionaryDatum &d, Name propname)
 Create a property of type ArrayDatum in the dictionary, if it does not already exist. More...
 
void initialize_property_doublevector (DictionaryDatum &d, Name propname)
 Create a property of type DoubleVectorDatum in the dictionary, if it does not already exist. More...
 
void initialize_property_intvector (DictionaryDatum &d, Name propname)
 Create a property of type IntVectorDatum in the dictionary, if it does not already exist. More...
 
template<typename PropT >
void append_property (DictionaryDatum &d, Name propname, const PropT &prop)
 Append a value to a property ArrayDatum in the dictionary. More...
 
template<>
void append_property< std::vector< double > > (DictionaryDatum &d, Name propname, const std::vector< double > &prop)
 Append a value to a property DoubleVectorDatum in the dictionary. More...
 
template<>
void append_property< std::vector< long > > (DictionaryDatum &d, Name propname, const std::vector< long > &prop)
 Append a value to a property IntVectorDatum in the dictionary. More...
 
void provide_property (DictionaryDatum &, Name, const std::vector< double > &)
 Provide a value to a property DoubleVectorDatum in the dictionary. More...
 
void provide_property (DictionaryDatum &, Name, const std::vector< long > &)
 Provide a value to a property IntVectorDatum in the dictionary. More...
 
void accumulate_property (DictionaryDatum &, Name, const std::vector< double > &)
 Add values of a vector<double> to a property DoubleVectorDatum in the dictionary. More...
 

Detailed Description

Class Dictionary defines the standard user interface for accessing tokens from dictionaries (see there).

However, this user interface returns tokens, from which the actual value would still need to be extracted. The utilitiy functions described in this group shortcut this step and provide direct access to the underlying fundamental values associated to a dictionary entry.

Function Documentation

void accumulate_property ( DictionaryDatum ,
Name  ,
const std::vector< double > &   
)

Add values of a vector<double> to a property DoubleVectorDatum in the dictionary.

This variant of append_property is for adding vector<double>s to vector<double>s of the same size. It is required for collecting data across threads when multimeter is running in accumulation mode.

References assert(), and Token::datum().

Referenced by nest::Multimeter::add_data_().

template<typename PropT >
void append_property ( DictionaryDatum d,
Name  propname,
const PropT &  prop 
)
inline

Append a value to a property ArrayDatum in the dictionary.

This is the version for scalar values

References assert(), Token::datum(), and Token::empty().

Referenced by nest::Multimeter::add_data_(), nest::RecordingDevice::Parameters_::get(), and nest::RecordingDevice::State_::get().

template<>
void append_property< std::vector< double > > ( DictionaryDatum d,
Name  propname,
const std::vector< double > &  prop 
)
inline

Append a value to a property DoubleVectorDatum in the dictionary.

This is a specialization for appending vector<double>s to vector<double>s

References assert(), Token::datum(), and Token::empty().

template<>
void append_property< std::vector< long > > ( DictionaryDatum d,
Name  propname,
const std::vector< long > &  prop 
)
inline

Append a value to a property IntVectorDatum in the dictionary.

This is a specialization for appending vector<long>s to vector<long>s

References assert(), Token::datum(), and Token::empty().

template<typename FT >
void def ( DictionaryDatum d,
Name const  n,
FT const &  value 
)

Define a new dictionary entry from a fundamental type.

Exceptions
TypeMismatchCreating a Token from the fundamental type failed, probably due to a missing template specialization.

Referenced by nest::Layer< D >::dump_connections().

template<typename FT , class D >
void def2 ( DictionaryDatum d,
Name const  n,
FT const &  value 
)

Define a new dictionary entry from a fundamental type.

Exceptions
TypeMismatchFundamental type and requested SLI type are incompatible.
double get_double_in_range ( const DictionaryDatum d,
Name const  n,
double  min,
double  max,
int  mode = 2 
)
inline

Get the value of an existing dictionary entry and check that it is in a specified range.

The range is specified by two parameters min and max which have the same type as the template argument. The last parameter mode defines the type of the range:

Mode Relation

0 min < x < max 1 min <= x < max 2 min <= x <= max

Exceptions
UnknownNameAn entry of the given name is not known in the dictionary.
RangeCheckif a value is outside the range

References Token::datum(), GenericDatum< D, slt >::get(), and nest::names::x.

long get_long_in_range ( const DictionaryDatum d,
Name const  n,
long  min,
long  max,
int  mode = 2 
)
inline

Get the value of an existing dictionary entry and check that it is in a specified range.

The range is specified by two parameters min and max which have the same type as the template argument. The last parameter mode defines the type of the range:

Mode Relation

0 min < x < max 1 min <= x < max 2 min <= x <= max

Exceptions
UnknownNameAn entry of the given name is not known in the dictionary.
RangeCheckif a value is outside the range

References Token::datum(), GenericDatum< D, slt >::get(), and nest::names::x.

template<typename FT >
FT getValue ( const DictionaryDatum d,
Name const  n 
)

Get the value of an existing dictionary entry.

Exceptions
UnknownNameAn entry of the given name is not known in the dictionary.

Referenced by nest::create_doughnut(), SLIArrayModule::Array2IntVectorFunction::execute(), and SLIArrayModule::Array2DoubleVectorFunction::execute().

void initialize_property_array ( DictionaryDatum d,
Name  propname 
)

Create a property of type ArrayDatum in the dictionary, if it does not already exist.

References nest::names::d, and Token::empty().

Referenced by nest::RecordingDevice::Parameters_::get().

void initialize_property_doublevector ( DictionaryDatum d,
Name  propname 
)

Create a property of type DoubleVectorDatum in the dictionary, if it does not already exist.

References nest::names::d, and Token::empty().

Referenced by nest::Multimeter::add_data_(), and nest::RecordingDevice::State_::get().

void initialize_property_intvector ( DictionaryDatum d,
Name  propname 
)

Create a property of type IntVectorDatum in the dictionary, if it does not already exist.

References nest::names::d, and Token::empty().

Referenced by nest::RecordingDevice::State_::get().

void provide_property ( DictionaryDatum ,
Name  ,
const std::vector< double > &   
)

Provide a value to a property DoubleVectorDatum in the dictionary.

In contrast to append_property, this function adds the value only once to the property. On all subsequent events, it ensures that the value passed in is identical to the value present. This is needed by recording_decive.

References assert(), and Token::datum().

Referenced by nest::RecordingDevice::State_::get().

void provide_property ( DictionaryDatum ,
Name  ,
const std::vector< long > &   
)

Provide a value to a property IntVectorDatum in the dictionary.

In contrast to append_property, this function adds the value only once to the property. On all subsequent events, it ensures that the value passed in is identical to the value present. This is needed by recording_decive.

References assert(), and Token::datum().

template<typename FT , typename VT >
bool updateValue ( DictionaryDatum const &  d,
Name const  n,
VT &  value 
)
template<typename FT , typename VT , class C >
void updateValue2 ( DictionaryDatum const &  d,
Name const  n,
C &  obj,
void(C::*)(VT)  setfunc 
)

Call a member function of an object, passing the value of an dictionary entry if it exists, skip call if it doesn't.

Exceptions
seegetValue(DictionaryDatum, Name)