diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-14 22:21:27 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-14 22:21:27 +0000 |
commit | 0bd73cd27b8f7b2645b46e54959affcab0e2d234 (patch) | |
tree | 3b3f2f44b54bb2fa7a25b6234e41a45ffdb596db | |
parent | 88b68226ace5d69fd9982c8a6dc2d735d7117b00 (diff) | |
download | ATCD-0bd73cd27b8f7b2645b46e54959affcab0e2d234.tar.gz |
:
16 files changed, 212 insertions, 145 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 08db798371f..cb912448d99 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,32 @@ +Mon Apr 14 17:06:37 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/HUDisplay_svnt.cpp: + * examples/handcrafted/Display/HUDisplay_svnt.h: + * examples/handcrafted/Display/GPS/GPS_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_exec.h: + * examples/handcrafted/Display/GPS/GPS_svnt.cpp: + * examples/handcrafted/Display/GPS/GPS_svnt.h: + * examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp: + * examples/handcrafted/Display/GPS/GPS_tracing_exec.h: + * examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen_exec.cpp: + * examples/handcrafted/Display/RateGen/RateGen_exec.h: + * examples/handcrafted/Display/RateGen/client.cpp: + * examples/handcrafted/Display/RateGen/controller.cpp: + * examples/handcrafted/Display/RateGen/run_test.pl: + * examples/handcrafted/Display/descriptors/NOTE.txt: Updated + docuemntation. Changed to inherit Pulse_Handler from + ACE_Task_Base. Reworked controller.cpp so that it won't look + like the process that actually generates the events. + +Mon Apr 14 14:57:51 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * examples/handcrafted/Display/RateGen/controller.cpp: Changed to + perform only one action in each exection of this program. I.e., + it either switch on or off the RateGen component and exit + immediately. This is to avoid the mis-conception that the + controller actually generates the Rate. + Sat Apr 12 12:36:08 2003 Nanbor Wang <nanbor@cs.wustl.edu> * CIDLC/parser_examples/cidl/cidl.vcproj: diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp index a9608347aad..543940c13a2 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.cpp @@ -5,7 +5,7 @@ #define DISPLACEMENT 256 /// Default constructor. -MyImpl::GPS_exec_impl::GPS_exec_impl () +MyImpl::GPS_exec_i::GPS_exec_i () { ACE_OS::srand ((u_int) ACE_OS::time ()); this->positionx_ = ACE_OS::rand (); @@ -13,22 +13,22 @@ MyImpl::GPS_exec_impl::GPS_exec_impl () } /// Default destructor. -MyImpl::GPS_exec_impl::~GPS_exec_impl () +MyImpl::GPS_exec_i::~GPS_exec_i () { } // Operations from HUDisplay::GPS HUDisplay::CCM_position_ptr -MyImpl::GPS_exec_impl::get_MyLocation (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPS_exec_i::get_MyLocation (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { return HUDisplay::CCM_position::_duplicate (this); } void -MyImpl::GPS_exec_impl::push_Refresh (HUDisplay::tick_ptr ev - ACE_ENV_ARG_DECL) +MyImpl::GPS_exec_i::push_Refresh (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { // Refresh position @@ -45,14 +45,14 @@ MyImpl::GPS_exec_impl::push_Refresh (HUDisplay::tick_ptr ev // Operations from HUDisplay::position CORBA::Long -MyImpl::GPS_exec_impl::posx (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPS_exec_i::posx (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->positionx_; } CORBA::Long -MyImpl::GPS_exec_impl::posy (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPS_exec_i::posy (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->positiony_; @@ -60,12 +60,12 @@ MyImpl::GPS_exec_impl::posy (ACE_ENV_SINGLE_ARG_DECL) // Operations from Components::SessionComponent void -MyImpl::GPS_exec_impl::set_session_context (Components::SessionContext_ptr ctx - ACE_ENV_ARG_DECL) +MyImpl::GPS_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_impl::set_session_context\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_i::set_session_context\n")); this->context_ = HUDisplay::CCM_GPS_Context::_narrow (ctx @@ -78,36 +78,36 @@ MyImpl::GPS_exec_impl::set_session_context (Components::SessionContext_ptr ctx } void -MyImpl::GPS_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::GPS_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_impl::ccm_activate\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_i::ccm_activate\n")); } void -MyImpl::GPS_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::GPS_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_impl::ccm_passivate\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_i::ccm_passivate\n")); } void -MyImpl::GPS_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::GPS_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_impl::ccm_remove\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_exec_i::ccm_remove\n")); } /// Default ctor. -MyImpl::GPSHome_exec_impl::GPSHome_exec_impl () +MyImpl::GPSHome_exec_i::GPSHome_exec_i () { } /// Default dtor. -MyImpl::GPSHome_exec_impl::~GPSHome_exec_impl () +MyImpl::GPSHome_exec_i::~GPSHome_exec_i () { } @@ -116,16 +116,16 @@ MyImpl::GPSHome_exec_impl::~GPSHome_exec_impl () // Implicit home operations. ::Components::EnterpriseComponent_ptr -MyImpl::GPSHome_exec_impl::create (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPSHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CreateFailure)) { - return new MyImpl::GPS_exec_impl; + return new MyImpl::GPS_exec_i; } extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr createGPSHome_Impl (void) { - return new MyImpl::GPSHome_exec_impl; + return new MyImpl::GPSHome_exec_i; } diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h index 5bdcd9870e4..352c9dd9d24 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_exec.h @@ -4,7 +4,8 @@ * @file GPS_exec.h * * Header file for the actual GPS and GPSHome component - * implementations. + * implementations. These classes are the implementations of local + * interfaces defined in GPSEI.idl. * * @author Nanbor Wang <nanbor@cse.wustl.edu> */ @@ -15,23 +16,29 @@ #include "GPSEIC.h" #include "tao/LocalObject.h" +// The namespace name for the actual implementation classes doesn't +// really matter. Since there may be several different +// implementations for a component, they can very well be in different +// namespaces. namespace MyImpl { /** - * @class GPS_exec_impl + * @class GPS_exec_i * - * RateGen executor implementation class. + * An example RateGen executor implementation class. */ - class GPS_EXEC_Export GPS_exec_impl : + class GPS_EXEC_Export GPS_exec_i : public virtual HUDisplay::GPS_Exec, + // CIAO container implementation depends on correct reference + // counting of local interfaces, so we take a short cut to public virtual TAO_Local_RefCounted_Object { public: /// Default constructor. - GPS_exec_impl (); + GPS_exec_i (); /// Default destructor. - ~GPS_exec_impl (); + ~GPS_exec_i (); // Operations from HUDisplay::GPS @@ -85,20 +92,20 @@ namespace MyImpl }; /** - * @class GPSHome_exec_impl + * @class GPSHome_exec_i * * GPS home executor implementation class. */ - class GPS_EXEC_Export GPSHome_exec_impl : + class GPS_EXEC_Export GPSHome_exec_i : public virtual HUDisplay::CCM_GPSHome, public virtual TAO_Local_RefCounted_Object { public: /// Default ctor. - GPSHome_exec_impl (); + GPSHome_exec_i (); /// Default dtor. - ~GPSHome_exec_impl (); + ~GPSHome_exec_i (); // Explicit home operations. @@ -112,6 +119,8 @@ namespace MyImpl } +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr createGPSHome_Impl (void); diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp index 903429e1f80..702d0928386 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.cpp @@ -3,14 +3,6 @@ // The generated filename for files using this template shoule be // GPSGS.cpp GS --> GlueSession -// @@ Notice: [ciao module name] can expand to either CIAO_GLUE or -// CIAO_GLUE_[module name] as defined in the header file. - -/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -/// @@@ Notice that all component and interface names need to be -/// fully qualified as we are creating a new namespace for the CIAO's -/// container glue code. -/// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #include "GPS_svnt.h" #include "../HUDisplay_svnt.h" diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.h index c69ae90c669..fccf79fc191 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.h +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_svnt.h @@ -4,12 +4,14 @@ // // @file GPS_svnt.h // -// This is a pseudo-meta generic servant implementations template -// for CIAO's CIDL compiler. It demonstrates how a servant -// implementation for a session component should look like. +// Servant Glue code (supposedly should be) generated using CIAO'S +// CIDL compiler. This file implement the servants that bridge the +// executor and the container. // -// The generated filename for files using this template shoule be -// GPS_svnt.h +// This file is "generated" using the template code under +// $(CIAO_ROOT)/docs/templates/ +// +// Remember to refect any changes back to the code templates. // // @author Nanbor Wang <nanbor@cs.wustl.edu> // @@ -110,9 +112,9 @@ namespace CIAO_GLUE_HUDisplay ACE_THROW_SPEC ((CORBA::SystemException, ::Components::ExceededConnectionLimit)); - HUDisplay::tickConsumer_ptr - unsubscribe_Ready (::Components::Cookie_ptr ck - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + HUDisplay::tickConsumer_ptr + unsubscribe_Ready (::Components::Cookie_ptr ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Components::InvalidConnection)); diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp index 488425bd9b4..9c52db56f29 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.cpp @@ -5,7 +5,7 @@ #define DISPLACEMENT 256 /// Default constructor. -MyImpl::GPS_tracing_exec_impl::GPS_tracing_exec_impl () : dx_(1), dy_(1) +MyImpl::GPS_tracing_exec_i::GPS_tracing_exec_i () : dx_(1), dy_(1) { ACE_OS::srand ((u_int) ACE_OS::time ()); @@ -14,22 +14,22 @@ MyImpl::GPS_tracing_exec_impl::GPS_tracing_exec_impl () : dx_(1), dy_(1) } /// Default destructor. -MyImpl::GPS_tracing_exec_impl::~GPS_tracing_exec_impl () +MyImpl::GPS_tracing_exec_i::~GPS_tracing_exec_i () { } // Operations from HUDisplay::GPS HUDisplay::CCM_position_ptr -MyImpl::GPS_tracing_exec_impl::get_MyLocation (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPS_tracing_exec_i::get_MyLocation (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { return HUDisplay::CCM_position::_duplicate (this); } void -MyImpl::GPS_tracing_exec_impl::push_Refresh (HUDisplay::tick_ptr ev - ACE_ENV_ARG_DECL) +MyImpl::GPS_tracing_exec_i::push_Refresh (HUDisplay::tick_ptr ev + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { // Refresh position @@ -51,14 +51,14 @@ MyImpl::GPS_tracing_exec_impl::push_Refresh (HUDisplay::tick_ptr ev // Operations from HUDisplay::position CORBA::Long -MyImpl::GPS_tracing_exec_impl::posx (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPS_tracing_exec_i::posx (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->positionx_; } CORBA::Long -MyImpl::GPS_tracing_exec_impl::posy (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPS_tracing_exec_i::posy (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->positiony_; @@ -66,12 +66,12 @@ MyImpl::GPS_tracing_exec_impl::posy (ACE_ENV_SINGLE_ARG_DECL) // Operations from Components::SessionComponent void -MyImpl::GPS_tracing_exec_impl::set_session_context (Components::SessionContext_ptr ctx - ACE_ENV_ARG_DECL) +MyImpl::GPS_tracing_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_impl::set_session_context\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::set_session_context\n")); this->context_ = HUDisplay::CCM_GPS_Context::_narrow (ctx @@ -84,36 +84,36 @@ MyImpl::GPS_tracing_exec_impl::set_session_context (Components::SessionContext_p } void -MyImpl::GPS_tracing_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::GPS_tracing_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_impl::ccm_activate\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_activate\n")); } void -MyImpl::GPS_tracing_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::GPS_tracing_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_impl::ccm_passivate\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_passivate\n")); } void -MyImpl::GPS_tracing_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::GPS_tracing_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_impl::ccm_remove\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::GPS_tracing_exec_i::ccm_remove\n")); } /// Default ctor. -MyImpl::GPSHome_tracing_exec_impl::GPSHome_tracing_exec_impl () +MyImpl::GPSHome_tracing_exec_i::GPSHome_tracing_exec_i () { } /// Default dtor. -MyImpl::GPSHome_tracing_exec_impl::~GPSHome_tracing_exec_impl () +MyImpl::GPSHome_tracing_exec_i::~GPSHome_tracing_exec_i () { } @@ -122,16 +122,16 @@ MyImpl::GPSHome_tracing_exec_impl::~GPSHome_tracing_exec_impl () // Implicit home operations. ::Components::EnterpriseComponent_ptr -MyImpl::GPSHome_tracing_exec_impl::create (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::GPSHome_tracing_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CreateFailure)) { - return new MyImpl::GPS_tracing_exec_impl; + return new MyImpl::GPS_tracing_exec_i; } extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr createGPSHome_Tracing_Impl (void) { - return new MyImpl::GPSHome_tracing_exec_impl; + return new MyImpl::GPSHome_tracing_exec_i; } diff --git a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.h b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.h index 7f960cce164..fb27c70740f 100644 --- a/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.h +++ b/TAO/CIAO/examples/handcrafted/Display/GPS/GPS_tracing_exec.h @@ -18,20 +18,20 @@ namespace MyImpl { /** - * @class GPS_tracing_exec_impl + * @class GPS_tracing_exec_i * * RateGen executor implementation class. */ - class GPS_EXEC_Export GPS_tracing_exec_impl : + class GPS_EXEC_Export GPS_tracing_exec_i : public virtual HUDisplay::GPS_Exec, public virtual TAO_Local_RefCounted_Object { public: /// Default constructor. - GPS_tracing_exec_impl (); + GPS_tracing_exec_i (); /// Default destructor. - ~GPS_tracing_exec_impl (); + ~GPS_tracing_exec_i (); // Operations from HUDisplay::GPS @@ -77,8 +77,11 @@ namespace MyImpl ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)); protected: + /// Current GPS reading. CORBA::Long positionx_; CORBA::Long positiony_; + + /// Delta amounts to emulate the position shift of each reading. int dx_; int dy_; @@ -87,20 +90,20 @@ namespace MyImpl }; /** - * @class GPSHome_tracing_exec_impl + * @class GPSHome_tracing_exec_i * * GPS home executor implementation class. */ - class GPS_EXEC_Export GPSHome_tracing_exec_impl : + class GPS_EXEC_Export GPSHome_tracing_exec_i : public virtual HUDisplay::CCM_GPSHome, public virtual TAO_Local_RefCounted_Object { public: /// Default ctor. - GPSHome_tracing_exec_impl (); + GPSHome_tracing_exec_i (); /// Default dtor. - ~GPSHome_tracing_exec_impl (); + ~GPSHome_tracing_exec_i (); // Explicit home operations. @@ -114,6 +117,8 @@ namespace MyImpl } +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. extern "C" GPS_EXEC_Export ::Components::HomeExecutorBase_ptr createGPSHome_Tracing_Impl (void); diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.cpp b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.cpp index 3efd9b83109..81f8bccea54 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.cpp @@ -13,6 +13,8 @@ #endif /* __ACE_INLINE__ */ // get_component implementation. +// get_component is a standard CORBA::Object operations that returns +// the component reference that an object interface associates to. CORBA::Object_ptr CIAO_GLUE_HUDisplay::position_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) diff --git a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h index 828b032afb6..f5b4b6e416c 100644 --- a/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h +++ b/TAO/CIAO/examples/handcrafted/Display/HUDisplay_svnt.h @@ -4,12 +4,14 @@ // // @file HUDisplay_svnt.h // -// This is a pseudo-meta generic servant implementations template -// for CIAO's CIDL compiler. It demonstrates how a servant -// implementation for a session component should look like. +// Servant Glue code (supposedly should be) generated using CIAO'S +// CIDL compiler. This file implement the servants that bridge the +// executor and the container. // -// The generated filename for files using this template shoule be -// [idl-basename]GS.h GS --> GlueSession +// This file is "generated" using the template code under +// $(CIAO_ROOT)/docs/templates/ +// +// Remember to refect any changes back to the code templates. // // @author Nanbor Wang <nanbor@cs.wustl.edu> // diff --git a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp index 68495d06ebd..cafdb475111 100644 --- a/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/NavDisplay/NavDisplay_exec.cpp @@ -63,6 +63,14 @@ MyImpl::NavDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) Components::CCMException)) { 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 + // to a valuetype factory and instruct the deployment framework to + // initialize and register the corresponding valuefactory in the + // 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]); diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp index aed3bd30a70..495e1b34175 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.cpp @@ -6,9 +6,8 @@ //================================================================= -MyImpl::Pulse_Handler::Pulse_Handler (MyImpl::RateGen_exec_impl *cb) +MyImpl::Pulse_Handler::Pulse_Handler (MyImpl::RateGen_exec_i *cb) : active_ (0), - count_ (0), done_ (0), tid_ (0), pulse_callback_ (cb) @@ -26,8 +25,7 @@ MyImpl::Pulse_Handler::~Pulse_Handler () int MyImpl::Pulse_Handler::open () { - return this->thr_mgr_.spawn (Pulse_Handler::svc_run, - this); + return this->activate (); } int @@ -37,7 +35,7 @@ MyImpl::Pulse_Handler::close () this->reactor ()->notify (); ACE_DEBUG ((LM_DEBUG, "Waiting\n")); - return this->thr_mgr_.wait (); + return this->wait (); } int @@ -97,55 +95,51 @@ MyImpl::Pulse_Handler::handle_timeout (const ACE_Time_Value &tv, // ACE_DEBUG ((LM_DEBUG, // ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"), // this, -// this->count_, // tv.sec (), // tv.usec ())); - ++this->count_; return 0; } -ACE_THR_FUNC_RETURN -MyImpl::Pulse_Handler::svc_run (void *args) +int +MyImpl::Pulse_Handler::svc (void) { - Pulse_Handler *handler = (Pulse_Handler *) args; - - handler->reactor ()->owner (ACE_OS::thr_self ()); + this->reactor ()->owner (ACE_OS::thr_self ()); - while (!handler->done_) - handler->reactor ()->handle_events (); + while (!this->done_) + this->reactor ()->handle_events (); return 0; } //================================================================= -MyImpl::RateGen_exec_impl::RateGen_exec_impl () +MyImpl::RateGen_exec_i::RateGen_exec_i () : hertz_ (0), pulser_ (this) { } -MyImpl::RateGen_exec_impl::RateGen_exec_impl (CORBA::Long hz) +MyImpl::RateGen_exec_i::RateGen_exec_i (CORBA::Long hz) : hertz_ (hz), pulser_ (this) { } -MyImpl::RateGen_exec_impl::~RateGen_exec_impl () +MyImpl::RateGen_exec_i::~RateGen_exec_i () { } CORBA::Long -MyImpl::RateGen_exec_impl::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::RateGen_exec_i::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->hertz_; } void -MyImpl::RateGen_exec_impl::hertz (CORBA::Long hertz +MyImpl::RateGen_exec_i::hertz (CORBA::Long hertz ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { @@ -155,7 +149,7 @@ MyImpl::RateGen_exec_impl::hertz (CORBA::Long hertz // Operations from supported interface(s) void -MyImpl::RateGen_exec_impl::start (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::RateGen_exec_i::start (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (this->hertz_ == 0 || this->pulser_.active()) @@ -166,7 +160,7 @@ MyImpl::RateGen_exec_impl::start (ACE_ENV_SINGLE_ARG_DECL) } void -MyImpl::RateGen_exec_impl::stop (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::RateGen_exec_i::stop (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { if (! this->pulser_.active ()) @@ -177,7 +171,7 @@ MyImpl::RateGen_exec_impl::stop (ACE_ENV_SINGLE_ARG_DECL) } CORBA::Boolean -MyImpl::RateGen_exec_impl::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::RateGen_exec_i::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->pulser_.active (); @@ -186,12 +180,12 @@ MyImpl::RateGen_exec_impl::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) // Operations from Components::SessionComponent void -MyImpl::RateGen_exec_impl::set_session_context (Components::SessionContext_ptr ctx +MyImpl::RateGen_exec_i::set_session_context (Components::SessionContext_ptr ctx ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::set_session_context\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::set_session_context\n")); this->context_ = HUDisplay::CCM_RateGen_Context::_narrow (ctx @@ -205,34 +199,34 @@ MyImpl::RateGen_exec_impl::set_session_context (Components::SessionContext_ptr c } void -MyImpl::RateGen_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::RateGen_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_activate\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_activate\n")); this->pulser_.open (); } void -MyImpl::RateGen_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::RateGen_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_passivate\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_passivate\n")); this->pulser_.close (); } void -MyImpl::RateGen_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +MyImpl::RateGen_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException, Components::CCMException)) { - ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_impl::ccm_remove\n")); + ACE_DEBUG ((LM_DEBUG, "MyImpl::RateGen_exec_i::ccm_remove\n")); } void -MyImpl::RateGen_exec_impl::pulse (void) +MyImpl::RateGen_exec_i::pulse (void) { ACE_TRY_NEW_ENV { @@ -252,34 +246,34 @@ MyImpl::RateGen_exec_impl::pulse (void) } -MyImpl::RateGenHome_exec_impl::RateGenHome_exec_impl () +MyImpl::RateGenHome_exec_i::RateGenHome_exec_i () { } -MyImpl::RateGenHome_exec_impl::~RateGenHome_exec_impl () +MyImpl::RateGenHome_exec_i::~RateGenHome_exec_i () { } ::Components::EnterpriseComponent_ptr -MyImpl::RateGenHome_exec_impl::new_RateGen (CORBA::Long hertz +MyImpl::RateGenHome_exec_i::new_RateGen (CORBA::Long hertz ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CreateFailure)) { - return new MyImpl::RateGen_exec_impl (hertz); + return new MyImpl::RateGen_exec_i (hertz); } ::Components::EnterpriseComponent_ptr -MyImpl::RateGenHome_exec_impl::create (ACE_ENV_SINGLE_ARG_DECL) +MyImpl::RateGenHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, Components::CreateFailure)) { - return new MyImpl::RateGen_exec_impl (); + return new MyImpl::RateGen_exec_i (); } extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr createRateGenHome_Impl (void) { - return new MyImpl::RateGenHome_exec_impl (); + return new MyImpl::RateGenHome_exec_i (); } diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h index 153a6515120..e8327a45225 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/RateGen_exec.h @@ -15,21 +15,21 @@ #include "RateGenEIC.h" #include "tao/LocalObject.h" #include "ace/Thread_Manager.h" -#include "ace/Event_Handler.h" +#include "ace/Task.h" namespace MyImpl { // Forward decl. - class RateGen_exec_impl; + class RateGen_exec_i; /** * @brief Active pulse generater */ - class Pulse_Handler : public ACE_Event_Handler + class Pulse_Handler : public ACE_Task_Base { public: // Default constructor - Pulse_Handler (RateGen_exec_impl *cb); + Pulse_Handler (RateGen_exec_i *cb); ~Pulse_Handler (); int open (void); @@ -50,40 +50,41 @@ namespace MyImpl virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask); - static ACE_THR_FUNC_RETURN svc_run (void *args); + virtual int svc (void); private: + /// Tracking whether we are actively generating pulse or not. long active_; - long count_; - + /// Flag to indicate completion of this active object. int done_; + /// The timer id we are waiting. int tid_; - RateGen_exec_impl *pulse_callback_; + RateGen_exec_i *pulse_callback_; ACE_Thread_Manager thr_mgr_; }; /** - * @class RateGen_exec_impl + * @class RateGen_exec_i * * RateGen executor implementation class. */ - class RATEGEN_EXEC_Export RateGen_exec_impl : + class RATEGEN_EXEC_Export RateGen_exec_i : public virtual HUDisplay::RateGen_Exec, public virtual TAO_Local_RefCounted_Object { public: /// Default constructor. - RateGen_exec_impl (); + RateGen_exec_i (); /// Initialize with a default frequency. - RateGen_exec_impl (CORBA::Long hz); + RateGen_exec_i (CORBA::Long hz); /// Default destructor. - ~RateGen_exec_impl (); + ~RateGen_exec_i (); // Attribute operations. @@ -134,25 +135,26 @@ namespace MyImpl /// Copmponent specific context HUDisplay::CCM_RateGen_Context_var context_; - /// + /// An active object that actually trigger the generation of + /// periodic events. Pulse_Handler pulser_; }; /** - * @class RateGenHome_exec_impl + * @class RateGenHome_exec_i * * RateGen home executor implementation class. */ - class RATEGEN_EXEC_Export RateGenHome_exec_impl : + class RATEGEN_EXEC_Export RateGenHome_exec_i : public virtual HUDisplay::CCM_RateGenHome, public virtual TAO_Local_RefCounted_Object { public: /// Default ctor. - RateGenHome_exec_impl (); + RateGenHome_exec_i (); /// Default dtor. - ~RateGenHome_exec_impl (); + ~RateGenHome_exec_i (); // Explicit home operations. diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp index bb2ba8e9d89..4cb07f82993 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/client.cpp @@ -1,5 +1,14 @@ // $Id$ +/** + * @file client.cpp + * + * This is a simple client test program that interact with the RateGen + * component implementation. This test uses the explicit factory + * operation in the home interface to create a RateGen component + * instance, run it for a while, and destroy the component instance. + */ + #include "RateGenC.h" int diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp index ce7f86548d5..f2be495dcca 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp @@ -3,6 +3,14 @@ #include "RateGenC.h" #include "ace/Get_Opt.h" +/** + * @file controller.cpp + * + * This program interact with a RateGen component, using its supported + * interface "opmode" to switch it on/off, and set the rate of the + * RateGen. + */ + char *rategen_ior_ = 0; int rate = 2; int turn_on = 1; diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl b/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl index 1745a5d8802..8e080d8d4bd 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/run_test.pl @@ -5,6 +5,10 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # $Id$ # -*- perl -*- +# +# @@ Run this script from ../descriptors/ instead. +# + use lib "../../../../../../bin"; use PerlACE::Run_Test; @@ -18,7 +22,7 @@ unlink $svr_ior; unlink $home_ior; # CIAO Daemon command line arguments -$daemon_args = "-o $daemon_ior -i ../CIAO_Installation_Data.ini -n ../../../../tools/ComponentServer/ComponentServer"; +$daemon_args = "-o $daemon_ior -i CIAO_Installation_Data.ini -n ../../../../tools/ComponentServer/ComponentServer"; # CIAO Daemon Controller location: $controller = "../../../../tools/Daemon/DaemonController"; @@ -43,7 +47,7 @@ $DS = new PerlACE::Process ("../../../../tools/Daemon/CIAO_Daemon", "$daemon_args"); # Client process definition -$CL = new PerlACE::Process ("client", +$CL = new PerlACE::Process ("../RateGen/client", "$cl_args"); ## Starting up the CIAO daemon diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt index dc45830a324..e09bbb9467b 100644 --- a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt @@ -104,11 +104,11 @@ Step 4: All the .cad files instruct the Assembly_Manager to write the IOR of the RateGen component to a file called "rategen.ior" in this directory. You will then need to use a controller program in a - separate shell window to switch on/off the Rate Generator. + separate shell window to switch on/off the Rate Generator. Cont - Start the controller with: + Execute the controller with: - ../RateGen/controller + ../RateGen/controller -o # To switch on the RateGen See its source to check what options are available to start up the controller. (Hints: you can control the rate (hertz) of the Rate @@ -116,9 +116,10 @@ Step 4: Once the controller is running, check out the Daemon window (for text-based NavDisplay component) or the GUI window for the output. - Once you are happy with it, press <enter> in this shell window to - terminate the controller program and you will stop the RateGen - component from sending out more event. + Once you are happy with it, you can stop the RateGen by executing + the controller as: + + ../RateGen/controller -f # To switch off the RateGen Repeat this step again to instruct the RateGen component to start generating events. |