Class for managing objects. More...
#include <ObjectManager.h>
Classes | |
struct | Objects |
The structure for object management. More... | |
Public Types | |
typedef std::vector< Object * > | ObjectVector |
typedef ObjectVector::iterator | ObjectVectorItr |
typedef ObjectVector::const_iterator | ObjectVectorConstItr |
typedef coil::Mutex | Mutex |
typedef coil::Guard< coil::Mutex > | Guard |
Public Member Functions | |
ObjectManager () | |
Constructor. | |
~ObjectManager (void) | |
Destructor. | |
bool | registerObject (Object *obj) |
Register the specified object. | |
Object * | unregisterObject (const Identifier &id) |
Unregister the specified object. | |
Object * | find (const Identifier &id) const |
Find the object. | |
std::vector< Object * > | getObjects () const |
Get a list of obejects that are registerd. | |
template<class Pred > | |
Pred | for_each (Pred p) |
Functor for searching object. | |
template<class Pred > | |
Pred | for_each (Pred p) const |
Functor for searching object. | |
Protected Attributes | |
Objects | m_objects |
The list of registered objects. |
Class for managing objects.
This is a class for managing various objects.
typedef coil::Guard<coil::Mutex> ObjectManager< Identifier, Object, Predicate >::Guard |
typedef coil::Mutex ObjectManager< Identifier, Object, Predicate >::Mutex |
typedef std::vector<Object*> ObjectManager< Identifier, Object, Predicate >::ObjectVector |
typedef ObjectVector::const_iterator ObjectManager< Identifier, Object, Predicate >::ObjectVectorConstItr |
typedef ObjectVector::iterator ObjectManager< Identifier, Object, Predicate >::ObjectVectorItr |
ObjectManager< Identifier, Object, Predicate >::ObjectManager | ( | ) | [inline] |
Constructor.
Constructor
ObjectManager< Identifier, Object, Predicate >::~ObjectManager | ( | void | ) | [inline] |
Destructor.
Destructor
Object* ObjectManager< Identifier, Object, Predicate >::find | ( | const Identifier & | id | ) | const [inline] |
Find the object.
Find the object that matches the specified condition among the registered objects and get it. This operation returns NULL if the object that does matches the specified condition is not registered.
id | ID of the target object for finding |
Pred ObjectManager< Identifier, Object, Predicate >::for_each | ( | Pred | p | ) | const [inline] |
Functor for searching object.
Pred ObjectManager< Identifier, Object, Predicate >::for_each | ( | Pred | p | ) | [inline] |
Functor for searching object.
Referenced by ObjectManager< const char *, DLLEntity, DllPred >::for_each().
std::vector<Object*> ObjectManager< Identifier, Object, Predicate >::getObjects | ( | ) | const [inline] |
Get a list of obejects that are registerd.
Get a list of objects that are registerd.
bool ObjectManager< Identifier, Object, Predicate >::registerObject | ( | Object * | obj | ) | [inline] |
Register the specified object.
Register the object that was specified. If the same object is already registered, this does not anything.
obj | The target object for the registration |
Object* ObjectManager< Identifier, Object, Predicate >::unregisterObject | ( | const Identifier & | id | ) | [inline] |
Unregister the specified object.
Unregister the object that was specified and get it. This operation returns NULL if the specified object is not registered.
id | ID of the target object for the unregistration |
Objects ObjectManager< Identifier, Object, Predicate >::m_objects [protected] |
The list of registered objects.
Referenced by ObjectManager< const char *, DLLEntity, DllPred >::find(), ObjectManager< const char *, DLLEntity, DllPred >::for_each(), ObjectManager< const char *, DLLEntity, DllPred >::getObjects(), ObjectManager< const char *, DLLEntity, DllPred >::registerObject(), and ObjectManager< const char *, DLLEntity, DllPred >::unregisterObject().