Dictionary class for interface to Python and C++ API. More...
#include <dictionary.h>
Public Member Functions | |
| Dictionary () | |
| any_type & | operator[] (const std::string &key) |
| any_type & | operator[] (std::string &&key) |
| any_type & | at (const std::string &key) |
| const any_type & | at (const std::string &key) const |
| bool | operator== (const Dictionary &other) const |
| Check whether the dictionary is equal to another dictionary. | |
| auto | begin () const |
| auto | end () const |
| auto | size () const |
| auto | empty () const |
| void | clear () |
| auto | find (const std::string &key) const |
| bool | known (const std::string &key) const |
| Check whether there exists a value with specified key in the dictionary. | |
| void | mark_as_accessed (const std::string &key) const |
| Mark to support checking for unaccessed entries. | |
| bool | has_been_accessed (const std::string &key) const |
Return true if mark_as_accessed has been called at least once for key. | |
| void | init_access_flags (const bool thread_local_dict=false) const |
| Initialize access flags to prepare for later error checking with all_entries_accessed. | |
| void | all_entries_accessed (const std::string &where, const std::string &what, const bool thread_local_dict=false) const |
| Confirm that all entries in dictionary have been accessed. | |
| template<DictionaryEntryType T> | |
| T | get (const std::string &key) const |
| Get the value at key in the specified type. | |
| template<typename T > | |
| std::vector< T > & | get_or_create_vector (const std::string &key) |
| Return reference to vector of type T stored under key. | |
| template<typename T > | |
| bool | update_value (const std::string &key, T &value) const |
| Update the specified non-vector value if there exists a value at key. | |
| template<Integer T> | |
| bool | update_integer_value (const std::string &key, T &value) const |
| Update the specified value if there exists an integer value at key. | |
| bool | update_dictionary (Dictionary &dict_out) const |
| Update the provided dictionary with all key-value pairs in this dictionary. | |
Dictionary class for interface to Python and C++ API.
Only this class should be used in code outside dictionary.{h,cpp}.
Methods that behave as in std::map are not documented explicitly.
|
inline |
|
inline |
Confirm that all entries in dictionary have been accessed.
Requires that init_access_flags has been called previously and does nothing if dict_miss_is_error has been set to false.
ref nest::UnaccessedDictionaryEntry if at least one dictionary entry has not been marked as accessed
| where | Information about calling location, will be included in error message |
| what | Information about dictionary inspected, will be included in error message |
| thread_local_dict | Pass true if calling this method on a thread-specific dictionary. Used for internal error checking (assert). |
Referenced by nest::cm_default::add_compartment_(), nest::cm_default::add_receptor_(), nest::CompartmentCurrents::add_synapse(), nest::Compartment::Compartment(), nest::ConnectionManager::connect(), nest::connect_layers(), nest::ConnectionManager::connect_tripartite(), nest::ConnectionCreator::ConnectionCreator(), nest::create_layer(), nest::create_mask(), nest::create_parameter(), nest::SPManager::disconnect(), nest::get_connections(), nest::set_connection_status(), and nest::set_kernel_status().
| any_type & Dictionary::at | ( | const std::string & | key | ) |
Referenced by nest::BernoulliBuilder::BernoulliBuilder(), nest::ConnectionCreator::ConnectionCreator(), nest::AbstractLayer::create_layer(), nest::ConnectionCreator::extract_params_(), nest::FixedInDegreeBuilder::FixedInDegreeBuilder(), nest::FixedOutDegreeBuilder::FixedOutDegreeBuilder(), nest::NodeManager::get_nodes(), nest::PoissonBuilder::PoissonBuilder(), nest::BipartiteConnBuilder::set_default_weight_or_delay_(), nest::cm_default::set_status(), and nest::BipartiteConnBuilder::set_synapse_params().
| const any_type & Dictionary::at | ( | const std::string & | key | ) | const |
|
inline |
Referenced by nest::create_parameter(), and operator<<().
|
inline |
Referenced by nest::ModelManager::clear_connection_models_(), nest::ModelManager::clear_node_models_(), nest::ConnectionManager::finalize(), nest::SPManager::finalize(), nest::RecordingDevice::set_status(), and nest::StimulationDevice::set_status().
|
inline |
|
inline |
|
inline |
Referenced by nest::ConnectionManager::connect_arrays(), and nest::get_nc_status().
|
inline |
Get the value at key in the specified type.
| T | Type of the value. If the value is not of the specified type, a TypeMismatch error is thrown. |
| key | key where the value is located in the dictionary. |
c std::out_of_range if key is not on dictionary
ref TypeMismatch if the value is not of specified type T.
Referenced by nest::cm_default::add_compartment_(), nest::cm_default::add_receptor_(), nest::AMPA::AMPA(), nest::AMPA_NMDA::AMPA_NMDA(), nest::BernoulliBuilder::BernoulliBuilder(), nest::ConnectionManager::connect(), nest::ConnectionManager::connect_tripartite(), nest::ConnectionCreator::ConnectionCreator(), nest::ModelManager::copy_model(), nest::AbstractLayer::create_layer(), nest::create_mask(), nest::create_parameter(), nest::SPManager::disconnect(), nest::Layer< D >::dump_connections(), nest::ConnectionCreator::extract_params_(), nest::FixedInDegreeBuilder::FixedInDegreeBuilder(), nest::FixedOutDegreeBuilder::FixedOutDegreeBuilder(), nest::GABA::GABA(), nest::ConnectionManager::get_conn_builder(), nest::ModelManager::get_node_model_id(), nest::StructuralPlasticityNode::get_status(), nest::ModelManager::get_synapse_model_id(), nest::ConnectionManager::get_third_conn_builder(), nest::K::K(), nest::Na::Na(), nest::SPManager::new_growth_curve(), nest::NMDA::NMDA(), nest::PoissonBuilder::PoissonBuilder(), nest::ModelManager::set_model_defaults(), nest::cm_default::set_status(), nest::SPManager::set_status(), nest::StructuralPlasticityNode::set_status(), nest::BipartiteConnBuilder::set_structural_plasticity_parameters(), nest::BipartiteConnBuilder::set_synapse_model_(), and nest::SPBuilder::update_delay().
| std::vector< T > & Dictionary::get_or_create_vector | ( | const std::string & | key | ) |
Return reference to vector of type T stored under key.
If key does not exist in dict, create empty vector<T> and return it.
|
inline |
Return true if mark_as_accessed has been called at least once for key.
Referenced by nest::RecordingDevice::set_status(), and nest::StimulationDevice::set_status().
|
inline |
Initialize access flags to prepare for later error checking with all_entries_accessed.
| thread_local_dict | Pass true if calling this method on a thread-specific dictionary. Used for internal error checking (assert). |
Referenced by nest::cm_default::add_compartment_(), nest::cm_default::add_receptor_(), nest::CompartmentCurrents::add_synapse(), nest::Compartment::Compartment(), nest::ConnectionManager::connect(), nest::connect_layers(), nest::ConnectionManager::connect_tripartite(), nest::create_layer(), nest::create_mask(), nest::create_parameter(), nest::SPManager::disconnect(), nest::get_connections(), nest::set_connection_status(), and nest::set_kernel_status().
|
inline |
Check whether there exists a value with specified key in the dictionary.
| key | key where the value may be located in the dictionary. |
true if there is a value with the specified key, false if not.Referenced by nest::cm_default::add_compartment_(), nest::cm_default::add_receptor_(), nest::AMPA::AMPA(), nest::AMPA_NMDA::AMPA_NMDA(), nest::cont_delay_synapse< targetidentifierT >::check_synapse_params(), nest::stdp_dopamine_synapse< targetidentifierT >::check_synapse_params(), nest::static_synapse_hom_w< targetidentifierT >::check_synapse_params(), nest::GenericConnectorModel< ConnectionT >::check_synapse_params(), nest::ConnectionManager::connect(), nest::ConnectionManager::connect_tripartite(), nest::ConnectionCreator::ConnectionCreator(), nest::ModelManager::copy_model(), nest::AbstractLayer::create_layer(), nest::SPManager::disconnect(), nest::ConnectionCreator::extract_params_(), nest::GABA::GABA(), nest::ConnectionManager::get_conn_builder(), nest::ModelManager::get_node_model_id(), nest::NodeManager::get_nodes(), nest::ModelManager::get_synapse_model_id(), nest::ConnectionManager::get_third_conn_builder(), nest::K::K(), nest::Na::Na(), nest::NMDA::NMDA(), nest::ConnectionManager::register_conn_builder(), nest::SPManager::register_growth_curve(), nest::ModelManager::register_node_model(), nest::ModelManager::register_specific_connection_model_(), nest::ConnectionManager::register_third_conn_builder(), nest::BipartiteConnBuilder::set_default_weight_or_delay_(), nest::ModelManager::set_model_defaults(), nest::cm_default::set_status(), nest::StructuralPlasticityNode::set_status(), nest::BipartiteConnBuilder::set_structural_plasticity_parameters(), nest::BipartiteConnBuilder::set_synapse_model_(), nest::BipartiteConnBuilder::set_synapse_params(), and nest::ConnectionManager::valid_connection_rule().
|
inline |
Mark to support checking for unaccessed entries.
|
inline |
Check whether the dictionary is equal to another dictionary.
Two dictionaries are equal if and only if they contain the exact same entries with the same values.
| other | dictionary to check against. |
| any_type & Dictionary::operator[] | ( | const std::string & | key | ) |
| any_type & Dictionary::operator[] | ( | std::string && | key | ) |
|
inline |
Referenced by nest::create_parameter(), nest::get_nc_status(), and nest::slice_nc().
|
inline |
Update the provided dictionary with all key-value pairs in this dictionary.
| dict_out | the dictionary to be updated. |
true if any values were updated in or added to dict_out . Referenced by nest::StimulationDevice::get_status().
|
inline |
Update the specified value if there exists an integer value at key.
| key | key where the value may be located in the dictionary. |
| value | object to update if there exists a value at key. |
| TypeMismatch | if the value at key is not an integer. |
true if key was found in dictionary and value was updated, else false
|
inline |
Update the specified non-vector value if there exists a value at key.
| key | key where the value may be located in the dictionary. |
| value | object to update if there exists a value at key. |
| TypeMismatch | if the value at key is not the same type as the value argument. |
true if key was found in dictionary and value was updated, else false Referenced by nest::BipartiteConnBuilder::BipartiteConnBuilder(), nest::Compartment::Compartment(), nest::ConnectionCreator::ConnectionCreator(), nest::IOManager::set_data_path_prefix_(), nest::cm_default::set_status(), nest::EventDeliveryManager::set_status(), nest::LoggingManager::set_status(), nest::MPIManager::set_status(), nest::EpropSynapseCommonProperties::set_status(), nest::EpropSynapseBSSHSLM2020CommonProperties::set_status(), nest::Node::set_status_base(), and nest::ThirdBernoulliWithPoolBuilder::ThirdBernoulliWithPoolBuilder().