org::xmlBlaster::util::Object_Lifetime_Manager Class Reference

Inheritance diagram for org::xmlBlaster::util::Object_Lifetime_Manager:

Inheritance graph
[legend]
Collaboration diagram for org::xmlBlaster::util::Object_Lifetime_Manager:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Preallocated_Object { XMLBLASTER_GLOBAL, PREALLOCATED_OBJECTS }
 Unique identifiers for Preallocated Objects. More...

Public Member Functions

virtual int startup (void)
virtual int shutdown (void)
 Object_Lifetime_Manager (void)
 ~Object_Lifetime_Manager (void)
template<class T>
void manage_object (T *obj)
 Add a new object to be managed on startup/shutdown.
template<class T>
void manage_object (const std::string &key, T *obj)
 Add a new object to be managed on startup/shutdown.
template<class T>
T * getManagedObject (const std::string &key)
 Lookup a managed object by its registration key.

Static Public Member Functions

static void init (void)
static void fini (void)
static int starting_up (void)
static int shutting_down (void)
static Object_Lifetime_Managerinstance (void)
 This function should be called during construction of static instances, or before any other threads have been created in the process.

Detailed Description

Definition at line 138 of file objman.h.


Member Enumeration Documentation

enum org::xmlBlaster::util::Object_Lifetime_Manager::Preallocated_Object

Unique identifiers for Preallocated Objects.

Enumerator:
XMLBLASTER_GLOBAL 
PREALLOCATED_OBJECTS 

Definition at line 161 of file objman.h.


Constructor & Destructor Documentation

org::xmlBlaster::util::Object_Lifetime_Manager::Object_Lifetime_Manager ( void   ) 

Definition at line 178 of file objman.h.

org::xmlBlaster::util::Object_Lifetime_Manager::~Object_Lifetime_Manager ( void   ) 

Definition at line 192 of file objman.h.


Member Function Documentation

void org::xmlBlaster::util::Object_Lifetime_Manager::init ( void   )  [static]

Definition at line 42 of file objman.cpp.

References instance(), and startup().

Referenced by main().

void org::xmlBlaster::util::Object_Lifetime_Manager::fini ( void   )  [static]

Definition at line 47 of file objman.cpp.

References instance(), and shutdown().

Referenced by main().

int org::xmlBlaster::util::Object_Lifetime_Manager::startup ( void   )  [virtual]

Implements org::xmlBlaster::util::Object_Lifetime_Manager_Base.

Definition at line 70 of file objman.cpp.

References org::xmlBlaster::util::Object_Lifetime_Manager_Base::OBJ_MAN_INITIALIZED, org::xmlBlaster::util::Object_Lifetime_Manager_Base::OBJ_MAN_INITIALIZING, org::xmlBlaster::util::Object_Lifetime_Manager_Base::object_manager_state_, PREALLOCATE_OBJECT, org::xmlBlaster::util::Object_Lifetime_Manager_Base::starting_up_i(), and XMLBLASTER_GLOBAL.

Referenced by init().

int org::xmlBlaster::util::Object_Lifetime_Manager::shutdown ( void   )  [virtual]

Implements org::xmlBlaster::util::Object_Lifetime_Manager_Base.

Definition at line 93 of file objman.cpp.

References org::xmlBlaster::util::Object_Lifetime_Manager_Base::dynamically_allocated_, org::xmlBlaster::util::Object_Lifetime_Manager_Base::OBJ_MAN_SHUT_DOWN, org::xmlBlaster::util::Object_Lifetime_Manager_Base::OBJ_MAN_SHUTTING_DOWN, org::xmlBlaster::util::Object_Lifetime_Manager_Base::object_manager_state_, org::xmlBlaster::util::Object_Lifetime_Manager_Base::shutting_down_i(), and XMLBLASTER_GLOBAL.

Referenced by fini().

static int org::xmlBlaster::util::Object_Lifetime_Manager::starting_up ( void   )  [static]

Definition at line 148 of file objman.h.

static int org::xmlBlaster::util::Object_Lifetime_Manager::shutting_down ( void   )  [static]

Definition at line 153 of file objman.h.

Object_Lifetime_Manager * org::xmlBlaster::util::Object_Lifetime_Manager::instance ( void   )  [static]

This function should be called during construction of static instances, or before any other threads have been created in the process.

This function should be called during construction of static instances, or before any other threads have been created in the process. So, it’s not thread safe.

Definition at line 58 of file objman.cpp.

References org::xmlBlaster::util::Object_Lifetime_Manager_Base::dynamically_allocated_.

Referenced by fini(), org::xmlBlaster::util::queue::QueueFactory::getFactory(), org::xmlBlaster::util::parser::ParserFactory::getFactory(), and init().

template<class T>
void org::xmlBlaster::util::Object_Lifetime_Manager::manage_object ( T *  obj  ) 

Add a new object to be managed on startup/shutdown.

If you want to lookup the managed object at any time you should use the manage_object(const std::string& key, T* obj) variant.

Parameters:
obj The instance to lifecycle-manage

Definition at line 208 of file objman.h.

Referenced by org::xmlBlaster::util::queue::QueueFactory::getFactory(), and org::xmlBlaster::util::parser::ParserFactory::getFactory().

template<class T>
void org::xmlBlaster::util::Object_Lifetime_Manager::manage_object ( const std::string &  key,
T *  obj 
)

Add a new object to be managed on startup/shutdown.

Parameters:
key The unique key of this object, you can lookup this instance later if desired
obj The instance to lifecycle-manage

Definition at line 220 of file objman.h.

template<class T>
T* org::xmlBlaster::util::Object_Lifetime_Manager::getManagedObject ( const std::string &  key  ) 

Lookup a managed object by its registration key.

Returns:
Pointer on managed object or NULL if not found

Definition at line 231 of file objman.h.


The documentation for this class was generated from the following files: