From 4757463db562192ac401095fe066d7195abd13a5 Mon Sep 17 00:00:00 2001 From: parsons Date: Wed, 30 Jun 2004 14:29:03 +0000 Subject: ChangeLogTag: Wed Jun 30 09:26:42 2004 Jeff Parsons --- TAO/CIAO/ChangeLog | 15 ++++ TAO/CIAO/examples/Hello/Sender/starter.cpp | 84 ++++++++++++--------- .../OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp | 69 ++++++++++------- .../OEP/BasicSP/BMDevice/BMDevice_exec.cpp | 58 ++++++++++----- .../examples/OEP/BasicSP/BMDevice/BMDevice_exec.h | 2 +- .../OEP/BasicSP/BMDisplay/BMDisplay_exec.cpp | 48 ++++++++---- TAO/CIAO/examples/OEP/BasicSP/EC/controller.cpp | 87 +++++++++++++--------- .../OEP/Display/NavDisplay/NavDisplay_exec.cpp | 54 ++++++++++---- .../examples/OEP/Display/RateGen/RateGen_exec.cpp | 82 ++++++++++++++------ .../examples/OEP/Display/RateGen/controller.cpp | 79 +++++++++++--------- 10 files changed, 372 insertions(+), 206 deletions(-) (limited to 'TAO') diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index f1102023e70..38ed7fbdf38 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,18 @@ +Wed Jun 30 09:26:42 2004 Jeff Parsons + + * examples/Hello/Sender/starter.cpp: + * examples/OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp: + * examples/OEP/BasicSP/BMDevice/BMDevice_exec.cpp: + * examples/OEP/BasicSP/BMDevice/BMDevice_exec.h: + * examples/OEP/BasicSP/BMDisplay/BMDisplay_exec.cpp: + * examples/OEP/BasicSP/EC/controller.cpp: + * examples/OEP/Display/NavDisplay/NavDisplay_exec.cpp: + * examples/OEP/Display/RateGen/RateGen_exec.cpp: + * examples/OEP/Display/RateGen/controller.cpp: + + Changes to eliminate build warnings (mostly assignments of + const char* to char*) and cosmetic changes. + Wed Jun 30 08:37:15 2004 Jeff Parsons * examples/Hello/Receiver/Receiver_exec.cpp: diff --git a/TAO/CIAO/examples/Hello/Sender/starter.cpp b/TAO/CIAO/examples/Hello/Sender/starter.cpp index 9f052fa5816..0482d731e6d 100644 --- a/TAO/CIAO/examples/Hello/Sender/starter.cpp +++ b/TAO/CIAO/examples/Hello/Sender/starter.cpp @@ -9,37 +9,45 @@ #include "ace/Get_Opt.h" //IOR file of the Sender -char * ior = 0; -char * message = "starters message"; +const char * ior = 0; +const char * message = "starters message"; + int parse_args (int argc, char *argv[]) { ACE_Get_Opt get_opts (argc, argv, "k:m"); int c = 0; + while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = get_opts.opt_arg (); - break; - - case 'm': - message = get_opts.opt_arg (); - break; - - case '?': // display help for use of the server. - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s\n" - "-k (default is file://sender.ior)\n", - "-m (default is starters message)\n" - "\n", - argv [0]), - -1); - } + { + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + + case 'm': + message = get_opts.opt_arg (); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-k (default is file://sender.ior)\n", + "-m (default is starters message)\n" + "\n", + argv [0]), + -1); + break; + } + } if (ior == 0) - ior = "file://sender.ior"; + { + ior = "file://sender.ior"; + } + return 0; } @@ -50,27 +58,33 @@ main (int argc, char *argv[]) { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init (argc, - argv, - "" - ACE_ENV_ARG_PARAMETER); + argv, + "" + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (parse_args (argc, argv) != 0) - return -1; + { + return -1; + } - CORBA::Object_var obj - = orb->string_to_object (ior - ACE_ENV_ARG_PARAMETER); + CORBA::Object_var obj = + orb->string_to_object (ior + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - Hello::Sender_var sender - = Hello::Sender::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); + Hello::Sender_var sender = + Hello::Sender::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (CORBA::is_nil (sender.in ())) - ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire Sender's objref\n"), -1); + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire Sender's objref\n"), + -1); + } sender->local_message (message); @@ -83,7 +97,7 @@ main (int argc, char *argv[]) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Unknown exception \n"); + "Unknown exception \n"); return -1; } ACE_ENDTRY; diff --git a/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp b/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp index c52afab9379..28fd5987e41 100644 --- a/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp +++ b/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp @@ -45,29 +45,30 @@ MyImpl::BMClosedED_exec_i::push_in_avail (BasicSP::DataAvailable * ACE_CHECK; if (CORBA::is_nil (dat.in ())) - { - ACE_DEBUG ((LM_DEBUG, - "BMClosedED - got nil from get_connection \n")); + { + ACE_DEBUG ((LM_DEBUG, + "BMClosedED - got nil from get_connection \n")); - ACE_THROW (CORBA::BAD_INV_ORDER ()); - } + ACE_THROW (CORBA::BAD_INV_ORDER ()); + } CORBA::String_var str = dat->get_data (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; if (CIAO::debug_level () > 0) - - ACE_DEBUG ((LM_DEBUG, - "BMClosedED - Display data is [%s] \n", - str.in ())); + { + ACE_DEBUG ((LM_DEBUG, + "BMClosedED - Display data is [%s] \n", + str.in ())); + } if (ACE_OS::strcmp (str, "BM DEVICE DATA") == 0) { this->str_ = CORBA::string_dup ("BM CLOSED ED DATA"); } - // Notify others + // Notify others. BasicSP::DataAvailable_var event = new OBV_BasicSP::DataAvailable; @@ -87,13 +88,18 @@ MyImpl::BMClosedED_exec_i::get_data (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) // Operations from Components::SessionComponent void -MyImpl::BMClosedED_exec_i::set_session_context (Components::SessionContext_ptr ctx - ACE_ENV_ARG_DECL) +MyImpl::BMClosedED_exec_i::set_session_context ( + Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMClosedED_exec_i::set_session_context\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMClosedED_exec_i::set_session_context\n")); + } this->context_ = BasicSP::CCM_BMClosedED_Context::_narrow (ctx @@ -101,7 +107,9 @@ MyImpl::BMClosedED_exec_i::set_session_context (Components::SessionContext_ptr c ACE_CHECK; if (CORBA::is_nil (this->context_.in ())) - ACE_THROW (CORBA::INTERNAL ()); + { + ACE_THROW (CORBA::INTERNAL ()); + } // Urm, we actually discard exceptions thown from this operation. } @@ -119,18 +127,22 @@ MyImpl::BMClosedED_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMClosedED_exec_i::ccm_activate\n")); - - char *argv[1] = { "BMClosedED_exec"}; + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMClosedED_exec_i::ccm_activate\n")); + } - int argc = sizeof(argv)/sizeof(argv[0]); + char *argv[1]; + argv[0] = "BMClosedED_exec"; + int argc = sizeof (argv)/sizeof (argv[0]); CORBA::ORB_var orb = CORBA::ORB_init (argc, - argv, - "" - ACE_ENV_ARG_PARAMETER); + argv, + "" + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - CIAO_REGISTER_VALUE_FACTORY (orb.in(), BasicSP::DataAvailable_init, + CIAO_REGISTER_VALUE_FACTORY (orb.in(), + BasicSP::DataAvailable_init, BasicSP::DataAvailable); } @@ -148,7 +160,8 @@ MyImpl::BMClosedED_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { // if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMClosedED_exec_i::ccm_passivate\n")); + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMClosedED_exec_i::ccm_passivate\n")); } void @@ -157,7 +170,8 @@ MyImpl::BMClosedED_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { // if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMClosedED_exec_i::ccm_remove\n")); + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMClosedED_exec_i::ccm_remove\n")); } /// Default ctor. @@ -179,10 +193,11 @@ MyImpl::BMClosedEDHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - Components::EnterpriseComponent_ptr tmp; + Components::EnterpriseComponent_ptr tmp = + Components::EnterpriseComponent::_nil (); ACE_NEW_THROW_EX (tmp, - MyImpl::BMClosedED_exec_i, - CORBA::NO_MEMORY ()); + MyImpl::BMClosedED_exec_i, + CORBA::NO_MEMORY ()); return tmp; } diff --git a/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice_exec.cpp b/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice_exec.cpp index c0004bd073d..d33ec16f4c9 100644 --- a/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice_exec.cpp +++ b/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice_exec.cpp @@ -33,8 +33,10 @@ MyImpl::BMDevice_exec_i::push_timeout (BasicSP::TimeOut * BasicSP::DataAvailable_var event = new OBV_BasicSP::DataAvailable; if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, - "BMDevice, received a timeout from EC \n")); + { + ACE_DEBUG ((LM_DEBUG, + "BMDevice, received a timeout from EC \n")); + } this->context_->push_data_available (event ACE_ENV_ARG_PARAMETER); @@ -56,21 +58,28 @@ MyImpl::BMDevice_exec_i::get_data (ACE_ENV_SINGLE_ARG_DECL) // Operations from Components::SessionComponent void -MyImpl::BMDevice_exec_i::set_session_context (Components::SessionContext_ptr ctx - ACE_ENV_ARG_DECL) +MyImpl::BMDevice_exec_i::set_session_context ( + Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDevice_exec_i::set_session_context\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDevice_exec_i::set_session_context\n")); + } this->context_ = BasicSP::CCM_BMDevice_Context::_narrow (ctx - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; if (CORBA::is_nil (this->context_.in ())) - ACE_THROW (CORBA::INTERNAL ()); + { + ACE_THROW (CORBA::INTERNAL ()); + } // Urm, we actually discard exceptions thown from this operation. } @@ -87,17 +96,22 @@ MyImpl::BMDevice_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDevice_exec_i::ccm_activate\n")); - char *argv[1] = { "BMDevice_exec"}; - - int argc = sizeof(argv)/sizeof(argv[0]); - CORBA::ORB_var orb = CORBA::ORB_init(argc, - argv, - "" - ACE_ENV_ARG_PARAMETER); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDevice_exec_i::ccm_activate\n")); + } + + char *argv[1]; + argv[0] = "BMDevice_exec"; + int argc = sizeof (argv)/sizeof (argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv, + "" + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - CIAO_REGISTER_VALUE_FACTORY (orb.in(), BasicSP::TimeOut_init, + CIAO_REGISTER_VALUE_FACTORY (orb.in(), + BasicSP::TimeOut_init, BasicSP::TimeOut); } @@ -114,7 +128,10 @@ MyImpl::BMDevice_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDevice_exec_i::ccm_passivate\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDevice_exec_i::ccm_passivate\n")); + } } void @@ -123,7 +140,10 @@ MyImpl::BMDevice_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDevice_exec_i::ccm_remove\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDevice_exec_i::ccm_remove\n")); + } } /// Default ctor. @@ -148,7 +168,7 @@ MyImpl::BMDeviceHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) Components::EnterpriseComponent_ptr tmp= 0; ACE_NEW_THROW_EX (tmp, MyImpl::BMDevice_exec_i, - CORBA::NO_MEMORY ()); + CORBA::NO_MEMORY ()); return tmp; } diff --git a/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice_exec.h b/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice_exec.h index be19fdcce6d..a33f82e5006 100644 --- a/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice_exec.h +++ b/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice_exec.h @@ -90,7 +90,7 @@ namespace MyImpl ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)); protected: - char *str_; + const char *str_; /// Copmponent specific context BasicSP::CCM_BMDevice_Context_var context_; diff --git a/TAO/CIAO/examples/OEP/BasicSP/BMDisplay/BMDisplay_exec.cpp b/TAO/CIAO/examples/OEP/BasicSP/BMDisplay/BMDisplay_exec.cpp index bc736e7add6..e3f22826a66 100644 --- a/TAO/CIAO/examples/OEP/BasicSP/BMDisplay/BMDisplay_exec.cpp +++ b/TAO/CIAO/examples/OEP/BasicSP/BMDisplay/BMDisplay_exec.cpp @@ -18,7 +18,8 @@ MyImpl::BMDisplay_exec_impl::~BMDisplay_exec_impl () void MyImpl::BMDisplay_exec_impl::push_data_ready ( BasicSP::DataAvailable *ev - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC ((CORBA::SystemException)) { ACE_UNUSED_ARG (ev); @@ -52,13 +53,18 @@ MyImpl::BMDisplay_exec_impl::push_data_ready ( // Operations from Components::SessionComponent void -MyImpl::BMDisplay_exec_impl::set_session_context (Components::SessionContext_ptr ctx - ACE_ENV_ARG_DECL) +MyImpl::BMDisplay_exec_impl::set_session_context ( + Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDisplay_exec_impl::set_session_context\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDisplay_exec_impl::set_session_context\n")); + } this->context_ = BasicSP::CCM_BMDisplay_Context::_narrow (ctx @@ -71,7 +77,9 @@ MyImpl::BMDisplay_exec_impl::set_session_context (Components::SessionContext_ptr } void -MyImpl::BMDisplay_exec_impl::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::BMDisplay_exec_impl::ciao_preactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { @@ -83,7 +91,10 @@ MyImpl::BMDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDisplay_exec_impl::ccm_activate\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDisplay_exec_impl::ccm_activate\n")); + } // @@ This hack work around a missing feature in CIAO's assembly // mechanism where a Softpkg descriptor can specify it's dependency @@ -92,8 +103,8 @@ MyImpl::BMDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) // component server. Here, we are registering the valuefactory // explicitly to work around this problem. - char *argv[1] = { "BMDisplay_exec"}; - + char *argv[1]; + argv[0] = "BMDisplay_exec"; int argc = sizeof(argv)/sizeof(argv[0]); CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, @@ -102,24 +113,32 @@ MyImpl::BMDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) ACE_CHECK; - CIAO_REGISTER_VALUE_FACTORY (orb.in(), BasicSP::DataAvailable_init, + CIAO_REGISTER_VALUE_FACTORY (orb.in(), + BasicSP::DataAvailable_init, BasicSP::DataAvailable); } void -MyImpl::BMDisplay_exec_impl::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::BMDisplay_exec_impl::ciao_postactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { } void -MyImpl::BMDisplay_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::BMDisplay_exec_impl::ccm_passivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDisplay_exec_impl::ccm_passivate\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDisplay_exec_impl::ccm_passivate\n")); + } } void @@ -128,7 +147,10 @@ MyImpl::BMDisplay_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDisplay_exec_impl::ccm_remove\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDisplay_exec_impl::ccm_remove\n")); + } } /// Default ctor. diff --git a/TAO/CIAO/examples/OEP/BasicSP/EC/controller.cpp b/TAO/CIAO/examples/OEP/BasicSP/EC/controller.cpp index a2b0f873ef9..d52ac54dba9 100644 --- a/TAO/CIAO/examples/OEP/BasicSP/EC/controller.cpp +++ b/TAO/CIAO/examples/OEP/BasicSP/EC/controller.cpp @@ -11,7 +11,7 @@ #include "ace/Get_Opt.h" #include "ace/streams.h" -char *rategen_ior_ = 0; +const char *rategen_ior_ = 0; int rate = 2; int turn_on = 1; @@ -22,42 +22,49 @@ parse_args (int argc, char *argv[]) int c; while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - turn_on = 1; - break; + { + switch (c) + { + case 'o': + turn_on = 1; + break; - case 'f': - turn_on = 0; - break; + case 'f': + turn_on = 0; + break; - case 'k': - rategen_ior_ = get_opts.opt_arg (); + case 'k': + rategen_ior_ = get_opts.opt_arg (); + break; + + case 'r': + rate = atoi (get_opts.opt_arg ()); break; - case 'r': - rate = atoi (get_opts.opt_arg ()); - break; - - case '?': // display help for use of the server. - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s\n" - "-o (Turn on the rate generator)\n" - "-f (Turn off the rate generator)\n" - "-k (default is file://rategen.ior)\n" - "-r (default is 3)\n" - "\n", - argv [0]), - -1); - } + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-o (Turn on the rate generator)\n" + "-f (Turn off the rate generator)\n" + "-k (default is file://rategen.ior)\n" + "-r (default is 3)\n" + "\n", + argv [0]), + -1); + break; + } + } if (rategen_ior_ == 0) - rategen_ior_ = "file://ec.ior"; + { + rategen_ior_ = "file://ec.ior"; + } if (rate == 0) - rate = 3; + { + rate = 3; + } return 0; } @@ -69,17 +76,19 @@ main (int argc, char *argv[]) { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init (argc, - argv, - "" - ACE_ENV_ARG_PARAMETER); + argv, + "" + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (parse_args (argc, argv) != 0) - return -1; + { + return -1; + } - CORBA::Object_var obj - = orb->string_to_object (rategen_ior_ - ACE_ENV_ARG_PARAMETER); + CORBA::Object_var obj = + orb->string_to_object (rategen_ior_ + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; BasicSP::EC_var pulser @@ -88,7 +97,11 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; if (CORBA::is_nil (pulser.in ())) - ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire 'EC' objref\n"), -1); + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'EC' objref\n"), + -1); + } pulser->hertz (rate ACE_ENV_ARG_PARAMETER); diff --git a/TAO/CIAO/examples/OEP/Display/NavDisplay/NavDisplay_exec.cpp b/TAO/CIAO/examples/OEP/Display/NavDisplay/NavDisplay_exec.cpp index 67e546dc11a..613fa0b26a4 100644 --- a/TAO/CIAO/examples/OEP/Display/NavDisplay/NavDisplay_exec.cpp +++ b/TAO/CIAO/examples/OEP/Display/NavDisplay/NavDisplay_exec.cpp @@ -28,10 +28,13 @@ MyImpl::NavDisplay_exec_impl::push_Refresh (HUDisplay::tick *ev ACE_CHECK; if (CORBA::is_nil (loc.in ())) - ACE_THROW (CORBA::BAD_INV_ORDER ()); + { + ACE_THROW (CORBA::BAD_INV_ORDER ()); + } CORBA::Long x = loc->posx (ACE_ENV_SINGLE_ARG_PARAMETER) % 500; ACE_CHECK; + CORBA::Long y = loc->posy (ACE_ENV_SINGLE_ARG_PARAMETER) % 300; ACE_CHECK; @@ -42,26 +45,35 @@ MyImpl::NavDisplay_exec_impl::push_Refresh (HUDisplay::tick *ev // Operations from Components::SessionComponent void -MyImpl::NavDisplay_exec_impl::set_session_context (Components::SessionContext_ptr ctx - ACE_ENV_ARG_DECL) +MyImpl::NavDisplay_exec_impl::set_session_context ( + Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplay_exec_impl::set_session_context\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::NavDisplay_exec_impl::set_session_context\n")); + } this->context_ = HUDisplay::CCM_NavDisplay_Context::_narrow (ctx - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; if (CORBA::is_nil (this->context_.in ())) - ACE_THROW (CORBA::INTERNAL ()); + { + ACE_THROW (CORBA::INTERNAL ()); + } // Urm, we actually discard exceptions thown from this operation. } void -MyImpl::NavDisplay_exec_impl::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::NavDisplay_exec_impl::ciao_preactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { @@ -73,7 +85,10 @@ MyImpl::NavDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplay_exec_impl::ccm_activate\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::NavDisplay_exec_impl::ccm_activate\n")); + } // @@ This hack work around a missing feature in CIAO's assembly // mechanism where a Softpkg descriptor can specify it's dependency @@ -82,9 +97,9 @@ MyImpl::NavDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) // component server. Here, we are registering the valuefactory // explicitly to work around this problem. - char *argv[1] = { "NavDisplay_exec"}; - - int argc = sizeof(argv)/sizeof(argv[0]); + char *argv[1]; + argv[0] = "NavDisplay_exec"; + int argc = sizeof (argv)/sizeof (argv[0]); CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "" @@ -92,12 +107,15 @@ MyImpl::NavDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) ACE_CHECK; - CIAO_REGISTER_VALUE_FACTORY (orb.in(), HUDisplay::tick_init, + CIAO_REGISTER_VALUE_FACTORY (orb.in(), + HUDisplay::tick_init, HUDisplay::tick); } void -MyImpl::NavDisplay_exec_impl::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::NavDisplay_exec_impl::ciao_postactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { @@ -109,7 +127,10 @@ MyImpl::NavDisplay_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplay_exec_impl::ccm_passivate\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::NavDisplay_exec_impl::ccm_passivate\n")); + } } void @@ -118,7 +139,10 @@ MyImpl::NavDisplay_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplay_exec_impl::ccm_remove\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::NavDisplay_exec_impl::ccm_remove\n")); + } } /// Default ctor. diff --git a/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.cpp b/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.cpp index b10d3a8dc77..b1960ef89d7 100644 --- a/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.cpp +++ b/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.cpp @@ -36,7 +36,10 @@ MyImpl::Pulse_Handler::close () this->reactor ()->notify (); if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "Waiting\n")); + { + ACE_DEBUG ((LM_DEBUG, "Waiting\n")); + } + return this->wait (); } @@ -44,7 +47,9 @@ int MyImpl::Pulse_Handler::start (CORBA::Long hertz) { if (hertz == 0 || this->active_ != 0) // Not valid - return -1; + { + return -1; + } long usec = 1000000 / hertz; @@ -61,7 +66,9 @@ int MyImpl::Pulse_Handler::stop (void) { if (this->active_ == 0) // Not valid. - return -1; + { + return -1; + } this->reactor ()->cancel_timer (this); @@ -80,11 +87,13 @@ MyImpl::Pulse_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), - this, - handle, - close_mask)); + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + } return 0; } @@ -110,7 +119,9 @@ MyImpl::Pulse_Handler::svc (void) this->reactor ()->owner (ACE_OS::thr_self ()); while (!this->done_) - this->reactor ()->handle_events (); + { + this->reactor ()->handle_events (); + } return 0; } @@ -143,7 +154,7 @@ MyImpl::RateGen_exec_i::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) void MyImpl::RateGen_exec_i::hertz (CORBA::Long hertz - ACE_ENV_ARG_DECL_NOT_USED) + ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { this->hertz_ = hertz; @@ -156,7 +167,9 @@ MyImpl::RateGen_exec_i::start (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->hertz_ == 0 || this->pulser_.active()) - ACE_THROW (CORBA::BAD_INV_ORDER ()); + { + ACE_THROW (CORBA::BAD_INV_ORDER ()); + } // @@ Start the rate generator this->pulser_.start (this->hertz_); @@ -167,7 +180,9 @@ MyImpl::RateGen_exec_i::stop (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (! this->pulser_.active ()) - ACE_THROW (CORBA::BAD_INV_ORDER ()); + { + ACE_THROW (CORBA::BAD_INV_ORDER ()); + } // @@ stop the rate generator this->pulser_.stop (); @@ -183,13 +198,18 @@ MyImpl::RateGen_exec_i::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) // Operations from Components::SessionComponent void -MyImpl::RateGen_exec_i::set_session_context (Components::SessionContext_ptr ctx - ACE_ENV_ARG_DECL) +MyImpl::RateGen_exec_i::set_session_context ( + Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::set_session_context\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::RateGen_exec_i::set_session_context\n")); + } this->context_ = HUDisplay::CCM_RateGen_Context::_narrow (ctx @@ -197,7 +217,9 @@ MyImpl::RateGen_exec_i::set_session_context (Components::SessionContext_ptr ctx ACE_CHECK; if (CORBA::is_nil (this->context_.in ())) - ACE_THROW (CORBA::INTERNAL ()); + { + ACE_THROW (CORBA::INTERNAL ()); + } // Urm, we actually discard exceptions thown from this operation. } @@ -215,7 +237,10 @@ MyImpl::RateGen_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_activate\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::RateGen_exec_i::ccm_activate\n")); + } this->pulser_.open (); } @@ -233,7 +258,11 @@ MyImpl::RateGen_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_passivate\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::RateGen_exec_i::ccm_passivate\n")); + } + this->pulser_.close (); } @@ -243,7 +272,10 @@ MyImpl::RateGen_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_remove\n")); + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::RateGen_exec_i::ccm_remove\n")); + } } void @@ -252,8 +284,10 @@ MyImpl::RateGen_exec_i::pulse (void) ACE_TRY_NEW_ENV { if (CIAO::debug_level () > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Pushing HUDisplay::tick event!\n"))); + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Pushing HUDisplay::tick event!\n"))); + } HUDisplay::tick_var ev = new OBV_HUDisplay::tick (); @@ -278,14 +312,14 @@ MyImpl::RateGenHome_exec_i::~RateGenHome_exec_i () } ::Components::EnterpriseComponent_ptr -MyImpl::RateGenHome_exec_i::new_RateGen (CORBA::Long hertz +MyImpl::RateGenHome_exec_i::new_RateGen (CORBA::Long /* hertz */ ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { Components::EnterpriseComponent_ptr tmp = 0; ACE_NEW_THROW_EX (tmp, - MyImpl::RateGen_exec_i, - CORBA::NO_MEMORY ()); + MyImpl::RateGen_exec_i, + CORBA::NO_MEMORY ()); return tmp; } diff --git a/TAO/CIAO/examples/OEP/Display/RateGen/controller.cpp b/TAO/CIAO/examples/OEP/Display/RateGen/controller.cpp index 6d9441c8fcb..664f59a062e 100644 --- a/TAO/CIAO/examples/OEP/Display/RateGen/controller.cpp +++ b/TAO/CIAO/examples/OEP/Display/RateGen/controller.cpp @@ -12,7 +12,7 @@ * RateGen. */ -char *rategen_ior_ = 0; +const char *rategen_ior_ = 0; int rate = 2; int turn_on = 1; @@ -23,42 +23,45 @@ parse_args (int argc, char *argv[]) int c; while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - turn_on = 1; - break; - - case 'f': - turn_on = 0; - break; - - case 'k': - rategen_ior_ = get_opts.opt_arg (); - break; - - case 'r': - rate = atoi (get_opts.opt_arg ()); - break; - - case '?': // display help for use of the server. - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s\n" - "-o (Turn on the rate generator)\n" - "-f (Turn off the rate generator)\n" - "-k (default is file://rategen.ior)\n" - "-r (default is 3)\n" - "\n", - argv [0]), - -1); - } + { + switch (c) + { + case 'o': + turn_on = 1; + break; + case 'f': + turn_on = 0; + break; + case 'k': + rategen_ior_ = get_opts.opt_arg (); + break; + case 'r': + rate = atoi (get_opts.opt_arg ()); + break; + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-o (Turn on the rate generator)\n" + "-f (Turn off the rate generator)\n" + "-k (default is file://rategen.ior)\n" + "-r (default is 3)\n" + "\n", + argv [0]), + -1); + break; + } + } if (rategen_ior_ == 0) - rategen_ior_ = "file://rategen.ior"; + { + rategen_ior_ = "file://rategen.ior"; + } if (rate == 0) - rate = 3; + { + rate = 3; + } return 0; } @@ -77,7 +80,9 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; if (parse_args (argc, argv) != 0) - return -1; + { + return -1; + } CORBA::Object_var obj = orb->string_to_object (rategen_ior_ @@ -90,7 +95,11 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; if (CORBA::is_nil (pulser.in ())) - ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire 'RateGen' objref\n"), -1); + { + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to acquire 'RateGen' objref\n"), + -1); + } if (turn_on) { -- cgit v1.2.1