Template for genNamedObj
Template for genNamedObj.This template supports the store, retrieval and location of named objects. A named object is simply an object that has a name (in the form of a string). Internally it is implemented using the STL map container.
Typical usage:
class XXX : public genNamedObj<X*> { XXX(const char *name, ...) : getNamedObj<X*>( name, this ) {...} }; // initialize the static members map<const char*, X*, cstring_ordering_t> genNamedObj<XXX*>::m_Map( my_cstring_ordering ); map<const char*, XXX*, cstring_ordering_t>::iterator genNamedObj<XXX*>::m_It = NULL;Note that we do normally not store the object itself in the container, but only the pointer to it. The string "name" is stored and managed internally. As the container is implemented as a static map, the user has to initialize its two static members,
An working example C++ file is test_gen_named_obj.cc.
MODIFICATIONS:
~genNamedObj()
inline const char* getObjName()
static bool exists( const char *name )
static X get( const char *name )
static X getObject( const char *name )
static int getObjects( const char *name, list<X> &theList )
int getLocation()
inline static int getNbElements()
static void add( const char *name, X x )
static void remove( const char *name )
inline static X begin()
inline static X end()
inline static X next()
char* m_Name
static map < const char*, X, cstring_ordering_t > m_Map
static map < const char*, X, cstring_ordering_t > ::iterator m_It
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de