ldas-tools-al 2.6.7
Loading...
Searching...
No Matches
ObjectRegistry< T > Class Template Reference

Object Registry. More...

#include <objectregistry.hh>

Collaboration diagram for ObjectRegistry< T >:

Classes

class  AutoLock
 Ensure release of resource lock. More...

Public Member Functions

 ObjectRegistry ()
 Constructor.
 ~ObjectRegistry ()
 Destructor.
bool isRegistered (const T *o) const
 Check if the object is one of managed objects.
size_t size () const
 The number of objects being managed.
void reset ()
 Clears the list of managed objects.
void registerObject (T *o)
 Add an object to the list of managed objects.
bool destructObject (T *o)
 Remove an object from the list and deletes the object.
bool removeObject (T *o)
 Remove an object from the list of managed objects.
template<class Op>
Op for_each (Op Function) const
 Execute a function for each member of the list.
 ObjectRegistry ()
 Constructor.
 ~ObjectRegistry ()
 Destructor.
bool isRegistered (const T *o) const
 Check if the object is one of managed objects.
size_t size () const
 The number of objects being managed.
void reset ()
 Clears the list of managed objects.
void registerObject (T *o)
 Add an object to the list of managed objects.
bool destructObject (T *o)
 Remove an object from the list and deletes the object.
bool removeObject (T *o)
 Remove an object from the list of managed objects.
template<class Op>
Op for_each (Op Function) const
 Execute a function for each member of the list.

Protected Member Functions

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

Protected Attributes

LDASTools::AL::ReadWriteLock::baton_type m_lock
 Ensure only one thread accesses the registry at a time.

Detailed Description

template<class T>
class ObjectRegistry< T >

Object Registry.

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 ensuring that memory isn't leaked by the TCL layer failing to destruct C+ objects.

Member Function Documentation

◆ begin()

template<class T>
ObjectRegistry< T >::const_iterator ObjectRegistry< T >::begin ( ) const
inlineprotected

Obtain the start of the list (read-only)

Get Beginning Const Iterator.

Returns a constant iterator positioned at the beginning of the registry.

Returns
const_iterator

◆ end()

template<class T>
ObjectRegistry< T >::const_iterator ObjectRegistry< T >::end ( ) const
inlineprotected

Obtain the end of the list (read-only)

Get End Const Iterator.

Returns a constant iterator positioned at the end of the registry.

Returns
const_iterator

The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/ldas-tools-al-2.6.7-build/ldas-tools-al-2.6.7/build/include/ldastoolsal/objectregistry.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-al-2.6.7-build/ldas-tools-al-2.6.7/src/objectregistry.hh