2 #include "ace/OS_NS_string.h"
4 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
6 // This is the primary entry point into the ACE_Service_Config (the
7 // constructor just handles simple initializations).
9 ACE_Service_Config::open (const ACE_TCHAR program_name[],
10 const ACE_TCHAR *logger_key,
11 bool ignore_static_svcs,
12 bool ignore_default_svc_conf,
13 bool ignore_debug_flag)
15 ACE_TRACE ("ACE_Service_Config::open");
16 if (singleton()->open_i (program_name,
19 ignore_default_svc_conf,
20 ignore_debug_flag) == -1)
23 return current()->open (program_name,
26 ignore_default_svc_conf,
32 ACE_Service_Config::open (int argc,
34 const ACE_TCHAR *logger_key,
35 bool ignore_static_svcs,
36 bool ignore_default_svc_conf,
37 bool ignore_debug_flag)
39 ACE_TRACE ("ACE_Service_Config::open");
41 if (singleton()->parse_args_i(argc, argv) == -1)
44 if (singleton()->open_i (argv[0],
47 ignore_default_svc_conf,
48 ignore_debug_flag) == -1)
51 return current()->open (argc,
55 ignore_default_svc_conf,
59 // Handle the command-line options intended for the
60 // ACE_Service_Config.
62 ACE_Service_Config::parse_args (int argc, ACE_TCHAR *argv[])
64 return ACE_Service_Config::current ()->parse_args (argc, argv);
67 /// Return the global configuration instance. Allways returns the same
69 ACE_INLINE ACE_Service_Gestalt *
70 ACE_Service_Config::global ()
72 return ACE_Service_Config::singleton()->instance_.get ();
75 /// Return the configuration instance, considered "global" in the
76 /// current thread. This may be the same as instance(), but on some
77 /// occasions, it may be a different one. For example,
78 /// ACE_Service_Config_Guard provides a way of temporarily replacing
79 /// the "current" configuration instance in the context of a thread.
80 ACE_INLINE ACE_Service_Gestalt *
81 ACE_Service_Config::instance ()
83 return ACE_Service_Config::current ();
86 // This method has changed to return the gestalt instead of the
87 // container, underlying the service repository and defined
88 // ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor*). This way
89 // the existing source code can keep using
90 // ACE_Service_Config::static_svcs(), however now it is not necessary
91 // to expose the repository storage *and* it is much easier to debug
92 // service registration problems.
94 ACE_INLINE ACE_Service_Gestalt*
95 ACE_Service_Config::static_svcs ()
97 return ACE_Service_Config::current ();
100 /// Compare two service descriptors for equality.
102 ACE_Static_Svc_Descriptor::operator== (ACE_Static_Svc_Descriptor &d) const
104 return ACE_OS::strcmp (name_, d.name_) == 0;
107 /// Compare two service descriptors for inequality.
109 ACE_Static_Svc_Descriptor::operator!= (ACE_Static_Svc_Descriptor &d) const
111 return !(*this == d);
115 ACE_Service_Config::signal_handler (ACE_Sig_Adapter *signal_handler)
117 signal_handler_ = signal_handler;
120 /// Initialize and activate a statically linked service.
122 ACE_Service_Config::initialize (const ACE_TCHAR *svc_name,
123 const ACE_TCHAR *parameters)
125 ACE_TRACE ("ACE_Service_Config::initialize");
126 return ACE_Service_Config::current ()->initialize (svc_name,
130 /// Dynamically link the shared object file and retrieve a pointer to
131 /// the designated shared object in this file.
133 ACE_Service_Config::initialize (const ACE_Service_Type *sr,
134 const ACE_TCHAR *parameters)
136 ACE_TRACE ("ACE_Service_Config::initialize");
137 return ACE_Service_Config::current ()->initialize (sr, parameters);
140 /// Process a file containing a list of service configuration
142 ACE_INLINE int ACE_Service_Config::process_file (const ACE_TCHAR file[])
144 return ACE_Service_Config::current ()->process_file (file);
149 ACE_Service_Config::process_directive (const ACE_TCHAR directive[])
151 return ACE_Service_Config::current ()->process_directive (directive);
154 /// Process service configuration requests as indicated in the queue of
157 ACE_Service_Config::process_directives ()
159 return ACE_Service_Config::current ()->process_directives (false);
163 ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd,
166 return ACE_Service_Config::current ()->process_directive (ssd, force_replace);
169 ACE_END_VERSIONED_NAMESPACE_DECL