Service_Config.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: Service_Config.inl 81673 2008-05-09 19:09:43Z iliyan $
00004 
00005 #include "ace/OS_NS_string.h"
00006 
00007 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00008 
00009 // This is the primary entry point into the ACE_Service_Config (the
00010 // constructor just handles simple initializations).
00011 ACE_INLINE int
00012 ACE_Service_Config::open (const ACE_TCHAR program_name[],
00013                           const ACE_TCHAR *logger_key,
00014                           bool ignore_static_svcs,
00015                           bool ignore_default_svc_conf,
00016                           bool ignore_debug_flag)
00017 {
00018   ACE_TRACE ("ACE_Service_Config::open");
00019   if (singleton()->open_i (program_name,
00020                            logger_key,
00021                            ignore_static_svcs,
00022                            ignore_default_svc_conf,
00023                            ignore_debug_flag) == -1)
00024     return -1;
00025 
00026   return current()->open (program_name,
00027                           logger_key,
00028                           ignore_static_svcs,
00029                           ignore_default_svc_conf,
00030                           ignore_debug_flag);
00031 }
00032 
00033 
00034 ACE_INLINE int
00035 ACE_Service_Config::open (int argc,
00036                           ACE_TCHAR *argv[],
00037                           const ACE_TCHAR *logger_key,
00038                           bool ignore_static_svcs,
00039                           bool ignore_default_svc_conf,
00040                           bool ignore_debug_flag)
00041 {
00042   ACE_TRACE ("ACE_Service_Config::open");
00043   if (singleton()->open_i (argv[0],
00044                            logger_key,
00045                            ignore_static_svcs,
00046                            ignore_default_svc_conf,
00047                            ignore_debug_flag) == -1)
00048     return -1;
00049 
00050   return current()->open (argc,
00051                           argv,
00052                           logger_key,
00053                           ignore_static_svcs,
00054                           ignore_default_svc_conf,
00055                           ignore_debug_flag);
00056 }
00057 
00058 // Handle the command-line options intended for the
00059 // ACE_Service_Config.
00060 ACE_INLINE int
00061 ACE_Service_Config::parse_args (int argc, ACE_TCHAR *argv[])
00062 {
00063   return ACE_Service_Config::current ()->parse_args (argc, argv);
00064 }
00065 
00066 /// Return the global configuration instance. Allways returns the same
00067 /// instance
00068 ACE_INLINE ACE_Service_Gestalt *
00069 ACE_Service_Config::global (void)
00070 {
00071   return ACE_Service_Config::singleton()->instance_.get ();
00072 }
00073 
00074 /// Return the configuration instance, considered "global" in the
00075 /// current thread. This may be the same as instance(), but on some
00076 /// occasions, it may be a different one. For example,
00077 /// ACE_Service_Config_Guard provides a way of temporarily replacing
00078 /// the "current" configuration instance in the context of a thread.
00079 ACE_INLINE ACE_Service_Gestalt *
00080 ACE_Service_Config::instance (void)
00081 {
00082   return ACE_Service_Config::current ();
00083 }
00084 
00085 // This method has changed to return the gestalt instead of the
00086 // container, underlying the service repository and defined
00087 // ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor*). This way
00088 // the existing source code can keep using
00089 // ACE_Service_Config::static_svcs(), however now it is not necessary
00090 // to expose the repository storage *and* it is much easier to debug
00091 // service registration problems.
00092 
00093 ACE_INLINE ACE_Service_Gestalt*
00094 ACE_Service_Config::static_svcs (void)
00095 {
00096   return ACE_Service_Config::current ();
00097 }
00098 
00099 /// Compare two service descriptors for equality.
00100 ACE_INLINE bool
00101 ACE_Static_Svc_Descriptor::operator== (ACE_Static_Svc_Descriptor &d) const
00102 {
00103   return ACE_OS::strcmp (name_, d.name_) == 0;
00104 }
00105 
00106 /// Compare two service descriptors for inequality.
00107 ACE_INLINE bool
00108 ACE_Static_Svc_Descriptor::operator!= (ACE_Static_Svc_Descriptor &d) const
00109 {
00110   return !(*this == d);
00111 }
00112 
00113 ACE_INLINE void
00114 ACE_Service_Config::signal_handler (ACE_Sig_Adapter *signal_handler)
00115 {
00116   signal_handler_ = signal_handler;
00117 }
00118 
00119 /// Initialize and activate a statically linked service.
00120 ACE_INLINE int
00121 ACE_Service_Config::initialize (const ACE_TCHAR *svc_name,
00122                                 const ACE_TCHAR *parameters)
00123 {
00124   ACE_TRACE ("ACE_Service_Config::initialize");
00125   return ACE_Service_Config::current ()->initialize (svc_name,
00126                                                      parameters);
00127 }
00128 
00129 /// Dynamically link the shared object file and retrieve a pointer to
00130 /// the designated shared object in this file.
00131 ACE_INLINE int
00132 ACE_Service_Config::initialize (const ACE_Service_Type *sr,
00133                                 const ACE_TCHAR *parameters)
00134 {
00135   ACE_TRACE ("ACE_Service_Config::initialize");
00136   return ACE_Service_Config::current ()->initialize (sr, parameters);
00137 }
00138 
00139 /// Process a file containing a list of service configuration
00140 /// directives.
00141 ACE_INLINE int ACE_Service_Config::process_file (const ACE_TCHAR file[])
00142 {
00143   return ACE_Service_Config::current ()->process_file (file);
00144 }
00145 
00146 ///
00147 ACE_INLINE int
00148 ACE_Service_Config::process_directive (const ACE_TCHAR directive[])
00149 {
00150   return ACE_Service_Config::current ()->process_directive (directive);
00151 }
00152 
00153 /// Process service configuration requests as indicated in the queue of
00154 /// svc.conf files.
00155 ACE_INLINE int
00156 ACE_Service_Config::process_directives (void)
00157 {
00158   return ACE_Service_Config::current ()->process_directives (false);
00159 }
00160 
00161 ACE_INLINE int
00162 ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd,
00163                                        bool force_replace)
00164 {
00165   return ACE_Service_Config::current ()->process_directive (ssd, force_replace);
00166 }
00167 
00168 
00169 #if defined (ACE_HAS_WINCE) && defined (ACE_USES_WCHAR)
00170 // We must provide these function to bridge Svc_Conf parser with ACE.
00171 
00172 ACE_INLINE int
00173 ACE_Service_Config::initialize (const ACE_Service_Type *sp, ACE_ANTI_TCHAR parameters[])
00174 {
00175   return ACE_Service_Config::initialize (sp, ACE_TEXT_ANTI_TO_TCHAR (parameters));
00176 }
00177 
00178 ACE_INLINE int
00179 ACE_Service_Config::initialize (const ACE_ANTI_TCHAR svc_name[], ACE_ANTI_TCHAR parameters[])
00180 {
00181   return ACE_Service_Config::initialize (ACE_TEXT_ANTI_TO_TCHAR (svc_name),
00182                                          ACE_TEXT_ANTI_TO_TCHAR (parameters));
00183 }
00184 
00185 ACE_INLINE int
00186 ACE_Service_Config::resume (const ACE_ANTI_TCHAR svc_name[])
00187 {
00188   return ACE_Service_Config::resume (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
00189 }
00190 
00191 ACE_INLINE int
00192 ACE_Service_Config::suspend (const ACE_ANTI_TCHAR svc_name[])
00193 {
00194   return ACE_Service_Config::suspend (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
00195 }
00196 
00197 ACE_INLINE int
00198 ACE_Service_Config::remove (const ACE_ANTI_TCHAR svc_name[])
00199 {
00200   return ACE_Service_Config::remove (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
00201 }
00202 #endif /* ACE_HAS_WINCE && !ACE_USES_WCHAR */
00203 
00204 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:18:42 2010 for ACE by  doxygen 1.4.7