The Dictionary class provides the data exchange interface between the NEST kernel and the Python level as well as with C++ applications. More...
Concepts | |
| concept | Integer |
A concept for "integer integers", excluding bool and char. | |
| concept | DictionaryEntryType |
| A concept for data types that can be stored in a Dictionary as any_type . | |
Classes | |
| struct | DictionarySchemaBuilder< Scalars > |
| Add a set of standard datatypes to any_type variant. More... | |
| class | AnyVector |
| Vector of any_type. More... | |
| struct | EmptyList |
| Datatype to allow empty Python lists to be represented without defaulting to a datatype. More... | |
| class | Dictionary |
| Dictionary class for interface to Python and C++ API. More... | |
Typedefs | |
| using | DictionarySchema = DictionarySchemaBuilder< double, long, bool, std::string, Dictionary > |
| Basic scalar data types, strings and dictionaries to be included in variant. | |
| using | any_type = DictionarySchema::VariantType< std::shared_ptr< nest::NodeCollection >, std::vector< std::vector< double > >, std::vector< std::vector< std::vector< double > > >, std::vector< std::vector< std::vector< long > > >, std::shared_ptr< nest::Parameter >, AnyVector, nest::VerbosityLevel, EmptyList > |
Complete any_type by adding specific data types. | |
Functions | |
| std::ostream & | operator<< (std::ostream &os, const EmptyList &) |
| Print EmptyList. | |
| std::ostream & | operator<< (std::ostream &os, const std::monostate &) |
Print std::monostate as "None". | |
| std::ostream & | operator<< (std::ostream &os, const AnyVector &av) |
| Print AnyVector. | |
| std::ostream & | operator<< (std::ostream &os, const Dictionary &dict) |
| Print Dictionary. | |
| template<typename T > | |
| std::string | pretty_typename () |
| Return typename boost-prettified if available, otherwise as returned by typename(). | |
| std::string | get_typename (const any_type &operand) |
Return typename of operand. | |
| std::string | get_dict_typenames (const Dictionary &dict) |
| Return multi-line string displaying dictionary content. | |
The Dictionary class provides the data exchange interface between the NEST kernel and the Python level as well as with C++ applications.
This group collects data types related to the implementation of the @Dictionary class.
The Dictionary class provides a map-like interface with access checking to allow detection of misspelled or unknown entries passed in to NEST. Since dictionaries need to be able to contain dictionaries, the outward-facing Dictionary class acts as a handle to the dictionary_ instance actually implementing the dictionary as a std::map<>.
The dictionary entries are of type DictEntry_ combining the actual data and the access flag. The actual data are represented as instances of any_type , which is a C++20 std::variant .
| using any_type = DictionarySchema::VariantType< std::shared_ptr< nest::NodeCollection >, std::vector< std::vector< double > >, std::vector< std::vector< std::vector< double > > >, std::vector< std::vector< std::vector< long > > >, std::shared_ptr< nest::Parameter >, AnyVector, nest::VerbosityLevel, EmptyList > |
Complete any_type by adding specific data types.
Add here data types that are required but were not added through the schema. The aim is to have as few types in the variant as possible and we therefore limit multi-dimensional vectors to those element types where they are needed (3-dim vectors are required for correlo-dectectors).
AnyVector is essentially a flexible Python list type. It is needed to return status data combining actual data from local nodes with std::monostate values marking the absence of data. These are converted to None at the Python level to maintain the NEST 3.9 user interface.
| using DictionarySchema = DictionarySchemaBuilder< double, long, bool, std::string, Dictionary > |
Basic scalar data types, strings and dictionaries to be included in variant.
This schema includes all types that should enter the variant as themselves and as vectors. Only long is included as integer type, because Python only knows signed integers.
| std::string get_dict_typenames | ( | const Dictionary & | dict | ) |
Return multi-line string displaying dictionary content.
References get_typename().
| std::string get_typename | ( | const any_type & | operand | ) |
Return typename of operand.
Referenced by dictionary_::cast_value_(), nest::ConnParameter::create(), nest::create_parameter(), get_dict_typenames(), nest::get_nc_status(), operator<<(), and nest::weight_recorder::Parameters_::set().
| std::ostream & operator<< | ( | std::ostream & | os, |
| const Dictionary & | dict | ||
| ) |
Print Dictionary.
References Dictionary::begin(), Dictionary::end(), and get_typename().
| std::ostream & operator<< | ( | std::ostream & | os, |
| const std::monostate & | |||
| ) |
Print std::monostate as "None".
| std::string pretty_typename | ( | ) |
Return typename boost-prettified if available, otherwise as returned by typename().