Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Cleanup_Func_Registry.h
blobb9ce64774f7506bbfe9a503c2ef35d75ff793c7f
1 // -*- C++ -*-
3 // ===================================================================
4 /**
5 * @file Cleanup_Func_Registry.h
7 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
8 */
9 // ===================================================================
11 #ifndef TAO_CLEANUP_FUNC_REGISTRY_H
12 #define TAO_CLEANUP_FUNC_REGISTRY_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "tao/TAO_Export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include /**/ "tao/Versioned_Namespace.h"
24 #include "ace/Array_Base.h"
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
28 /**
29 * @class TAO_Cleanup_Func_Registry
31 * @brief
32 * This is a helper class that is designed to perform cleanup on
33 * thread-specific objects registered in the ORB Core TSS resources by
34 * invoking the corresponding cleanup function on each object. Hence,
35 * there is a tight coupling between this class and the TAO ORB Core.
37 class TAO_Export TAO_Cleanup_Func_Registry
39 friend class TAO_ORB_Core;
41 public:
42 /// Constructor.
43 TAO_Cleanup_Func_Registry () = default;
45 /// Return the number of registered cleanup functions.
46 size_t size () const;
48 protected:
49 /// Register a cleanup function. The number of slot the cleanup
50 /// function is placed is in will match the one reserved for the
51 /// corresponding thread specific object in the ORB Core TSS
52 /// resources. The @a slot_id is returned via the second reference
53 /// argument. This method returns 0 on failure, and -1 on failure.
54 int register_cleanup_function (ACE_CLEANUP_FUNC func, size_t &slot_id);
56 /// Invoke the corresponding cleanup function on each
57 /// thread-specific object.
58 void cleanup (ACE_Array_Base<void *> &ts_objects);
60 private:
61 TAO_Cleanup_Func_Registry (const TAO_Cleanup_Func_Registry &) = delete;
62 TAO_Cleanup_Func_Registry &operator= (const TAO_Cleanup_Func_Registry &) = delete;
64 /// Array of registered cleanup functions. The number of
65 /// registered cleanup functions should be the same as the number
66 /// of registered thread-specific objects in the ORB Core TSS
67 /// resources.
68 ACE_Array_Base<ACE_CLEANUP_FUNC> cleanup_funcs_;
71 TAO_END_VERSIONED_NAMESPACE_DECL
73 #if defined (__ACE_INLINE__)
74 # include "tao/Cleanup_Func_Registry.inl"
75 #endif /* __ACE_INLINE__ */
78 #include /**/ "ace/post.h"
80 #endif /* TAO_CLEANUP_FUNC_REGISTRY_H */