diff options
Diffstat (limited to 'TAO/CIAO/examples/OEP')
18 files changed, 2451 insertions, 0 deletions
diff --git a/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED.mpc b/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED.mpc new file mode 100644 index 00000000000..3a34534e512 --- /dev/null +++ b/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED.mpc @@ -0,0 +1,68 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay -i BMClosedED" +// This file has been manually modified to add a second component implementation. + +project(BMClosedED_stub): ciao_client { + after += BasicSP_stub + sharedname = BMClosedED_stub + + idlflags += -Wb,stub_export_macro=BMCLOSEDED_STUB_Export + idlflags += -Wb,stub_export_include=BMClosedED_stub_export.h + idlflags += -Wb,skel_export_macro=BMCLOSEDED_SVNT_Export + idlflags += -Wb,skel_export_include=BMClosedED_svnt_export.h + + dynamicflags = BMCLOSEDED_STUB_BUILD_DLL + + libs += BasicSP_stub + + IDL_Files { + BMClosedED.idl + } + + Source_Files { + BMClosedEDC.cpp + } +} + +project(BMClosedED_svnt) : ciao_servant { + after += BasicSP_svnt BMClosedED_stub + sharedname = BMClosedED_svnt + libs += BMClosedED_stub BasicSP_stub BasicSP_svnt + libpaths += .. + idlflags += -Wb,export_macro=BMCLOSEDED_SVNT_Export -Wb,export_include=BMClosedED_svnt_export.h + dynamicflags = BMCLOSEDED_SVNT_BUILD_DLL + + CIDL_Files { + BMClosedED.cidl + } + + IDL_Files { + BMClosedEDE.idl + } + + Source_Files { + BMClosedEDEC.cpp + BMClosedEDS.cpp + BMClosedED_svnt.cpp + } +} + + +project(BMClosedED_exec) : ciao_component { + after += BMClosedED_svnt + sharedname = BMClosedED_exec + libs += BMClosedED_stub BMClosedED_svnt BasicSP_stub BasicSP_svnt + libpaths += .. + idlflags += -Wb,export_macro=BMCLOSEDED_EXEC_Export -Wb,export_include=BMClosedED_exec_export.h + dynamicflags = BMCLOSEDED_EXEC_BUILD_DLL + + IDL_Files { + BMClosedEDEI.idl + } + + Source_Files { + BMClosedEDEIC.cpp + BMClosedED_exec.cpp + } +} + diff --git a/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp b/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp new file mode 100644 index 00000000000..a08164ffc10 --- /dev/null +++ b/TAO/CIAO/examples/OEP/BasicSP/BMClosedED/BMClosedED_exec.cpp @@ -0,0 +1,198 @@ +// $Id$ + +#include "ciao/CIAO_common.h" +#include "BMClosedED_exec.h" + +#include "ace/OS_NS_string.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::BMClosedED_exec_i::BMClosedED_exec_i () +{ +} + +/// Default destructor. +MyImpl::BMClosedED_exec_i::~BMClosedED_exec_i () +{ +} + +// Operations from HUDisplay::BMClosedED + +BasicSP::CCM_ReadData_ptr +MyImpl::BMClosedED_exec_i::get_dataout (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return BasicSP::CCM_ReadData::_duplicate (this); +} + +void +MyImpl::BMClosedED_exec_i::push_in_avail (BasicSP::DataAvailable * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + + if (CIAO::debug_level () > 0) + { + ACE_DEBUG ((LM_DEBUG, + "BMClosedED - Doing computations \n")); + + ACE_DEBUG ((LM_DEBUG, + "BMClosedED - Doing data fetch \n")); + } + + // Refresh position + BasicSP::ReadData_var dat + = this->context_->get_connection_datain (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (dat.in ())) + { + ACE_DEBUG ((LM_DEBUG, + "BMClosedED - got nil from get_connection \n")); + + 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 ())); + } + + if (ACE_OS::strcmp (str, "BM DEVICE DATA") == 0) + { + this->str_ = CORBA::string_dup ("BM CLOSED ED DATA"); + } + + // Notify others. + BasicSP::DataAvailable_var event = + new OBV_BasicSP::DataAvailable; + + this->context_->push_out_avail (event + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +// Operations from HUDisplay::position + +char * +MyImpl::BMClosedED_exec_i::get_data (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->str_.inout ()); +} + +// Operations from Components::SessionComponent +void +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")); + } + + this->context_ = + BasicSP::CCM_BMClosedED_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::BMClosedED_exec_i::ciao_preactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::BMClosedED_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMClosedED_exec_i::ccm_activate\n")); + } +} + +void +MyImpl::BMClosedED_exec_i::ciao_postactivate ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::BMClosedED_exec_i::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::BMClosedED_exec_i::ccm_passivate\n")); +} + +void +MyImpl::BMClosedED_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + // if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMClosedED_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::BMClosedEDHome_exec_i::BMClosedEDHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::BMClosedEDHome_exec_i::~BMClosedEDHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::BMClosedEDHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + Components::EnterpriseComponent_ptr tmp = + Components::EnterpriseComponent::_nil (); + ACE_NEW_THROW_EX (tmp, + MyImpl::BMClosedED_exec_i, + CORBA::NO_MEMORY ()); + return tmp; +} + + +extern "C" BMCLOSEDED_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMClosedEDHome_Impl (void) +{ + return new MyImpl::BMClosedEDHome_exec_i; +} diff --git a/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice.mpc b/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice.mpc new file mode 100644 index 00000000000..af2e66ae3a6 --- /dev/null +++ b/TAO/CIAO/examples/OEP/BasicSP/BMDevice/BMDevice.mpc @@ -0,0 +1,76 @@ +// $Id$ + +project(BMDevice_stub): ciao_client { + after += BasicSP_stub + + sharedname = BMDevice_stub + + libs += BasicSP_stub + + idlflags += -Wb,stub_export_macro=BMDEVICE_STUB_Export + idlflags += -Wb,stub_export_include=BMDevice_stub_export.h + idlflags += -Wb,skel_export_macro=BMDEVICE_SVNT_Export + idlflags += -Wb,skel_export_include=BMDevice_svnt_export.h + + libpaths += .. + libs += BasicSP_stub + dynamicflags = BMDEVICE_STUB_BUILD_DLL + + IDL_Files { + BMDevice.idl + } + + Source_Files { + BMDeviceC.cpp + } +} + +project(BMDevice_svnt) : ciao_servant { + after += BMDevice_stub BasicSP_stub + sharedname = BMDevice_svnt + + libs += BMDevice_stub BasicSP_stub BasicSP_svnt + + libpaths += .. + + idlflags += -Wb,export_macro=BMDEVICE_SVNT_Export + idlflags += -Wb,export_include=BMDevice_svnt_export.h + dynamicflags = BMDEVICE_SVNT_BUILD_DLL + + CIDL_Files { + BMDevice.cidl + } + + IDL_Files { + BMDeviceE.idl + } + + Source_Files { + BMDeviceEC.cpp + BMDeviceS.cpp + BMDevice_svnt.cpp + } +} + + +project(BMDevice_exec) : ciao_component { + after += BMDevice_svnt + sharedname = BMDevice_exec + libs += BMDevice_stub BMDevice_svnt BasicSP_stub BasicSP_svnt + libpaths += .. + idlflags += -Wb,export_macro=BMDEVICE_EXEC_Export + idlflags += -Wb,export_include=BMDevice_exec_export.h + dynamicflags = BMDEVICE_EXEC_BUILD_DLL + + IDL_Files { + BMDeviceEI.idl + } + + Source_Files { + BMDeviceES.cpp + BMDeviceEIC.cpp + BMDeviceEIS.cpp + BMDevice_exec.cpp + } +} + diff --git a/TAO/CIAO/examples/OEP/BasicSP/BMDisplay/BMDisplay.mpc b/TAO/CIAO/examples/OEP/BasicSP/BMDisplay/BMDisplay.mpc new file mode 100644 index 00000000000..539650f007f --- /dev/null +++ b/TAO/CIAO/examples/OEP/BasicSP/BMDisplay/BMDisplay.mpc @@ -0,0 +1,68 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p BasicSP -i BMDisplay" + +project(BMDisplay_stub): ciao_client { + after += BasicSP_stub + + sharedname = BMDisplay_stub + + idlflags += -Wb,stub_export_macro=BMDISPLAY_STUB_Export + idlflags += -Wb,stub_export_include=BMDisplay_stub_export.h + idlflags += -Wb,skel_export_macro=BMDISPLAY_SVNT_Export + idlflags += -Wb,skel_export_include=BMDisplay_svnt_export.h + + libs += BasicSP_stub + + dynamicflags = BMDISPLAY_STUB_BUILD_DLL + + IDL_Files { + BMDisplay.idl + } + + Source_Files { + BMDisplayC.cpp + } +} + +project(BMDisplay_svnt) : ciao_servant { + after += BasicSP_svnt BMDisplay_stub + sharedname = BMDisplay_svnt + libs += BMDisplay_stub BasicSP_stub BasicSP_svnt + libpaths += .. + idlflags += -Wb,export_macro=BMDISPLAY_SVNT_Export -Wb,export_include=BMDisplay_svnt_export.h + dynamicflags = BMDISPLAY_SVNT_BUILD_DLL + + CIDL_Files { + BMDisplay.cidl + } + + IDL_Files { + BMDisplayE.idl + } + + Source_Files { + BMDisplayEC.cpp + BMDisplayS.cpp + BMDisplay_svnt.cpp + } +} + + +project(BMDisplay_exec) : ciao_component { + after += BMDisplay_svnt + sharedname = BMDisplay_exec + libs += BMDisplay_stub BMDisplay_svnt BasicSP_stub BasicSP_svnt + libpaths += .. + idlflags += -Wb,export_macro=BMDISPLAY_EXEC_Export -Wb,export_include=BMDisplay_exec_export.h + dynamicflags = BMDISPLAY_EXEC_BUILD_DLL + + IDL_Files { + BMDisplayEI.idl + } + + Source_Files { + BMDisplayEIC.cpp + BMDisplay_exec.cpp + } +} + diff --git a/TAO/CIAO/examples/OEP/BasicSP/EC/EC.mpc b/TAO/CIAO/examples/OEP/BasicSP/EC/EC.mpc new file mode 100644 index 00000000000..3544eac4714 --- /dev/null +++ b/TAO/CIAO/examples/OEP/BasicSP/EC/EC.mpc @@ -0,0 +1,101 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p BasicSP -i -c EC" + +project(EC_stub): ciao_client { + after += BasicSP_stub + sharedname = EC_stub + + libs += BasicSP_stub + + idlflags += -Wb,stub_export_macro=EC_STUB_Export + idlflags += -Wb,stub_export_include=EC_stub_export.h + idlflags += -Wb,skel_export_macro=EC_SVNT_Export + idlflags += -Wb,skel_export_include=EC_svnt_export.h + + dynamicflags = EC_STUB_BUILD_DLL + + IDL_Files { + EC.idl + } + + Source_Files { + ECC.cpp + } +} + +project(EC_svnt) : ciao_servant { + after += BasicSP_svnt EC_stub + sharedname = EC_svnt + libs += EC_stub BasicSP_stub BasicSP_svnt + libpaths += .. + idlflags += -Wb,export_macro=EC_SVNT_Export + idlflags += -Wb,export_include=EC_svnt_export.h + + dynamicflags = EC_SVNT_BUILD_DLL + + CIDL_Files { + EC.cidl + } + + IDL_Files { + ECE.idl + } + + Source_Files { + ECEC.cpp + ECS.cpp + EC_svnt.cpp + } +} + + +project(EC_exec) : ciao_component { + after += EC_svnt + sharedname = EC_exec + libs += EC_stub BasicSP_stub EC_svnt + libpaths += .. + idlflags += -Wb,export_macro=EC_EXEC_Export + idlflags += -Wb,export_include=EC_exec_export.h + dynamicflags = EC_EXEC_BUILD_DLL + + IDL_Files { + ECEI.idl + } + + Source_Files { + ECEIC.cpp + EC_exec.cpp + } +} + + + +project (EC_client) : ciao_client, valuetype { + exename = client + after += EC_stub + libs += EC_stub BasicSP_stub + libpaths += .. + + IDL_Files { + } + + Source_Files { + client.cpp + } +} + + +project (EC_controller) : ciao_client, valuetype { + exename = controller + after += EC_stub + libs += EC_stub BasicSP_stub + libpaths += .. + + IDL_Files { + } + + Source_Files { + controller.cpp + } +} + diff --git a/TAO/CIAO/examples/OEP/BasicSP/EC/EC_exec.cpp b/TAO/CIAO/examples/OEP/BasicSP/EC/EC_exec.cpp new file mode 100644 index 00000000000..d4930ceec3c --- /dev/null +++ b/TAO/CIAO/examples/OEP/BasicSP/EC/EC_exec.cpp @@ -0,0 +1,300 @@ +// $Id$ + +#include "EC_exec.h" +#include "CIAO_common.h" +#include "ace/Timer_Queue.h" +#include "ace/Reactor.h" + +//================================================================= + +MyImpl::timeout_Handler::timeout_Handler (MyImpl::EC_exec_i *cb) + : active_ (0), + done_ (0), + tid_ (0), + pulse_callback_ (cb) +{ + // Nothing + this->reactor (new ACE_Reactor); +} + +MyImpl::timeout_Handler::~timeout_Handler () +{ + delete this->reactor (); + this->reactor (0); +} + +int +MyImpl::timeout_Handler::open_h () +{ + return this->activate (); +} + +int +MyImpl::timeout_Handler::close_h() +{ + this->done_ = 1; + this->reactor ()->notify (); + + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "Waiting\n")); + return this->wait (); +} + +int +MyImpl::timeout_Handler::start (CORBA::Long hertz) +{ + if (hertz == 0 || this->active_ != 0) // Not valid + return -1; + + long usec = 1000000 / hertz; + + this->tid_ = this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)); + + this->active_ = 1; + return 0; +} + +int +MyImpl::timeout_Handler::stop (void) +{ + if (this->active_ == 0) // Not valid. + return -1; + + this->reactor ()->cancel_timer (this); + + this->active_ = 0; + return 0; +} + +int +MyImpl::timeout_Handler::active (void) +{ + return this->active_; +} + +int +MyImpl::timeout_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)); + + return 0; +} + +int +MyImpl::timeout_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + this->pulse_callback_->pulse (); + +// ACE_DEBUG ((LM_DEBUG, +// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"), +// this, +// tv.sec (), +// tv.usec ())); + + return 0; +} + +int +MyImpl::timeout_Handler::svc (void) +{ + this->reactor ()->owner (ACE_OS::thr_self ()); + + while (!this->done_) + this->reactor ()->handle_events (); + + return 0; +} + +//================================================================= + +MyImpl::EC_exec_i::EC_exec_i () + : hertz_ (0), + pulser_ (this) +{ + +} + +MyImpl::EC_exec_i::EC_exec_i (CORBA::Long hz) + : hertz_ (hz), + pulser_ (this) +{ +} + +MyImpl::EC_exec_i::~EC_exec_i () +{ +} + +CORBA::Long +MyImpl::EC_exec_i::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->hertz_; +} + +void +MyImpl::EC_exec_i::hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->hertz_ = hertz; +} + +// Operations from supported interface(s) + +void +MyImpl::EC_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 ()); + + // @@ Start the rate generator + this->pulser_.start (this->hertz_); +} + +void +MyImpl::EC_exec_i::stop (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (! this->pulser_.active ()) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + // @@ stop the rate generator + this->pulser_.stop (); +} + +CORBA::Boolean +MyImpl::EC_exec_i::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->pulser_.active (); +} + +// Operations from Components::SessionComponent + +void +MyImpl::EC_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::EC_exec_i::set_session_context\n")); + + this->context_ = + BasicSP::CCM_EC_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. + +} + +void +MyImpl::EC_exec_i::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::EC_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_activate\n")); + + this->pulser_.open_h (); +} + +void +MyImpl::EC_exec_i::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::EC_exec_i::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::EC_exec_i::ccm_passivate\n")); + this->pulser_.close_h (); +} + +void +MyImpl::EC_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_remove\n")); +} + +void +MyImpl::EC_exec_i::pulse (void) +{ + ACE_TRY_NEW_ENV + { + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Pushing BasicSP::TimeOut event!\n"))); + + BasicSP::TimeOut_var ev = new OBV_BasicSP::TimeOut (); + + this->context_->push_timeout (ev.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // @@ do nothing? + } + ACE_ENDTRY; +} + +MyImpl::ECHome_exec_i::ECHome_exec_i () +{ +} + +MyImpl::ECHome_exec_i::~ECHome_exec_i () +{ +} + +::Components::EnterpriseComponent_ptr +MyImpl::ECHome_exec_i::new_EC (CORBA::Long hertz + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return new MyImpl::EC_exec_i (hertz); +} + +::Components::EnterpriseComponent_ptr +MyImpl::ECHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::EC_exec_i (); +} + + +extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr +createECHome_Impl (void) +{ + return new MyImpl::ECHome_exec_i (); +} diff --git a/TAO/CIAO/examples/OEP/BasicSP/EC/EC_exec.h b/TAO/CIAO/examples/OEP/BasicSP/EC/EC_exec.h new file mode 100644 index 00000000000..057f8f70f14 --- /dev/null +++ b/TAO/CIAO/examples/OEP/BasicSP/EC/EC_exec.h @@ -0,0 +1,190 @@ +// $Id$ + +//============================================================ +/** + * @file EC_exec.h + * + * Header file for the actualy EC and ECHome component + * implementation. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================ + +#ifndef EC_EXEC_H +#define EC_EXEC_H + +#include "ECEIC.h" +#include "tao/LocalObject.h" +#include "ace/Thread_Manager.h" +#include "ace/Task.h" + +namespace MyImpl +{ + // Forward decl. + class EC_exec_i; + + /** + * @brief Active pulse generater + */ + class timeout_Handler : public ACE_Task_Base + { + public: + // Default constructor + timeout_Handler (EC_exec_i *cb); + ~timeout_Handler (); + + int open_h (void); + + int close_h (void); + + int start (CORBA::Long hertz); + + int stop (void); + + int active (void); + + // Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + // Called when <Time_Handler> is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + long active_; + + /// Flag to indicate completion of this active object. + int done_; + + /// The timer id we are waiting. + int tid_; + + EC_exec_i *pulse_callback_; + + ACE_Thread_Manager thr_mgr_; + }; + + /** + * @class EC_exec_i + * + * EC executor implementation class. + */ + class EC_EXEC_Export EC_exec_i : + public virtual BasicSP::EC_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + EC_exec_i (); + + /// Initialize with a default frequency. + EC_exec_i (CORBA::Long hz); + + /// Default destructor. + ~EC_exec_i (); + + // Attribute operations. + + virtual CORBA::Long hertz (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from supported interface(s) + + virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean active (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + + virtual void ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + /// Helper function to be called back by timeout_Handler + void pulse (void); + + protected: + /// Frequency + CORBA::Long hertz_; + + /// Copmponent specific context + BasicSP::CCM_EC_Context_var context_; + + /// An active object that actually trigger the generation of + /// periodic events. + timeout_Handler pulser_; + }; + + /** + * @class ECHome_exec_i + * + * EC home executor implementation class. + */ + class EC_EXEC_Export ECHome_exec_i : + public virtual BasicSP::CCM_ECHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + ECHome_exec_i (); + + /// Default dtor. + ~ECHome_exec_i (); + + // Explicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + new_EC (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr +createECHome_Impl (void); + +#endif /* CIAO_ECGEN_EXEC_H */ diff --git a/TAO/CIAO/examples/OEP/Display/GPS/GPS.mpc b/TAO/CIAO/examples/OEP/Display/GPS/GPS.mpc new file mode 100644 index 00000000000..3b7a859de56 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/GPS/GPS.mpc @@ -0,0 +1,92 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay -i GPS" +// This file has been manually modified to add a second component implementation. + +project(GPS_stub): ciao_client { + after += HUDisplay_stub + sharedname = GPS_stub + + libs += HUDisplay_stub + + idlflags += -Wb,stub_export_macro=GPS_STUB_Export + idlflags += -Wb,stub_export_include=GPS_stub_export.h + idlflags += -Wb,skel_export_macro=GPS_SVNT_Export + idlflags += -Wb,skel_export_include=GPS_svnt_export.h + + dynamicflags = GPS_STUB_BUILD_DLL + + IDL_Files { + GPS.idl + } + + Source_Files { + GPSC.cpp + } +} + +project(GPS_svnt) : ciao_servant { + after += HUDisplay_svnt GPS_stub + sharedname = GPS_svnt + + libs += GPS_stub HUDisplay_stub HUDisplay_svnt + + libpaths += .. + + idlflags += -Wb,export_macro=GPS_SVNT_Export + idlflags += -Wb,export_include=GPS_svnt_export.h + + dynamicflags = GPS_SVNT_BUILD_DLL + + CIDL_Files { + GPS.cidl + } + + IDL_Files { + GPSE.idl + } + + Source_Files { + GPSEC.cpp + GPSS.cpp + GPS_svnt.cpp + } +} + + +project(GPS_exec) : ciao_component { + after += GPS_svnt + sharedname = GPS_exec + libs += GPS_stub GPS_svnt HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=GPS_EXEC_Export + idlflags += -Wb,export_include=GPS_exec_export.h + dynamicflags = GPS_EXEC_BUILD_DLL + + IDL_Files { + GPSEI.idl + } + + Source_Files { + GPSEIC.cpp + GPS_exec.cpp + } +} + +project(GPS_tracing_exec) : ciao_component { + after += GPS_svnt + sharedname = GPS_tracing_exec + libs += GPS_stub GPS_svnt HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=GPS_EXEC_Export + idlflags += -Wb,export_include=GPS_exec_export.h + dynamicflags = GPS_EXEC_BUILD_DLL + + IDL_Files { + GPSEI.idl + } + + Source_Files { + GPSEIC.cpp + GPS_tracing_exec.cpp + } +} diff --git a/TAO/CIAO/examples/OEP/Display/NavDisplay/NavDisplay.mpc b/TAO/CIAO/examples/OEP/Display/NavDisplay/NavDisplay.mpc new file mode 100644 index 00000000000..aa7d123f11d --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/NavDisplay/NavDisplay.mpc @@ -0,0 +1,68 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay -i NavDisplay" + +project(NavDisplay_stub): ciao_client { + after += HUDisplay_stub + sharedname = NavDisplay_stub + + libs += HUDisplay_stub + + idlflags += -Wb,stub_export_macro=NAVDISPLAY_STUB_Export + idlflags += -Wb,stub_export_include=NavDisplay_stub_export.h + idlflags += -Wb,skel_export_macro=NAVDISPLAY_SVNT_Export + idlflags += -Wb,skel_export_include=NavDisplay_svnt_export.h + + dynamicflags = NAVDISPLAY_STUB_BUILD_DLL + + IDL_Files { + NavDisplay.idl + } + + Source_Files { + NavDisplayC.cpp + } +} + +project(NavDisplay_svnt) : ciao_servant { + after += HUDisplay_svnt NavDisplay_stub + sharedname = NavDisplay_svnt + libs += NavDisplay_stub HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=NAVDISPLAY_SVNT_Export + idlflags += -Wb,export_include=NavDisplay_svnt_export.h + dynamicflags = NAVDISPLAY_SVNT_BUILD_DLL + + CIDL_Files { + NavDisplay.cidl + } + + IDL_Files { + NavDisplayE.idl + } + + Source_Files { + NavDisplayEC.cpp + NavDisplayS.cpp + NavDisplay_svnt.cpp + } +} + + +project(NavDisplay_exec) : ciao_component { + after += NavDisplay_svnt + sharedname = NavDisplay_exec + libs += NavDisplay_stub NavDisplay_svnt HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=NAVDISPLAY_EXEC_Export + idlflags += -Wb,export_include=NavDisplay_exec_export.h + dynamicflags = NAVDISPLAY_EXEC_BUILD_DLL + + IDL_Files { + NavDisplayEI.idl + } + + Source_Files { + NavDisplayEIC.cpp + NavDisplay_exec.cpp + } +} diff --git a/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/DetailView.cpp b/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/DetailView.cpp new file mode 100644 index 00000000000..95125600100 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/DetailView.cpp @@ -0,0 +1,165 @@ +// $Id$ + +#include "DetailView.h" +#include <qlayout.h> +#include <qpushbutton.h> +#include <qtabwidget.h> +#include <qtable.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qspinbox.h> + + +DetailView::DetailView(QWidget *parent, const char *name) +: QWidget(parent, name), current_unit(NULL) +{ + QGridLayout *grid = new QGridLayout(this, 8, 10); + + // Create a label containing a QMovie + separatorlabel = new QLabel(this, "label0" ); + + grid->addMultiCellWidget(separatorlabel, 0, 0, 0, 9); + + QLabel *sem_id_label = new QLabel("FDN:", this); + grid->addWidget(sem_id_label, 1, 0); + sem_id_val = new QLineEdit(this); + sem_id_val->setReadOnly(1); + grid->addMultiCellWidget(sem_id_val, 1, 1, 1, 7); + + QLabel *descr_label = new QLabel("Description:", this); + grid->addWidget(descr_label, 2, 0); + descr_edit = new QLineEdit(this); + grid->addMultiCellWidget(descr_edit, 2, 2, 1, 7); + + QLabel *x_label = new QLabel("X coordinate:", this); + grid->addWidget(x_label, 3, 0); + x_edit = new QSpinBox(this); + x_edit->setMinValue(0); + x_edit->setMaxValue(65535); + grid->addWidget(x_edit, 3, 1); + + QLabel *y_label = new QLabel("Y coordinate:", this); + grid->addWidget(y_label, 3, 3); + y_edit = new QSpinBox(this); + y_edit->setMinValue(0); + y_edit->setMaxValue(65535); + grid->addWidget(y_edit, 3, 4); + + QLabel *z_label = new QLabel("Z coordinate:", this); + grid->addWidget(z_label, 3, 6); + z_edit = new QSpinBox(this); + z_edit->setMinValue(0); + z_edit->setMaxValue(65535); + grid->addWidget(z_edit, 3, 7); + + // Create a label containing a QMovie + QString path_to_movie; + char *ace_root = getenv("ACE_ROOT"); + if(ace_root) + { + path_to_movie += ace_root; + path_to_movie += "/TAO/CIAO/examples/handcrafted/Display/NavDisplayGUI_exec/trolltech.gif"; + } + else + { + path_to_movie = "../NavDisplayGUI_exec/trolltech.gif"; + } + movie = QMovie(path_to_movie); + movielabel = new QLabel(this, "label1" ); + movie.connectStatus(this, SLOT(movieStatus(int))); + movie.connectUpdate(this, SLOT(movieUpdate(const QRect&))); + movielabel->setFrameStyle( QFrame::Box | QFrame::Plain ); + movielabel->setMovie(movie); + movielabel->setFixedSize( 128+movielabel->frameWidth()*2, + 64+movielabel->frameWidth()*2 ); + grid->addMultiCellWidget(new QLabel("", this), 1, 4, 8, 8); + grid->addMultiCellWidget(movielabel, 1, 4, 9, 9); + + + QPushButton *apply = new QPushButton("Apply", this); + apply->setDefault(1); + grid->addWidget(apply, 7, 9); + + connect(apply, SIGNAL(clicked()), this, SLOT(apply())); + + QTabWidget *tabs = new QTabWidget(this); + + + child_list = new QTable(0, 6, tabs); + child_list->setSelectionMode(QTable::Single); + child_list->horizontalHeader()->setLabel(0, "FDN"); + child_list->horizontalHeader()->setLabel(1, "Description"); + child_list->horizontalHeader()->setLabel(2, "X Coordinate"); + child_list->horizontalHeader()->setLabel(3, "Y Coordinate"); + child_list->horizontalHeader()->setLabel(4, "Z Coordinate"); + child_list->horizontalHeader()->setLabel(5, "Color"); + + parent_list = new QTable(0, 6, tabs); + parent_list->setSelectionMode(QTable::Single); + parent_list->horizontalHeader()->setLabel(0, "FDN"); + parent_list->horizontalHeader()->setLabel(1, "Description"); + parent_list->horizontalHeader()->setLabel(2, "X Coordinate"); + parent_list->horizontalHeader()->setLabel(3, "Y Coordinate"); + parent_list->horizontalHeader()->setLabel(4, "Z Coordinate"); + parent_list->horizontalHeader()->setLabel(5, "Color"); + + tabs->addTab(child_list, "Property set &1"); + tabs->addTab(parent_list, "Property set &2"); + + grid->addMultiCellWidget(new QLabel(this), 4, 4, 0, 9); + grid->addMultiCellWidget(tabs, 5, 5, 0, 9); +} + + +DetailView::~DetailView() +{ +} + + +void +DetailView::currentNode(NavUnit *unit) +{ + UnitLocation loc = unit->getLocation(); + descr_edit->setText(unit->getShortDescr()); + this->updateLocation(loc); +} + +void +DetailView::updateLocation(const UnitLocation &loc) +{ + x_edit->setValue(static_cast<int>(loc.x_)); + y_edit->setValue(static_cast<int>(loc.y_)); + z_edit->setValue(static_cast<int>(loc.z_)); +} + +void +DetailView::apply() +{ +} + + +void +DetailView::movieUpdate( const QRect& ) +{ + // Uncomment this to test animated icons on your window manager + //setIcon( movie.framePixmap() ); +} + + +void +DetailView::movieStatus( int s ) +{ + switch ( s ) { + case QMovie::SourceEmpty: + case QMovie::UnrecognizedFormat: + { + QPixmap pm("tt-logo.png"); + movielabel->setPixmap(pm); + movielabel->setFixedSize(pm.size()); + } + break; + default: + if ( movielabel->movie() ) // for flicker-free animation: + movielabel->setBackgroundMode( NoBackground ); + } +} diff --git a/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc b/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc new file mode 100644 index 00000000000..cb5cea1b621 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/NavDisplayGUI.mpc @@ -0,0 +1,44 @@ +// $Id$ +project(NavDisplayGUI_exec) : ciao_component, qt { + after += NavDisplay_exec + requires += qt + sharedname = NavDisplayGUI_exec + libs += NavDisplay_stub NavDisplay_svnt HUDisplay_stub HUDisplay_svnt + libpaths += .. ../NavDisplay + dynamicflags = NAVDISPLAY_EXEC_BUILD_DLL QT_DLL + includes += ../NavDisplay + idlflags += -I ../NavDisplay -Wb,export_macro=NAVDISPLAY_EXEC_Export -Wb,export_include=NavDisplay_exec_export.h + + IDL_Files { + gendir = . + ../NavDisplay/NavDisplayEI.idl + } + + Source_Files { + NavDisplayEIC.cpp + AddNavUnitCmd.cpp + DetailView.cpp + MapView.cpp + NavUnit.cpp + NodeItem.cpp + QuitCmd.cpp + RootPanel.cpp + UpdatePositionCmd.cpp + Worker.cpp + NavDisplayGUI_exec.cpp + } + + MOC_Files { + DetailView.h + MapView.h + NodeItem.h + RootPanel.h + } + Source_Files { + DetailView_moc.cpp + MapView_moc.cpp + NodeItem_moc.cpp + RootPanel_moc.cpp + } + +} diff --git a/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp b/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp new file mode 100644 index 00000000000..224e0cac41b --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/NavDisplayGUI_exec.cpp @@ -0,0 +1,208 @@ +// $Id$ + +#include "NavDisplayGUI_exec.h" +#include "CIAO_common.h" +#include <qapplication.h> +#include <qevent.h> + +#include "UpdatePositionCmd.h" +#include "QuitCmd.h" +#include "AddNavUnitCmd.h" +#include "Worker.h" + +static const char *argv[] = +{ + "NavDisplayGUI" +}; + +/// Default constructor. +MyImpl::NavDisplayGUI_exec_impl::NavDisplayGUI_exec_impl () +: unit_(1, "Model T3+"), loc_(50, 20, 0) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::NavDisplayGUI_exec_impl ()\n")); +} + +/// Default destructor. +MyImpl::NavDisplayGUI_exec_impl::~NavDisplayGUI_exec_impl () +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::~NavDisplayGUI_exec_impl ()\n")); +} + +// Operations from HUDisplay::NavDisplay + +void +MyImpl::NavDisplayGUI_exec_impl::push_Refresh ( + HUDisplay::tick * /* ev */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + //ACE_DEBUG ((LM_DEBUG, "ENTER: MyImpl::NavDisplayGUI_exec_impl::push_Refresh()\n")); + + // Refresh position + HUDisplay::position_var loc = + this->context_->get_connection_GPSLocation (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long lx = loc->posx (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Long ly = loc->posy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + mutex_.acquire(); + + loc_.x_ = lx % 500; + loc_.y_ = ly % 300; + + this->unit_.setLocation(loc_); + + mutex_.release(); + + //ACE_DEBUG ((LM_DEBUG, "DISPLAY: Current Location is: %d %d\n", int(attrs.x_), int(attrs.y_))); + + RootPanel *root_pane = worker_->getMainWindow(); + if(root_pane) + { + UpdatePositionCmd *cmd = UpdatePositionCmd::create( + root_pane, &(this->unit_)); + QCustomEvent *evt = new QCustomEvent(QEvent::User, cmd); + QApplication::postEvent(root_pane, evt); + } + + //ACE_DEBUG ((LM_DEBUG, "LEAVE: MyImpl::NavDisplayGUI_exec_impl::push_Refresh()\n")); +} + +// Operations from Components::SessionComponent +void +MyImpl::NavDisplayGUI_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::NavDisplayGUI_exec_impl::set_session_context\n")); + + this->context_ = + HUDisplay::CCM_NavDisplay_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. +} + +void +MyImpl::NavDisplayGUI_exec_impl::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::NavDisplayGUI_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "ENTER: MyImpl::NavDisplayGUI_exec_impl::ccm_activate\n")); + + worker_ = new Worker(sizeof(argv)/sizeof(argv[0]), const_cast<char **> (argv)); + + if (worker_->activate(THR_NEW_LWP | THR_JOINABLE, 1) != 0) + { + ACE_DEBUG((LM_ERROR, + "Cannot activate client threads\n")); + ACE_THROW(Components::CCMException()); + } + + worker_->waitUntillInitialized(); + + AddNavUnitCmd *cmd = AddNavUnitCmd::create( + worker_->getMainWindow(), &(this->unit_)); + QCustomEvent *evt = new QCustomEvent(QEvent::User, cmd); + QApplication::postEvent(worker_->getMainWindow(), evt); + + + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "LEAVE: MyImpl::NavDisplayGUI_exec_impl::ccm_activate\n")); +} + +void +MyImpl::NavDisplayGUI_exec_impl::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::NavDisplayGUI_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::NavDisplayGUI_exec_impl::ccm_passivate\n")); + + RootPanel *target = worker_->getMainWindow(); + if(target) + { + QuitCmd *cmd = QuitCmd::create(target); + QCustomEvent *evt = new QCustomEvent(QEvent::User, cmd); + QApplication::postEvent(target, evt); + worker_->thr_mgr()->wait(); + } + + delete worker_; +} + +void +MyImpl::NavDisplayGUI_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::NavDisplayGUI_exec_impl::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::NavDisplayGUIHome_exec_impl::NavDisplayGUIHome_exec_impl () +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + "MyImpl::NavDisplayGUI_exec_impl::NavDisplayGUIHome_exec_impl ()\n")); +} + +/// Default dtor. +MyImpl::NavDisplayGUIHome_exec_impl::~NavDisplayGUIHome_exec_impl () +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + "MyImpl::NavDisplayGUI_exec_impl::~NavDisplayGUIHome_exec_impl ()\n")); +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::NavDisplayGUIHome_exec_impl::create (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + "MyImpl::NavDisplayGUIHome_exec_impl::create()\n")); + + return new MyImpl::NavDisplayGUI_exec_impl; +} + + +extern "C" NAVDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +createNavDisplayHome_Impl (void) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "createNavDisplayHome_Impl()\n")); + return new MyImpl::NavDisplayGUIHome_exec_impl; +} diff --git a/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/README b/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/README new file mode 100644 index 00000000000..c5cb76a6fd9 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/NavDisplayGUI_exec/README @@ -0,0 +1,15 @@ +This example is the Qt-based GUI implementation of NavDisplay component. + +It is NOT necessary to compile ACE/TAO/CIAO with Qt support, +since this example does not relyes on Qt Reactor and +communicates with GUI part using QApplication::postMessage() and +simple Command Pattern based framework. But be sure that QTDIR +environment variable is pointed to your Qt installation directory. + +If you need to build this component, make sure you have the necessary +Qt libraries/tools installed, and define + +qt = 1 + +in $(ACE_ROOT)/bin/MakeProjectCreator/config/default.features before +creating the workspace/project for this example. diff --git a/TAO/CIAO/examples/OEP/Display/RateGen/RateGen.mpc b/TAO/CIAO/examples/OEP/Display/RateGen/RateGen.mpc new file mode 100644 index 00000000000..649aa038b66 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/RateGen/RateGen.mpc @@ -0,0 +1,99 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -l .. -p HUDisplay -i -c RateGen" + +project(RateGen_stub): ciao_client { + after += HUDisplay_stub + sharedname = RateGen_stub + + idlflags += -Wb,stub_export_macro=RATEGEN_STUB_Export + idlflags += -Wb,stub_export_include=RateGen_stub_export.h + idlflags += -Wb,skel_export_macro=RATEGEN_SVNT_Export + idlflags += -Wb,skel_export_include=RateGen_svnt_export.h + + dynamicflags = RATEGEN_STUB_BUILD_DLL + + libs += HUDisplay_stub + + IDL_Files { + RateGen.idl + } + + Source_Files { + RateGenC.cpp + } +} + +project(RateGen_svnt) : ciao_servant { + after += HUDisplay_svnt RateGen_stub + sharedname = RateGen_svnt + libs += RateGen_stub HUDisplay_stub HUDisplay_svnt + libpaths += .. + idlflags += -Wb,export_macro=RATEGEN_SVNT_Export + idlflags += -Wb,export_include=RateGen_svnt_export.h + dynamicflags = RATEGEN_SVNT_BUILD_DLL + + CIDL_Files { + RateGen.cidl + } + + IDL_Files { + RateGenE.idl + } + + Source_Files { + RateGenEC.cpp + RateGenS.cpp + RateGen_svnt.cpp + } +} + + +project(RateGen_exec) : ciao_component { + after += RateGen_svnt + sharedname = RateGen_exec + libs += RateGen_stub HUDisplay_stub RateGen_svnt + libpaths += .. + idlflags += -Wb,export_macro=RATEGEN_EXEC_Export + idlflags += -Wb,export_include=RateGen_exec_export.h + dynamicflags = RATEGEN_EXEC_BUILD_DLL + + IDL_Files { + RateGenEI.idl + } + + Source_Files { + RateGenEIC.cpp + RateGen_exec.cpp + } +} + + + +project (RateGen_client) : ciao_client, valuetype { + exename = client + after += RateGen_stub + libs += RateGen_stub HUDisplay_stub + libpaths += .. + + IDL_Files { + } + + Source_Files { + client.cpp + } +} + + +project (RateGen_controller) : ciao_client, valuetype { + exename = controller + after += RateGen_stub + libs += RateGen_stub HUDisplay_stub + libpaths += .. + + IDL_Files { + } + + Source_Files { + controller.cpp + } +} diff --git a/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.cpp b/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.cpp new file mode 100644 index 00000000000..a79c4d0a3b1 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.cpp @@ -0,0 +1,341 @@ +// $Id$ + +#include "RateGen_exec.h" +#include "CIAO_common.h" +#include "ace/Timer_Queue.h" +#include "ace/Reactor.h" + +//================================================================= + +MyImpl::Pulse_Handler::Pulse_Handler (MyImpl::RateGen_exec_i *cb) + : active_ (0), + done_ (0), + tid_ (0), + pulse_callback_ (cb) +{ + // Nothing + this->reactor (new ACE_Reactor); +} + +MyImpl::Pulse_Handler::~Pulse_Handler () +{ + delete this->reactor (); + this->reactor (0); +} + +int +MyImpl::Pulse_Handler::open_h () +{ + return this->activate (); +} + +int +MyImpl::Pulse_Handler::close_h () +{ + this->done_ = 1; + this->reactor ()->notify (); + + if (CIAO::debug_level () > 0) + { + ACE_DEBUG ((LM_DEBUG, "Waiting\n")); + } + + return this->wait (); +} + +int +MyImpl::Pulse_Handler::start (CORBA::Long hertz) +{ + if (hertz == 0 || this->active_ != 0) // Not valid + { + return -1; + } + + long usec = 1000000 / hertz; + + this->tid_ = this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)); + + this->active_ = 1; + return 0; +} + +int +MyImpl::Pulse_Handler::stop (void) +{ + if (this->active_ == 0) // Not valid. + { + return -1; + } + + this->reactor ()->cancel_timer (this); + + this->active_ = 0; + return 0; +} + +int +MyImpl::Pulse_Handler::active (void) +{ + return this->active_; +} + +int +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)); + } + + return 0; +} + +int +MyImpl::Pulse_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + this->pulse_callback_->pulse (); + +// ACE_DEBUG ((LM_DEBUG, +// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"), +// this, +// tv.sec (), +// tv.usec ())); + + return 0; +} + +int +MyImpl::Pulse_Handler::svc (void) +{ + this->reactor ()->owner (ACE_OS::thr_self ()); + + while (!this->done_) + { + this->reactor ()->handle_events (); + } + + return 0; +} + +//================================================================= + +MyImpl::RateGen_exec_i::RateGen_exec_i () + : hertz_ (0), + pulser_ (this) +{ + +} + +MyImpl::RateGen_exec_i::RateGen_exec_i (CORBA::Long hz) + : hertz_ (hz), + pulser_ (this) +{ +} + +MyImpl::RateGen_exec_i::~RateGen_exec_i () +{ +} + +CORBA::Long +MyImpl::RateGen_exec_i::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->hertz_; +} + +void +MyImpl::RateGen_exec_i::hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->hertz_ = hertz; +} + +// Operations from supported interface(s) + +void +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 ()); + } + + // @@ Start the rate generator + this->pulser_.start (this->hertz_); +} + +void +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 ()); + } + + // @@ stop the rate generator + this->pulser_.stop (); +} + +CORBA::Boolean +MyImpl::RateGen_exec_i::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->pulser_.active (); +} + +// Operations from Components::SessionComponent + +void +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")); + } + + this->context_ = + HUDisplay::CCM_RateGen_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + // Urm, we actually discard exceptions thown from this operation. + +} + +void +MyImpl::RateGen_exec_i::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::RateGen_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::RateGen_exec_i::ccm_activate\n")); + } + + this->pulser_.open_h (); +} + +void +MyImpl::RateGen_exec_i::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::RateGen_exec_i::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::RateGen_exec_i::ccm_passivate\n")); + } + + this->pulser_.close_h (); +} + +void +MyImpl::RateGen_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::RateGen_exec_i::ccm_remove\n")); + } +} + +void +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"))); + } + + HUDisplay::tick_var ev = new OBV_HUDisplay::tick (); + + this->context_->push_Pulse (ev.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // @@ do nothing? + } + ACE_ENDTRY; + +} + +MyImpl::RateGenHome_exec_i::RateGenHome_exec_i () +{ +} + +MyImpl::RateGenHome_exec_i::~RateGenHome_exec_i () +{ +} + +::Components::EnterpriseComponent_ptr +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 ()); + ACE_CHECK_RETURN (tmp); + + return tmp; +} + +::Components::EnterpriseComponent_ptr +MyImpl::RateGenHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::RateGen_exec_i (); +} + + +extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr +createRateGenHome_Impl (void) +{ + return new MyImpl::RateGenHome_exec_i (); +} diff --git a/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.h b/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.h new file mode 100644 index 00000000000..7e29d047e75 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/RateGen/RateGen_exec.h @@ -0,0 +1,187 @@ +// $Id$ + +/** + * @file RateGen_exec.h + * + * Header file for the actualy RateGen and RateGenHome component + * implementation. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef RATEGEN_EXEC_H +#define RATEGEN_EXEC_H + +#include "RateGenEIC.h" +#include "tao/LocalObject.h" +#include "ace/Thread_Manager.h" +#include "ace/Task.h" + +namespace MyImpl +{ + // Forward decl. + class RateGen_exec_i; + + /** + * @brief Active pulse generater + */ + class Pulse_Handler : public ACE_Task_Base + { + public: + // Default constructor + Pulse_Handler (RateGen_exec_i *cb); + ~Pulse_Handler (); + + int open_h (void); + + int close_h (void); + + int start (CORBA::Long hertz); + + int stop (void); + + int active (void); + + // Handle the timeout. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + // Called when <Time_Handler> is removed. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + virtual int svc (void); + + private: + /// Tracking whether we are actively generating pulse or not. + long active_; + + /// Flag to indicate completion of this active object. + int done_; + + /// The timer id we are waiting. + int tid_; + + RateGen_exec_i *pulse_callback_; + + ACE_Thread_Manager thr_mgr_; + }; + + /** + * @class RateGen_exec_i + * + * RateGen executor implementation class. + */ + class RATEGEN_EXEC_Export RateGen_exec_i : + public virtual HUDisplay::RateGen_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + RateGen_exec_i (); + + /// Initialize with a default frequency. + RateGen_exec_i (CORBA::Long hz); + + /// Default destructor. + ~RateGen_exec_i (); + + // Attribute operations. + + virtual CORBA::Long hertz (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from supported interface(s) + + virtual void start (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void stop (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean active (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from Components::SessionComponent + + virtual void set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + /// Helper function to be called back by Pulse_Handler + void pulse (void); + + protected: + /// Frequency + CORBA::Long hertz_; + + /// 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_i + * + * RateGen home executor implementation class. + */ + class RATEGEN_EXEC_Export RateGenHome_exec_i : + public virtual HUDisplay::CCM_RateGenHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + RateGenHome_exec_i (); + + /// Default dtor. + ~RateGenHome_exec_i (); + + // Explicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + new_RateGen (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +extern "C" RATEGEN_EXEC_Export ::Components::HomeExecutorBase_ptr +createRateGenHome_Impl (void); + +#endif /* RATEGEN_EXEC_H */ diff --git a/TAO/CIAO/examples/OEP/Display/descriptors/NOTE-win.txt b/TAO/CIAO/examples/OEP/Display/descriptors/NOTE-win.txt new file mode 100644 index 00000000000..463c05cb080 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/descriptors/NOTE-win.txt @@ -0,0 +1,91 @@ +Conventional test: +================== + +Remote Daemon: +-------------- + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Remote Daemon + .....\tools\Daemon\CIAO_Daemon -ORBEndpoint iiop://localhost:12000 -n ../../../../tools/ComponentServer/ComponentServer + +Local Daemon: +-------------- + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Local Daemon + .....\tools\Daemon\CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/ComponentServer/ComponentServer + + +Assembly Manager +----------------- + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Assembly Manager + .....\tools\Assembly_Deployer\Assembly_Manager -o ior -c test.dat + +Assembly Deployer +----------------- + + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Assembly Deployer + .....\tools\Assembly_Deployer\Assembly_Deployer -k file://ior -a HUDisplay.cad -o IDfile + +client +------ + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Client + ..\RateGen\controller -o + + +Tearing down the application: +----------------------------- + + .....\tools\Assembly_Deployer\Assembly_Deployer -k file://ior -d IDfile + + +RT-server-test: +=============== + +Remote Daemon: +-------------- + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Remote Daemon + .....\tools\Daemon\CIAO_Daemon -ORBEndpoint iiop://localhost:12000 -n ../../../../tools/RTComponentServer/RTComponentServer -m svcmap.dat + +Local Daemon: +-------------- + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Local Daemon + .....\tools\Daemon\CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/RTComponentServer/RTComponentServer -m svcmap.dat + + +Assembly Manager +----------------- + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Assembly Manager + .....\tools\Assembly_Deployer\Assembly_Manager -o ior -c test.dat + +Assembly Deployer +----------------- + + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Assembly Deployer + .....\tools\Assembly_Deployer\Assembly_Deployer -k file://ior -a HUDisplay-rtcad.cad -o IDfile + +client +------ + + w:\TAO\CIAO\examples\OEP\Display\descriptors\ + title Controller + ..\RateGen\controller -o + +Tearing down the application: +----------------------------- + + .....\tools\Assembly_Deployer\Assembly_Deployer -k file://ior -d IDfile diff --git a/TAO/CIAO/examples/OEP/Display/descriptors/NOTE.txt b/TAO/CIAO/examples/OEP/Display/descriptors/NOTE.txt new file mode 100644 index 00000000000..902735238e3 --- /dev/null +++ b/TAO/CIAO/examples/OEP/Display/descriptors/NOTE.txt @@ -0,0 +1,140 @@ +This directory contains various XML descriptors and configuration +files required to compose the HUDisplay application in a variety of +different ways. Let's go over a few important files first: + +test.dat: +--------- + + This file describes the deployment daemons CIAO's Assembly_Manager + will contact to instantiate ComponentServer's, home's, and component + instances. Each line specify the name of a installation + "destination" (I used this to specify <processcollocation> + destination in various *.cad files) and the corresponding IOR for + the CIAO_Daemon. The first entry is the "default" destination the + deployment framework will use. + + For example, test.dat now contains: + + Default corbaloc:iiop:localhost:10000/ServerActivator + Remote corbaloc:iiop:localhost:12000/ServerActivator + + You can copy and modify the copy to deploy the components in various + different locations to let the application truely "distributed". + For example, changing the remote ServerActivator to: + corbaloc:iiop:deuce.doc.wustl.edu:13000/ServerActivator + + Remember to start up the Assembly_Manager in Step 2 using the + revised "test.dat" you created, and start up the CIAO_Daemon's in + Step 1 according to the specification. + +*.cad: +------ + + These files specify how an application should be composed. The + specification includes, where to install a component, what + implementation to use, and how to connect components together. + Currently, we have: + + BasicSP.cad: Plain vanilla assembly descriptor. This file install + all components using the "Default" (the first daemon) + in 'test.dat. You can see the application output + from the default daemon shell. + +Unfortunately, there's no run_test.pl for starting and running these +example configurations/assemblies as these daemons/managers programs +are still under development. You will need several shell windows for +them. All the following step should be run from this subdirectory +($CIAO_ROOT/examples/OEP/Display/descriptors/). Here are the +steps to demonstrate the examples: + +Step 1: +======= + + You need to start up the CIAO daemon as specified in the + deployment configuration file 'test.dat' (Notice the endpoint + specification.) If you run more than one daemon (each with its + own host port), I recommend running each CIAO_Daemon in its own + shell window so you can tell where a component in the example + application is running. Here are some hints on how to start the + daemon: + + ${CIAO_ROOT}/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/ComponentServer/ComponentServer + + and on Windows + + %CIAO_ROOT%/tools/Daemon/CIAO_Daemon -ORBEndpoint iiop://localhost:10000 -n ../../../../tools/ComponentServer/ComponentServer + + Note that the environment variable CIAO_ROOT must be set + (to TAO_ROOT/CIAO). + +Step 2: +======= + + Next, you will need to start up the Assembly_Manager which actually + does the assembly work. This should also be started in a separate + shell window. + + ${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat + + or + + %CIAO_ROOT%/tools/Assembly_Deployer/Assembly_Manager -o ior -c test.dat + +Step 3: +======= + + You then need to instruct the Assembly_Manager to deploy a specific + component assembly descriptor. For example: + + ${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Deployer -k file://ior -a BasicSP.cad -o IDfile + + or + + %CIAO_ROOT%/tools/Assembly_Deployer/Assembly_Deployer -k file://ior -a BasicSP.cad -o IDfile + +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. Cont + + Execute the controller with: + + ..\EC\controller -o # To switch on the EC component + + See its source to check what options are available to start up the + controller. (Hints: you can control the rate (hertz) of the Rate + Generator component.) + + Once the controller is running, check out the Daemon window for + text-based BMClosedED and BMDisplay components. Once you are + happy with it, you can stop the EC component by executing the + controller as: + + ../EC/controller -f # To switch off the EC component + + Repeat this step again to instruct the EC component to start + generating events. + +Step 5: +======= + + Once you are done with the test. Use the following command to + tear_down the application, kill all ComponentServer's, and terminate + both the Assembly_Deployer and Assembly_Manager process. + + ${CIAO_ROOT}/tools/Assembly_Deployer/Assembly_Deployer -k file://ior -d IDfile + + or + + %CIAO_ROOT%/tools/Assembly_Deployer/Assembly_Deployer -k file://ior -d IDfile + + Repeat Step 2-5 using different configurations and assembly + descriptors. + +Step 6: +======= + + Terminate CIAO_Daemon (either using ^C or DaemonController.) |