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

Cleanup_Func_Registry.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // ===================================================================
00004 /**
00005  *  @file   Cleanup_Func_Registry.h
00006  *
00007  *  $Id: Cleanup_Func_Registry.h,v 1.1.1.2 2003/02/21 18:36:44 chad Exp $
00008  *
00009  *  @author Ossama Othman <ossama@uci.edu>
00010  */
00011 // ===================================================================
00012 
00013 #ifndef TAO_CLEANUP_FUNC_REGISTRY_H
00014 #define TAO_CLEANUP_FUNC_REGISTRY_H
00015 #include "ace/pre.h"
00016 
00017 #include "TAO_Export.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "ace/Array_Base.h"
00024 
00025 /**
00026  * @class TAO_Cleanup_Func_Registry
00027  *
00028  * @brief
00029  * This is a helper class that is designed to perform cleanup on
00030  * thread-specific objects registered in the ORB Core TSS resources by
00031  * invoking the corresponding cleanup function on each object.  Hence,
00032  * there is a tight coupling between this class and the TAO ORB Core.
00033  */
00034 class TAO_Export TAO_Cleanup_Func_Registry
00035 {
00036   friend class TAO_ORBInitInfo;
00037   friend class TAO_ORB_Core_TSS_Resources;
00038   friend class TAO_ORB_Core;
00039 
00040 public:
00041 
00042   /// Constructor
00043   TAO_Cleanup_Func_Registry (void);
00044 
00045   /// Destructor
00046   ~TAO_Cleanup_Func_Registry (void);
00047 
00048   /// Return the number of registered cleanup functions.
00049   size_t size (void) const;
00050 
00051 protected:
00052 
00053   /// Register a cleanup function.  The number of slot the cleanup
00054   /// function is placed is in will match the one reserved for the
00055   /// corresponding thread specific object in the ORB Core TSS
00056   /// resources.  The slot_id is returned via the second reference
00057   /// argument.  This method returns 0 on failure, and -1 on failure.
00058   int register_cleanup_function (ACE_CLEANUP_FUNC func,
00059                                  size_t &slot_id);
00060 
00061   /// Invoke the corresponding cleanup function on each
00062   /// thread-specific object.
00063   void cleanup (ACE_Array_Base<void *> &ts_objects);
00064 
00065 private:
00066 
00067   /// Prevent copying through the copy constructor and the assignment
00068   /// operator.
00069   ACE_UNIMPLEMENTED_FUNC (
00070     TAO_Cleanup_Func_Registry (const TAO_Cleanup_Func_Registry &))
00071   ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Cleanup_Func_Registry &))
00072 
00073 private:
00074 
00075   /// Array of registered cleanup functions.  The number of
00076   /// registered cleanup functions should be the same as the number
00077   /// of registered thread-specific objects in the ORB Core TSS
00078   /// resources.
00079   ACE_Array_Base<ACE_CLEANUP_FUNC> cleanup_funcs_;
00080 
00081 };
00082 
00083 #if defined (__ACE_INLINE__)
00084 # include "Cleanup_Func_Registry.inl"
00085 #endif  /* __ACE_INLINE__ */
00086 
00087 
00088 #include "ace/post.h"
00089 
00090 #endif  /* TAO_CLEANUP_FUNC_REGISTRY_H */

Generated on Mon Jun 16 13:48:03 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002