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_Manager * | instance (void) |
This function should be called during construction of static instances, or before any other threads have been created in the process. |
Definition at line 138 of file objman.h.
org::xmlBlaster::util::Object_Lifetime_Manager::Object_Lifetime_Manager | ( | void | ) |
org::xmlBlaster::util::Object_Lifetime_Manager::~Object_Lifetime_Manager | ( | void | ) |
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] |
static int org::xmlBlaster::util::Object_Lifetime_Manager::shutting_down | ( | void | ) | [static] |
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().
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.
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().
void org::xmlBlaster::util::Object_Lifetime_Manager::manage_object | ( | const std::string & | key, | |
T * | obj | |||
) |
T* org::xmlBlaster::util::Object_Lifetime_Manager::getManagedObject | ( | const std::string & | key | ) |