Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_Cleanup_Func_Registry Class Reference

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>

Collaboration diagram for TAO_Cleanup_Func_Registry:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_Cleanup_Func_Registry (void)
 Constructor. More...

 ~TAO_Cleanup_Func_Registry (void)
 Destructor. More...

size_t size (void) const
 Return the number of registered cleanup functions. More...


Protected Methods

int register_cleanup_function (ACE_CLEANUP_FUNC func, size_t &slot_id)
 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. More...

void cleanup (ACE_Array_Base< void * > &ts_objects)
 Invoke the corresponding cleanup function on each thread-specific object. More...


Private Methods

 TAO_Cleanup_Func_Registry (const TAO_Cleanup_Func_Registry &)
 Prevent copying through the copy constructor and the assignment operator. More...

void operator= (const TAO_Cleanup_Func_Registry &)

Private Attributes

ACE_Array_Base< ACE_CLEANUP_FUNCcleanup_funcs_
 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. More...


Friends

class TAO_ORBInitInfo
class TAO_ORB_Core_TSS_Resources
class TAO_ORB_Core

Detailed Description

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 34 of file Cleanup_Func_Registry.h.


Constructor & Destructor Documentation

TAO_Cleanup_Func_Registry::TAO_Cleanup_Func_Registry void   
 

Constructor.

Definition at line 14 of file Cleanup_Func_Registry.cpp.

00015   : cleanup_funcs_ ()
00016 {
00017 }

TAO_Cleanup_Func_Registry::~TAO_Cleanup_Func_Registry void   
 

Destructor.

Definition at line 19 of file Cleanup_Func_Registry.cpp.

00020 {
00021 }

TAO_Cleanup_Func_Registry::TAO_Cleanup_Func_Registry const TAO_Cleanup_Func_Registry &    [private]
 

Prevent copying through the copy constructor and the assignment operator.


Member Function Documentation

void TAO_Cleanup_Func_Registry::cleanup ACE_Array_Base< void * > &    ts_objects [protected]
 

Invoke the corresponding cleanup function on each thread-specific object.

Definition at line 40 of file Cleanup_Func_Registry.cpp.

References ACE_ASSERT, ACE_CLEANUP_FUNC, cleanup_funcs_, ACE_Array_Base< ACE_CLEANUP_FUNC >::size, and ACE_Array_Base::size.

00041 {
00042   size_t len = ts_objects.size ();
00043 
00044   // The allocated slot may never have been used.  It is therefore
00045   // possible that the TSS array size may be less than the cleanup
00046   // function size.  However, there is still a one-to-one
00047   // correspondence between cleanup_func[foo] and ts_object[foo].
00048 
00049   ACE_ASSERT (len <= this->cleanup_funcs_.size ());
00050 
00051   /// Cleanup each TSS object.
00052   for (size_t i = 0; i < len; ++i)
00053     {
00054       ACE_CLEANUP_FUNC destructor = this->cleanup_funcs_[i];
00055       if (destructor != 0)
00056         destructor (ts_objects[i], 0);
00057     }
00058 }

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 24 of file Cleanup_Func_Registry.cpp.

References ACE_CLEANUP_FUNC, cleanup_funcs_, and ACE_Array_Base< ACE_CLEANUP_FUNC >::size.

Referenced by TAO_ORB_Core::add_tss_cleanup_func.

00027 {
00028   size_t slot = this->cleanup_funcs_.size ();
00029 
00030   if (this->cleanup_funcs_.size (slot + 1) != 0)
00031     return -1;
00032 
00033   this->cleanup_funcs_[slot] = func;
00034   slot_id = slot;
00035 
00036   return 0;
00037 }

ACE_INLINE size_t TAO_Cleanup_Func_Registry::size void    const
 

Return the number of registered cleanup functions.

Definition at line 6 of file Cleanup_Func_Registry.inl.

References cleanup_funcs_, and ACE_Array_Base< ACE_CLEANUP_FUNC >::size.

Referenced by TAO_ORB_Core::set_tss_resource.

00007 {
00008   return this->cleanup_funcs_.size ();
00009 }


Friends And Related Function Documentation

friend class TAO_ORB_Core [friend]
 

Definition at line 38 of file Cleanup_Func_Registry.h.

friend class TAO_ORB_Core_TSS_Resources [friend]
 

Definition at line 37 of file Cleanup_Func_Registry.h.

friend class TAO_ORBInitInfo [friend]
 

Definition at line 36 of file Cleanup_Func_Registry.h.


Member Data Documentation

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 79 of file Cleanup_Func_Registry.h.

Referenced by cleanup, register_cleanup_function, and size.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:06:19 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002