NEST  2.6.0,not_revisioned_source_dir@0
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
Dictionary Class Reference

A class that associates names and tokens. More...

#include <dict.h>

Inheritance diagram for Dictionary:

Classes

class  DictItemLexicalOrder
 Helper class for lexicographical sorting of dictionary entries. More...
 

Public Types

typedef TokenMap::const_iterator const_iterator
 Constant iterator for dictionary. More...
 

Public Member Functions

 Dictionary ()
 
 Dictionary (const Dictionary &d)
 
 ~Dictionary ()
 
void clear ()
 
const Tokenlookup (const Name &n) const
 Lookup and return Token with given name in dictionary. More...
 
const Tokenlookup2 (const Name &n) const
 lookup a name in the dictionary. More...
 
bool known (const Name &) const
 
bool known_but_not_accessed (const Name &) const
 Returns true if name is known but token has not been accessed. More...
 
Tokeninsert (const Name &n, const Token &t)
 
Tokeninsert_move (const Name &, Token &)
 
void remove (const Name &n)
 Remove entry from dictionary. More...
 
const Tokenoperator[] (const Name &) const
 
Tokenoperator[] (const Name &)
 
const Tokenoperator[] (const char *) const
 
Tokenoperator[] (const char *)
 
bool empty (void) const
 
void info (std::ostream &) const
 
bool operator== (const Dictionary &d) const
 
void add_dict (const std::string &, SLIInterpreter &)
 Add the contents of this dictionary to another. More...
 
void remove_dict (const std::string &, SLIInterpreter &)
 Remove entries found in another dictionary from this. More...
 
void clear_access_flags ()
 Clear access flags on all dictionary elements. More...
 
bool all_accessed (std::string &missed) const
 Check whether all elements have been accessed. More...
 
void initialize_property_array (Name propname)
 First element in dictionary. More...
 
void add_dictstack_reference ()
 This function is called when a dictionary is pushed to the dictionary stack. More...
 
void remove_dictstack_reference ()
 This function is called when the dictionary is popped from the dictionary stack. More...
 
bool is_on_dictstack () const
 Returns true, if the dictionary has references on the dictionary stack. More...
 

Private Member Functions

bool all_accessed_ (std::string &, std::string prefix=std::string()) const
 

Private Attributes

int refs_on_dictstack_
 Worker function checking whether all elements have been accessed. More...
 

Static Private Attributes

static const Token VoidToken
 

Friends

std::ostream & operator<< (std::ostream &, const Dictionary &)
 

Detailed Description

A class that associates names and tokens.

Member Typedef Documentation

typedef TokenMap::const_iterator Dictionary::const_iterator

Constant iterator for dictionary.

Dictionary inherits privately from std::map to hide implementation details. To allow for inspection of all elements in a dictionary, we export the constant iterator type and begin() and end() methods.

Constructor & Destructor Documentation

Dictionary::Dictionary ( )
inline
Dictionary::Dictionary ( const Dictionary d)
inline
Dictionary::~Dictionary ( )

Member Function Documentation

void Dictionary::add_dict ( const std::string &  target,
SLIInterpreter i 
)

Add the contents of this dictionary to another.

The target dictionary is given by names and must be retrieved via the interpreter.

Todo:
Allow for free formatting of target dictionary entries via functor, and add traits to allow duplicates.
See also
remove_dict

References SLIInterpreter::baselookup(), and nest::names::d.

void Dictionary::add_dictstack_reference ( )
inline

This function is called when a dictionary is pushed to the dictionary stack.

The dictioray stack must keep track about which dictioraries are on the dictionary stack. If a dictionary is modified and it is on the dictionary stack, the cache of the dictionary stack must be adjusted. This is e.g. the case for the systemdict or the errordict.

References refs_on_dictstack_.

bool Dictionary::all_accessed ( std::string &  missed) const
inline

Check whether all elements have been accessed.

Checks nested dictionaries recursively.

Parameters
std::string&contains string with names of non-accessed entries
Returns
true if all dictionary elements have been accessed
Note
this is just a wrapper, all_accessed_() does the work, hides recursion
See also
clear_access_flags(), all_accessed_()

References all_accessed_().

Referenced by nest::register_preconf_model().

bool Dictionary::all_accessed_ ( std::string &  missed,
std::string  prefix = std::string() 
) const
private

Referenced by all_accessed().

void Dictionary::clear ( )
void Dictionary::clear_access_flags ( )

Clear access flags on all dictionary elements.

Flags for nested dictionaries are cleared recursively.

See also
all_accessed()

Referenced by nest::register_preconf_model().

bool Dictionary::empty ( void  ) const
inline
void Dictionary::info ( std::ostream &  out) const
void Dictionary::initialize_property_array ( Name  propname)

First element in dictionary.

Dictionary inherits privately from std::map to hide implementation details. To allow for inspection of all elements in a dictionary, we export the constant iterator type and begin() and end() methods. One-past-last element in dictionary. Dictionary inherits privately from std::map to hide implementation details. To allow for inspection of all elements in a dictionary, we export the constant iterator type and begin() and end() methods.

Token & Dictionary::insert ( const Name n,
const Token t 
)
inline
Token & Dictionary::insert_move ( const Name n,
Token t 
)
inline
bool Dictionary::is_on_dictstack ( ) const
inline

Returns true, if the dictionary has references on the dictionary stack.

References refs_on_dictstack_.

bool Dictionary::known ( const Name n) const
inline
bool Dictionary::known_but_not_accessed ( const Name n) const
inline

Returns true if name is known but token has not been accessed.

const Token & Dictionary::lookup ( const Name n) const
inline
const Token & Dictionary::lookup2 ( const Name n) const
inline

lookup a name in the dictionary.

If the name is not found an UndefinedName exception is thrown. lookup2 is the preferred way to retrieve entries from the dictionary.

Note
The token returned should always be stored as a const &, so that the control flag for dictionary read-out is set on the Token in the dictionary, not its copy.

References Name::toString().

bool Dictionary::operator== ( const Dictionary d) const
inline

References operator==().

const Token & Dictionary::operator[] ( const Name n) const
inline

References Name::toString().

Referenced by operator[]().

Token & Dictionary::operator[] ( const Name n)
inline
const Token & Dictionary::operator[] ( const char *  n) const

References operator[]().

Token & Dictionary::operator[] ( const char *  n)

References operator[]().

void Dictionary::remove ( const Name n)

Remove entry from dictionary.

Referenced by nest::Network::unregister_model().

void Dictionary::remove_dict ( const std::string &  target,
SLIInterpreter i 
)

Remove entries found in another dictionary from this.

See also
add_dict

References SLIInterpreter::baselookup(), and nest::names::d.

void Dictionary::remove_dictstack_reference ( )
inline

This function is called when the dictionary is popped from the dictionary stack.

References refs_on_dictstack_.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const Dictionary d 
)
friend

Member Data Documentation

int Dictionary::refs_on_dictstack_
private

Worker function checking whether all elements have been accessed.

Checks nested dictionaries recursively.

Parameters
std::string&contains string with names of non-accessed entries
std::stringprefix for nested dictionary entries, built during recursion
Returns
true if all dictionary elements have been accessed
Note
this is just the worker for all_accessed()
See also
clear_access_flags(), all_accessed()

Referenced by add_dictstack_reference(), is_on_dictstack(), and remove_dictstack_reference().

const Token Dictionary::VoidToken
staticprivate

Referenced by lookup().


The documentation for this class was generated from the following files: