diff options
Diffstat (limited to 'TAO/orbsvcs/Logging_Service/Event_Logging_Service')
-rw-r--r-- | TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.cpp | 37 | ||||
-rw-r--r-- | TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.h | 12 |
2 files changed, 25 insertions, 24 deletions
diff --git a/TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.cpp b/TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.cpp index be47a102d7c..649fc2e7085 100644 --- a/TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.cpp +++ b/TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.cpp @@ -5,6 +5,7 @@ #include "tao/IORTable/IORTable.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_unistd.h" +#include "ace/Argv_Type_Converter.h" ACE_RCSID (Event_Logging_Service, Event_Logging_Service, @@ -13,8 +14,6 @@ ACE_RCSID (Event_Logging_Service, Event_Logging_Service::Event_Logging_Service (void) : service_name_ ("EventLogFactory"), - ior_file_name_ (0), - pid_file_name_ (0), bind_to_naming_service_ (1), nthreads_ (0) { @@ -27,7 +26,7 @@ Event_Logging_Service::~Event_Logging_Service (void) } void -Event_Logging_Service::init_ORB (int& argc, char *argv [] +Event_Logging_Service::init_ORB (int& argc, char *argv[] ACE_ENV_ARG_DECL) { this->orb_ = CORBA::ORB_init (argc, @@ -55,9 +54,9 @@ Event_Logging_Service::init_ORB (int& argc, char *argv [] } int -Event_Logging_Service::parse_args (int argc, char *argv[]) +Event_Logging_Service::parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("n:o:p:t:x")); + ACE_Get_Arg_Opt<ACE_TCHAR> get_opt (argc, argv, ACE_TEXT("n:o:p:t:x")); int opt; while ((opt = get_opt ()) != EOF) @@ -65,15 +64,15 @@ Event_Logging_Service::parse_args (int argc, char *argv[]) switch (opt) { case 'n': - service_name_ = get_opt.opt_arg(); + service_name_.set (ACE_TEXT_TO_CHAR_IN (get_opt.opt_arg())); break; case 'o': - ior_file_name_ = get_opt.opt_arg(); + ior_file_name_.set (ACE_TEXT_TO_CHAR_IN (get_opt.opt_arg())); break; case 'p': - pid_file_name_ = get_opt.opt_arg(); + pid_file_name_.set (ACE_TEXT_TO_CHAR_IN (get_opt.opt_arg())); break; case 't': @@ -103,14 +102,16 @@ Event_Logging_Service::parse_args (int argc, char *argv[]) } int -Event_Logging_Service::init (int argc, char *argv[] ACE_ENV_ARG_DECL) +Event_Logging_Service::init (int argc, ACE_TCHAR *argv[] ACE_ENV_ARG_DECL) { + ACE_Argv_Type_Converter convert (argc, argv); + // initalize the ORB. - this->init_ORB (argc, argv + this->init_ORB (convert.get_argc(), convert.get_ASCII_argv() ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - if (this->parse_args (argc, argv) == -1) + if (this->parse_args (convert.get_argc(), convert.get_TCHAR_argv()) == -1) return -1; // Activate the event log factory @@ -145,13 +146,13 @@ Event_Logging_Service::init (int argc, char *argv[] ACE_ENV_ARG_DECL) ACE_CHECK_RETURN (-1); } - if (ior_file_name_ != 0) + if (ior_file_name_.length() != 0) { - FILE* iorf = ACE_OS::fopen (ior_file_name_, ACE_TEXT("w")); + FILE* iorf = ACE_OS::fopen (ior_file_name_.fast_rep(), ACE_TEXT("w")); if (iorf == 0) { ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", - ior_file_name_), + ior_file_name_.c_str()), -1); } @@ -159,9 +160,9 @@ Event_Logging_Service::init (int argc, char *argv[] ACE_ENV_ARG_DECL) ACE_OS::fclose (iorf); } - if (pid_file_name_ != 0) + if (pid_file_name_.length() != 0) { - FILE* pidf = ACE_OS::fopen (pid_file_name_, ACE_TEXT("w")); + FILE* pidf = ACE_OS::fopen (pid_file_name_.fast_rep(), ACE_TEXT("w")); if (pidf != 0) { ACE_OS::fprintf (pidf, @@ -182,7 +183,7 @@ Event_Logging_Service::init (int argc, char *argv[] ACE_ENV_ARG_DECL) CosNaming::Name name (1); name.length (1); - name[0].id = CORBA::string_dup (this->service_name_); + name[0].id = CORBA::string_dup (this->service_name_.fast_rep()); this->naming_->rebind (name, obj.in () @@ -269,7 +270,7 @@ Event_Logging_Service::shutdown (ACE_ENV_SINGLE_ARG_DECL) // Unbind from the naming service. CosNaming::Name name (1); name.length (1); - name[0].id = CORBA::string_dup (this->service_name_); + name[0].id = CORBA::string_dup (this->service_name_.fast_rep()); this->naming_->unbind (name ACE_ENV_ARG_PARAMETER); diff --git a/TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.h b/TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.h index de98deb20f9..17c335f7077 100644 --- a/TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.h +++ b/TAO/orbsvcs/Logging_Service/Event_Logging_Service/Event_Logging_Service.h @@ -40,7 +40,7 @@ class Event_Logging_Service virtual ~Event_Logging_Service (void); // Destructor. - int init (int argc, char *argv[] ACE_ENV_ARG_DECL); + int init (int argc, ACE_TCHAR *argv[] ACE_ENV_ARG_DECL); // Initializes the Telecom Log Service. // Returns 0 on success, -1 on error. @@ -53,11 +53,11 @@ class Event_Logging_Service // Returns 0 on success, -1 on error. protected: - void init_ORB (int& argc, char *argv [] + void init_ORB (int& argc, char *argv[] ACE_ENV_ARG_DECL); // initialize the ORB. - int parse_args (int argc, char *argv []); + int parse_args (int argc, ACE_TCHAR *argv[]); // Parses the command line arguments. void resolve_naming_service (ACE_ENV_SINGLE_ARG_DECL); @@ -79,13 +79,13 @@ protected: CosNaming::NamingContext_var naming_; // A naming context. - const char* service_name_; + ACE_CString service_name_; // The name we use to bind with the NameService - const char* ior_file_name_; + ACE_CString ior_file_name_; // The name of the file where we output the factory IOR. - const char* pid_file_name_; + ACE_CString pid_file_name_; // The name of the file where we output the process id. int bind_to_naming_service_; |