diff options
author | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-02-14 23:19:16 +0000 |
---|---|---|
committer | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-02-14 23:19:16 +0000 |
commit | bb9b112d2ba6faf5305ecc2cd3cd01d82547fe41 (patch) | |
tree | df38af287b61587693176243f04aee4f15ad445e | |
parent | b2b7cc3206a268281740f60c4168e378eae179e6 (diff) | |
download | ATCD-bb9b112d2ba6faf5305ecc2cd3cd01d82547fe41.tar.gz |
ChangeLogTag: Wed Feb 14 23:05:16 UTC 2007 Iliyan Jeliazkov <iliyan@ociweb.com>
-rw-r--r-- | ACE/ChangeLog | 12 | ||||
-rw-r--r-- | ACE/ace/Service_Config.cpp | 43 | ||||
-rw-r--r-- | ACE/ace/Service_Config.h | 22 | ||||
-rw-r--r-- | ACE/ace/Service_Config.inl | 15 | ||||
-rw-r--r-- | ACE/ace/Service_Gestalt.cpp | 18 | ||||
-rw-r--r-- | ACE/ace/Service_Gestalt.h | 10 |
6 files changed, 56 insertions, 64 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index eff3563b46b..739d2692b4b 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,15 @@ +Wed Feb 14 23:05:16 UTC 2007 Iliyan Jeliazkov <iliyan@ociweb.com> + + * ace/Service_Config.h: + * ace/Service_Config.inl: + * ace/Service_Config.cpp: + * ace/Service_Gestalt.h: + * ace/Service_Gestalt.cpp: + + Moved the ACE_Unmanaged_Singleton usage to the implementation + file and eliminated the unnecesary #includes, aiming to reduce + the footprint. + Wed Feb 14 19:56:14 UTC 2007 Adam Mitz <mitza@ociweb.com> * ace/Service_Config.h: diff --git a/ACE/ace/Service_Config.cpp b/ACE/ace/Service_Config.cpp index ab9c2c440d2..94cc1cfb9c0 100644 --- a/ACE/ace/Service_Config.cpp +++ b/ACE/ace/Service_Config.cpp @@ -6,11 +6,10 @@ #include "ace/Service_Config.inl" #endif /* __ACE_INLINE__ */ -#include "ace/ACE.h" -#include "ace/Guard_T.h" -#include "ace/Log_Msg.h" #include "ace/Service_Types.h" #include "ace/Reactor.h" +#include "ace/Singleton.h" +#include "ace/Service_Repository.h" #ifndef ACE_LACKS_UNIX_SIGNALS # include "ace/Sig_Adapter.h" @@ -26,7 +25,20 @@ ACE_RCSID (ace, Service_Config, "$Id$") - ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + /** + * @c ACE_Service_Config is supposed to be a Singleton. This is the + * only Configuration Gestalt available for access from static + * initializers at proces start-up time. Using Unmanaged Singleton + * is safer because (a) the Object Manager may not yet be fully initialized in the + * context of a static initializer that uses SC, and (b) because we + * know that upon process exit the SC will still be automaticaly and explicitely closed + * by @c ACE_Object_Manager::fini(). + */ + typedef ACE_Unmanaged_Singleton<ACE_Service_Config, + ACE_SYNCH_RECURSIVE_MUTEX> ACE_SERVICE_CONFIG_SINGLETON; + /// ACE_Service_Config_Guard::ACE_Service_Config_Guard (ACE_Service_Gestalt * psg) @@ -78,21 +90,23 @@ int ACE_Service_Config::signum_ = SIGHUP; /// -ACE_Service_Config::TSS_Resources::TSS_Resources (void) - : ptr_ (ACE_Service_Config::global()) +ACE_Service_Config::TSS_Resources::TSS_Resources (void) + : ptr_ (ACE_Service_Config::global()) { } /// -ACE_Service_Gestalt *ACE_Service_Config::TSS_Resources::ptr () const +ACE_Service_Gestalt * +ACE_Service_Config::TSS_Resources::ptr () const { - return ptr_; + return this->ptr_; } /// -ACE_Service_Gestalt *ACE_Service_Config::TSS_Resources::ptr (ACE_Service_Gestalt *n) +ACE_Service_Gestalt * +ACE_Service_Config::TSS_Resources::ptr (ACE_Service_Gestalt *n) { - return ptr_ = n; + return this->ptr_ = n; } @@ -322,6 +336,15 @@ ACE_Service_Config::static_svcs (void) return ACE_Service_Config::instance (); } +/// Return the global configuration instance. Allways returns the same +/// instance +ACE_INLINE ACE_Service_Config * +ACE_Service_Config::global (void) +{ + return ACE_SERVICE_CONFIG_SINGLETON::instance (); +} + + /// int ACE_Service_Config::insert (ACE_Static_Svc_Descriptor* stsd) diff --git a/ACE/ace/Service_Config.h b/ACE/ace/Service_Config.h index a1fb5feed00..f6c7e5f0975 100644 --- a/ACE/ace/Service_Config.h +++ b/ACE/ace/Service_Config.h @@ -18,12 +18,12 @@ #include /**/ "ace/config-all.h" #include "ace/Default_Constants.h" #include "ace/Service_Gestalt.h" +#include "ace/TSS_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/SString.h" #include "ace/OS_NS_signal.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -209,22 +209,6 @@ protected: */ virtual int parse_args_i (int argc, ACE_TCHAR *argv[]); - /// = Static interfaces - -private: - - /** - * @c ACE_Service_Config is supposed to be a Singleton. This is the - * only Configuration Gestalt available for access from static - * initializers at proces start-up time. Using Unmanaged Singleton - * makes it safe since OM may not yet be fully initialized in the - * context of a static initializer that uses SC, and also because we - * know that upon process exit, the SC will be explicitely closed - * (in the @c ACE_Object_Manager::fini()). - */ - typedef ACE_Unmanaged_Singleton<ACE_Service_Config, - ACE_SYNCH_RECURSIVE_MUTEX> ACE_SERVICE_CONFIG_SINGLETON; - /** * A Wrapper for the TSS-stored pointer to the "current" * configuration Gestalt. Static initializers from any DLL loaded @@ -246,6 +230,8 @@ private: ACE_TSS_TYPE (TSS_Resources) tss_; + /// = Static interfaces + public: /** * Mutator to set the (TSS) global instance. Intended for use by @@ -263,7 +249,7 @@ public: * discouraged as it allows circumvention of the mechanism for * dynamically loading services. Use with extreme caution! */ - static ACE_Service_Gestalt* global (void); + static ACE_Service_Config* global (void); /// Accessor for the "current" service gestalt static ACE_Service_Gestalt* current (void); diff --git a/ACE/ace/Service_Config.inl b/ACE/ace/Service_Config.inl index c0cd157d566..ec07c3847a7 100644 --- a/ACE/ace/Service_Config.inl +++ b/ACE/ace/Service_Config.inl @@ -52,15 +52,6 @@ ACE_Service_Config::parse_args (int argc, ACE_TCHAR *argv[]) } -/// Return the global configuration instance. Allways returns the same -/// instance -ACE_INLINE ACE_Service_Gestalt * -ACE_Service_Config::global (void) -{ - return ACE_SERVICE_CONFIG_SINGLETON::instance (); -} - - /// Return the configuration instance, considered "global" in the /// current thread. This may be the same as instance(), but on some /// occasions, it may be a different one. For example, @@ -69,7 +60,7 @@ ACE_Service_Config::global (void) ACE_INLINE ACE_Service_Gestalt * ACE_Service_Config::instance (void) { - return ACE_SERVICE_CONFIG_SINGLETON::instance ()->tss_->ptr (); + return ACE_Service_Config::global ()->tss_->ptr (); } @@ -81,14 +72,14 @@ ACE_Service_Config::instance (void) ACE_INLINE ACE_Service_Gestalt * ACE_Service_Config::current (void) { - return ACE_SERVICE_CONFIG_SINGLETON::instance ()->tss_->ptr (); + return ACE_Service_Config::global ()->tss_->ptr (); } /// A mutator to set the "current" (TSS) gestalt instance. ACE_INLINE ACE_Service_Gestalt* ACE_Service_Config::current (ACE_Service_Gestalt *newcurrent) { - return ACE_SERVICE_CONFIG_SINGLETON::instance ()->tss_->ptr (newcurrent); + return ACE_Service_Config::global ()->tss_->ptr (newcurrent); } diff --git a/ACE/ace/Service_Gestalt.cpp b/ACE/ace/Service_Gestalt.cpp index 5fe5b88ae09..1658bc06d53 100644 --- a/ACE/ace/Service_Gestalt.cpp +++ b/ACE/ace/Service_Gestalt.cpp @@ -1,34 +1,20 @@ // $Id$ +#include "ace/OS_NS_sys_stat.h" #include "ace/Svc_Conf.h" #include "ace/Get_Opt.h" #include "ace/ARGV.h" -#include "ace/Malloc.h" #include "ace/Service_Manager.h" #include "ace/Service_Types.h" -#include "ace/Containers.h" -#include "ace/Auto_Ptr.h" -#include "ace/Reactor.h" -#include "ace/Thread_Manager.h" -#include "ace/DLL.h" +#include "ace/Service_Repository.h" #include "ace/XML_Svc_Conf.h" -#include "ace/SString.h" #ifndef ACE_LACKS_UNIX_SIGNALS # include "ace/Signal.h" #endif /* !ACE_LACKS_UNIX_SIGNALS */ -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_time.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_sys_stat.h" - -#include "ace/TSS_T.h" #include "ace/Service_Gestalt.h" -#include "ace/Svc_Conf_Param.h" - ACE_RCSID (ace, Service_Gestalt, "$Id$") diff --git a/ACE/ace/Service_Gestalt.h b/ACE/ace/Service_Gestalt.h index a5d656a53a5..9cc4b079793 100644 --- a/ACE/ace/Service_Gestalt.h +++ b/ACE/ace/Service_Gestalt.h @@ -14,21 +14,14 @@ #define ACE_SERVICE_GESTALT_H #include /**/ "ace/pre.h" - #include /**/ "ace/config-all.h" -#include "ace/Default_Constants.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Auto_Ptr.h" #include "ace/SString.h" #include "ace/Unbounded_Queue.h" -#include "ace/Service_Repository.h" -#include "ace/Singleton.h" -#include "ace/OS_NS_signal.h" -#include "ace/Synch_Traits.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -42,7 +35,8 @@ class ACE_DLL; class ACE_Static_Svc_Descriptor; class ACE_Svc_Conf_Param; -class ACE_Service_Gestalt; +class ACE_Service_Type; +class ACE_Service_Repository; /** * @class ACE_Service_Gestalt |