diff options
Diffstat (limited to 'TAO/tao/TAO_Singleton_Manager.h')
-rw-r--r-- | TAO/tao/TAO_Singleton_Manager.h | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/TAO/tao/TAO_Singleton_Manager.h b/TAO/tao/TAO_Singleton_Manager.h index 8d0313f6cb6..891a31ebf0e 100644 --- a/TAO/tao/TAO_Singleton_Manager.h +++ b/TAO/tao/TAO_Singleton_Manager.h @@ -28,12 +28,18 @@ #include "tao/orbconf.h" #include "ace/Object_Manager_Base.h" -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - #if defined (ACE_HAS_EXCEPTIONS) typedef void (*TAO_unexpected_handler)(void); #endif /* ACE_HAS_EXCEPTIONS */ + +/// Adapter for cleanup, used to register cleanup function with the +/// ACE_Object_Manager. +extern "C" +void +TAO_Singleton_Manager_cleanup_destroyer (void *, void *); + + /** * @class TAO_Singleton_Manager * @@ -53,6 +59,9 @@ typedef void (*TAO_unexpected_handler)(void); */ class TAO_Export TAO_Singleton_Manager : public ACE_Object_Manager_Base { + + friend void TAO_Singleton_Manager_cleanup_destroyer (void *, void *); + public: /// Explicitly initialize. virtual int init (void); @@ -77,6 +86,24 @@ public: /// See ACE_Object_Manager::shutting_down for more information. static int shutting_down (void); + /// Unique identifiers for preallocated Objects. + enum Preallocated_Object + { +# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + /// @@ No MT-specific preallocated objects (yet). Remove the + /// below dummy enum once a preallocated object is added. + TAO_EMPTY_PREALLOCATED_OBJECT, +# else + /// Without ACE_MT_SAFE, There are no preallocated objects. + /// Make sure that the preallocated_array size is at least one + /// by declaring this dummy ... + TAO_EMPTY_PREALLOCATED_OBJECT, +# endif /* ACE_MT_SAFE */ + + /// This enum value must be last! + TAO_PREALLOCATED_OBJECTS + }; + /// Accesses a default signal set used, for example, in /// ACE_Sig_Guard methods. static sigset_t *default_mask (void); @@ -133,16 +160,13 @@ public: void _set_unexpected (TAO_unexpected_handler u); #endif /* ACE_HAS_EXCEPTIONS */ -protected: - +private: /// Force allocation on the heap. //@{ TAO_Singleton_Manager (void); ~TAO_Singleton_Manager (void); //@} -private: - /// Disallow copying by not implementing the following ... //@{ TAO_Singleton_Manager (const TAO_Singleton_Manager &); @@ -154,6 +178,11 @@ private: int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param); private: + /// Singleton instance pointer. + static TAO_Singleton_Manager *instance_; + + /// Table of preallocated objects. + static void *preallocated_object[TAO_PREALLOCATED_OBJECTS]; /// Default signal set used, for example, in ACE_Sig_Guard. sigset_t *default_mask_; @@ -186,8 +215,6 @@ private: #endif /* ACE_HAS_EXCEPTIONS */ }; -TAO_END_VERSIONED_NAMESPACE_DECL - #if defined (__ACE_INLINE__) # include "tao/TAO_Singleton_Manager.inl" #endif /* __ACE_INLINE__ */ |