diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-05-14 22:48:54 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-05-14 22:48:54 +0000 |
commit | 7f112ff6968e4fee2a38bcca1a6c1f6630d75e37 (patch) | |
tree | 78778590b5c6c5e56fd628273ce5a8d6130d6ac1 /ace/Singleton.h | |
parent | ec23ba492313939a7bc4c3482c7bdccb7cecb9ea (diff) | |
download | ATCD-7f112ff6968e4fee2a38bcca1a6c1f6630d75e37.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/Singleton.h')
-rw-r--r-- | ace/Singleton.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ace/Singleton.h b/ace/Singleton.h index 86966d9f0bb..f2bcdde8c3d 100644 --- a/ace/Singleton.h +++ b/ace/Singleton.h @@ -34,6 +34,9 @@ public: static TYPE *instance (void); // Global access point to the Singleton. + static TYPE *instance (TYPE*); + // Set the Singleton instance. + static void dump (void); // Dump the state of the object. @@ -45,6 +48,48 @@ protected: static LOCK ace_singleton_lock_; // Lock the creation of the singleton. #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ + + static TYPE *&instance_i (void); + // Get pointer to the Singleton instance + + static LOCK &singleton_lock_ (void); + // Get reference to Singleton lock; +}; + +template <class TYPE, class LOCK, ACE_Singleton_Strategy MEMORY> +class ACE_SingletonEx + // = TITLE + // A Singleton Adapter that can allocate memory either off the + // heap or out of thread-specific storage. + // + // = DESCRIPTION + // Uses the Adapter pattern to turn ordinary classes into + // Singletons optimized with the Double-Check pattern. +{ +public: + static TYPE *instance (void); + // Global access point to the Singleton. + + static TYPE *instance (TYPE*); + // Set the Singleton instance. + + static void dump (void); + // Dump the state of the object. + +protected: +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + static TYPE *instance_; + // Pointer to the Singleton instance. + + static LOCK ace_singletonex_lock_; + // Lock the creation of the singleton. +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ + + static TYPE *&instance_i (void); + // Get pointer to the SingletonEx instance. + + static LOCK &singleton_lock_ (void); + // Get reference to SingletonEx lock; }; #if defined (__ACE_INLINE__) |