NEST
2.6.0,not_revisioned_source_dir@0
|
Represent strings by ints to facilitate fast comparison. More...
#include <name.h>
Public Types | |
typedef unsigned int | handle_t |
Public Member Functions | |
Name () | |
Create Name without value. More... | |
Name (const char s[]) | |
Name (const std::string &s) | |
Name (const Name &n) | |
const std::string & | toString (void) const |
Return string represented by Name. More... | |
handle_t | toIndex (void) const |
Return table index for Name object. More... | |
bool | operator== (const Name &n) const |
bool | operator!= (const Name &n) const |
bool | operator< (const Name &n) const |
Non-alphabetic ordering of names. More... | |
void | print_handle (std::ostream &) const |
Static Public Member Functions | |
static bool | lookup (const std::string &s) |
static size_t | capacity () |
static size_t | num_handles () |
static void | list_handles (std::ostream &) |
static void | list (std::ostream &) |
static void | info (std::ostream &) |
Private Types | |
typedef std::map< std::string, handle_t > | HandleMap_ |
Datatype for map from strings to handles. More... | |
typedef std::deque< std::string > | HandleTable_ |
Private Member Functions | |
handle_t | insert (const std::string &) |
Static Private Member Functions | |
static HandleMap_ & | handleMapInstance_ () |
Function returning a reference to the single map instance. More... | |
static HandleTable_ & | handleTableInstance_ () |
Private Attributes | |
handle_t | handle_ |
Handle for the name represented by the Name object. More... | |
Represent strings by ints to facilitate fast comparison.
Each Name object represents a string by a unique integer number. Comparing Name objects instead of comparing strings directly, reduces the complexity of string comparison to that of int comparison.
Each Name object contains a Handle to the string it represents. Strings are mapped to Handles via an associative array. Handles are stored in a table, and each Handle contains its own index into this table as unique ID, as well as the string represented. Fast comparison of Name objects is achieved by comparing the indices stored in the handles. Reference counting permits deletion of unused Handles.
typedef unsigned int Name::handle_t |
|
private |
Datatype for map from strings to handles.
|
private |
|
inline |
Create Name without value.
|
inline |
|
inline |
|
inline |
|
static |
References handleTableInstance_().
|
inlinestaticprivate |
Function returning a reference to the single map instance.
Implementation akin to Meyers Singleton, see Alexandrescu, ch 6.4.
References handleTableInstance_().
|
inlinestaticprivate |
Referenced by capacity(), handleMapInstance_(), insert(), list_handles(), num_handles(), print_handle(), and toString().
|
static |
References list_handles().
|
private |
References handleMapInstance_(), and handleTableInstance_().
Referenced by nest::cg_create_masks().
|
static |
References handleMapInstance_(), and list_handles().
|
static |
References handleTableInstance_(), nest::names::n, and num_handles().
|
inlinestatic |
References handleMapInstance_().
Referenced by SLIType::settypename().
|
static |
References handleTableInstance_().
Referenced by DictionaryStack::basecache_token(), DictionaryStack::cache_token(), and list_handles().
|
inline |
void Name::print_handle | ( | std::ostream & | o | ) | const |
References handle_, and handleTableInstance_().
|
inline |
Return table index for Name object.
References handle_.
Referenced by DictionaryStack::basecache_token(), DictionaryStack::baseknown(), DictionaryStack::baselookup(), DictionaryStack::cache_token(), DictionaryStack::clear_token_from_basecache(), DictionaryStack::clear_token_from_cache(), DictionaryStack::known(), and DictionaryStack::lookup2().
const std::string & Name::toString | ( | void | ) | const |
Return string represented by Name.
References handle_, and handleTableInstance_().
Referenced by __pyx_f_12pynestkernel_sli_datum_to_object(), nest::GenericFactory< BaseT >::create(), SLIInterpreter::createcommand(), nest::Network::divergent_connect(), MathLinkPutStringFunction::execute(), XIfstreamFunction::execute(), IfstreamFunction::execute(), OfstreamFunction::execute(), OfsopenFunction::execute(), IsstreamFunction::execute(), StrSStreamFunction::execute(), StrFunction::execute(), PrettyprintFunction::execute(), CloseistreamFunction::execute(), CloseostreamFunction::execute(), FlushFunction::execute(), EndlFunction::execute(), EndsFunction::execute(), EatwhiteFunction::execute(), SetwFunction::execute(), SetprecisionFunction::execute(), IOSFixedFunction::execute(), IOSScientificFunction::execute(), IOSDefaultFunction::execute(), IOSShowpointFunction::execute(), IOSNoshowpointFunction::execute(), IOSShowbaseFunction::execute(), IOSNoshowbaseFunction::execute(), IOSDecFunction::execute(), nest::NestModule::SetDefaults_l_DFunction::execute(), IOSHexFunction::execute(), nest::NestModule::GetDefaults_lFunction::execute(), IOSOctFunction::execute(), IOSLeftFunction::execute(), IOSRightFunction::execute(), IOSInternalFunction::execute(), GetcFunction::execute(), GetsFunction::execute(), GetlineFunction::execute(), IGoodFunction::execute(), IClearFunction::execute(), OClearFunction::execute(), IFailFunction::execute(), OGoodFunction::execute(), IEofFunction::execute(), OEofFunction::execute(), In_AvailFunction::execute(), ReadDoubleFunction::execute(), ReadIntFunction::execute(), ReadWordFunction::execute(), nest::Network::execute_sli_protected(), nest::Time::ms::fromtoken(), getValue< bool >(), getValue< double >(), getValue< float >(), getValue< long >(), getValue< std::string >(), getValue< std::vector< double > >(), getValue< std::vector< long > >(), Dictionary::lookup2(), DictionaryStack::lookup2(), nest::UnknownModelName::message(), operator<<(), Dictionary::operator[](), setValue< bool >(), setValue< double >(), setValue< float >(), setValue< long >(), setValue< std::string >(), setValue< std::valarray< double > >(), setValue< std::valarray< long > >(), setValue< std::vector< double > >(), setValue< std::vector< long > >(), TokenArray::toValarray(), TokenArray::toVector(), and DictionaryStack::undef().
|
private |
Handle for the name represented by the Name object.
Referenced by operator!=(), operator<(), operator==(), print_handle(), toIndex(), and toString().