ERC CISST - cisst software

cmnObjectRegister Class Reference
[Common Tools]

#include <cmnObjectRegister.h>

Collaboration diagram for cmnObjectRegister:

Collaboration graph
[legend]
List of all members.

Detailed Description

Object Register.

The class register allows to register some objects by name. Since the object register is implemented as a singleton, it allows to retrieve an object from anywhere.

This mechanism can be used to share an object between different threads. Another example is the embedding of a scripting language such as Python. In this case, the programmer can use the Register() method to register an object with a given name. Within the Python shell, it is then possible to retrieve by name a "pointer" on the same object.

The main restriction is that all the registered objects must be derived from cmnGenericObject.

Definition at line 63 of file cmnObjectRegister.h.

Static Public Member Functions

Protected Member Functions


Member Typedef Documentation

typedef ContainerType::const_iterator cmnObjectRegister::const_iterator

Simple typedefs to ease the declaration of iterators

Definition at line 72 of file cmnObjectRegister.h.

typedef ContainerType::const_reverse_iterator cmnObjectRegister::const_reverse_iterator

Simple typedefs to ease the declaration of iterators

Definition at line 73 of file cmnObjectRegister.h.


Constructor & Destructor Documentation

cmnObjectRegister::cmnObjectRegister (  )  [inline, protected]

Constructor. The only constructor must be private in order to ensure that the object register is a singleton.

Definition at line 128 of file cmnObjectRegister.h.

virtual cmnObjectRegister::~cmnObjectRegister (  )  [inline, protected, virtual]

Destructor. Does nothing specific.

Definition at line 131 of file cmnObjectRegister.h.


Member Function Documentation

static cmnObjectRegister* cmnObjectRegister::Instance ( void   )  [static]

The object register is instantiated as a singleton. To access the unique instantiation, one needs to use this static method. The instantiated object register is created at the first call of this method since it is a static variable declared in this method's scope.

Returns:
A pointer to the object register.

static bool cmnObjectRegister::Register ( const std::string &  objectName,
cmnGenericObject objectPointer 
) [inline, static]

The Register method registers an object pointer with a given name in the static register.

Parameters:
objectName The name given to the soon registered object.
objectPointer The pointer to the cmnGenericObject object (or any derived class).
Returns:
True if successful, false if the object has already been registered or the name has already been used.

Definition at line 156 of file cmnObjectRegister.h.

static bool cmnObjectRegister::Remove ( const std::string &  objectName  )  [inline, static]

The remove method allows to "un-register" a registered object. It doesn't affect the object itself.

Parameters:
objectName The name given to the object when it was registered.
Returns:
True if the object was actually registered, false if the object was not registered.

Definition at line 169 of file cmnObjectRegister.h.

static cmnGenericObject* cmnObjectRegister::FindObject ( const std::string &  objectName  )  [inline, static]

Get the object by name. Returns null if the object is not registered.

Parameters:
objectName The name to look up.
Returns:
The pointer to the cmnGenericObject object corresponding to the className, or null if not registered.

Definition at line 182 of file cmnObjectRegister.h.

static std::string cmnObjectRegister::FindName ( cmnGenericObject objectPointer  )  [inline, static]

Get the name of an object. Returns "undefined" if the object is not registered.

Parameters:
objectPointer The object to look up.

Definition at line 192 of file cmnObjectRegister.h.

static std::string cmnObjectRegister::ToString ( void   )  [inline, static]

Print the register content to an STL string and returns a copy of this string

Definition at line 199 of file cmnObjectRegister.h.

static void cmnObjectRegister::ToStream ( std::ostream &  outputStream  )  [inline, static]

Print the register content to a text stream

Definition at line 207 of file cmnObjectRegister.h.

static const_iterator cmnObjectRegister::begin ( void   )  [inline, static]

Begin const iterator.

Definition at line 213 of file cmnObjectRegister.h.

static const_iterator cmnObjectRegister::end ( void   )  [inline, static]

End const iterator.

Definition at line 219 of file cmnObjectRegister.h.


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu