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

ObjCryst::ObjRegistry Class Template Reference

Refinable Object Registry. More...

#include <RefinableObj.h>

List of all members.

Public Methods

 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 DeleteAll ()
 Delete all objects in the registry.. Use with caution !!

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

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

T & GetObj (const string &objName)
 Get an object from its name in the registry. The search starts at the *end* of the registry.

const T & GetObj (const string &objName) const
 Get an object from its name in the registry. The search starts at the *end* of the registry.

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.

const 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.

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 The search starts at the *end* of the registry.

long Find (const string &objName, const string &className) const
 Find the number of an object in the registry from its name The search starts at the *end* of the registry. Also check the class of the object.

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


Private Attributes

T ** mpRegistry
 The registry.

unsigned long mNbRegistered
 Number of registered objects.

unsigned long mMaxNbRegistered
 Max number of registered objects. Dynamically allocated.

string mName
 Name of this registry.


Detailed Description

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

Refinable Object Registry.

This class is used to keep a list of all object of a given class at the global level. 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. Finding an object in the registry from its name will be slow, since it uses string (case-sensitive) comparison.

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).


Member Function Documentation

const T& GetObj const unsigned int    i const
 

Get object i in the registry.

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

T& GetObj const unsigned int    i
 

Get object i in the registry.

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


The documentation for this class was generated from the following file:
Generated on Wed Nov 14 19:48:37 2001 for ObjCryst++ by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001