Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ObjCryst::ObjRegistry< T > Class Template Reference

Object Registry. More...

Inheritance diagram for ObjCryst::ObjRegistry< T >:

Inheritance graph
[legend]
Collaboration diagram for ObjCryst::ObjRegistry< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ObjRegistry ()
 ObjRegistry (const string &name)
 ~ObjRegistry ()
void Register (T &obj)
 Register a new object. Already registered objects are skipped.

void DeRegister (T &obj)
 De-register an object.

void DeRegister (const string &objName)
 De-register an object from its name.

void DeRegisterAll ()
 De-register all objects from the list.

void DeleteAll ()
 Delete all objects in the registry.. Use with caution !!

T & GetObj (const unsigned int i)
 Get object #i in the registry.

const T & GetObj (const unsigned int i) const
 Get object #i in the registry.

T & GetObj (const string &objName)
 Get an object from its name in the registry.

const T & GetObj (const string &objName) const
 Get an object from its name in the registry.

T & GetObj (const string &objName, const string &className)
 Get an object from its name in the registry.

const T & GetObj (const string &objName, const string &className) const
 Get an object from its name in the registry.

long GetNb () const
 Get the index of an object in the registry, from its name Warning: it can change if an object is removed from the registry.

void Print () const
void SetName (const string &)
const string & GetName () const
long Find (const string &objName) const
 Find the number of an object in the registry from its name (slow !) The search starts at the *end* of the registry.

long Find (const string &objName, const string &className, const bool nothrow=false) const
 Find the number of an object in the registry from its name (slow !) The search starts at the *end* of the registry.

long Find (const T &obj) const
 Find the number of an object in the registry The search starts at the *end* of the registry.

const RefinableObjClockGetRegistryClock () const
 Last time an object was added or removed from the registry.


Private Attributes

vector< T * > mvpRegistry
 The registry of objects.

string mName
 Name of this registry.

RefinableObjClock mListClock
 Last time an object was added or removed.


Detailed Description

template<class T>
class ObjCryst::ObjRegistry< T >

Object Registry.

This class is used to keep a list of all object of a given class at the global level, or inside another object. This is primarily aimed for the derivative of the RefinableObj class but it can be used for any class that has GetName() and GetClassName() function. This class now uses a vector<> approach from the STL.

Warning:
the order of the objects in the registry can change (every time an object is de-registered).

Todo:
(?) create two derived classes with the same interface, one which is a const registry (the 'client' registry for RefinableObj), and one which has a non-const access to the registered objects (the 'sub-objects' in RefinableObj).


Constructor & Destructor Documentation

template<class T>
ObjCryst::ObjRegistry< T >::ObjRegistry  ) 
 

template<class T>
ObjCryst::ObjRegistry< T >::ObjRegistry const string &  name  ) 
 

template<class T>
ObjCryst::ObjRegistry< T >::~ObjRegistry  ) 
 


Member Function Documentation

template<class T>
void ObjCryst::ObjRegistry< T >::DeleteAll  ) 
 

Delete all objects in the registry.. Use with caution !!

template<class T>
void ObjCryst::ObjRegistry< T >::DeRegister const string &  objName  ) 
 

De-register an object from its name.

template<class T>
void ObjCryst::ObjRegistry< T >::DeRegister T &  obj  ) 
 

De-register an object.

template<class T>
void ObjCryst::ObjRegistry< T >::DeRegisterAll  ) 
 

De-register all objects from the list.

template<class T>
long ObjCryst::ObjRegistry< T >::Find const T &  obj  )  const
 

Find the number of an object in the registry The search starts at the *end* of the registry.

template<class T>
long ObjCryst::ObjRegistry< T >::Find const string &  objName,
const string &  className,
const bool  nothrow = false
const
 

Find the number of an object in the registry from its name (slow !) The search starts at the *end* of the registry.

Also check the class of the object (inheritance...). use nothrow=true to avoid having an exception thrown if no object is found (instead the index returned will be -1)

template<class T>
long ObjCryst::ObjRegistry< T >::Find const string &  objName  )  const
 

Find the number of an object in the registry from its name (slow !) The search starts at the *end* of the registry.

template<class T>
const string& ObjCryst::ObjRegistry< T >::GetName  )  const
 

template<class T>
long ObjCryst::ObjRegistry< T >::GetNb  )  const
 

Get the index of an object in the registry, from its name Warning: it can change if an object is removed from the registry.

template<class T>
const T& ObjCryst::ObjRegistry< T >::GetObj const string &  objName,
const string &  className
const
 

Get an object from its name in the registry.

The search starts at the *end* of the registry. Also check the class of the object.

template<class T>
T& ObjCryst::ObjRegistry< T >::GetObj const string &  objName,
const string &  className
 

Get an object from its name in the registry.

The search starts at the *end* of the registry. Also check the class of the object.

template<class T>
const T& ObjCryst::ObjRegistry< T >::GetObj const string &  objName  )  const
 

Get an object from its name in the registry.

The search starts at the *end* of the registry.

template<class T>
T& ObjCryst::ObjRegistry< T >::GetObj const string &  objName  ) 
 

Get an object from its name in the registry.

The search starts at the *end* of the registry.

template<class T>
const T& ObjCryst::ObjRegistry< T >::GetObj const unsigned int  i  )  const
 

Get object #i in the registry.

For internal use only.

Use with caution. The order of the objects changes as objects are added and removed.

template<class T>
T& ObjCryst::ObjRegistry< T >::GetObj const unsigned int  i  ) 
 

Get object #i in the registry.

For internal use only.

Use with caution. The order of the objects changes as objects are added and removed.

template<class T>
const RefinableObjClock& ObjCryst::ObjRegistry< T >::GetRegistryClock  )  const
 

Last time an object was added or removed from the registry.

template<class T>
void ObjCryst::ObjRegistry< T >::Print  )  const
 

template<class T>
void ObjCryst::ObjRegistry< T >::Register T &  obj  ) 
 

Register a new object. Already registered objects are skipped.

template<class T>
void ObjCryst::ObjRegistry< T >::SetName const string &   ) 
 


Member Data Documentation

template<class T>
RefinableObjClock ObjCryst::ObjRegistry< T >::mListClock [private]
 

Last time an object was added or removed.

template<class T>
string ObjCryst::ObjRegistry< T >::mName [private]
 

Name of this registry.

template<class T>
vector<T*> ObjCryst::ObjRegistry< T >::mvpRegistry [private]
 

The registry of objects.


The documentation for this class was generated from the following file:
Generated on Tue Nov 14 15:06:01 2006 for ObjCryst++ by doxygen 1.3.6