diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-12-08 21:59:30 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-12-08 21:59:30 +0000 |
commit | 63165b00e2d667e39e15cf084128d94a563d484e (patch) | |
tree | 6939cf1ed0a80ce8a3224d33f3d23c0e1b9a517f /TAO/examples/Logging | |
parent | 6579bccb3a3f22f882ef908ad5f7e1a65b00b133 (diff) | |
download | ATCD-63165b00e2d667e39e15cf084128d94a563d484e.tar.gz |
Merged corba-env-clean branch.
Diffstat (limited to 'TAO/examples/Logging')
-rw-r--r-- | TAO/examples/Logging/Logger_i.cpp | 32 | ||||
-rw-r--r-- | TAO/examples/Logging/Logger_i.h | 30 | ||||
-rw-r--r-- | TAO/examples/Logging/Logging_Service.cpp | 8 | ||||
-rw-r--r-- | TAO/examples/Logging/Logging_Service_i.cpp | 60 | ||||
-rw-r--r-- | TAO/examples/Logging/Logging_Service_i.h | 12 | ||||
-rw-r--r-- | TAO/examples/Logging/Logging_Test_i.cpp | 56 | ||||
-rw-r--r-- | TAO/examples/Logging/Logging_Test_i.h | 4 |
7 files changed, 98 insertions, 104 deletions
diff --git a/TAO/examples/Logging/Logger_i.cpp b/TAO/examples/Logging/Logger_i.cpp index 6a76e648b70..6a1cf278034 100644 --- a/TAO/examples/Logging/Logger_i.cpp +++ b/TAO/examples/Logging/Logger_i.cpp @@ -18,8 +18,8 @@ Logger_Factory_i::~Logger_Factory_i (void) } Logger_ptr -Logger_Factory_i::make_logger (const char *name, - CORBA::Environment &ACE_TRY_ENV) +Logger_Factory_i::make_logger (const char *name + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { Logger_i *result; @@ -62,7 +62,7 @@ Logger_Factory_i::make_logger (const char *name, // registration attempt. // @@ Matt, this code doesn't seem right. Can you please check with // Irfan and Carlos about whether this is the right thing to do? - return result->_this (ACE_TRY_ENV); + return result->_this (TAO_ENV_SINGLE_ARG_PARAMETER); } Logger_i::Logger_i (const char *name) @@ -111,34 +111,34 @@ Logger_i::verbosity_conversion (Logger::Verbosity_Level verbosity_level) } void -Logger_i::log (const Logger::Log_Record &log_rec, - CORBA::Environment &ACE_TRY_ENV) +Logger_i::log (const Logger::Log_Record &log_rec + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->logv (log_rec, verbosity_level_, ACE_TRY_ENV); + this->logv (log_rec, verbosity_level_ TAO_ENV_ARG_PARAMETER); } void -Logger_i::log2 (const Logger::Log_Record &log_rec, - CORBA::Environment &ACE_TRY_ENV) +Logger_i::log2 (const Logger::Log_Record &log_rec + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->logv (log_rec, verbosity_level_, ACE_TRY_ENV); + this->logv (log_rec, verbosity_level_ TAO_ENV_ARG_PARAMETER); } void Logger_i::logv2 (const Logger::Log_Record &log_rec, - Logger::Verbosity_Level verbosity, - CORBA::Environment &ACE_TRY_ENV) + Logger::Verbosity_Level verbosity + TAO_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->logv (log_rec, verbosity, ACE_TRY_ENV); + this->logv (log_rec, verbosity TAO_ENV_ARG_PARAMETER); } void Logger_i::logv (const Logger::Log_Record &log_rec, - Logger::Verbosity_Level verbosity, - CORBA::Environment &) + Logger::Verbosity_Level verbosity + TAO_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { // Create an <ACE_Log_Record> to leverage existing logging @@ -187,8 +187,8 @@ Logger_i::logv (const Logger::Log_Record &log_rec, } void -Logger_i::verbosity (Logger::Verbosity_Level level, - CORBA::Environment &) +Logger_i::verbosity (Logger::Verbosity_Level level + TAO_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { this->verbosity_level_ = level; diff --git a/TAO/examples/Logging/Logger_i.h b/TAO/examples/Logging/Logger_i.h index 0c11bd6e257..c775c094e55 100644 --- a/TAO/examples/Logging/Logger_i.h +++ b/TAO/examples/Logging/Logger_i.h @@ -34,37 +34,32 @@ public: virtual ~Logger_i (void); // destructor - virtual void log (const Logger::Log_Record &log_rec, - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()) + virtual void log (const Logger::Log_Record &log_rec + TAO_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // Writes the <log_rec> to the standard output. virtual void logv (const Logger::Log_Record &log_rec, - Logger::Verbosity_Level verbosity, - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()) + Logger::Verbosity_Level verbosity + TAO_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // Writes the <log_rec> to the standard output with the given // verbosity level - virtual void log2 (const Logger::Log_Record &log_rec, - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()) + virtual void log2 (const Logger::Log_Record &log_rec + TAO_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // Writes the <log_rec> to the standard output. virtual void logv2 (const Logger::Log_Record &log_rec, - Logger::Verbosity_Level verbosity, - CORBA::Environment & ACE_TRY_ENV= - TAO_default_environment ()) + Logger::Verbosity_Level verbosity + TAO_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // Writes the <log_rec> to the standard output with the given // verbosity level - void verbosity (Logger::Verbosity_Level level, - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()) + void verbosity (Logger::Verbosity_Level level + TAO_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // Sets the verbosity level. Valid values are {VERBOSE, VERBOSE_LITE // and SILENT}. Defaults to VERBOSE @@ -98,9 +93,8 @@ public: ~Logger_Factory_i (void); // Destructor. - virtual Logger_ptr make_logger (const char *name, - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()) + virtual Logger_ptr make_logger (const char *name + TAO_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); // This function returns a logger with name <name>. If <name> is // unique, a new logger is created; else, a previously created diff --git a/TAO/examples/Logging/Logging_Service.cpp b/TAO/examples/Logging/Logging_Service.cpp index 67b106d5384..d8943451bf2 100644 --- a/TAO/examples/Logging/Logging_Service.cpp +++ b/TAO/examples/Logging/Logging_Service.cpp @@ -14,16 +14,16 @@ main (int argc, char *argv[]) Logger_Server log_server; - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + TAO_ENV_DECLARE_NEW_ENV; + ACE_TRY { - int ret = log_server.init (argc, argv, ACE_TRY_ENV); + int ret = log_server.init (argc, argv TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (ret == -1) return 1; else { - log_server.run (ACE_TRY_ENV); + log_server.run (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } } diff --git a/TAO/examples/Logging/Logging_Service_i.cpp b/TAO/examples/Logging/Logging_Service_i.cpp index 12fb1297a9a..16e55cac3b3 100644 --- a/TAO/examples/Logging/Logging_Service_i.cpp +++ b/TAO/examples/Logging/Logging_Service_i.cpp @@ -24,14 +24,14 @@ Logger_Server::parse_args (void) TAO_debug_level++; break; case 'n': // Set factory name to cmnd line arg - service_name_ = get_opts.optarg; - break; + service_name_ = get_opts.optarg; + break; case '?': default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s" " [-d]" - " [-n service-name]" + " [-n service-name]" "\n", argv_ [0]), -1); @@ -43,8 +43,8 @@ Logger_Server::parse_args (void) int Logger_Server::init (int argc, - char *argv[], - CORBA::Environment &ACE_TRY_ENV) + char *argv[] + TAO_ENV_ARG_DECL) { this->argc_ = argc; this->argv_ = argv; @@ -52,44 +52,44 @@ Logger_Server::init (int argc, // Call the init of <TAO_ORB_Manager> to initialize the ORB and // create a child POA under the root POA. if (this->orb_manager_.init_child_poa (argc, - argv, - "child_poa", - ACE_TRY_ENV) == -1) + argv, + "child_poa" + TAO_ENV_ARG_PARAMETER) == -1) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "init_child_poa"), - -1); + "%p\n", + "init_child_poa"), + -1); ACE_CHECK_RETURN (-1); - this->orb_manager_.activate_poa_manager (ACE_TRY_ENV); + this->orb_manager_.activate_poa_manager (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); // Parse the command line arguments. if (this->parse_args () != 0) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "parse_args"), - -1); + "%p\n", + "parse_args"), + -1); // Activate the logger_factory. CORBA::String_var str = this->orb_manager_.activate_under_child_poa ("logger_factory", - &this->factory_impl_, - ACE_TRY_ENV); + &this->factory_impl_ + TAO_ENV_ARG_PARAMETER); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "The IOR is: <%s>\n", - str.in ())); + "The IOR is: <%s>\n", + str.in ())); // Initialize the naming service - int ret = this->init_naming_service (ACE_TRY_ENV); + int ret = this->init_naming_service (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); if (ret != 0) ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "init_naming_service"), - -1); + "%p\n", + "init_naming_service"), + -1); else return 0; } @@ -99,7 +99,7 @@ Logger_Server::init (int argc, // and logger_factory object. int -Logger_Server::init_naming_service (CORBA::Environment& ACE_TRY_ENV) +Logger_Server::init_naming_service (TAO_ENV_SINGLE_ARG_DECL_NOT_USED TAO_ENV_SINGLE_ARG_PARAMETER) { // Get pointers to the ORB and child POA CORBA::ORB_var orb = this->orb_manager_.orb (); @@ -107,11 +107,11 @@ Logger_Server::init_naming_service (CORBA::Environment& ACE_TRY_ENV) // Initialize the naming service if (this->my_name_server_.init (orb.in (), - child_poa.in ()) == -1) + child_poa.in ()) == -1) return -1; // Create an instance of the Logger_Factory - Logger_Factory_var factory = this->factory_impl_._this (ACE_TRY_ENV); + Logger_Factory_var factory = this->factory_impl_._this (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); //Register the logger_factory @@ -119,17 +119,17 @@ Logger_Server::init_naming_service (CORBA::Environment& ACE_TRY_ENV) factory_name.length (1); factory_name[0].id = CORBA::string_dup ("Logger_Factory"); this->my_name_server_->bind (factory_name, - factory.in (), - ACE_TRY_ENV); + factory.in () + TAO_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); return 0; } int -Logger_Server::run (CORBA::Environment &ACE_TRY_ENV) +Logger_Server::run (TAO_ENV_SINGLE_ARG_DECL) { - int ret = this->orb_manager_.run (ACE_TRY_ENV); + int ret = this->orb_manager_.run (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); if (ret == -1) ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/examples/Logging/Logging_Service_i.h b/TAO/examples/Logging/Logging_Service_i.h index a5d1af2d28d..0f94019e7b2 100644 --- a/TAO/examples/Logging/Logging_Service_i.h +++ b/TAO/examples/Logging/Logging_Service_i.h @@ -57,15 +57,15 @@ public: // Destructor. int init (int argc, - char **argv, - CORBA::Environment &ACE_TRY_ENV); + char **argv + TAO_ENV_ARG_DECL); // Initialize the Logger_Server state - parsing arguments and ... - int run (CORBA::Environment &ACE_TRY_ENV); + int run (TAO_ENV_SINGLE_ARG_DECL); // Run the ORB. - Logger_ptr make_logger (const char *name, - CORBA::Environment &ACE_TRY_ENV); + Logger_ptr make_logger (const char *name + TAO_ENV_ARG_DECL); // This function creates and returns a logger with the given <name>. // Currently, <name> is unused. @@ -73,7 +73,7 @@ private: int parse_args (void); // Parses the commandline arguments. - int init_naming_service (CORBA::Environment &ACE_TRY_ENV); + int init_naming_service (TAO_ENV_SINGLE_ARG_DECL); // Initialises the name server and registers logger_factory with the // name server. diff --git a/TAO/examples/Logging/Logging_Test_i.cpp b/TAO/examples/Logging/Logging_Test_i.cpp index 168a705f8f6..2941345f45d 100644 --- a/TAO/examples/Logging/Logging_Test_i.cpp +++ b/TAO/examples/Logging/Logging_Test_i.cpp @@ -28,7 +28,7 @@ Logger_Client::init (int argc, char *argv[]) this->argc_ = argc; this->argv_ = argv; - ACE_DECLARE_NEW_CORBA_ENV; + TAO_ENV_DECLARE_NEW_ENV; ACE_TRY { if (TAO_debug_level > 0) @@ -37,8 +37,8 @@ Logger_Client::init (int argc, char *argv[]) // Initialize the ORB orb_ = CORBA::ORB_init (argc, argv, - "internet", - ACE_TRY_ENV); + "internet" + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (TAO_debug_level > 0) @@ -50,7 +50,7 @@ Logger_Client::init (int argc, char *argv[]) return -1; // Initialize the naming service - int ret = this->init_naming_service (ACE_TRY_ENV); + int ret = this->init_naming_service (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; if (ret != 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -58,7 +58,7 @@ Logger_Client::init (int argc, char *argv[]) "services.\n"), -1); // Create the logger instances - ret = this->init_loggers (ACE_TRY_ENV); + ret = this->init_loggers (TAO_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; if (ret != 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -79,7 +79,7 @@ Logger_Client::init (int argc, char *argv[]) } int -Logger_Client::init_naming_service (CORBA::Environment &ACE_TRY_ENV) +Logger_Client::init_naming_service (TAO_ENV_SINGLE_ARG_DECL) { // Initialize the naming services if (my_name_client_.init (orb_.in ()) != 0) @@ -94,8 +94,8 @@ Logger_Client::init_naming_service (CORBA::Environment &ACE_TRY_ENV) factory_name[0].id = CORBA::string_dup ("Logger_Factory"); CORBA::Object_var factory_ref = - my_name_client_->resolve (factory_name, - ACE_TRY_ENV); + my_name_client_->resolve (factory_name + TAO_ENV_ARG_PARAMETER); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "\nFactory_ref resolved\n")); @@ -110,8 +110,8 @@ Logger_Client::init_naming_service (CORBA::Environment &ACE_TRY_ENV) // Narrow the factory and check the success factory_ = - Logger_Factory::_narrow (factory_ref.in (), - ACE_TRY_ENV); + Logger_Factory::_narrow (factory_ref.in () + TAO_ENV_ARG_PARAMETER); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, @@ -126,8 +126,8 @@ Logger_Client::init_naming_service (CORBA::Environment &ACE_TRY_ENV) // If debugging, get the factory's IOR CORBA::String_var str = - orb_->object_to_string (factory_.in (), - ACE_TRY_ENV); + orb_->object_to_string (factory_.in () + TAO_ENV_ARG_PARAMETER); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "The factory IOR is <%s>\n", @@ -136,18 +136,18 @@ Logger_Client::init_naming_service (CORBA::Environment &ACE_TRY_ENV) } int -Logger_Client::init_loggers (CORBA::Environment &ACE_TRY_ENV) +Logger_Client::init_loggers (TAO_ENV_SINGLE_ARG_DECL) { // Retrieve the Logger obj ref corresponding to key1 and // key2. ACE_TRY { - this->logger_1_ = factory_->make_logger ("key1", - ACE_TRY_ENV); + this->logger_1_ = factory_->make_logger ("key1" + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - this->logger_2_ = factory_->make_logger ("key2", - ACE_TRY_ENV); + this->logger_2_ = factory_->make_logger ("key2" + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (CORBA::is_nil (this->logger_1_.in ())) @@ -168,8 +168,8 @@ Logger_Client::init_loggers (CORBA::Environment &ACE_TRY_ENV) { ACE_DEBUG ((LM_DEBUG, "\nTrying to resolve already created logger...")); - Logger_var logger_3 = factory_->make_logger ("key1", - ACE_TRY_ENV); + Logger_var logger_3 = factory_->make_logger ("key1" + TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (CORBA::is_nil (logger_3.in ())) @@ -195,7 +195,7 @@ Logger_Client::init_loggers (CORBA::Environment &ACE_TRY_ENV) int Logger_Client::run (void) { - ACE_DECLARE_NEW_CORBA_ENV; + TAO_ENV_DECLARE_NEW_ENV; ACE_TRY { // Create 3 Log_Records for the test @@ -245,36 +245,36 @@ Logger_Client::run (void) } // Change the verbosity. - this->logger_1_->verbosity (Logger::VERBOSE_LITE, ACE_TRY_ENV); + this->logger_1_->verbosity (Logger::VERBOSE_LITE TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Log the first Log_Record (VERBOSE_LITE) - this->logger_1_->log (rec1, ACE_TRY_ENV); + this->logger_1_->log (rec1 TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Change the verbosity again. - this->logger_2_->verbosity (Logger::VERBOSE, ACE_TRY_ENV); + this->logger_2_->verbosity (Logger::VERBOSE TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Log the second Log_Record (VERBOSE) - this->logger_2_->log (rec2, ACE_TRY_ENV); + this->logger_2_->log (rec2 TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Change the verbosity again - this->logger_2_->verbosity (Logger::SILENT, ACE_TRY_ENV); + this->logger_2_->verbosity (Logger::SILENT TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Log the third log record using logv() (this shows if the // verbosity level overrides the logger's verbosity level) - this->logger_2_->logv (rec3, Logger::VERBOSE, ACE_TRY_ENV); + this->logger_2_->logv (rec3, Logger::VERBOSE TAO_ENV_ARG_PARAMETER); // Change the verbosity again (so that regular log msgs can be // seen again) - this->logger_2_->verbosity (Logger::VERBOSE, ACE_TRY_ENV); + this->logger_2_->verbosity (Logger::VERBOSE TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Log the fourth record using log2() - this->logger_2_->log2 (rec4, ACE_TRY_ENV); + this->logger_2_->log2 (rec4 TAO_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } diff --git a/TAO/examples/Logging/Logging_Test_i.h b/TAO/examples/Logging/Logging_Test_i.h index aac66ba4c31..d377718d42f 100644 --- a/TAO/examples/Logging/Logging_Test_i.h +++ b/TAO/examples/Logging/Logging_Test_i.h @@ -69,10 +69,10 @@ private: const char *msg); // Prepares the <Log_Record> for logging. - int init_naming_service (CORBA::Environment &ACE_TRY_ENV); + int init_naming_service (TAO_ENV_SINGLE_ARG_DECL); // Initialises the name server and resolves the logger_factory - int init_loggers (CORBA::Environment &ACE_TRY_ENV); + int init_loggers (TAO_ENV_SINGLE_ARG_DECL); // Instantiates the 2 logger member variables void show_record (Logger::Log_Record &newrec); |