frepple::utils::HasName< T > Class Template Reference

Base class for objects using a string as their primary key. More...

#include <utils.h>

Inheritance diagram for frepple::utils::HasName< T >:
frepple::utils::NonCopyable frepple::utils::Tree::TreeNode frepple::utils::HasHierarchy< T >

List of all members.

Classes

class  iterator
 This class models a STL-like iterator that allows us to iterate over the named entities in a simple and safe way. More...

Public Member Functions

void endElement (XMLInput &pIn, const Attribute &pAttr, const DataElement &pElement)
 HasName (const char *n)
 HasName (const string &n)
void setName (const string &newname)
 ~HasName ()

Static Public Member Functions

static T * add (T *t, T *hint)
static T * add (T *t)
static T * add (const string &k, const MetaClass &cls)
static iterator begin ()
static void clear ()
static bool empty ()
static iterator end ()
static T * find (const string &k)
static T * findLowerBound (const string &k, bool *f=NULL)
static Objectreader (const MetaClass *cat, const AttributeList &in)
static size_t size ()
static void verify ()
static void writer (const MetaCategory *c, XMLOutput *o)

Detailed Description

template<class T>
class frepple::utils::HasName< T >

Base class for objects using a string as their primary key.

Instances of this class have the following properties:

Definition at line 3707 of file utils.h.


Constructor & Destructor Documentation

template<class T>
frepple::utils::HasName< T >::HasName ( const string &  n  )  [inline, explicit]

Constructor.

Definition at line 3793 of file utils.h.

template<class T>
frepple::utils::HasName< T >::HasName ( const char *  n  )  [inline, explicit]

Constructor.

Definition at line 3796 of file utils.h.

template<class T>
frepple::utils::HasName< T >::~HasName (  )  [inline]

Destructor.

Definition at line 3802 of file utils.h.


Member Function Documentation

template<class T>
static T* frepple::utils::HasName< T >::add ( T *  t,
T *  hint 
) [inline, static]

Registers an entity created by the default constructor. The second argument is a hint: when passing an entity with a name close to the new one, the insertion will be sped up considerably.

Definition at line 3843 of file utils.h.

template<class T>
static T* frepple::utils::HasName< T >::add ( T *  t  )  [inline, static]

Registers an entity created by the default constructor.

Definition at line 3837 of file utils.h.

template<class T>
static T* frepple::utils::HasName< T >::add ( const string &  k,
const MetaClass cls 
) [inline, static]

Creates a new entity.

Definition at line 3824 of file utils.h.

template<class T>
static iterator frepple::utils::HasName< T >::begin (  )  [inline, static]

Returns a STL-like iterator to the start of the entity list.

Definition at line 3777 of file utils.h.

template<class T>
static void frepple::utils::HasName< T >::clear (  )  [inline, static]

Deletes all elements from the list.

Definition at line 3790 of file utils.h.

template<class T>
static bool frepple::utils::HasName< T >::empty (  )  [inline, static]

Returns false if no named entities have been defined yet.

Definition at line 3780 of file utils.h.

template<class T>
static iterator frepple::utils::HasName< T >::end (  )  [inline, static]

Returns a STL-like iterator to the end of the entity list.

Definition at line 3774 of file utils.h.

template<class T>
void frepple::utils::HasName< T >::endElement ( XMLInput pIn,
const Attribute pAttr,
const DataElement pElement 
) [inline]
template<class T>
static T* frepple::utils::HasName< T >::find ( const string &  k  )  [inline, static]

Find an entity given its name. In case it can't be found, a NULL pointer is returned.

Definition at line 3806 of file utils.h.

template<class T>
static T* frepple::utils::HasName< T >::findLowerBound ( const string &  k,
bool *  f = NULL 
) [inline, static]

Find the element with this given key or the element immediately preceding it.
The optional second argument is a boolean that is set to true when the element is found in the list.

Definition at line 3817 of file utils.h.

template<class T>
static Object* frepple::utils::HasName< T >::reader ( const MetaClass cat,
const AttributeList in 
) [inline, static]

This method is available as a object creation factory for classes that are using a string as a key identifier, in particular classes derived from the HasName base class. The following attributes are recognized:

  • name:
    Name of the entity to be created/changed/removed.
    The default value is "unspecified".
  • type:
    Determines the subclass to be created.
    The default value is "default".
  • action:
    Determines the action to be performed on the object.
    This can be A (for 'add'), C (for 'change'), AC (for 'add_change') or R (for 'remove').
    'add_change' is the default value.
    See also:
    HasName

Definition at line 3864 of file utils.h.

template<class T>
void frepple::utils::HasName< T >::setName ( const string &  newname  )  [inline]

Rename the entity.

Definition at line 3799 of file utils.h.

template<class T>
static size_t frepple::utils::HasName< T >::size (  )  [inline, static]

Returns the number of defined entities.

Definition at line 3783 of file utils.h.

template<class T>
static void frepple::utils::HasName< T >::verify (  )  [inline, static]

Debugging method to verify the validity of the tree. An exception is thrown when the tree is corrupted.

Definition at line 3787 of file utils.h.

template<class T>
static void frepple::utils::HasName< T >::writer ( const MetaCategory c,
XMLOutput o 
) [inline, static]

A handler that is used to persist the tree.

Definition at line 3957 of file utils.h.


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

Generated on 25 Sep 2009 for frePPLe by  doxygen 1.6.1