Class Index Cross Index Namespace Index

template Class ObjectRegistry< class T >

Object Registry
Contained in: global
Derived from: none
Derived by: none

#include "general/objectregistry.hh"


public function member index:

ObjectRegistry();
~ObjectRegistry();
bool destructObject(T* o);
Op for_each(Op Function) const;
bool isRegistered(const T* o);
void registerObject(T* o);
bool removeObject(T* o);
void reset();
size_t size() const;
 

protected function member index:

iterator begin(); Obtain the start of the list
const_iterator begin() const; Obtain the start of the list (read-only)
iterator end(); Obtain the end of the list
const_iterator end() const; Obtain the end of the list (read-only)
 

Description:

This class implements a registry for objects. The registry provides a mechanism for keeping track of pointers. The class contains methods to add/remove pointers to the registry, as well as to check for the existence of a pointer in the registry.

The registry owns its objects. That is, when the registry is destructed it destructs any objects which are registered with it.

A STL set is used to store pointers to the registered objects.

This class is used by the LDAS API's to keep track of pointer objects returned to the TCL layer. To avoid segmentation faults, when the C++ layer receives a pointer from TCL, the appropriate ObjectRegistry object is checked to ensure that the pointer exists. Furthermore, the resetApi command causes the C++ layer to empty the ObjectRegistry objects, thereby

objects.


Function Member Descriptions:


ObjectRegistry::ObjectRegistry


ObjectRegistry();



ObjectRegistry::~ObjectRegistry


~ObjectRegistry();



ObjectRegistry::begin - Obtain the start of the list


iterator begin();



ObjectRegistry::begin - Obtain the start of the list (read-only)


const_iterator begin() const;



ObjectRegistry::destructObject


bool destructObject(T* o);



ObjectRegistry::end - Obtain the end of the list


iterator end();



ObjectRegistry::end - Obtain the end of the list (read-only)


const_iterator end() const;



ObjectRegistry::for_each


Op for_each(Op Function) const;



ObjectRegistry::isRegistered


bool isRegistered(const T* o);



ObjectRegistry::registerObject


void registerObject(T* o);



ObjectRegistry::removeObject


bool removeObject(T* o);



ObjectRegistry::reset


void reset();



ObjectRegistry::size


size_t size() const;



Variable Member Descriptions:


ObjectRegistry::mData - Collection of data members

std::set< T* > mData;

ObjectRegistry::m_lock - Ensure only one thread accesses the registry at a time

mutable lock_type m_lock;