diff options
16 files changed, 2521 insertions, 5 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index c1750011770..c4a23d09934 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,21 @@ +Wed May 14 15:50:12 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> + + + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED.idl: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED.mpc: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedEDE.idl: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedEDEI.idl: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec.cpp: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec.h: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec_export.h: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED_stub_export.h: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt.cpp: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt.h: + * examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt_export.h: + * examples/handcrafted/BasicSP/EC/EC.idl: Implementation for the + BMClosedED component. + + Tue May 13 23:26:18 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> * examples/handcrafted/BasicSP/BasicSP_svnt.cpp: diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED.idl b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED.idl index 251c5a45fc9..2fe200151fe 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED.idl +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED.idl @@ -5,10 +5,10 @@ module BasicSP { component BMClosedED { - provides ReadData dataOut; - uses ReadData dataIn; - publishes DataAvailable outDataAvailable; - consumes DataAvailable inDataAvailable; + provides ReadData dataout; + uses ReadData datain; + publishes DataAvailable out_avail; + consumes DataAvailable in_avail; }; home BMClosedEDHome manages BMClosedED diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED.mpc b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED.mpc new file mode 100644 index 00000000000..1cc925cd2b3 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED.mpc @@ -0,0 +1,57 @@ +// $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 { + depends += BasicSP_stub + sharedname = BMClosedED_stub + idlflags += -Wb,stub_export_macro=BMCLOSEDED_STUB_Export -Wb,stub_export_include=BMClosedED_stub_export.h -Wb,skel_export_macro=BMCLOSEDED_SVNT_Export -Wb,skel_export_include=BMClosedED_svnt_export.h + dllflags = BMCLOSEDED_STUB_BUILD_DLL + + IDL_Files { + BMClosedED.idl + } + + Source_Files { + BMClosedEDC.cpp + } +} + +project(BMClosedED_svnt) : ciao_server { + depends += 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 + dllflags = BMCLOSEDED_SVNT_BUILD_DLL + + IDL_Files { + BMClosedEDE.idl + } + + Source_Files { + BMClosedEDEC.cpp + BMClosedEDS.cpp + BMClosedED_svnt.cpp + } +} + + +project(BMClosedED_exec) : ciao_server { + depends += 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 + dllflags = BMCLOSEDED_EXEC_BUILD_DLL + + IDL_Files { + BMClosedEDEI.idl + } + + Source_Files { + BMClosedEDEIC.cpp + BMClosedED_exec.cpp + } +} + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedEDE.idl b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedEDE.idl new file mode 100644 index 00000000000..7b2676cd902 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedEDE.idl @@ -0,0 +1,76 @@ +// $Id$ + +// =========================================================== +// +// @file BMClosedED.idl +// +// Generated based on $(CIAO_ROOT)/docs/templates/Executor.idl +// +// @author Balachandran Natarajan <bala@dre.vanderbilt.edu> +// +// =========================================================== + +#ifndef CIAO_BMCLOSED_IDL +#define CIAO_BMCLOSED_IDL + +#include "CCM_Container.idl" // Found in $(CIAO_ROOT)/ciao + // For various definitions of container + // internal/callback interfaces +#include "BMClosedED.idl" // Original component IDL definition +#include "../BasicSPE.idl" + +module BasicSP { + + // Component Main Executor Interface. We currently do not + // support Executor-based implementation. + + local interface CCM_BMClosed_Executor + : ::Components::EnterpriseComponent + { + }; + + // Monolithic component executor. + // For implementing monolithic component call back interface. + + local interface CCM_BMClosedED + : ::Components::EnterpriseComponent + { + CCM_ReadData get_dataout (); + + void push_in_avail (in DataAvailable a); + }; + + /** + * Component Context Interface + * + * Notice that we are taking a shortcut here to inherit the + * component-specific context from SessionContext directly instead + * of CCMContext. + */ + local interface CCM_BMClosedED_Context + : Components::SessionContext + { + void push_out_avail (in DataAvailable a); + ReadData get_connection_datain (); + }; + + local interface CCM_BMClosedEDHomeExplicit + : ::Components::HomeExecutorBase + { + }; + + local interface CCM_BMClosedEDHomeImplicit + { + ::Components::EnterpriseComponent create () + raises (::Components::CCMException); + }; + + local interface CCM_BMClosedEDHome + : CCM_BMClosedEDHomeExplicit, + CCM_BMClosedEDHomeImplicit + { + }; + +}; + +#endif /* CIAO_BMCLOSED_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedEDEI.idl b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedEDEI.idl new file mode 100644 index 00000000000..82f2b51870e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedEDEI.idl @@ -0,0 +1,33 @@ +// $Id$ + +/** + * @file GPSEI.idl + * + * Definition of the GPS component implementation. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#ifndef CIAO_BMCLOSEDEDI_IDL +#define CIAO_BMCLOSEDEDI_IDL + +#include "BMClosedEDE.idl" + +module BasicSP +{ + /** + * @interface BMClosedED_Exec + * + * The actually GPS executor inherits from both CCM_GPS and + * CCM_position interfaces as a monolithic implementation. + */ + local interface BMClosedED_Exec : + CCM_BMClosedED, + CCM_ReadData, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_BMCLOSEDEDI_IDL*/ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec.cpp b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec.cpp new file mode 100644 index 00000000000..cf71d9a325f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec.cpp @@ -0,0 +1,141 @@ +// $Id$ + +#include "BMClosedED_exec.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) + 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)) +{ + + 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_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (dat.in ())) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + this->str_ = + dat->get_data (); + + ACE_DEBUG ((LM_DEBUG, + "BMDisplay - Display data is [%s] \n", + this->str_.in ())); + + // Nitify 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) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return 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)) +{ + 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::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::BMClosedED_exec_i::ccm_activate\n")); +} + +void +MyImpl::BMClosedED_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + 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)) +{ + 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)) +{ + return new MyImpl::BMClosedED_exec_i; +} + + +extern "C" BMCLOSEDED_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMClosedEDHome_Impl (void) +{ + return new MyImpl::BMClosedEDHome_exec_i; +} diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec.h b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec.h new file mode 100644 index 00000000000..870ca679dfe --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec.h @@ -0,0 +1,119 @@ +// $Id$ + +//================================================================ +/** + * @file BMClosedED_exec.h + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//================================================================ + +#ifndef CIAO_BMCLOSED_EXEC_H +#define CIAO_BMCLOSED_EXEC_H + +#include "BMClosedEDEIC.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 BMClosedED_exec_i + * + * An example RateGen executor implementation class. + */ + class BMCLOSEDED_EXEC_Export BMClosedED_exec_i : + public virtual BasicSP::BMClosedED_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. + BMClosedED_exec_i (void); + + /// Default destructor. + ~BMClosedED_exec_i (void); + + // Operations from HUDisplay::BMClosedED + + virtual BasicSP::CCM_ReadData_ptr + get_dataout (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_in_avail (BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from HUDisplay::position + virtual char * + get_data (ACE_ENV_SINGLE_ARG_DECL) + 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 + ccm_activate (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)); + protected: + CORBA::String_var str_; + + /// Copmponent specific context + BasicSP::CCM_BMClosedED_Context_var context_; + }; + + /** + * @class BMClosedEDHome_exec_i + * + * BMClosedED home executor implementation class. + */ + class BMCLOSEDED_EXEC_Export BMClosedEDHome_exec_i : + public virtual BasicSP::CCM_BMClosedEDHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + BMClosedEDHome_exec_i (); + + /// Default dtor. + ~BMClosedEDHome_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// Executor DLL entry point. CIAO's deployment and assembly framework +// invokes this function on the resulting DLL to get the home executor. +extern "C" BMCLOSEDED_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMClosedEDHome_Impl (void); + +#endif /* CIAO_BMCLOSED_EXEC_H*/ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec_export.h b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec_export.h new file mode 100644 index 00000000000..b2d7ae01e02 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMCLOSEDED_EXEC +// ------------------------------ +#ifndef BMCLOSEDED_EXEC_EXPORT_H +#define BMCLOSEDED_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMCLOSEDED_EXEC_HAS_DLL) +# define BMCLOSEDED_EXEC_HAS_DLL 1 +#endif /* ! BMCLOSEDED_EXEC_HAS_DLL */ + +#if defined (BMCLOSEDED_EXEC_HAS_DLL) && (BMCLOSEDED_EXEC_HAS_DLL == 1) +# if defined (BMCLOSEDED_EXEC_BUILD_DLL) +# define BMCLOSEDED_EXEC_Export ACE_Proper_Export_Flag +# define BMCLOSEDED_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMCLOSEDED_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMCLOSEDED_EXEC_BUILD_DLL */ +# define BMCLOSEDED_EXEC_Export ACE_Proper_Import_Flag +# define BMCLOSEDED_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMCLOSEDED_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMCLOSEDED_EXEC_BUILD_DLL */ +#else /* BMCLOSEDED_EXEC_HAS_DLL == 1 */ +# define BMCLOSEDED_EXEC_Export +# define BMCLOSEDED_EXEC_SINGLETON_DECLARATION(T) +# define BMCLOSEDED_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMCLOSEDED_EXEC_HAS_DLL == 1 */ + +// Set BMCLOSEDED_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMCLOSEDED_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define BMCLOSEDED_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMCLOSEDED_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMCLOSEDED_EXEC_NTRACE */ + +#if (BMCLOSEDED_EXEC_NTRACE == 1) +# define BMCLOSEDED_EXEC_TRACE(X) +#else /* (BMCLOSEDED_EXEC_NTRACE == 1) */ +# define BMCLOSEDED_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMCLOSEDED_EXEC_NTRACE == 1) */ + +#endif /* BMCLOSEDED_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_stub_export.h b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_stub_export.h new file mode 100644 index 00000000000..a2511681640 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMCLOSEDED_STUB +// ------------------------------ +#ifndef BMCLOSEDED_STUB_EXPORT_H +#define BMCLOSEDED_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMCLOSEDED_STUB_HAS_DLL) +# define BMCLOSEDED_STUB_HAS_DLL 1 +#endif /* ! BMCLOSEDED_STUB_HAS_DLL */ + +#if defined (BMCLOSEDED_STUB_HAS_DLL) && (BMCLOSEDED_STUB_HAS_DLL == 1) +# if defined (BMCLOSEDED_STUB_BUILD_DLL) +# define BMCLOSEDED_STUB_Export ACE_Proper_Export_Flag +# define BMCLOSEDED_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMCLOSEDED_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMCLOSEDED_STUB_BUILD_DLL */ +# define BMCLOSEDED_STUB_Export ACE_Proper_Import_Flag +# define BMCLOSEDED_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMCLOSEDED_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMCLOSEDED_STUB_BUILD_DLL */ +#else /* BMCLOSEDED_STUB_HAS_DLL == 1 */ +# define BMCLOSEDED_STUB_Export +# define BMCLOSEDED_STUB_SINGLETON_DECLARATION(T) +# define BMCLOSEDED_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMCLOSEDED_STUB_HAS_DLL == 1 */ + +// Set BMCLOSEDED_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMCLOSEDED_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define BMCLOSEDED_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMCLOSEDED_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMCLOSEDED_STUB_NTRACE */ + +#if (BMCLOSEDED_STUB_NTRACE == 1) +# define BMCLOSEDED_STUB_TRACE(X) +#else /* (BMCLOSEDED_STUB_NTRACE == 1) */ +# define BMCLOSEDED_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMCLOSEDED_STUB_NTRACE == 1) */ + +#endif /* BMCLOSEDED_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt.cpp new file mode 100644 index 00000000000..f247b99155c --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt.cpp @@ -0,0 +1,1125 @@ +// $Id$ + +#include "BMClosedED_svnt.h" +#include "../BasicSP_svnt.h" +#include "Cookies.h" + +void +CIAO_GLUE_BasicSP::BMClosedED_Context::push_out_avail (BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_Active_Map_Manager<BasicSP::DataAvailableConsumer_var>::iterator + end = this->ciao_publishes_out_avail_map_.end (); + for (ACE_Active_Map_Manager<BasicSP::DataAvailableConsumer_var>::iterator + iter = this->ciao_publishes_out_avail_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager<BasicSP::DataAvailableConsumer_var>::ENTRY &entry = *iter; + BasicSP::DataAvailableConsumer_var c + = BasicSP::DataAvailableConsumer::_narrow (entry.int_id_.in ()); + c->push_DataAvailable (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + +// Operations for publishes interfaces. +::Components::Cookie * +CIAO_GLUE_BasicSP::BMClosedED_Context::subscribe_out_avail (BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + if (CORBA::is_nil (c)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + BasicSP::DataAvailableConsumer_var sub + = BasicSP::DataAvailableConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_out_avail_map_.bind (sub.in (), + key); + + sub._retn (); // Release ownership. + + ::Components::Cookie_var retv = new CIAO::Map_Key_Cookie (key); + return retv._retn (); +} + +BasicSP::DataAvailableConsumer_ptr +CIAO_GLUE_BasicSP::BMClosedED_Context::unsubscribe_out_avail (::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + BasicSP::DataAvailableConsumer_var retv; + + ACE_Active_Map_Manager_Key key; + if (ck == 0 || + CIAO::Map_Key_Cookie::extract (ck, key) == -1) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + if (this->ciao_publishes_out_avail_map_.unbind (key, + retv) != 0) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + return retv._retn (); +} + +BasicSP::ReadData_ptr +CIAO_GLUE_BasicSP::BMClosedED_Context::get_connection_datain (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return BasicSP::ReadData::_duplicate (this->ciao_uses_datain_.in ()); +} + +// Simplex [receptacle name] connection management operations +void +CIAO_GLUE_BasicSP::BMClosedED_Context::connect_datain (BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + if (! CORBA::is_nil (this->ciao_uses_datain_.in ())) + ACE_THROW (::Components::AlreadyConnected ()); + + if (CORBA::is_nil (c)) + ACE_THROW (::Components::InvalidConnection ()); + + // When do we throw InvalidConnection exception? + this->ciao_uses_datain_ = BasicSP::ReadData::_duplicate (c); +} + +BasicSP::ReadData_ptr +CIAO_GLUE_BasicSP::BMClosedED_Context::disconnect_datain (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + if (CORBA::is_nil (this->ciao_uses_datain_.in ())) + ACE_THROW (::Components::NoConnection ()); + + return this->ciao_uses_datain_._retn (); +} + + +// Operations for ::Components::SessionContext interface +CORBA::Object_ptr +CIAO_GLUE_BasicSP::BMClosedED_Context::get_CCM_object (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ How do I check for IllegalState here? When it's not in a + // callback operation... + // ACE_THROW_RETURN (::Components::IllegalState (), 0); + + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = this->container_->get_objref (this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->component_ = BasicSP::BMClosedED::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (this->component_.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); // This should not happen... + } + return BasicSP::BMClosedED::_duplicate (this->component_.in ()); +} + + + +CIAO_GLUE_BasicSP::BMClosedED_Context::BMClosedED_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + CIAO_GLUE_BasicSP::BMClosedED_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) +{ +} + + +CIAO_GLUE_BasicSP::BMClosedED_Context::~BMClosedED_Context () +{ +} + +// Operations for emits interfaces. + +// Operations for ::Components::CCMContext + ::Components::Principal_ptr +CIAO_GLUE_BasicSP::BMClosedED_Context::get_caller_principal (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ We don't support Security in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + + ::Components::CCMHome_ptr +CIAO_GLUE_BasicSP::BMClosedED_Context::get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return ::Components::CCMHome::_duplicate (this->home_.in ()); +} + + CORBA::Boolean +CIAO_GLUE_BasicSP::BMClosedED_Context::get_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + + ::Components::Transaction::UserTransaction_ptr +CIAO_GLUE_BasicSP::BMClosedED_Context::get_user_transaction (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + + CORBA::Boolean +CIAO_GLUE_BasicSP::BMClosedED_Context::is_caller_in_role (const char * role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (role); + + // @@ We don't support Transaction in CIAO yet. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + + void +CIAO_GLUE_BasicSP::BMClosedED_Context::set_rollback_only (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)) +{ + // @@ We don't support Transaction in CIAO yet. + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + + +/*******************************************************************************/ +CIAO_GLUE_BasicSP::BMClosedED_Servant::BMClosedED_Servant (BasicSP::CCM_BMClosedED_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (BasicSP::CCM_BMClosedED::_duplicate (exe)), + container_ (c) +{ + this->context_ = + new CIAO_GLUE_BasicSP::BMClosedED_Context (h, c, this); + + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (exe + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->set_session_context (this->context_ + ACE_ENV_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; +} + + +CIAO_GLUE_BasicSP::BMClosedED_Servant::~BMClosedED_Servant (void) +{ + ACE_TRY_NEW_ENV + { + Components::SessionComponent_var scom = + Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (! CORBA::is_nil (scom.in ())) + scom->ccm_remove (ACE_ENV_SINGLE_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ Ignore any exceptions? What happens if + // set_session_context throws an CCMException? + } + ACE_ENDTRY; + this->context_->_remove_ref (); +} + +// Operations for provides interfaces. +BasicSP::ReadData_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::provide_dataout (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->provide_datain_.in ())) + { + BasicSP::CCM_ReadData_var fexe + = this->executor_->get_dataout (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (fexe.in ())) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + CIAO_GLUE_BasicSP::ReadData_Servant *svt = + new CIAO_GLUE_BasicSP::ReadData_Servant (fexe.in (), + this->context_); + + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = + this->container_->install_servant (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + BasicSP::ReadData_var fo + = BasicSP::ReadData::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->provide_datain_ = fo; + } + + return BasicSP::ReadData::_duplicate (this->provide_datain_.in ()); +} + +void +CIAO_GLUE_BasicSP::BMClosedED_Servant::connect_datain (BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) +{ + this->context_->connect_datain (c + ACE_ENV_ARG_PARAMETER); +} + +BasicSP::ReadData_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::disconnect_datain (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)) +{ + return this->context_->disconnect_datain (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +BasicSP::ReadData_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_connection_datain (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_connection_datain (ACE_ENV_SINGLE_ARG_PARAMETER); +} + + +// Operations for consumers interfaces. +// EventConsumer Glue Code implementation + +// Inherit from ::Compopnents::EventConsumerBase +void +CIAO_GLUE_BasicSP::BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::push_event (Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)) +{ + BasicSP::DataAvailable_var ev_type = BasicSP::DataAvailable::_downcast (ev); + if (ev_type != 0) + { + this->push_DataAvailable (ev_type.in () + ACE_ENV_ARG_PARAMETER); + return; + } + + // @@ This include the case when we receive a parent eventtype of [eventtype] + ACE_THROW (::Components::BadEventType ()); +} + +// get_component implementation. +BasicSP::DataAvailableConsumer_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_consumer_in_avail (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->consumes_in_avail_.in ())) + { + CIAO_GLUE_BasicSP::BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant *svt = + new CIAO_GLUE_BasicSP::BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant (this->executor_.in (), + this->context_); + PortableServer::ServantBase_var safe_servant (svt); + + CORBA::Object_var obj = this->container_->install_servant (svt + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + BasicSP::DataAvailableConsumer_var eco + = BasicSP::DataAvailableConsumer::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->consumes_in_avail_ = eco; + } + + return BasicSP::DataAvailableConsumer::_duplicate (this->consumes_in_avail_.in ()); +} + +// Operations for Navigation interface +CORBA::Object_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::provide_facet (const char * name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) +{ + if (name == 0) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + // We simply iterate thru all the facets this component provides + // now. We can also use a hash map along with perfect hashing + // (i.e., gperf) if we need faster performance since all the provided + // interfaces are static to a component definition. + + if (ACE_OS_String::strcmp (name, "dataout") == 0) + return this->provide_dataout (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (::Components::InvalidName (), 0); +} + +::Components::FacetDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_all_facets (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (1); // #99 = number of all provided + collection->length (1); + + ::Components::FacetDescription_var x; + CORBA::ULong i = 0; + + x = new ::OBV_Components::FacetDescription; + + x->Name ((const char *)"dataout"); + x->type_id ((const char *) "IDL:BasicSP/ReadData:1.0"); // + x->facet_ref (this->provide_dataout (ACE_ENV_SINGLE_ARG_PARAMETER)); + + collection[i] = x._retn (); + ++i; + + return collection._retn (); + +} + +::Components::FacetDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::FacetDescriptions_var collection + = new ::Components::FacetDescriptions (names.length ()); + collection->length (names.length ()); + + ::Components::FacetDescription_var x; + CORBA::ULong i = 0; + + for (; i < names.length (); ++i) + { + x = new ::OBV_Components::FacetDescription; + + if (ACE_OS_String::strcmp (names[i].in (), "dataout") == 0) + { + x->Name ((const char *)"dataout"); + x->type_id ((const char *) "IDL:BasicSP/ReadData:1.0"); // + x->facet_ref (this->provide_dataout (ACE_ENV_SINGLE_ARG_PARAMETER)); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + + collection[i] = x._retn(); + } + return collection._retn (); +} + +CORBA::Boolean +CIAO_GLUE_BasicSP::BMClosedED_Servant::same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (object_ref)) + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + + CORBA::Object_var the_other = + object_ref->_get_component (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CORBA::Object_var me = this->context_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return me->_is_equivalent (object_ref + ACE_ENV_ARG_PARAMETER); +} + +// Operations for Receptacles interface +::Components::Cookie * +CIAO_GLUE_BasicSP::BMClosedED_Servant::connect (const char *name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)) +{ + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (name, "datain") == 0) + { + BasicSP::ReadData_var _ciao_conn = + BasicSP::ReadData::_narrow (connection + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_conn.in ())) + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + + this->connect_datain (_ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + return 0; + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +CORBA::Object_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::disconnect (const char *name, + Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)) +{ + ACE_UNUSED_ARG (ck); + + // @@ We can omit this if clause if there's no receptacle in this component. + if (name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (name, "datain") == 0) + return this->disconnect_datain (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConnectionDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_connections (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (0); + + retv->length (1); + CORBA::ULong i = 0; + + retv[i] = new OBV_Components::ReceptacleDescription; + + retv[i]->Name ((const char *) "datain"); + retv[i]->type_id ((const char *) "IDL:BasicSP/ReadData:1.0"); + retv[i]->is_multiple (0); + retv[i]->connections (*this->get_connections ("datain" + ACE_ENV_ARG_PARAMETER)); + return retv._retn (); +} + +::Components::ReceptacleDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ReceptacleDescriptions_var retv = + new ::Components::ReceptacleDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new ::OBV_Components::ReceptacleDescription; + if (ACE_OS_String::strcmp (names[i].in (), "datain") == 0) + { + retv[i]->Name ((const char *) "datain"); + retv[i]->type_id ((const char *) "IDL:BasicSP/ReadData:1.0"); + retv[i]->is_multiple (0); + retv[i]->connections (*this->get_connections ("datain" + ACE_ENV_ARG_PARAMETER)); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + return retv._retn (); +} + +// Operations for Events interface +::Components::EventConsumerBase_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_consumer (const char * sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ We can omit this if clause if there's no event sinks in this component. + if (sink_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (sink_name, "in_avail") == 0) + return this->get_consumer_in_avail (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::Cookie * +CIAO_GLUE_BasicSP::BMClosedED_Servant::subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (publisher_name, "out_avail") == 0) + { + BasicSP::DataAvailableConsumer_var _ciao_consumer = + BasicSP::DataAvailableConsumer::_narrow (subscriber + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (_ciao_consumer.in ())) + ACE_THROW_RETURN (Components::InvalidConnection (), 0); + + return this->subscribe_out_avail (_ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::unsubscribe (const char * publisher_name, + Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) +{ + // @@ We can omit this if clause if there's no publisher in this component. + if (publisher_name == 0) + ACE_THROW_RETURN (Components::InvalidName (), 0); + + if (ACE_OS_String::strcmp (publisher_name, "out_avail") == 0) + { + return this->unsubscribe_out_avail (ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +void +CIAO_GLUE_BasicSP::BMClosedED_Servant::connect_consumer (const char *, + Components::EventConsumerBase_ptr + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)) +{ + ACE_THROW (Components::InvalidName ()); +} + +::Components::EventConsumerBase_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::disconnect_consumer (const char * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)) +{ + ACE_THROW_RETURN (Components::InvalidName (), 0); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_all_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (1); // #99 is the number of consumers + // this component has. + retv->length (1); + + CORBA::ULong i = 0; + + retv[i] = new OBV_Components::ConsumerDescription; + retv[i]->Name ("in_avail"); + retv[i]->type_id ("IDL:BasicSP/DataAvailableConsumer:1.0"); + BasicSP::DataAvailableConsumer_var c + = this->get_consumer_in_avail (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + + return retv._retn (); +} + +::Components::ConsumerDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::ConsumerDescriptions_var retv = + new ::Components::ConsumerDescriptions (names.length ()); + + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + retv[i] = new OBV_Components::ConsumerDescription; + + if (ACE_OS_String::strcmp (names[i].in (), "in_avail") == 0) + { + retv[i]->Name ("in_avail"); + retv[i]->type_id ("IDL:BasicSP/DataAvailableConsumer:1.0"); + BasicSP::DataAvailableConsumer_var c = + this->get_consumer_in_avail (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + retv[i]->consumer (c.in ()); + } + else + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_all_emitters (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (0); // #99 is the number of emitters + // this component has. + return retv._retn (); +} + +::Components::EmitterDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + ::Components::EmitterDescriptions_var retv = + new ::Components::EmitterDescriptions (names.length ()); + retv->length (names.length ()); + + CORBA::ULong i = 0; + for (; i < names.length (); ++i) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + return retv._retn (); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_all_publishers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::PublisherDescriptions * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_named_publishers (const Components::NameList & + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)) +{ + // @@ to-do + + // Need to add interfaces in the Context class to gather the information. + // Or we can just relay it to the Context object. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +// Operations for CCMObject interface +::CORBA::IRObject_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ to-do: Connect to an IfR? + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + +::Components::CCMHome_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_ccm_home (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->context_->get_CCM_home (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +::Components::PrimaryKeyBase * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_primary_key (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)) +{ + // This is a keyless component. + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); +} + +void +CIAO_GLUE_BasicSP::BMClosedED_Servant::configuration_complete (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)) +{ + // @@ to-do + // No-op. Don't know how to pass this info to monolithic executor. +} + +void +CIAO_GLUE_BasicSP::BMClosedED_Servant::remove (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + // @@ to-do + // Need to figure out what to do here. E.g., tear down the all the connections + // this component has? +} + +::Components::ComponentPortDescription * +CIAO_GLUE_BasicSP::BMClosedED_Servant::get_all_ports (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::ComponentPortDescription_var retv = + new OBV_Components::ComponentPortDescription; + + ::Components::FacetDescriptions_var facets_desc + = this->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ReceptacleDescriptions_var receptacle_desc + = get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::ConsumerDescriptions_var consumer_desc + = this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::EmitterDescriptions_var emitter_desc + = this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ::Components::PublisherDescriptions_var publisher_desc + = this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + + retv->facets (facets_desc.in()); + retv->receptacles (receptacle_desc.in()); + retv->consumers (consumer_desc.in()); + retv->emitters (emitter_desc.in()); + retv->publishers (publisher_desc.in()); + + return retv._retn(); +} + +// get_component implementation. +CORBA::Object_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow (this->context_); + + if (! CORBA::is_nil(sc.in ())) + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + // @@ Do we need to try the following case here? We are afterall implementing + // a session component here. + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow (this->context_); + + if (! CORBA::is_nil(ec.in ())) + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); +} + +void +CIAO_GLUE_BasicSP::BMClosedED_Servant::_ciao_activate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_activate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +void +CIAO_GLUE_BasicSP::BMClosedED_Servant::_ciao_passivate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ::Components::SessionComponent_var temp = + ::Components::SessionComponent::_narrow (this->executor_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (! CORBA::is_nil (temp.in ())) + temp->ccm_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + + +CIAO_GLUE_BasicSP::BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::DataAvailableConsumer_in_avail_Servant + (BasicSP::CCM_BMClosedED_ptr executor, + BasicSP::CCM_BMClosedED_Context_ptr c) + : executor_ (BasicSP::CCM_BMClosedED::_duplicate (executor)), + ctx_ (BasicSP::CCM_BMClosedED_Context::_duplicate (c)) +{ +} + + +CIAO_GLUE_BasicSP::BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::~DataAvailableConsumer_in_avail_Servant () +{ +} + + CORBA::Object_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::_get_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->ctx_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); +} + + void +CIAO_GLUE_BasicSP::BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::push_DataAvailable + (BasicSP::DataAvailable *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->executor_->push_in_avail (evt + ACE_ENV_ARG_PARAMETER); +} + +// Operations for emits interfaces. + +// Operations for publishes interfaces. + ::Components::Cookie * +CIAO_GLUE_BasicSP::BMClosedED_Servant::subscribe_out_avail (BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)) +{ + return this->context_->subscribe_out_avail (c + ACE_ENV_ARG_PARAMETER); +} + + BasicSP::DataAvailableConsumer_ptr +CIAO_GLUE_BasicSP::BMClosedED_Servant::unsubscribe_out_avail (::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)) +{ + return this->context_->unsubscribe_out_avail (ck + ACE_ENV_ARG_PARAMETER); +} + +/************************************************************************************/ +BasicSP::BMClosedED_ptr +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::_ciao_activate_component (BasicSP::CCM_BMClosedED_ptr exe + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Object_var hobj + = this->container_->get_objref (this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::CCMHome_var home + = ::Components::CCMHome::_narrow (hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + CIAO_GLUE_BasicSP::BMClosedED_Servant *svt = + new CIAO_GLUE_BasicSP::BMClosedED_Servant (exe, + home.in (), + this->container_); + PortableServer::ServantBase_var safe (svt); + PortableServer::ObjectId_var oid; + + CORBA::Object_var objref + = this->container_->install_component (svt, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + BasicSP::BMClosedED_var ho + = BasicSP::BMClosedED::_narrow (objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + // @@ what should happen if bind fail? + safe._retn (); + } + return ho._retn (); +} + +void +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::_ciao_passivate_component (BasicSP::BMClosedED_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component (comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CIAO_GLUE_BasicSP::BMClosedED_Servant *servant = 0; + if (this->component_map_.unbind (oid.in (), servant) == 0) + { + PortableServer::ServantBase_var safe (servant); + servant->_ciao_passivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + // What happen if unbind failed? + +} + +// Operations for Implicit Home interface +BasicSP::BMClosedED_ptr +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + if (this->executor_.in () == 0) + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + BasicSP::CCM_BMClosedED_var _ciao_comp + = BasicSP::CCM_BMClosedED::_narrow (_ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->_ciao_activate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +// Operations for CCMHome interface +void +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)) +{ + BasicSP::BMClosedED_var _ciao_comp + = BasicSP::BMClosedED::_narrow (comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + ACE_THROW (CORBA::INTERNAL ()); // What is the right exception to throw here? + + // @@ It seems to me that we need to make sure this is a component + // generated by this home before calling remove on this component. + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + + // Removing the object reference? get the servant from the POA with + // the objref, and call remove() on the component, deactivate the + // component, and then remove-ref the servant? + this->_ciao_passivate_component (_ciao_comp.in () + ACE_ENV_ARG_PARAMETER); +} + +extern "C" BMCLOSEDED_SVNT_Export ::PortableServer::Servant +createBMClosedEDHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) +{ + if (p == 0) + return 0; + + BasicSP::CCM_BMClosedEDHome_var x + = BasicSP::CCM_BMClosedEDHome::_narrow (p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (CORBA::is_nil (x.in ())) + return 0; + + return new CIAO_GLUE_BasicSP::BMClosedEDHome_Servant (x.in (), + c); +} + + +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::BMClosedEDHome_Servant (BasicSP::CCM_BMClosedEDHome_ptr exe, + CIAO::Session_Container *c) + : executor_ (BasicSP::CCM_BMClosedEDHome::_duplicate (exe)), + container_ (c) +{ +} + + +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::~BMClosedEDHome_Servant (void) +{ +} + +// Operations for KeylessHome interface + ::Components::CCMObject_ptr +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::create_component (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)) +{ + // Simply forward to the create method. + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +// Operations for CCMHome interface + ::CORBA::IRObject_ptr +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::get_component_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} + + CORBA::IRObject_ptr +CIAO_GLUE_BasicSP::BMClosedEDHome_Servant::get_home_def (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // @@ TO-DO. Contact IfR? + + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt.h new file mode 100644 index 00000000000..62d35928aab --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt.h @@ -0,0 +1,510 @@ +// $Id$ + +// =========================================================== +// +// @file BMClosedED_svnt.h +// +// Servant Glue code (supposedly should be) generated using CIAO'S +// CIDL compiler. This file implement the servants that bridge the +// executor and the container. +// +// 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> +// +// =========================================================== + +#ifndef CIAO_GLUE_SESSION_BMCLOSEDED_SVNT_H +#define CIAO_GLUE_SESSION_BMCLOSEDED_SVNT_H +#include "ace/pre.h" + +#include "BMClosedEDS.h" // Source in the skeletons for component + // client-view equivalent interfaces +#include "BMClosedEDEC.h" // Source in the executor mapping + // that component implementations use +#include "ciao/Container_Base.h" //Source in the container interface definitions +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO_GLUE_BasicSP +{ + // Facet glue code has already been defined in ../BasicSP_svnt.* + + + ////////////////////////////////////////////////////////////////// + // Component specific context implementation + class BMCLOSEDED_SVNT_Export BMClosedED_Context : + public virtual BasicSP::CCM_BMClosedED_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the the servant glue code we generate to access + // our states. + friend class BMClosedED_Servant; + + // Ctor. + BMClosedED_Context (::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMClosedED_Servant *sv); + + // Dtor. + virtual ~BMClosedED_Context (); + + // Operations for [component name] event source, and + // receptacles defined in CCM_[component name]_Context. + + void push_out_avail (BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + BasicSP::ReadData_ptr + get_connection_datain (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for ::Components::CCMContext + virtual ::Components::Principal_ptr + get_caller_principal (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_CCM_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean + get_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual ::Components::Transaction::UserTransaction_ptr + get_user_transaction (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + virtual CORBA::Boolean + is_caller_in_role (const char * role + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + set_rollback_only (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + + // Operations for ::Components::SessionContext interface + virtual CORBA::Object_ptr + get_CCM_object (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::IllegalState)); + protected: + // We need to generate, in protected section, stuff that manage + // connections and consumers of this component. + + // Operations for emits interfaces. + + // Operations for publishes interfaces. + ::Components::Cookie * + subscribe_out_avail (BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + BasicSP::DataAvailableConsumer_ptr + unsubscribe_out_avail (::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + void + connect_datain (BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + BasicSP::ReadData_ptr + disconnect_datain (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + ACE_Active_Map_Manager<BasicSP::DataAvailableConsumer_var> ciao_publishes_out_avail_map_; + + BasicSP::ReadData_var ciao_uses_datain_; + + protected: + /// Cached component home reference. + ::Components::CCMHome_var home_; + + /// session container + ::CIAO::Session_Container *container_; + + /// Reference back to owner. + BMClosedED_Servant *servant_; + + /// @@ Cached component reference. + BasicSP::BMClosedED_var component_; + }; + + ////////////////////////////////////////////////////////////////// + // Component Servant Glue code implementation + class BMCLOSEDED_SVNT_Export BMClosedED_Servant + : public virtual POA_BasicSP::BMClosedED, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + BMClosedED_Servant (BasicSP::CCM_BMClosedED_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + // Dtor. + ~BMClosedED_Servant (void); + + // Operations for provides interfaces. + virtual BasicSP::ReadData_ptr + provide_dataout (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for receptacles interfaces. + virtual void + connect_datain (BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual BasicSP::ReadData_ptr + disconnect_datain (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::NoConnection)); + + virtual BasicSP::ReadData_ptr + get_connection_datain (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Operations for consumers interfaces. + + // First we need to generate the event sink specific servant + class BMCLOSEDED_SVNT_Export DataAvailableConsumer_in_avail_Servant + : public virtual POA_BasicSP::DataAvailableConsumer, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Constructor and destructor. + DataAvailableConsumer_in_avail_Servant (BasicSP::CCM_BMClosedED_ptr executor, + BasicSP::CCM_BMClosedED_Context_ptr c); + ~DataAvailableConsumer_in_avail_Servant (); + + virtual void push_DataAvailable (BasicSP::DataAvailable *evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Inherit from ::Compopnents::EventBConsumerBase + virtual void push_event (Components::EventBase *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::BadEventType)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Consumer Executor + BasicSP::CCM_BMClosedED_var executor_; + + // Context object. + BasicSP::CCM_BMClosedED_Context_var ctx_; + }; + + virtual BasicSP::DataAvailableConsumer_ptr + get_consumer_in_avail (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for emits interfaces. + + // Operations for publishes interfaces. + virtual ::Components::Cookie * + subscribe_out_avail (BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual BasicSP::DataAvailableConsumer_ptr + unsubscribe_out_avail (::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + ::Components::InvalidConnection)); + + // Operations for Navigation interface + virtual CORBA::Object_ptr provide_facet (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)) ; + + virtual ::Components::FacetDescriptions * + get_all_facets (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::FacetDescriptions * + get_named_facets (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException , + Components::InvalidName)); + + virtual CORBA::Boolean same_component (CORBA::Object_ptr object_ref + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for Receptacles interface + virtual ::Components::Cookie *connect (const char * name, + CORBA::Object_ptr connection + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::AlreadyConnected, + Components::ExceededConnectionLimit)); + + virtual CORBA::Object_ptr disconnect (const char * name, + Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::CookieRequired, + Components::NoConnection)); + + virtual ::Components::ConnectionDescriptions * + get_connections (const char * name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::ReceptacleDescriptions * + get_all_receptacles (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ReceptacleDescriptions * + get_named_receptacles (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for Events interface + virtual ::Components::EventConsumerBase_ptr + get_consumer (const char * sink_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::Cookie * + subscribe (const char * publisher_name, + Components::EventConsumerBase_ptr subscriber + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection, + Components::ExceededConnectionLimit)); + + virtual ::Components::EventConsumerBase_ptr + unsubscribe (const char * publisher_name, + Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void connect_consumer (const char * emitter_name, + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::AlreadyConnected, + Components::InvalidConnection)); + + virtual ::Components::EventConsumerBase_ptr + disconnect_consumer (const char * source_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::NoConnection)); + + virtual ::Components::ConsumerDescriptions * + get_all_consumers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::ConsumerDescriptions * + get_named_consumers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::EmitterDescriptions * + get_all_emitters (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::EmitterDescriptions * + get_named_emitters (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + virtual ::Components::PublisherDescriptions * + get_all_publishers (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PublisherDescriptions * + get_named_publishers (const Components::NameList & names + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName)); + + // Operations for CCMObject interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::CCMHome_ptr + get_ccm_home (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::PrimaryKeyBase * + get_primary_key (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::NoKeyAvailable)); + + virtual void configuration_complete (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidConfiguration)); + + virtual void remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + virtual ::Components::ComponentPortDescription * + get_all_ports (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // get_component implementation. + virtual CORBA::Object_ptr + _get_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO specific operations. + // Activate the object in the container_ + void + _ciao_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // My Executor. + BasicSP::CCM_BMClosedED_var executor_; + + // My Run-time Context. + BMClosedED_Context *context_; + + // Managing container. + ::CIAO::Session_Container *container_; + + // Cached provided interfaces. + BasicSP::ReadData_var provide_datain_; + + BasicSP::DataAvailableConsumer_var consumes_in_avail_; + }; + + + ////////////////////////////////////////////////////////////////// + // Component Home Glue code implementation + + // Foreach component home + class BMCLOSEDED_SVNT_Export BMClosedEDHome_Servant : + public virtual POA_BasicSP::BMClosedEDHome, // full skeleton name here + public virtual PortableServer::RefCountServantBase + { + public: + // Ctor. + BMClosedEDHome_Servant (BasicSP::CCM_BMClosedEDHome_ptr exe, + CIAO::Session_Container *c); + + // Dtor. + ~BMClosedEDHome_Servant (void); + + // User defined and inherited operations + + // Factory operations + + // Finder operations + + // Operations for KeylessHome interface + virtual ::Components::CCMObject_ptr + create_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for Implicit Home interface + virtual BasicSP::BMClosedED_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CreateFailure)); + + // Operations for CCMHome interface + virtual ::CORBA::IRObject_ptr + get_component_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::CORBA::IRObject_ptr + get_home_def (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void remove_component (Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::RemoveFailure)); + + protected: + // Helper method for factory operations. + BasicSP::BMClosedED_ptr + _ciao_activate_component (BasicSP::CCM_BMClosedED_ptr exe + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component (BasicSP::BMClosedED_ptr comp + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // My Executor. + BasicSP::CCM_BMClosedEDHome_var executor_; + + // My Container + CIAO::Session_Container *container_; + + // Components this home manages. + ACE_Hash_Map_Manager_Ex <PortableServer::ObjectId, + BMClosedED_Servant*, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> component_map_; + }; + + extern "C" BMCLOSEDED_SVNT_Export ::PortableServer::Servant + createBMClosedEDHome_Servant (::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); +} + + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_BMCLOSEDED_SVNT_H */ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt_export.h b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt_export.h new file mode 100644 index 00000000000..bcabbe1023e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/BMClosedED_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMCLOSEDED_SVNT +// ------------------------------ +#ifndef BMCLOSEDED_SVNT_EXPORT_H +#define BMCLOSEDED_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMCLOSEDED_SVNT_HAS_DLL) +# define BMCLOSEDED_SVNT_HAS_DLL 1 +#endif /* ! BMCLOSEDED_SVNT_HAS_DLL */ + +#if defined (BMCLOSEDED_SVNT_HAS_DLL) && (BMCLOSEDED_SVNT_HAS_DLL == 1) +# if defined (BMCLOSEDED_SVNT_BUILD_DLL) +# define BMCLOSEDED_SVNT_Export ACE_Proper_Export_Flag +# define BMCLOSEDED_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMCLOSEDED_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMCLOSEDED_SVNT_BUILD_DLL */ +# define BMCLOSEDED_SVNT_Export ACE_Proper_Import_Flag +# define BMCLOSEDED_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMCLOSEDED_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMCLOSEDED_SVNT_BUILD_DLL */ +#else /* BMCLOSEDED_SVNT_HAS_DLL == 1 */ +# define BMCLOSEDED_SVNT_Export +# define BMCLOSEDED_SVNT_SINGLETON_DECLARATION(T) +# define BMCLOSEDED_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMCLOSEDED_SVNT_HAS_DLL == 1 */ + +// Set BMCLOSEDED_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMCLOSEDED_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define BMCLOSEDED_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMCLOSEDED_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMCLOSEDED_SVNT_NTRACE */ + +#if (BMCLOSEDED_SVNT_NTRACE == 1) +# define BMCLOSEDED_SVNT_TRACE(X) +#else /* (BMCLOSEDED_SVNT_NTRACE == 1) */ +# define BMCLOSEDED_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMCLOSEDED_SVNT_NTRACE == 1) */ + +#endif /* BMCLOSEDED_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS.idl b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS.idl new file mode 100644 index 00000000000..8a2f2f50361 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS.idl @@ -0,0 +1,25 @@ +// $Id$ + +/** + * @file GPS.idl + * + * Definition of the GPS component. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ + +#include "../HUDisplay.idl" + +module HUDisplay +{ + component GPS + { + provides position MyLocation; + publishes tick Ready; + consumes tick Refresh; + }; + + home GPSHome manages GPS + { + }; +}; diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS_tracing_exec.cpp b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS_tracing_exec.cpp new file mode 100644 index 00000000000..e0e2a642999 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS_tracing_exec.cpp @@ -0,0 +1,137 @@ +// $Id$ + +#include "GPS_tracing_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::GPS_tracing_exec_i::GPS_tracing_exec_i () : dx_(1), dy_(1) +{ + ACE_OS::srand ((u_int) ACE_OS::time ()); + + this->positionx_ = 20; + this->positiony_ = 25; +} + +/// Default destructor. +MyImpl::GPS_tracing_exec_i::~GPS_tracing_exec_i () +{ +} + +// Operations from HUDisplay::GPS + +HUDisplay::CCM_position_ptr +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_i::push_Refresh (HUDisplay::tick * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Refresh position + if(this->positionx_ > 500) this->dx_ = -1; + if(this->positionx_ < 10) this->dx_ = 1; + if(this->positiony_ > 300) this->dy_ = -1; + if(this->positiony_ < 10) this->dy_ = 1; + + this->positionx_ += this->dx_; + this->positiony_ += this->dy_; + + // Nitify others + HUDisplay::tick_var event = new OBV_HUDisplay::tick; + + this->context_->push_Ready (event + ACE_ENV_ARG_PARAMETER); +} + +// Operations from HUDisplay::position + +CORBA::Long +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_i::posy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->positiony_; +} + +// Operations from Components::SessionComponent +void +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_i::set_session_context\n")); + + this->context_ = + HUDisplay::CCM_GPS_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::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_i::ccm_activate\n")); +} + +void +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_i::ccm_passivate\n")); +} + +void +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_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::GPSHome_tracing_exec_i::GPSHome_tracing_exec_i () +{ +} + +/// Default dtor. +MyImpl::GPSHome_tracing_exec_i::~GPSHome_tracing_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::GPSHome_tracing_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + 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_i; +} diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS_tracing_exec.h b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS_tracing_exec.h new file mode 100644 index 00000000000..07b81437cec --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP/BMClosedED/GPS_tracing_exec.h @@ -0,0 +1,125 @@ +// $Id$ + +/** + * @file GPS_tracing_exec.h + * + * Header file for the actual GPS and GPSHome component + * implementations. + * + * @author Nanbor Wang <nanbor@cse.wustl.edu> + */ + +#ifndef GPS_TRACING_EXEC_H +#define GPS_TRACING_EXEC_H + +#include "GPSEIC.h" +#include "tao/LocalObject.h" + +namespace MyImpl +{ + /** + * @class GPS_tracing_exec_i + * + * RateGen executor implementation class. + */ + 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_i (); + + /// Default destructor. + ~GPS_tracing_exec_i (); + + // Operations from HUDisplay::GPS + + virtual HUDisplay::CCM_position_ptr + get_MyLocation (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_Refresh (HUDisplay::tick *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from HUDisplay::position + + virtual CORBA::Long + posx (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Long + posy (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 + ccm_activate (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)); + protected: + /// Current GPS reading. + CORBA::Long positionx_; + CORBA::Long positiony_; + + /// Delta amounts to emulate the position shift of each reading. + int dx_; + int dy_; + + /// Copmponent specific context + HUDisplay::CCM_GPS_Context_var context_; + }; + + /** + * @class GPSHome_tracing_exec_i + * + * GPS home executor implementation class. + */ + 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_i (); + + /// Default dtor. + ~GPSHome_tracing_exec_i (); + + // Explicit home operations. + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +// 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); + +#endif /* GPS_TRACING_EXEC_H */ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl index 88c5442e4a5..d2096e707d8 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl +++ b/TAO/CIAO/examples/handcrafted/BasicSP/EC/EC.idl @@ -17,7 +17,7 @@ module BasicSP { component EventChannel { - publishes TimeOut timeOut20; + publishes TimeOut timeOut; }; home EventChannelHome manages EventChannel |