This is a helper class that is designed to perform cleanup on thread-specific objects registered in the ORB Core TSS resources by invoking the corresponding cleanup function on each object. Hence, there is a tight coupling between this class and the TAO ORB Core. More...
#include <Cleanup_Func_Registry.h>
Public Member Functions | |
TAO_Cleanup_Func_Registry (void) | |
Constructor. | |
size_t | size (void) const |
Return the number of registered cleanup functions. | |
Protected Member Functions | |
int | register_cleanup_function (ACE_CLEANUP_FUNC func, size_t &slot_id) |
void | cleanup (ACE_Array_Base< void * > &ts_objects) |
Private Member Functions | |
TAO_Cleanup_Func_Registry (const TAO_Cleanup_Func_Registry &) | |
void | operator= (const TAO_Cleanup_Func_Registry &) |
Private Attributes | |
ACE_Array_Base< ACE_CLEANUP_FUNC > | cleanup_funcs_ |
Friends | |
class | TAO_ORB_Core |
This is a helper class that is designed to perform cleanup on thread-specific objects registered in the ORB Core TSS resources by invoking the corresponding cleanup function on each object. Hence, there is a tight coupling between this class and the TAO ORB Core.
Definition at line 40 of file Cleanup_Func_Registry.h.
TAO_Cleanup_Func_Registry::TAO_Cleanup_Func_Registry | ( | void | ) |
TAO_Cleanup_Func_Registry::TAO_Cleanup_Func_Registry | ( | const TAO_Cleanup_Func_Registry & | ) | [private] |
Prevent copying through the copy constructor and the assignment operator.
void TAO_Cleanup_Func_Registry::cleanup | ( | ACE_Array_Base< void * > & | ts_objects | ) | [protected] |
Invoke the corresponding cleanup function on each thread-specific object.
Cleanup each TSS object.
Definition at line 31 of file Cleanup_Func_Registry.cpp.
{ size_t const len = ts_objects.size (); // The allocated slot may never have been used. It is therefore // possible that the TSS array size may be less than the cleanup // function size. However, there is still a one-to-one // correspondence between cleanup_func[foo] and ts_object[foo]. ACE_ASSERT (len <= this->cleanup_funcs_.size ()); /// Cleanup each TSS object. for (size_t i = 0; i < len; ++i) { ACE_CLEANUP_FUNC destructor = this->cleanup_funcs_[i]; if (destructor != 0) destructor (ts_objects[i], 0); } }
void TAO_Cleanup_Func_Registry::operator= | ( | const TAO_Cleanup_Func_Registry & | ) | [private] |
int TAO_Cleanup_Func_Registry::register_cleanup_function | ( | ACE_CLEANUP_FUNC | func, | |
size_t & | slot_id | |||
) | [protected] |
Register a cleanup function. The number of slot the cleanup function is placed is in will match the one reserved for the corresponding thread specific object in the ORB Core TSS resources. The slot_id is returned via the second reference argument. This method returns 0 on failure, and -1 on failure.
Definition at line 16 of file Cleanup_Func_Registry.cpp.
{ size_t const slot = this->cleanup_funcs_.size (); if (this->cleanup_funcs_.size (slot + 1) != 0) return -1; this->cleanup_funcs_[slot] = func; slot_id = slot; return 0; }
size_t TAO_Cleanup_Func_Registry::size | ( | void | ) | const |
Return the number of registered cleanup functions.
Definition at line 14 of file Cleanup_Func_Registry.inl.
{ return this->cleanup_funcs_.size (); }
friend class TAO_ORB_Core [friend] |
Definition at line 42 of file Cleanup_Func_Registry.h.
ACE_Array_Base<ACE_CLEANUP_FUNC> TAO_Cleanup_Func_Registry::cleanup_funcs_ [private] |
Array of registered cleanup functions. The number of registered cleanup functions should be the same as the number of registered thread-specific objects in the ORB Core TSS resources.
Definition at line 78 of file Cleanup_Func_Registry.h.