diff options
70 files changed, 11152 insertions, 0 deletions
diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED.cidl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED.cidl new file mode 100644 index 00000000000..c241c806a34 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED.cidl @@ -0,0 +1,19 @@ +//$Id$ + +#ifndef BMCLOSEDED_CIDL +#define BMCLOSEDED_CIDL + +#include "BMClosedED.idl" + +composition session BMClosedED_Impl +{ + home executor BMClosedEDHome_Exec + { + implements BasicSP::BMClosedEDHome; + manages BMClosedED_Exec; + }; +}; + +#endif /* BMCLOSEDED_CIDL */ + + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED.idl new file mode 100644 index 00000000000..2fe200151fe --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED.idl @@ -0,0 +1,17 @@ +//$Id$ +#include "../BasicSP.idl" + +module BasicSP +{ + component BMClosedED + { + 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_EC/BMClosedED/BMClosedED.mpc b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED.mpc new file mode 100644 index 00000000000..014268adf82 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED.mpc @@ -0,0 +1,61 @@ +// $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 -Wb,stub_export_include=BMClosedED_stub_export.h -Wb,skel_export_macro=BMCLOSEDED_SVNT_Export -Wb,skel_export_include=BMClosedED_svnt_export.h + dynamicflags = BMCLOSEDED_STUB_BUILD_DLL + + 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/handcrafted/BasicSP_EC/BMClosedED/BMClosedEDE.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedEDE.idl new file mode 100644 index 00000000000..bd1877ac6d5 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedEDE.idl @@ -0,0 +1,49 @@ +// $Id$ +#include <Components.idl> +#include "BMClosedED.idl" + +module BasicSP +{ + local interface CCM_ReadData : ReadData + { + }; + +}; + +module BasicSP +{ + local interface CCM_BMClosedED : ::Components::EnterpriseComponent + { + ::BasicSP::CCM_ReadData get_dataout (); + void push_in_avail (in ::BasicSP::DataAvailable ev); + }; + + local interface CCM_BMClosedED_Context : ::Components::SessionContext + { + ::BasicSP::ReadData get_connection_datain (); + void push_out_avail (in ::BasicSP::DataAvailable ev); + }; + + local interface CCM_BMClosedEDHomeExplicit : ::Components::HomeExecutorBase + { + }; + + local interface CCM_BMClosedEDHomeImplicit + { + ::Components::EnterpriseComponent create () raises (::Components::CCMException); + }; + + local interface CCM_BMClosedEDHome : CCM_BMClosedEDHomeExplicit, CCM_BMClosedEDHomeImplicit + { + }; + +}; + +module BMClosedED_Impl +{ + local interface _Context : ::BasicSP::CCM_BMClosedED_Context, ::Components::SessionContext + { + }; + +}; + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedEDEI.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedEDEI.idl new file mode 100644 index 00000000000..a95918e6595 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedEDEI.idl @@ -0,0 +1,33 @@ +// $Id$ + +/** + * @file BMClosedEDEI.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_EC/BMClosedED/BMClosedED_exec.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_exec.cpp new file mode 100644 index 00000000000..401e530ae46 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_exec.cpp @@ -0,0 +1,161 @@ +// $Id$ + +#include "CIAO_common.h" +#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_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 ()); + } + + char *str = + dat->get_data (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "BMClosedED - Display data is [%s] \n", + str)); + + 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) + 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")); + + char *argv[1] = { "BMClosedED_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BasicSP::DataAvailable_init, + BasicSP::DataAvailable); +} + +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_EC/BMClosedED/BMClosedED_exec.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_exec.h new file mode 100644 index 00000000000..870ca679dfe --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/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_EC/BMClosedED/BMClosedED_exec_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_exec_export.h new file mode 100644 index 00000000000..b2d7ae01e02 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/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_EC/BMClosedED/BMClosedED_stub_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_stub_export.h new file mode 100644 index 00000000000..a2511681640 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/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_EC/BMClosedED/BMClosedED_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.cpp new file mode 100644 index 00000000000..01f2eff9f53 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.cpp @@ -0,0 +1,1502 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "BMClosedED_svnt.h" +#include "Cookies.h" + +namespace CIAO_GLUE_BasicSP +{ + ReadData_Servant::ReadData_Servant ( + ::BasicSP::CCM_ReadData_ptr executor, + ::Components::CCMContext_ptr c) + : executor_ (::BasicSP::CCM_ReadData::_duplicate (executor)), + ctx_ (::Components::CCMContext::_duplicate (c)) + { + } + + ReadData_Servant::~ReadData_Servant (void) + { + } + + char * + ReadData_Servant::get_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->executor_->get_data ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + CORBA::Object_ptr + ReadData_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->ctx_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (! CORBA::is_nil (sc.in ())) + { + return sc->get_CCM_object ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow ( + this->ctx_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (! CORBA::is_nil (ec.in ())) + { + return ec->get_CCM_object ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + } + +} + +namespace CIAO_GLUE_BasicSP +{ + BMClosedED_Context::BMClosedED_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMClosedED_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv), + // START new event code + ciao_proxy_out_avail_consumer_ (RtecEventChannelAdmin::ProxyPushConsumer::_nil ()), + ciao_event_channel_ (RtecEventChannelAdmin::EventChannel::_nil ()) + // END new event code + { + } + + BMClosedED_Context::~BMClosedED_Context (void) + { + // START new event code + this->ciao_event_channel_->destroy (); + // END new event code + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + BMClosedED_Context::get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Principal::_nil ()); + } + + ::Components::CCMHome_ptr + BMClosedED_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + BMClosedED_Context::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Transaction::UserTransaction_ptr + BMClosedED_Context::get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Transaction::UserTransaction::_nil ()); + } + + CORBA::Boolean + BMClosedED_Context::is_caller_in_role ( + const char *role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_UNUSED_ARG (role); + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + BMClosedED_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + BMClosedED_Context::get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = + this->container_->get_objref ( + this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->component_ = + ::BasicSP::BMClosedED::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (CORBA::is_nil (this->component_.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + } + + return ::BasicSP::BMClosedED::_duplicate ( + this->component_.in ()); + } + + // Operations for BMClosedED receptacles and event sources, + // defined in ::BasicSP::CCM_BMClosedED_Context. + + ::BasicSP::ReadData_ptr + BMClosedED_Context::get_connection_datain ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::BasicSP::ReadData::_duplicate ( + this->ciao_uses_datain_.in ()); + } + + void + 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 ()); + } + + this->ciao_uses_datain_ = + ::BasicSP::ReadData::_duplicate (c); + } + + ::BasicSP::ReadData_ptr + 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_RETURN ( + ::Components::NoConnection (), + ::BasicSP::ReadData::_nil ()); + } + + return this->ciao_uses_datain_._retn (); + } + + void + BMClosedED_Context::push_out_avail ( + ::BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + // START new event code + RtecEventComm::EventSet events (1); + events.length (1); + events[0].header.source = ACE_ES_EVENT_SOURCE_ANY + 3; + events[0].header.type = ACE_ES_EVENT_UNDEFINED + 3; + events[0].data.any_value <<= ev; + ciao_proxy_out_avail_consumer_->push (events); + // END new event code + + // START new event code + /* + 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 () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_DataAvailable ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + */ + // END new event code + } + + ::Components::Cookie * + BMClosedED_Context::subscribe_out_avail ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + + // START new event code + // Get a reference to the ORB. + char * argv[1] = { "BMClosedED_exec" }; + int argc = sizeof (argv) / sizeof (argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Get a reference to the POA + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Nil RootPOA\n"), 0); + + // Get a reference to the event channel + if (CORBA::is_nil (this->ciao_event_channel_.in ())) + { + TAO_EC_Event_Channel_Attributes attributes (root_poa.in (), root_poa.in ()); + TAO_EC_Event_Channel * ec_servant; + ACE_NEW_RETURN (ec_servant, TAO_EC_Event_Channel (attributes), 0); + ec_servant->activate (); + this->ciao_event_channel_ = ec_servant->_this (); + } + + // Establish supplier's connection to event channel if not done yet + if (CORBA::is_nil (this->ciao_proxy_out_avail_consumer_.in ())) + { + RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = + this->ciao_event_channel_->for_suppliers (); + this->ciao_proxy_out_avail_consumer_ = supplier_admin->obtain_push_consumer (); + + // Create and register supplier servant + out_avail_Supplier_impl * supplier_servant; + ACE_NEW_RETURN (supplier_servant, out_avail_Supplier_impl (orb.in ()), 0); + RtecEventComm::PushSupplier_var supplier = supplier_servant->_this (); + + // Set QoS properties and connect + ACE_SupplierQOS_Factory qos; + qos.insert (ACE_ES_EVENT_SOURCE_ANY + 3, + ACE_ES_EVENT_UNDEFINED + 3, + 0, + 1); + this->ciao_proxy_out_avail_consumer_->connect_push_supplier (supplier.in (), + qos.get_SupplierQOS ()); + } // End if (ciao_proxy_out_avail_consumer_ is nil) + + // Establish consumer's connection to event channel + if (CORBA::is_nil (c)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + } + + ::BasicSP::DataAvailableConsumer_var sub = ::BasicSP::DataAvailableConsumer::_duplicate (c); + + RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = + this->ciao_event_channel_->for_consumers (); + RtecEventChannelAdmin::ProxyPushSupplier_var ciao_proxy_out_avail_supplier = + consumer_admin->obtain_push_supplier (); + + // Create and register consumer servant + out_avail_Consumer_impl * consumer_servant; + ACE_NEW_RETURN (consumer_servant, out_avail_Consumer_impl (orb.in (), sub.in ()), 0); + RtecEventComm::PushConsumer_var consumer = consumer_servant->_this (); + + // Put reference to this PushConsumer in the map so we can disconnect later + ACE_Active_Map_Manager_Key key; + this->ciao_proxy_out_avail_supplier_map_.bind (ciao_proxy_out_avail_supplier.in (), key); + + // Set QoS properties and connect + ACE_ConsumerQOS_Factory qos; + qos.start_disjunction_group (1); + qos.insert_type (ACE_ES_EVENT_UNDEFINED + 3, + 0); + ciao_proxy_out_avail_supplier->connect_push_consumer (consumer.in (), + qos.get_ConsumerQOS ()); + + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + // END new event code + + // START old event code + /* + 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 (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + */ + // END old event code + + } + + ::BasicSP::DataAvailableConsumer_ptr + BMClosedED_Context::unsubscribe_out_avail ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + // START new event code + ::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 (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + RtecEventChannelAdmin::ProxyPushSupplier_var ciao_proxy_out_avail_supplier; + + if (this->ciao_proxy_out_avail_supplier_map_.find (key, ciao_proxy_out_avail_supplier) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + ciao_proxy_out_avail_supplier->disconnect_push_supplier (); + + if (this->ciao_proxy_out_avail_supplier_map_.unbind (key, ciao_proxy_out_avail_supplier) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + return retv._retn (); + // END new event code + + // START old event code + /* + ::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 (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + if (this->ciao_publishes_out_avail_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + return retv._retn (); + */ + // END old event code + } + + + 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 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 + { + } + ACE_ENDTRY; + } + + 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 + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + ::BasicSP::ReadData_ptr + BMClosedED_Servant::provide_dataout ( + ACE_ENV_SINGLE_ARG_PARAMETER) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (this->provide_dataout_.in ())) + { + ::BasicSP::CCM_ReadData_var fexe = + this->executor_->get_dataout (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + if (::CORBA::is_nil (fexe.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::ReadData::_nil ()); + } + + ReadData_Servant *svt = + new 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 (::BasicSP::ReadData::_nil ()); + + ::BasicSP::ReadData_var fo = + ::BasicSP::ReadData::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + this->provide_dataout_ = fo; + } + + return ::BasicSP::ReadData::_duplicate (this->provide_dataout_.in ()); + } + + void + 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 + 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 + 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); + } + + ::Components::Cookie * + 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 + 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); + } + + 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)) + { + } + + BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant::~DataAvailableConsumer_in_avail_Servant (void) + { + } + + CORBA::Object_ptr + 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 + 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); + } + + // Inherited from ::Components::EventConsumerBase. + void + 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_SINGLE_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BasicSP::DataAvailableConsumer_ptr + 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 ())) + { + BMClosedED_Servant::DataAvailableConsumer_in_avail_Servant *svt = + new 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 (::BasicSP::DataAvailableConsumer::_nil ()); + + ::BasicSP::DataAvailableConsumer_var eco = + ::BasicSP::DataAvailableConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + this->consumes_in_avail_ = eco; + } + + return ::BasicSP::DataAvailableConsumer::_duplicate (this->consumes_in_avail_.in ()); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + 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 (), + ::CORBA::Object::_nil ()); + } + + if (ACE_OS::strcmp (name, "dataout") == 0) + { + return this->provide_dataout (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::FacetDescriptions * + BMClosedED_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + BMClosedED_Servant::get_named_facets ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + CORBA::Boolean + 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 ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for Receptacles interface. + + ::Components::Cookie * + 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::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); + } + + // Simplex connect. + this->connect_datain ( + _ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + + return 0; + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + 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)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + if (ACE_OS::strcmp (name, "datain") == 0) + { + // Simplex disconnect. + return this->disconnect_datain (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::ConnectionDescriptions * + BMClosedED_Servant::get_connections ( + const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMClosedED_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMClosedED_Servant::get_named_receptacles ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for Events interface. + + ::Components::EventConsumerBase_ptr + BMClosedED_Servant::get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (sink_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (sink_name, "in_avail") == 0) + { + return this->get_consumer_in_avail (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::Cookie * + BMClosedED_Servant::subscribe ( + const char *publisher_name, + ::Components::EventConsumerBase_ptr subscribe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::ExceededConnectionLimit)) + { + if (publisher_name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + if (ACE_OS::strcmp (publisher_name, "out_avail") == 0) + { + ::BasicSP::DataAvailableConsumer_var _ciao_consumer = + ::BasicSP::DataAvailableConsumer::_narrow ( + subscribe + 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 + BMClosedED_Servant::unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)) + { + if (publisher_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (publisher_name, "out_avail") == 0) + { + return this->unsubscribe_out_avail ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + BMClosedED_Servant::connect_consumer ( + const char *emitter_name, + ::Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + BMClosedED_Servant::disconnect_consumer ( + const char *source_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMClosedED_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMClosedED_Servant::get_named_consumers ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMClosedED_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMClosedED_Servant::get_named_emitters ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMClosedED_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMClosedED_Servant::get_named_publishers ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for CCMObject interface. + + CORBA::IRObject_ptr + BMClosedED_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + 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 * + BMClosedED_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + BMClosedED_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + BMClosedED_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + 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); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + 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 (); + } + + CORBA::Object_ptr + BMClosedED_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::CORBA::Object::_nil ()); + + if (! ::CORBA::is_nil (sc.in ())) + { + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::CORBA::Object::_nil ()); + + if (! ::CORBA::is_nil (ec.in ())) + { + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + 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 + 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); + } + } + + // Supported operations. + + + BMClosedEDHome_Servant::BMClosedEDHome_Servant ( + ::BasicSP::CCM_BMClosedEDHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_BMClosedEDHome::_duplicate (exe)), + container_ (c) + { + } + + BMClosedEDHome_Servant::~BMClosedEDHome_Servant (void) + { + } + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + BMClosedEDHome_Servant::create_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for implicit home interface. + + ::BasicSP::BMClosedED_ptr + 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 (), + ::BasicSP::BMClosedED::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + ::BasicSP::CCM_BMClosedED_var _ciao_comp = + ::BasicSP::CCM_BMClosedED::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + BMClosedEDHome_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::CORBA::IRObject_ptr + BMClosedEDHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + 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 ()); + } + + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::BasicSP::BMClosedED_ptr + BMClosedEDHome_Servant::_ciao_activate_component ( + ::BasicSP::CCM_BMClosedED_ptr exe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var hobj = + this->container_->get_objref ( + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + BMClosedED_Servant *svt = + new 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 (::BasicSP::BMClosedED::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + ::BasicSP::BMClosedED_var ho = + ::BasicSP::BMClosedED::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMClosedED::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + 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; + + 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; + } + } + + // Supported operations. + + // START new event code + out_avail_Supplier_impl::out_avail_Supplier_impl (void) + { + } + + out_avail_Supplier_impl::out_avail_Supplier_impl (CORBA::ORB_ptr orb) : + orb_ (CORBA::ORB::_duplicate (orb)) + { + } + + void out_avail_Supplier_impl::disconnect_push_supplier (void) + { + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); + PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); + root_poa->deactivate_object (oid); + } + + out_avail_Consumer_impl::out_avail_Consumer_impl (void) + { + } + + out_avail_Consumer_impl::out_avail_Consumer_impl (CORBA::ORB_ptr orb, + ::BasicSP::DataAvailableConsumer_ptr out_avail_consumer) : + orb_ (CORBA::ORB::_duplicate (orb)), + out_avail_consumer_ (::BasicSP::DataAvailableConsumer::_duplicate (out_avail_consumer)) + { + } + + void out_avail_Consumer_impl::push (const RtecEventComm::EventSet& events) + { + ACE_DEBUG ((LM_DEBUG, "CIAO_GLUE_BasicSP::out_avail_Consumer_impl::push\n")); + for (unsigned long i = 0; i < events.length (); i++) + { + ::BasicSP::DataAvailable * ev; + if (events[i].data.any_value >>= ev) + { + this->out_avail_consumer_->push_DataAvailable (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + } + + void out_avail_Consumer_impl::disconnect_push_consumer (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); + PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); + root_poa->deactivate_object (oid); + } + // END new event code + + +} + +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); +} + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.h new file mode 100644 index 00000000000..9d4a7fb3ae0 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.h @@ -0,0 +1,697 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_BMCLOSEDED_SVNT_H +#define CIAO_GLUE_SESSION_BMCLOSEDED_SVNT_H +#include "ace/pre.h" + +#include "BMClosedEDS.h" +#include "BMClosedEDEC.h" + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +// START new event code +#include "orbsvcs/RtecEventCommS.h" +#include "orbsvcs/RtecEventChannelAdminC.h" +#include "Event_Utilities.h" +#include "orbsvcs/Event/EC_Event_Channel.h" +#include "orbsvcs/Event/EC_Default_Factory.h" +// END new event code + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO_GLUE_BasicSP +{ + class BMCLOSEDED_SVNT_Export ReadData_Servant + : public virtual POA_BasicSP::ReadData, + public virtual PortableServer::RefCountServantBase + { + public: + ReadData_Servant ( + ::BasicSP::CCM_ReadData_ptr executor, + ::Components::CCMContext_ptr ctx); + + virtual ~ReadData_Servant (void); + + virtual char * + get_data ( + 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)); + + protected: + // Facet executor. + ::BasicSP::CCM_ReadData_var executor_; + + // Context object. + ::Components::CCMContext_var ctx_; + }; + +} + +namespace CIAO_GLUE_BasicSP +{ + class BMCLOSEDED_SVNT_Export BMClosedED_Context + : public virtual ::BasicSP::CCM_BMClosedED_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class BMClosedED_Servant; + + BMClosedED_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMClosedED_Servant *sv); + + virtual ~BMClosedED_Context (void); + + // Operations from ::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 from ::Components::SessionContext interface. + + virtual CORBA::Object_ptr + get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations for BMClosedED receptacles and event sources, + // defined in ::BasicSP::CCM_BMClosedED_Context. + + virtual ::BasicSP::ReadData_ptr + get_connection_datain ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_out_avail ( + ::BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Methods that manage this component's connections and consumers. + + virtual void + connect_datain ( + ::BasicSP::ReadData_ptr + 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 ::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)); + + protected: + // Simplex datain connection. + ::BasicSP::ReadData_var + ciao_uses_datain_; + + ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var> + ciao_publishes_out_avail_map_; + + // START new event code + RtecEventChannelAdmin::ProxyPushConsumer_var + ciao_proxy_out_avail_consumer_; + + ACE_Active_Map_Manager< + ::RtecEventChannelAdmin::ProxyPushSupplier_var> + ciao_proxy_out_avail_supplier_map_; + + RtecEventChannelAdmin::EventChannel_var ciao_event_channel_; + // END new event code + + ::Components::CCMHome_var + home_; + + ::CIAO::Session_Container * + container_; + + BMClosedED_Servant * + servant_; + + ::BasicSP::BMClosedED_var + component_; + }; + + class BMCLOSEDED_SVNT_Export BMClosedED_Servant + : public virtual POA_BasicSP::BMClosedED, + public virtual PortableServer::RefCountServantBase + { + public: + BMClosedED_Servant ( + ::BasicSP::CCM_BMClosedED_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~BMClosedED_Servant (void); + + virtual ::BasicSP::ReadData_ptr + provide_dataout ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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)); + + virtual ::BasicSP::ReadData_ptr + get_connection_datain ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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)); + + // Servant class for the in_avail consumer. + class BMCLOSEDED_SVNT_Export DataAvailableConsumer_in_avail_Servant + : public virtual POA_BasicSP::DataAvailableConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + DataAvailableConsumer_in_avail_Servant ( + ::BasicSP::CCM_BMClosedED_ptr executor, + ::BasicSP::CCM_BMClosedED_Context_ptr c); + + virtual ~DataAvailableConsumer_in_avail_Servant (void); + + virtual void + push_DataAvailable ( + ::BasicSP::DataAvailable *evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Inherited from ::Components::EventConsumerBase. + 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: + ::BasicSP::CCM_BMClosedED_var + executor_; + + ::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 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. + + 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: + ::BasicSP::CCM_BMClosedED_var + executor_; + + BMClosedED_Context * + context_; + + ::CIAO::Session_Container * + container_; + + ::BasicSP::ReadData_var + provide_dataout_; + + ::BasicSP::DataAvailableConsumer_var + consumes_in_avail_; + + }; + + class BMCLOSEDED_SVNT_Export BMClosedEDHome_Servant + : public virtual POA_BasicSP::BMClosedEDHome, + public virtual PortableServer::RefCountServantBase + { + public: + BMClosedEDHome_Servant ( + ::BasicSP::CCM_BMClosedEDHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~BMClosedEDHome_Servant (void); + + // Home factory and other operations. + + // Operations for keyless home 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)); + + // Supported operations. + + protected: + // CIAO-specific operations. + + ::BasicSP::BMClosedED_ptr + _ciao_activate_component ( + ::BasicSP::CCM_BMClosedED_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BasicSP::BMClosedED_ptr comp + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BasicSP::CCM_BMClosedEDHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + 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); + + // START new event code + class out_avail_Supplier_impl : + public virtual POA_RtecEventComm::PushSupplier, + public virtual PortableServer::RefCountServantBase + { + public: + + out_avail_Supplier_impl (void); + + out_avail_Supplier_impl (CORBA::ORB_ptr orb); + + virtual void disconnect_push_supplier (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + }; + + class out_avail_Consumer_impl : + public virtual POA_RtecEventComm::PushConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + + out_avail_Consumer_impl (void); + + out_avail_Consumer_impl (CORBA::ORB_ptr orb, + ::BasicSP::DataAvailableConsumer_ptr out_avail_consumer); + + virtual void push (const RtecEventComm::EventSet& events); + + virtual void disconnect_push_consumer (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + ::BasicSP::DataAvailableConsumer_var out_avail_consumer_; + }; + // END new event code + +} + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_BMCLOSEDED_SVNT_H */ + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt_export.h new file mode 100644 index 00000000000..bcabbe1023e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/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_EC/BMClosedED/config b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/config new file mode 100644 index 00000000000..a122025755d --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/config @@ -0,0 +1 @@ +BMClosedED_exec|createBMClosedEDHome_Impl|BMClosedED_svnt|createBMClosedEDHome_Servant diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.cidl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.cidl new file mode 100644 index 00000000000..30026cf8c13 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.cidl @@ -0,0 +1,19 @@ +//$Id$ + +#ifndef BMDEVICE_CIDL +#define BMDEVICE_CIDL + +#include "BMDevice.idl" + +composition session BMDevice_Impl +{ + home executor BMDeviceHome_Exec + { + implements BasicSP::BMDeviceHome; + manages BMDevice_Exec; + }; +}; + +#endif /* BMDEVICE_CIDL */ + + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.idl new file mode 100644 index 00000000000..86477c12f8b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.idl @@ -0,0 +1,30 @@ +//$Id$ +//============================================================================= +/** + * @file BMDevice.idl + * + * Definition of the BMDevice component + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= +#ifndef CIAO_BMDEVICE_IDL +#define CIAO_BMDEVICE_IDL + +#include "../BasicSP.idl" + +module BasicSP +{ + component BMDevice + { + provides ReadData data_read; + publishes DataAvailable data_available; + consumes TimeOut timeout; + }; + + home BMDeviceHome manages BMDevice + { + }; +}; + +#endif /*CIAO_BMDEVICE_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.mpc b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.mpc new file mode 100644 index 00000000000..2c618860cb9 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice.mpc @@ -0,0 +1,64 @@ +// $Id$ + +project(BMDevice_stub): ciao_client { + after += BasicSP_stub + sharedname = BMDevice_stub + + idlflags += -Wb,stub_export_macro=BMDEVICE_STUB_Export -Wb,stub_export_include=BMDevice_stub_export.h -Wb,skel_export_macro=BMDEVICE_SVNT_Export -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 -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 -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/handcrafted/BasicSP_EC/BMDevice/BMDeviceE.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDeviceE.idl new file mode 100644 index 00000000000..0ca2b4cbfc8 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDeviceE.idl @@ -0,0 +1,48 @@ +// $Id$ +#include <Components.idl> +#include "BMDevice.idl" + +module BasicSP +{ + local interface CCM_ReadData : ReadData + { + }; + +}; + +module BasicSP +{ + local interface CCM_BMDevice : ::Components::EnterpriseComponent + { + ::BasicSP::CCM_ReadData get_data_read (); + void push_timeout (in ::BasicSP::TimeOut ev); + }; + + local interface CCM_BMDevice_Context : ::Components::SessionContext + { + void push_data_available (in ::BasicSP::DataAvailable ev); + }; + + local interface CCM_BMDeviceHomeExplicit : ::Components::HomeExecutorBase + { + }; + + local interface CCM_BMDeviceHomeImplicit + { + ::Components::EnterpriseComponent create () raises (::Components::CCMException); + }; + + local interface CCM_BMDeviceHome : CCM_BMDeviceHomeExplicit, CCM_BMDeviceHomeImplicit + { + }; + +}; + +module BMDevice_Impl +{ + local interface _Context : ::BasicSP::CCM_BMDevice_Context, ::Components::SessionContext + { + }; + +}; + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDeviceEI.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDeviceEI.idl new file mode 100644 index 00000000000..18a4ad9eaa4 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDeviceEI.idl @@ -0,0 +1,30 @@ +// $Id$ +//============================================================================= +/** + * @file BMDeviceEI.idl + * + * Definition of the BMDevice component implementation. + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= +#ifndef CIAO_BMDEVICEEI_IDL +#define CIAO_BMDEVICEEI_IDL + +#include "BMDeviceE.idl" + +module BasicSP +{ + /** + * @interface BMDevice_Exec + */ + local interface BMDevice_Exec : + CCM_BMDevice, + CCM_ReadData, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_BMDEVICEEI_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec.cpp new file mode 100644 index 00000000000..a53ce4f3836 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec.cpp @@ -0,0 +1,133 @@ +// $Id$ + +#include "CIAO_common.h" +#include "BMDevice_exec.h" + +#define DISPLACEMENT 256 + +/// Default constructor. +MyImpl::BMDevice_exec_i::BMDevice_exec_i (void) + : str_ ("BM DEVICE DATA") +{ + +} + +/// Default destructor. +MyImpl::BMDevice_exec_i::~BMDevice_exec_i () +{ +} + +BasicSP::CCM_ReadData_ptr +MyImpl::BMDevice_exec_i::get_data_read (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return BasicSP::CCM_ReadData::_duplicate (this); +} + +void +MyImpl::BMDevice_exec_i::push_timeout (BasicSP::TimeOut * + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + // Nitify others + BasicSP::DataAvailable_var event = new OBV_BasicSP::DataAvailable; + + ACE_DEBUG ((LM_DEBUG, + "BMDevice, received a timeout from EC \n")); + + this->context_->push_data_available (event + ACE_ENV_ARG_PARAMETER); +} + +char * +MyImpl::BMDevice_exec_i::data_read (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->str_; +} + +char * +MyImpl::BMDevice_exec_i::get_data (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->data_read (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +// Operations from Components::SessionComponent +void +MyImpl::BMDevice_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::BMDevice_exec_i::set_session_context\n")); + + this->context_ = + BasicSP::CCM_BMDevice_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::BMDevice_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDevice_exec_i::ccm_activate\n")); + char *argv[1] = { "BMDevice_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BasicSP::TimeOut_init, + BasicSP::TimeOut); +} + +void +MyImpl::BMDevice_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDevice_exec_i::ccm_passivate\n")); +} + +void +MyImpl::BMDevice_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDevice_exec_i::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::BMDeviceHome_exec_i::BMDeviceHome_exec_i () +{ +} + +/// Default dtor. +MyImpl::BMDeviceHome_exec_i::~BMDeviceHome_exec_i () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::BMDeviceHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::BMDevice_exec_i; +} + + +extern "C" BMDEVICE_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMDeviceHome_Impl (void) +{ + return new MyImpl::BMDeviceHome_exec_i; +} diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec.h new file mode 100644 index 00000000000..d65cbca8b9b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec.h @@ -0,0 +1,122 @@ +// $Id$ + +// ================================================================ +/** + * @file BMDevice_exec.h + * + * Header file for the actual BMDevice and BMDeviceHome component + * implementations. These classes are the implementations of local + * interfaces defined in BMDeviceEI.idl. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +// ================================================================ + +#ifndef CIAO_BMDEVICE_EXEC_H +#define CIAO_BMDEVICE_EXEC_H + +#include "BMDeviceEIC.h" +#include "tao/LocalObject.h" + +namespace MyImpl +{ + /** + * @class BMDEVICE_exec_i + * + * An example RateGen executor implementation class. + */ + class BMDEVICE_EXEC_Export BMDevice_exec_i : + public virtual BasicSP::BMDevice_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + BMDevice_exec_i (); + + /// Default destructor. + ~BMDevice_exec_i (); + + // Operations from BasicSP::BMDevice + + virtual BasicSP::CCM_ReadData_ptr + get_data_read (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + push_timeout (BasicSP::TimeOut *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations from BasicSP::position + + virtual char * + data_read (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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: + char *str_; + + /// Copmponent specific context + BasicSP::CCM_BMDevice_Context_var context_; + }; + + /** + * @class BMDeviceHome_exec_i + * + * BMDevice home executor implementation class. + */ + class BMDEVICE_EXEC_Export BMDeviceHome_exec_i : + public virtual BasicSP::CCM_BMDeviceHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + BMDeviceHome_exec_i (); + + /// Default dtor. + ~BMDeviceHome_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" BMDEVICE_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMDeviceHome_Impl (void); + +#endif /* CIAO_BMDEVICE_EXEC_H*/ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec_export.h new file mode 100644 index 00000000000..0aa2a34ba17 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMDEVICE_EXEC +// ------------------------------ +#ifndef BMDEVICE_EXEC_EXPORT_H +#define BMDEVICE_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMDEVICE_EXEC_HAS_DLL) +# define BMDEVICE_EXEC_HAS_DLL 1 +#endif /* ! BMDEVICE_EXEC_HAS_DLL */ + +#if defined (BMDEVICE_EXEC_HAS_DLL) && (BMDEVICE_EXEC_HAS_DLL == 1) +# if defined (BMDEVICE_EXEC_BUILD_DLL) +# define BMDEVICE_EXEC_Export ACE_Proper_Export_Flag +# define BMDEVICE_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMDEVICE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMDEVICE_EXEC_BUILD_DLL */ +# define BMDEVICE_EXEC_Export ACE_Proper_Import_Flag +# define BMDEVICE_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMDEVICE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMDEVICE_EXEC_BUILD_DLL */ +#else /* BMDEVICE_EXEC_HAS_DLL == 1 */ +# define BMDEVICE_EXEC_Export +# define BMDEVICE_EXEC_SINGLETON_DECLARATION(T) +# define BMDEVICE_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMDEVICE_EXEC_HAS_DLL == 1 */ + +// Set BMDEVICE_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMDEVICE_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define BMDEVICE_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMDEVICE_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMDEVICE_EXEC_NTRACE */ + +#if (BMDEVICE_EXEC_NTRACE == 1) +# define BMDEVICE_EXEC_TRACE(X) +#else /* (BMDEVICE_EXEC_NTRACE == 1) */ +# define BMDEVICE_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMDEVICE_EXEC_NTRACE == 1) */ + +#endif /* BMDEVICE_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_stub_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_stub_export.h new file mode 100644 index 00000000000..b0f1a552d4b --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMDEVICE_STUB +// ------------------------------ +#ifndef BMDEVICE_STUB_EXPORT_H +#define BMDEVICE_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMDEVICE_STUB_HAS_DLL) +# define BMDEVICE_STUB_HAS_DLL 1 +#endif /* ! BMDEVICE_STUB_HAS_DLL */ + +#if defined (BMDEVICE_STUB_HAS_DLL) && (BMDEVICE_STUB_HAS_DLL == 1) +# if defined (BMDEVICE_STUB_BUILD_DLL) +# define BMDEVICE_STUB_Export ACE_Proper_Export_Flag +# define BMDEVICE_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMDEVICE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMDEVICE_STUB_BUILD_DLL */ +# define BMDEVICE_STUB_Export ACE_Proper_Import_Flag +# define BMDEVICE_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMDEVICE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMDEVICE_STUB_BUILD_DLL */ +#else /* BMDEVICE_STUB_HAS_DLL == 1 */ +# define BMDEVICE_STUB_Export +# define BMDEVICE_STUB_SINGLETON_DECLARATION(T) +# define BMDEVICE_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMDEVICE_STUB_HAS_DLL == 1 */ + +// Set BMDEVICE_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMDEVICE_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define BMDEVICE_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMDEVICE_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMDEVICE_STUB_NTRACE */ + +#if (BMDEVICE_STUB_NTRACE == 1) +# define BMDEVICE_STUB_TRACE(X) +#else /* (BMDEVICE_STUB_NTRACE == 1) */ +# define BMDEVICE_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMDEVICE_STUB_NTRACE == 1) */ + +#endif /* BMDEVICE_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp new file mode 100644 index 00000000000..2c91f8fcf90 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp @@ -0,0 +1,1389 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "BMDevice_svnt.h" +#include "Cookies.h" + +namespace CIAO_GLUE_BasicSP +{ + ReadData_Servant::ReadData_Servant ( + ::BasicSP::CCM_ReadData_ptr executor, + ::Components::CCMContext_ptr c) + : executor_ (::BasicSP::CCM_ReadData::_duplicate (executor)), + ctx_ (::Components::CCMContext::_duplicate (c)) + { + } + + ReadData_Servant::~ReadData_Servant (void) + { + } + + char * + ReadData_Servant::get_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->executor_->get_data ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + CORBA::Object_ptr + ReadData_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->ctx_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (! CORBA::is_nil (sc.in ())) + { + return sc->get_CCM_object ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow ( + this->ctx_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (! CORBA::is_nil (ec.in ())) + { + return ec->get_CCM_object ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + } + +} + +namespace CIAO_GLUE_BasicSP +{ + BMDevice_Context::BMDevice_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMDevice_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv), + // START new event code + ciao_proxy_data_available_consumer_ (RtecEventChannelAdmin::ProxyPushConsumer::_nil ()), + ciao_event_channel_ (RtecEventChannelAdmin::EventChannel::_nil ()) + // END new event code + { + } + + BMDevice_Context::~BMDevice_Context (void) + { + // START new event code + this->ciao_event_channel_->destroy (); + // END new event code + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + BMDevice_Context::get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Principal::_nil ()); + } + + ::Components::CCMHome_ptr + BMDevice_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + BMDevice_Context::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Transaction::UserTransaction_ptr + BMDevice_Context::get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Transaction::UserTransaction::_nil ()); + } + + CORBA::Boolean + BMDevice_Context::is_caller_in_role ( + const char *role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_UNUSED_ARG (role); + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + BMDevice_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + BMDevice_Context::get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = + this->container_->get_objref ( + this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->component_ = + ::BasicSP::BMDevice::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (CORBA::is_nil (this->component_.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + } + + return ::BasicSP::BMDevice::_duplicate ( + this->component_.in ()); + } + + // Operations for BMDevice receptacles and event sources, + // defined in ::BasicSP::CCM_BMDevice_Context. + + void + BMDevice_Context::push_data_available ( + ::BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + // START new event code + RtecEventComm::EventSet events (1); + events.length (1); + events[0].header.source = ACE_ES_EVENT_SOURCE_ANY + 2; + events[0].header.type = ACE_ES_EVENT_UNDEFINED + 2; + events[0].data.any_value <<= ev; + ciao_proxy_data_available_consumer_->push (events); + // END new event code + + // START old event code + /* + ACE_Active_Map_Manager<::BasicSP::DataAvailableConsumer_var>::iterator end = + this->ciao_publishes_data_available_map_.end (); + + for (ACE_Active_Map_Manager<::BasicSP::DataAvailableConsumer_var>::iterator iter = + this->ciao_publishes_data_available_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 () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_DataAvailable ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + */ + // END old event code + } + + ::Components::Cookie * + BMDevice_Context::subscribe_data_available ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + // START new event code + // Get a reference to the ORB. + char * argv[1] = { "BMDevice_exec" }; + int argc = sizeof (argv) / sizeof (argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Get a reference to the POA + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Nil RootPOA\n"), 0); + + // Get a reference to the event channel + if (CORBA::is_nil (this->ciao_event_channel_.in ())) + { + TAO_EC_Event_Channel_Attributes attributes (root_poa.in (), root_poa.in ()); + TAO_EC_Event_Channel * ec_servant; + ACE_NEW_RETURN (ec_servant, TAO_EC_Event_Channel (attributes), 0); + ec_servant->activate (); + this->ciao_event_channel_ = ec_servant->_this (); + } + + // Establish supplier's connection to event channel if not done yet + if (CORBA::is_nil (this->ciao_proxy_data_available_consumer_.in ())) + { + RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = + this->ciao_event_channel_->for_suppliers (); + this->ciao_proxy_data_available_consumer_ = supplier_admin->obtain_push_consumer (); + + // Create and register supplier servant + data_available_Supplier_impl * supplier_servant; + ACE_NEW_RETURN (supplier_servant, data_available_Supplier_impl (orb.in ()), 0); + RtecEventComm::PushSupplier_var supplier = supplier_servant->_this (); + + // Set QoS properties and connect + ACE_SupplierQOS_Factory qos; + qos.insert (ACE_ES_EVENT_SOURCE_ANY + 2, + ACE_ES_EVENT_UNDEFINED + 2, + 0, + 1); + this->ciao_proxy_data_available_consumer_->connect_push_supplier (supplier.in (), + qos.get_SupplierQOS ()); + } // End if (ciao_proxy_data_available_consumer_ is nil) + + // Establish consumer's connection to event channel + if (CORBA::is_nil (c)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + } + + ::BasicSP::DataAvailableConsumer_var sub = ::BasicSP::DataAvailableConsumer::_duplicate (c); + + RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = + this->ciao_event_channel_->for_consumers (); + RtecEventChannelAdmin::ProxyPushSupplier_var ciao_proxy_data_available_supplier = + consumer_admin->obtain_push_supplier (); + + // Create and register consumer servant + data_available_Consumer_impl * consumer_servant; + ACE_NEW_RETURN (consumer_servant, data_available_Consumer_impl (orb.in (), sub.in ()), 0); + RtecEventComm::PushConsumer_var consumer = consumer_servant->_this (); + + // Put reference to this PushConsumer in the map so we can disconnect later + ACE_Active_Map_Manager_Key key; + this->ciao_proxy_data_available_supplier_map_.bind (ciao_proxy_data_available_supplier.in (), key); + + // Set QoS properties and connect + ACE_ConsumerQOS_Factory qos; + qos.start_disjunction_group (1); + qos.insert_type (ACE_ES_EVENT_UNDEFINED + 2, + 0); + ciao_proxy_data_available_supplier->connect_push_consumer (consumer.in (), + qos.get_ConsumerQOS ()); + + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + // END new event code + + // START old event code + /* + 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_data_available_map_.bind (sub.in (), key); + + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + */ + // END old event code + } + + ::BasicSP::DataAvailableConsumer_ptr + BMDevice_Context::unsubscribe_data_available ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + // START new event code + ::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 (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + RtecEventChannelAdmin::ProxyPushSupplier_var ciao_proxy_data_available_supplier; + + if (this->ciao_proxy_data_available_supplier_map_.find (key, ciao_proxy_data_available_supplier) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + ciao_proxy_data_available_supplier->disconnect_push_supplier (); + + if (this->ciao_proxy_data_available_supplier_map_.unbind (key, ciao_proxy_data_available_supplier) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + return retv._retn (); + // END new event code + + // START old event code + /* + ::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 (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + if (this->ciao_publishes_data_available_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::DataAvailableConsumer::_nil ()); + } + + return retv._retn (); + */ + // END old event code + } + + + BMDevice_Servant::BMDevice_Servant ( + ::BasicSP::CCM_BMDevice_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_BMDevice::_duplicate (exe)), + container_ (c) + { + this->context_ = new BMDevice_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 + { + } + ACE_ENDTRY; + } + + BMDevice_Servant::~BMDevice_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 + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + ::BasicSP::ReadData_ptr + BMDevice_Servant::provide_data_read ( + ACE_ENV_SINGLE_ARG_PARAMETER) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (::CORBA::is_nil (this->provide_data_read_.in ())) + { + ::BasicSP::CCM_ReadData_var fexe = + this->executor_->get_data_read (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + if (::CORBA::is_nil (fexe.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::ReadData::_nil ()); + } + + ReadData_Servant *svt = + new 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 (::BasicSP::ReadData::_nil ()); + + ::BasicSP::ReadData_var fo = + ::BasicSP::ReadData::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::ReadData::_nil ()); + + this->provide_data_read_ = fo; + } + + return ::BasicSP::ReadData::_duplicate (this->provide_data_read_.in ()); + } + + ::Components::Cookie * + BMDevice_Servant::subscribe_data_available ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_data_available ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BasicSP::DataAvailableConsumer_ptr + BMDevice_Servant::unsubscribe_data_available ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_data_available ( + ck + ACE_ENV_ARG_PARAMETER); + } + + BMDevice_Servant::TimeOutConsumer_timeout_Servant::TimeOutConsumer_timeout_Servant ( + ::BasicSP::CCM_BMDevice_ptr executor, + ::BasicSP::CCM_BMDevice_Context_ptr c) + : executor_ (::BasicSP::CCM_BMDevice::_duplicate (executor)), + ctx_ (::BasicSP::CCM_BMDevice_Context::_duplicate (c)) + { + } + + BMDevice_Servant::TimeOutConsumer_timeout_Servant::~TimeOutConsumer_timeout_Servant (void) + { + } + + CORBA::Object_ptr + BMDevice_Servant::TimeOutConsumer_timeout_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 + BMDevice_Servant::TimeOutConsumer_timeout_Servant::push_TimeOut ( + ::BasicSP::TimeOut *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_timeout ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + BMDevice_Servant::TimeOutConsumer_timeout_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::BasicSP::TimeOut_var ev_type = + ::BasicSP::TimeOut::_downcast (ev); + + if (ev_type != 0) + { + this->push_TimeOut ( + ev_type.in () + ACE_ENV_SINGLE_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BasicSP::TimeOutConsumer_ptr + BMDevice_Servant::get_consumer_timeout ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_timeout_.in ())) + { + BMDevice_Servant::TimeOutConsumer_timeout_Servant *svt = + new BMDevice_Servant::TimeOutConsumer_timeout_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 (::BasicSP::TimeOutConsumer::_nil ()); + + ::BasicSP::TimeOutConsumer_var eco = + ::BasicSP::TimeOutConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::TimeOutConsumer::_nil ()); + + this->consumes_timeout_ = eco; + } + + return ::BasicSP::TimeOutConsumer::_duplicate (this->consumes_timeout_.in ()); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + BMDevice_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 (), + ::CORBA::Object::_nil ()); + } + + if (ACE_OS::strcmp (name, "data_read") == 0) + { + return this->provide_data_read (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::FacetDescriptions * + BMDevice_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + BMDevice_Servant::get_named_facets ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + CORBA::Boolean + BMDevice_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 ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for Receptacles interface. + + ::Components::Cookie * + BMDevice_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); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + BMDevice_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)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::ConnectionDescriptions * + BMDevice_Servant::get_connections ( + const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMDevice_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMDevice_Servant::get_named_receptacles ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for Events interface. + + ::Components::EventConsumerBase_ptr + BMDevice_Servant::get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (sink_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (sink_name, "timeout") == 0) + { + return this->get_consumer_timeout (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::Cookie * + BMDevice_Servant::subscribe ( + const char *publisher_name, + ::Components::EventConsumerBase_ptr subscribe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::ExceededConnectionLimit)) + { + if (publisher_name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + if (ACE_OS::strcmp (publisher_name, "data_available") == 0) + { + ::BasicSP::DataAvailableConsumer_var _ciao_consumer = + ::BasicSP::DataAvailableConsumer::_narrow ( + subscribe + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (_ciao_consumer.in ())) + { + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + } + + return this->subscribe_data_available ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + BMDevice_Servant::unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)) + { + if (publisher_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (publisher_name, "data_available") == 0) + { + return this->unsubscribe_data_available ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + BMDevice_Servant::connect_consumer ( + const char *emitter_name, + ::Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + BMDevice_Servant::disconnect_consumer ( + const char *source_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMDevice_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMDevice_Servant::get_named_consumers ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMDevice_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMDevice_Servant::get_named_emitters ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMDevice_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMDevice_Servant::get_named_publishers ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for CCMObject interface. + + CORBA::IRObject_ptr + BMDevice_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + BMDevice_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 * + BMDevice_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + BMDevice_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + BMDevice_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + BMDevice_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); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + 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 (); + } + + CORBA::Object_ptr + BMDevice_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::CORBA::Object::_nil ()); + + if (! ::CORBA::is_nil (sc.in ())) + { + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::CORBA::Object::_nil ()); + + if (! ::CORBA::is_nil (ec.in ())) + { + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + BMDevice_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 + BMDevice_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); + } + } + + // Supported operations. + + + BMDeviceHome_Servant::BMDeviceHome_Servant ( + ::BasicSP::CCM_BMDeviceHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_BMDeviceHome::_duplicate (exe)), + container_ (c) + { + } + + BMDeviceHome_Servant::~BMDeviceHome_Servant (void) + { + } + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + BMDeviceHome_Servant::create_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for implicit home interface. + + ::BasicSP::BMDevice_ptr + BMDeviceHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::BMDevice::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + ::BasicSP::CCM_BMDevice_var _ciao_comp = + ::BasicSP::CCM_BMDevice::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + BMDeviceHome_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::CORBA::IRObject_ptr + BMDeviceHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BMDeviceHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BasicSP::BMDevice_var _ciao_comp = + ::BasicSP::BMDevice::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::BasicSP::BMDevice_ptr + BMDeviceHome_Servant::_ciao_activate_component ( + ::BasicSP::CCM_BMDevice_ptr exe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var hobj = + this->container_->get_objref ( + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + BMDevice_Servant *svt = + new BMDevice_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 (::BasicSP::BMDevice::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + ::BasicSP::BMDevice_var ho = + ::BasicSP::BMDevice::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDevice::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + BMDeviceHome_Servant::_ciao_passivate_component ( + ::BasicSP::BMDevice_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; + + BMDevice_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; + } + } + + // Supported operations. + + // START new event code + data_available_Supplier_impl::data_available_Supplier_impl (void) + { + } + + data_available_Supplier_impl::data_available_Supplier_impl (CORBA::ORB_ptr orb) : + orb_ (CORBA::ORB::_duplicate (orb)) + { + } + + void data_available_Supplier_impl::disconnect_push_supplier (void) + { + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); + PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); + root_poa->deactivate_object (oid); + } + + data_available_Consumer_impl::data_available_Consumer_impl (void) + { + } + + data_available_Consumer_impl::data_available_Consumer_impl (CORBA::ORB_ptr orb, + ::BasicSP::DataAvailableConsumer_ptr data_available_consumer) : + orb_ (CORBA::ORB::_duplicate (orb)), + data_available_consumer_ (::BasicSP::DataAvailableConsumer::_duplicate (data_available_consumer)) + { + } + + void data_available_Consumer_impl::push (const RtecEventComm::EventSet& events) + { + ACE_DEBUG ((LM_DEBUG, "CIAO_GLUE_BasicSP::data_available_Consumer_impl::push\n")); + for (unsigned long i = 0; i < events.length (); i++) + { + ::BasicSP::DataAvailable * ev; + if (events[i].data.any_value >>= ev) + { + this->data_available_consumer_->push_DataAvailable (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + } + + void data_available_Consumer_impl::disconnect_push_consumer (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); + PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); + root_poa->deactivate_object (oid); + } + // END new event code + +} + +extern "C" BMDEVICE_SVNT_Export ::PortableServer::Servant +createBMDeviceHome_Servant ( +::Components::HomeExecutorBase_ptr p, +CIAO::Session_Container *c +ACE_ENV_ARG_DECL) +{ + if (p == 0) + { + return 0; + } + + ::BasicSP::CCM_BMDeviceHome_var x = + ::BasicSP::CCM_BMDeviceHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + ::CIAO_GLUE_BasicSP::BMDeviceHome_Servant ( + x.in (), + c); +} + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.h new file mode 100644 index 00000000000..e90ab684176 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.h @@ -0,0 +1,653 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_BMDEVICE_SVNT_H +#define CIAO_GLUE_SESSION_BMDEVICE_SVNT_H +#include "ace/pre.h" + +#include "BMDeviceS.h" +#include "BMDeviceEC.h" + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +// START new event code +#include "orbsvcs/RtecEventCommS.h" +#include "orbsvcs/RtecEventChannelAdminC.h" +#include "Event_Utilities.h" +#include "orbsvcs/Event/EC_Event_Channel.h" +#include "orbsvcs/Event/EC_Default_Factory.h" +// END new event code + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO_GLUE_BasicSP +{ + class BMDEVICE_SVNT_Export ReadData_Servant + : public virtual POA_BasicSP::ReadData, + public virtual PortableServer::RefCountServantBase + { + public: + ReadData_Servant ( + ::BasicSP::CCM_ReadData_ptr executor, + ::Components::CCMContext_ptr ctx); + + virtual ~ReadData_Servant (void); + + virtual char * + get_data ( + 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)); + + protected: + // Facet executor. + ::BasicSP::CCM_ReadData_var executor_; + + // Context object. + ::Components::CCMContext_var ctx_; + }; + +} + +namespace CIAO_GLUE_BasicSP +{ + class BMDEVICE_SVNT_Export BMDevice_Context + : public virtual ::BasicSP::CCM_BMDevice_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class BMDevice_Servant; + + BMDevice_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMDevice_Servant *sv); + + virtual ~BMDevice_Context (void); + + // Operations from ::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 from ::Components::SessionContext interface. + + virtual CORBA::Object_ptr + get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations for BMDevice receptacles and event sources, + // defined in ::BasicSP::CCM_BMDevice_Context. + + virtual void + push_data_available ( + ::BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Methods that manage this component's connections and consumers. + + virtual ::Components::Cookie * + subscribe_data_available ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::DataAvailableConsumer_ptr + unsubscribe_data_available ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BasicSP::DataAvailableConsumer_var> + ciao_publishes_data_available_map_; + + // START new event code + RtecEventChannelAdmin::ProxyPushConsumer_var + ciao_proxy_data_available_consumer_; + + ACE_Active_Map_Manager< + ::RtecEventChannelAdmin::ProxyPushSupplier_var> + ciao_proxy_data_available_supplier_map_; + + RtecEventChannelAdmin::EventChannel_var ciao_event_channel_; + // END new event code + + ::Components::CCMHome_var + home_; + + ::CIAO::Session_Container * + container_; + + BMDevice_Servant * + servant_; + + ::BasicSP::BMDevice_var + component_; + }; + + class BMDEVICE_SVNT_Export BMDevice_Servant + : public virtual POA_BasicSP::BMDevice, + public virtual PortableServer::RefCountServantBase + { + public: + BMDevice_Servant ( + ::BasicSP::CCM_BMDevice_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~BMDevice_Servant (void); + + virtual ::BasicSP::ReadData_ptr + provide_data_read ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::Components::Cookie * + subscribe_data_available ( + ::BasicSP::DataAvailableConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::DataAvailableConsumer_ptr + unsubscribe_data_available ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Servant class for the timeout consumer. + class BMDEVICE_SVNT_Export TimeOutConsumer_timeout_Servant + : public virtual POA_BasicSP::TimeOutConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + TimeOutConsumer_timeout_Servant ( + ::BasicSP::CCM_BMDevice_ptr executor, + ::BasicSP::CCM_BMDevice_Context_ptr c); + + virtual ~TimeOutConsumer_timeout_Servant (void); + + virtual void + push_TimeOut ( + ::BasicSP::TimeOut *evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Inherited from ::Components::EventConsumerBase. + 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: + ::BasicSP::CCM_BMDevice_var + executor_; + + ::BasicSP::CCM_BMDevice_Context_var + ctx_; + }; + + virtual ::BasicSP::TimeOutConsumer_ptr + get_consumer_timeout ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // 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. + + 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: + ::BasicSP::CCM_BMDevice_var + executor_; + + BMDevice_Context * + context_; + + ::CIAO::Session_Container * + container_; + + ::BasicSP::ReadData_var + provide_data_read_; + + ::BasicSP::TimeOutConsumer_var + consumes_timeout_; + + }; + + class BMDEVICE_SVNT_Export BMDeviceHome_Servant + : public virtual POA_BasicSP::BMDeviceHome, + public virtual PortableServer::RefCountServantBase + { + public: + BMDeviceHome_Servant ( + ::BasicSP::CCM_BMDeviceHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~BMDeviceHome_Servant (void); + + // Home factory and other operations. + + // Operations for keyless home 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::BMDevice_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)); + + // Supported operations. + + protected: + // CIAO-specific operations. + + ::BasicSP::BMDevice_ptr + _ciao_activate_component ( + ::BasicSP::CCM_BMDevice_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BasicSP::BMDevice_ptr comp + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BasicSP::CCM_BMDeviceHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + BMDevice_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" BMDEVICE_SVNT_Export ::PortableServer::Servant + createBMDeviceHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + // START new event code + class data_available_Supplier_impl : + public virtual POA_RtecEventComm::PushSupplier, + public virtual PortableServer::RefCountServantBase + { + public: + + data_available_Supplier_impl (void); + + data_available_Supplier_impl (CORBA::ORB_ptr orb); + + virtual void disconnect_push_supplier (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + }; + + class data_available_Consumer_impl : + public virtual POA_RtecEventComm::PushConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + + data_available_Consumer_impl (void); + + data_available_Consumer_impl (CORBA::ORB_ptr orb, + ::BasicSP::DataAvailableConsumer_ptr data_available_consumer); + + virtual void push (const RtecEventComm::EventSet& events); + + virtual void disconnect_push_consumer (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + ::BasicSP::DataAvailableConsumer_var data_available_consumer_; + }; + // END new event code + +} + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_BMDEVICE_SVNT_H */ + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt_export.h new file mode 100644 index 00000000000..653db47fefb --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMDEVICE_SVNT +// ------------------------------ +#ifndef BMDEVICE_SVNT_EXPORT_H +#define BMDEVICE_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMDEVICE_SVNT_HAS_DLL) +# define BMDEVICE_SVNT_HAS_DLL 1 +#endif /* ! BMDEVICE_SVNT_HAS_DLL */ + +#if defined (BMDEVICE_SVNT_HAS_DLL) && (BMDEVICE_SVNT_HAS_DLL == 1) +# if defined (BMDEVICE_SVNT_BUILD_DLL) +# define BMDEVICE_SVNT_Export ACE_Proper_Export_Flag +# define BMDEVICE_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMDEVICE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMDEVICE_SVNT_BUILD_DLL */ +# define BMDEVICE_SVNT_Export ACE_Proper_Import_Flag +# define BMDEVICE_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMDEVICE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMDEVICE_SVNT_BUILD_DLL */ +#else /* BMDEVICE_SVNT_HAS_DLL == 1 */ +# define BMDEVICE_SVNT_Export +# define BMDEVICE_SVNT_SINGLETON_DECLARATION(T) +# define BMDEVICE_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMDEVICE_SVNT_HAS_DLL == 1 */ + +// Set BMDEVICE_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMDEVICE_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define BMDEVICE_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMDEVICE_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMDEVICE_SVNT_NTRACE */ + +#if (BMDEVICE_SVNT_NTRACE == 1) +# define BMDEVICE_SVNT_TRACE(X) +#else /* (BMDEVICE_SVNT_NTRACE == 1) */ +# define BMDEVICE_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMDEVICE_SVNT_NTRACE == 1) */ + +#endif /* BMDEVICE_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/config b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/config new file mode 100644 index 00000000000..5798aa88e24 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/config @@ -0,0 +1 @@ +BMDevice_exec|createBMDeviceHome_Impl|BMDevice_svnt|createBMDeviceHome_Servant diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.cidl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.cidl new file mode 100644 index 00000000000..4342aa753c8 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.cidl @@ -0,0 +1,18 @@ +//$Id$ + +#ifndef BMDISPLAY_CIDL +#define BMDISPLAY_CIDL + +#include "BMDisplay.idl" + +composition session BMDisplay_Impl +{ + home executor BMDisplayHome_Exec + { + implements BasicSP::BMDisplayHome; + manages BMDisplay_Exec; + }; +}; + +#endif /* BMDISPLAY_CIDL */ + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.idl new file mode 100644 index 00000000000..cbeed950b07 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.idl @@ -0,0 +1,15 @@ +//$Id$ +#include "../BasicSP.idl" + +module BasicSP +{ + component BMDisplay + { + consumes DataAvailable data_ready; + uses ReadData comp_data; + }; + + home BMDisplayHome manages BMDisplay + { + }; +}; diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.mpc b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.mpc new file mode 100644 index 00000000000..5c0a113b9c8 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay.mpc @@ -0,0 +1,60 @@ +// $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 -Wb,stub_export_include=BMDisplay_stub_export.h -Wb,skel_export_macro=BMDISPLAY_SVNT_Export -Wb,skel_export_include=BMDisplay_svnt_export.h + 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/handcrafted/BasicSP_EC/BMDisplay/BMDisplayE.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayE.idl new file mode 100644 index 00000000000..78575b701d9 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayE.idl @@ -0,0 +1,39 @@ +// $Id$ +#include <Components.idl> +#include "BMDisplay.idl" + +module BasicSP +{ + local interface CCM_BMDisplay : ::Components::EnterpriseComponent + { + void push_data_ready (in ::BasicSP::DataAvailable ev); + }; + + local interface CCM_BMDisplay_Context : ::Components::SessionContext + { + ::BasicSP::ReadData get_connection_comp_data (); + }; + + local interface CCM_BMDisplayHomeExplicit : ::Components::HomeExecutorBase + { + }; + + local interface CCM_BMDisplayHomeImplicit + { + ::Components::EnterpriseComponent create () raises (::Components::CCMException); + }; + + local interface CCM_BMDisplayHome : CCM_BMDisplayHomeExplicit, CCM_BMDisplayHomeImplicit + { + }; + +}; + +module BMDisplay_Impl +{ + local interface _Context : ::BasicSP::CCM_BMDisplay_Context, ::Components::SessionContext + { + }; + +}; + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayEI.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayEI.idl new file mode 100644 index 00000000000..8a218debab1 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayEI.idl @@ -0,0 +1,33 @@ +// $Id$ +//=========================================================== +/** + * @file BMDisplayEI.idl + * + * Definition of the BMDisplay (navigation display) component + * implementation. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//=========================================================== +#ifndef CIAO_BMDISPLAYEI_IDL +#define CIAO_BMDISPLAYEI_IDL + +#include "BMDisplayE.idl" + +module BasicSP +{ + /** + * @interface BMDisplay_Exec + * + * The actually BMDisplay executor inherits from both CCM_BMDisplay + * and session_component interfaces as a monolithic implementation. + */ + local interface BMDisplay_Exec : + CCM_BMDisplay, + Components::SessionComponent + { + }; + +}; + +#endif /* CIAO_BMDISPLAYEI_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec.cpp new file mode 100644 index 00000000000..f7ac0de4c4a --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec.cpp @@ -0,0 +1,135 @@ +// $Id$ + +#include "CIAO_common.h" +#include "BMDisplay_exec.h" + +/// Default constructor. +MyImpl::BMDisplay_exec_impl::BMDisplay_exec_impl () +{ +} + +/// Default destructor. +MyImpl::BMDisplay_exec_impl::~BMDisplay_exec_impl () +{ +} + +// Operations from BasicSP::BMDisplay + +void +MyImpl::BMDisplay_exec_impl::push_data_ready ( + BasicSP::DataAvailable *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_UNUSED_ARG (ev); + + ACE_DEBUG ((LM_DEBUG, + "BMDisplay - Doing computations \n")); + + ACE_DEBUG ((LM_DEBUG, + "BMDisplay - Doing data fetch \n")); + + // Refresh position + BasicSP::ReadData_var dat + = this->context_->get_connection_comp_data (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (dat.in ())) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + char *str = + dat->get_data (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "BMDisplay - Display data is [%s] \n", + str)); + +} + +// Operations from Components::SessionComponent +void +MyImpl::BMDisplay_exec_impl::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDisplay_exec_impl::set_session_context\n")); + + this->context_ = + BasicSP::CCM_BMDisplay_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::BMDisplay_exec_impl::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDisplay_exec_impl::ccm_activate\n")); + + // @@ This hack work around a missing feature in CIAO's assembly + // mechanism where a Softpkg descriptor can specify it's dependency + // to a valuetype factory and instruct the deployment framework to + // initialize and register the corresponding valuefactory in the + // component server. Here, we are registering the valuefactory + // explicitly to work around this problem. + + char *argv[1] = { "BMDisplay_exec"}; + + int argc = sizeof(argv)/sizeof(argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv ACE_ENV_ARG_PARAMETER); + + CIAO_REGISTER_VALUE_FACTORY (orb.in(), BasicSP::DataAvailable_init, + BasicSP::DataAvailable); +} + +void +MyImpl::BMDisplay_exec_impl::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDisplay_exec_impl::ccm_passivate\n")); +} + +void +MyImpl::BMDisplay_exec_impl::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::BMDisplay_exec_impl::ccm_remove\n")); +} + +/// Default ctor. +MyImpl::BMDisplayHome_exec_impl::BMDisplayHome_exec_impl () +{ +} + +/// Default dtor. +MyImpl::BMDisplayHome_exec_impl::~BMDisplayHome_exec_impl () +{ +} + +// Explicit home operations. + +// Implicit home operations. + +::Components::EnterpriseComponent_ptr +MyImpl::BMDisplayHome_exec_impl::create (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::BMDisplay_exec_impl; +} + + +extern "C" BMDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMDisplayHome_Impl (void) +{ + return new MyImpl::BMDisplayHome_exec_impl; +} diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec.h new file mode 100644 index 00000000000..25c5c4f3488 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec.h @@ -0,0 +1,102 @@ +// $Id$ + +//============================================================== +/** + * @file BMDisplay_exec.h + * + * Header file for the actual BMDisplay and BMDisplayHome component + * implementations. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================== +#ifndef CIAO_BMDISPLAY_EXEC_H +#define CIAO_BMDISPLAY_EXEC_H + +#include "BMDisplayEIC.h" +#include "tao/LocalObject.h" + +namespace MyImpl +{ + /** + * @class BMDisplay_exec_impl + * + * RateGen executor implementation class. + */ + class BMDISPLAY_EXEC_Export BMDisplay_exec_impl : + public virtual BasicSP::BMDisplay_Exec, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default constructor. + BMDisplay_exec_impl (); + + /// Default destructor. + ~BMDisplay_exec_impl (); + + // Operations from BasicSP::BMDisplay + + virtual void + push_data_ready (BasicSP::DataAvailable *ev + ACE_ENV_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: + /// Copmponent specific context + BasicSP::CCM_BMDisplay_Context_var context_; + }; + + /** + * @class BMDisplayHome_exec_impl + * + * BMDisplay home executor implementation class. + */ + class BMDISPLAY_EXEC_Export BMDisplayHome_exec_impl : + public virtual BasicSP::CCM_BMDisplayHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + BMDisplayHome_exec_impl (); + + /// Default dtor. + ~BMDisplayHome_exec_impl (); + + // 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)); + }; + +} + +extern "C" BMDISPLAY_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMDisplayHome_Impl (void); + +#endif /* BMDISPLAY_EXEC_H */ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec_export.h new file mode 100644 index 00000000000..1f684e4e2c0 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMDISPLAY_EXEC +// ------------------------------ +#ifndef BMDISPLAY_EXEC_EXPORT_H +#define BMDISPLAY_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMDISPLAY_EXEC_HAS_DLL) +# define BMDISPLAY_EXEC_HAS_DLL 1 +#endif /* ! BMDISPLAY_EXEC_HAS_DLL */ + +#if defined (BMDISPLAY_EXEC_HAS_DLL) && (BMDISPLAY_EXEC_HAS_DLL == 1) +# if defined (BMDISPLAY_EXEC_BUILD_DLL) +# define BMDISPLAY_EXEC_Export ACE_Proper_Export_Flag +# define BMDISPLAY_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMDISPLAY_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMDISPLAY_EXEC_BUILD_DLL */ +# define BMDISPLAY_EXEC_Export ACE_Proper_Import_Flag +# define BMDISPLAY_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMDISPLAY_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMDISPLAY_EXEC_BUILD_DLL */ +#else /* BMDISPLAY_EXEC_HAS_DLL == 1 */ +# define BMDISPLAY_EXEC_Export +# define BMDISPLAY_EXEC_SINGLETON_DECLARATION(T) +# define BMDISPLAY_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMDISPLAY_EXEC_HAS_DLL == 1 */ + +// Set BMDISPLAY_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMDISPLAY_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define BMDISPLAY_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMDISPLAY_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMDISPLAY_EXEC_NTRACE */ + +#if (BMDISPLAY_EXEC_NTRACE == 1) +# define BMDISPLAY_EXEC_TRACE(X) +#else /* (BMDISPLAY_EXEC_NTRACE == 1) */ +# define BMDISPLAY_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMDISPLAY_EXEC_NTRACE == 1) */ + +#endif /* BMDISPLAY_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_stub_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_stub_export.h new file mode 100644 index 00000000000..399dbb7425d --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMDISPLAY_STUB +// ------------------------------ +#ifndef BMDISPLAY_STUB_EXPORT_H +#define BMDISPLAY_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMDISPLAY_STUB_HAS_DLL) +# define BMDISPLAY_STUB_HAS_DLL 1 +#endif /* ! BMDISPLAY_STUB_HAS_DLL */ + +#if defined (BMDISPLAY_STUB_HAS_DLL) && (BMDISPLAY_STUB_HAS_DLL == 1) +# if defined (BMDISPLAY_STUB_BUILD_DLL) +# define BMDISPLAY_STUB_Export ACE_Proper_Export_Flag +# define BMDISPLAY_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMDISPLAY_STUB_BUILD_DLL */ +# define BMDISPLAY_STUB_Export ACE_Proper_Import_Flag +# define BMDISPLAY_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMDISPLAY_STUB_BUILD_DLL */ +#else /* BMDISPLAY_STUB_HAS_DLL == 1 */ +# define BMDISPLAY_STUB_Export +# define BMDISPLAY_STUB_SINGLETON_DECLARATION(T) +# define BMDISPLAY_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMDISPLAY_STUB_HAS_DLL == 1 */ + +// Set BMDISPLAY_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMDISPLAY_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define BMDISPLAY_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMDISPLAY_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMDISPLAY_STUB_NTRACE */ + +#if (BMDISPLAY_STUB_NTRACE == 1) +# define BMDISPLAY_STUB_TRACE(X) +#else /* (BMDISPLAY_STUB_NTRACE == 1) */ +# define BMDISPLAY_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMDISPLAY_STUB_NTRACE == 1) */ + +#endif /* BMDISPLAY_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.cpp new file mode 100644 index 00000000000..d198fa14984 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.cpp @@ -0,0 +1,1053 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "BMDisplay_svnt.h" +#include "Cookies.h" + +namespace CIAO_GLUE_BasicSP +{ + BMDisplay_Context::BMDisplay_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMDisplay_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + BMDisplay_Context::~BMDisplay_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + BMDisplay_Context::get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Principal::_nil ()); + } + + ::Components::CCMHome_ptr + BMDisplay_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + BMDisplay_Context::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Transaction::UserTransaction_ptr + BMDisplay_Context::get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Transaction::UserTransaction::_nil ()); + } + + CORBA::Boolean + BMDisplay_Context::is_caller_in_role ( + const char *role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_UNUSED_ARG (role); + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + BMDisplay_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + BMDisplay_Context::get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = + this->container_->get_objref ( + this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->component_ = + ::BasicSP::BMDisplay::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (CORBA::is_nil (this->component_.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + } + + return ::BasicSP::BMDisplay::_duplicate ( + this->component_.in ()); + } + + // Operations for BMDisplay receptacles and event sources, + // defined in ::BasicSP::CCM_BMDisplay_Context. + + ::BasicSP::ReadData_ptr + BMDisplay_Context::get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::BasicSP::ReadData::_duplicate ( + this->ciao_uses_comp_data_.in ()); + } + + void + BMDisplay_Context::connect_comp_data ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + if (! CORBA::is_nil (this->ciao_uses_comp_data_.in ())) + { + ACE_THROW (::Components::AlreadyConnected ()); + } + + if (CORBA::is_nil (c)) + { + ACE_THROW (::Components::InvalidConnection ()); + } + + this->ciao_uses_comp_data_ = + ::BasicSP::ReadData::_duplicate (c); + } + + ::BasicSP::ReadData_ptr + BMDisplay_Context::disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + if (CORBA::is_nil (this->ciao_uses_comp_data_.in ())) + { + ACE_THROW_RETURN ( + ::Components::NoConnection (), + ::BasicSP::ReadData::_nil ()); + } + + return this->ciao_uses_comp_data_._retn (); + } + + + BMDisplay_Servant::BMDisplay_Servant ( + ::BasicSP::CCM_BMDisplay_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_BMDisplay::_duplicate (exe)), + container_ (c) + { + this->context_ = new BMDisplay_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 + { + } + ACE_ENDTRY; + } + + BMDisplay_Servant::~BMDisplay_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 + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::DataAvailableConsumer_data_ready_Servant ( + ::BasicSP::CCM_BMDisplay_ptr executor, + ::BasicSP::CCM_BMDisplay_Context_ptr c) + : executor_ (::BasicSP::CCM_BMDisplay::_duplicate (executor)), + ctx_ (::BasicSP::CCM_BMDisplay_Context::_duplicate (c)) + { + } + + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::~DataAvailableConsumer_data_ready_Servant (void) + { + } + + CORBA::Object_ptr + BMDisplay_Servant::DataAvailableConsumer_data_ready_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 + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::push_DataAvailable ( + ::BasicSP::DataAvailable *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_data_ready ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + BMDisplay_Servant::DataAvailableConsumer_data_ready_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_SINGLE_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::BasicSP::DataAvailableConsumer_ptr + BMDisplay_Servant::get_consumer_data_ready ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (CORBA::is_nil (this->consumes_data_ready_.in ())) + { + BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant *svt = + new BMDisplay_Servant::DataAvailableConsumer_data_ready_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 (::BasicSP::DataAvailableConsumer::_nil ()); + + ::BasicSP::DataAvailableConsumer_var eco = + ::BasicSP::DataAvailableConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ()); + + this->consumes_data_ready_ = eco; + } + + return ::BasicSP::DataAvailableConsumer::_duplicate (this->consumes_data_ready_.in ()); + } + + void + BMDisplay_Servant::connect_comp_data ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + this->context_->connect_comp_data ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BasicSP::ReadData_ptr + BMDisplay_Servant::disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + return this->context_->disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::BasicSP::ReadData_ptr + BMDisplay_Servant::get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + BMDisplay_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 (), + ::CORBA::Object::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::FacetDescriptions * + BMDisplay_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + BMDisplay_Servant::get_named_facets ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + CORBA::Boolean + BMDisplay_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 ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for Receptacles interface. + + ::Components::Cookie * + BMDisplay_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::strcmp (name, "comp_data") == 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); + } + + // Simplex connect. + this->connect_comp_data ( + _ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + + return 0; + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + BMDisplay_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)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + if (ACE_OS::strcmp (name, "comp_data") == 0) + { + // Simplex disconnect. + return this->disconnect_comp_data (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::ConnectionDescriptions * + BMDisplay_Servant::get_connections ( + const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMDisplay_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + BMDisplay_Servant::get_named_receptacles ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for Events interface. + + ::Components::EventConsumerBase_ptr + BMDisplay_Servant::get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (sink_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (sink_name, "data_ready") == 0) + { + return this->get_consumer_data_ready (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::Cookie * + BMDisplay_Servant::subscribe ( + const char *publisher_name, + ::Components::EventConsumerBase_ptr subscribe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::ExceededConnectionLimit)) + { + if (publisher_name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + BMDisplay_Servant::unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)) + { + if (publisher_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + BMDisplay_Servant::connect_consumer ( + const char *emitter_name, + ::Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + BMDisplay_Servant::disconnect_consumer ( + const char *source_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMDisplay_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + BMDisplay_Servant::get_named_consumers ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMDisplay_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + BMDisplay_Servant::get_named_emitters ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMDisplay_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + BMDisplay_Servant::get_named_publishers ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for CCMObject interface. + + CORBA::IRObject_ptr + BMDisplay_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + BMDisplay_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 * + BMDisplay_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + BMDisplay_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + BMDisplay_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + BMDisplay_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); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + 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 (); + } + + CORBA::Object_ptr + BMDisplay_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::CORBA::Object::_nil ()); + + if (! ::CORBA::is_nil (sc.in ())) + { + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::CORBA::Object::_nil ()); + + if (! ::CORBA::is_nil (ec.in ())) + { + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + BMDisplay_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 + BMDisplay_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); + } + } + + // Supported operations. + + + BMDisplayHome_Servant::BMDisplayHome_Servant ( + ::BasicSP::CCM_BMDisplayHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_BMDisplayHome::_duplicate (exe)), + container_ (c) + { + } + + BMDisplayHome_Servant::~BMDisplayHome_Servant (void) + { + } + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + BMDisplayHome_Servant::create_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for implicit home interface. + + ::BasicSP::BMDisplay_ptr + BMDisplayHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::BMDisplay::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + ::BasicSP::CCM_BMDisplay_var _ciao_comp = + ::BasicSP::CCM_BMDisplay::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + BMDisplayHome_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::CORBA::IRObject_ptr + BMDisplayHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + BMDisplayHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BasicSP::BMDisplay_var _ciao_comp = + ::BasicSP::BMDisplay::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::BasicSP::BMDisplay_ptr + BMDisplayHome_Servant::_ciao_activate_component ( + ::BasicSP::CCM_BMDisplay_ptr exe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var hobj = + this->container_->get_objref ( + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + BMDisplay_Servant *svt = + new BMDisplay_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 (::BasicSP::BMDisplay::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + ::BasicSP::BMDisplay_var ho = + ::BasicSP::BMDisplay::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::BMDisplay::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + BMDisplayHome_Servant::_ciao_passivate_component ( + ::BasicSP::BMDisplay_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; + + BMDisplay_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; + } + } + + // Supported operations. + + +} + +extern "C" BMDISPLAY_SVNT_Export ::PortableServer::Servant +createBMDisplayHome_Servant ( +::Components::HomeExecutorBase_ptr p, +CIAO::Session_Container *c +ACE_ENV_ARG_DECL) +{ + if (p == 0) + { + return 0; + } + + ::BasicSP::CCM_BMDisplayHome_var x = + ::BasicSP::CCM_BMDisplayHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + ::CIAO_GLUE_BasicSP::BMDisplayHome_Servant ( + x.in (), + c); +} + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.h new file mode 100644 index 00000000000..e495bc820d3 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.h @@ -0,0 +1,554 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_BMDISPLAY_SVNT_H +#define CIAO_GLUE_SESSION_BMDISPLAY_SVNT_H +#include "ace/pre.h" + +#include "BMDisplayS.h" +#include "BMDisplayEC.h" + +#include "ciao/Container_Base.h" +#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 +{ + class BMDISPLAY_SVNT_Export BMDisplay_Context + : public virtual ::BasicSP::CCM_BMDisplay_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class BMDisplay_Servant; + + BMDisplay_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + BMDisplay_Servant *sv); + + virtual ~BMDisplay_Context (void); + + // Operations from ::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 from ::Components::SessionContext interface. + + virtual CORBA::Object_ptr + get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations for BMDisplay receptacles and event sources, + // defined in ::BasicSP::CCM_BMDisplay_Context. + + virtual ::BasicSP::ReadData_ptr + get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Methods that manage this component's connections and consumers. + + virtual void + connect_comp_data ( + ::BasicSP::ReadData_ptr + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual ::BasicSP::ReadData_ptr + disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)); + + protected: + // Simplex comp_data connection. + ::BasicSP::ReadData_var + ciao_uses_comp_data_; + + ::Components::CCMHome_var + home_; + + ::CIAO::Session_Container * + container_; + + BMDisplay_Servant * + servant_; + + ::BasicSP::BMDisplay_var + component_; + }; + + class BMDISPLAY_SVNT_Export BMDisplay_Servant + : public virtual POA_BasicSP::BMDisplay, + public virtual PortableServer::RefCountServantBase + { + public: + BMDisplay_Servant ( + ::BasicSP::CCM_BMDisplay_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~BMDisplay_Servant (void); + + // Servant class for the data_ready consumer. + class BMDISPLAY_SVNT_Export DataAvailableConsumer_data_ready_Servant + : public virtual POA_BasicSP::DataAvailableConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + DataAvailableConsumer_data_ready_Servant ( + ::BasicSP::CCM_BMDisplay_ptr executor, + ::BasicSP::CCM_BMDisplay_Context_ptr c); + + virtual ~DataAvailableConsumer_data_ready_Servant (void); + + virtual void + push_DataAvailable ( + ::BasicSP::DataAvailable *evt + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Inherited from ::Components::EventConsumerBase. + 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: + ::BasicSP::CCM_BMDisplay_var + executor_; + + ::BasicSP::CCM_BMDisplay_Context_var + ctx_; + }; + + virtual ::BasicSP::DataAvailableConsumer_ptr + get_consumer_data_ready ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + connect_comp_data ( + ::BasicSP::ReadData_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)); + + virtual ::BasicSP::ReadData_ptr + disconnect_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual ::BasicSP::ReadData_ptr + get_connection_comp_data ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // 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. + + 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: + ::BasicSP::CCM_BMDisplay_var + executor_; + + BMDisplay_Context * + context_; + + ::CIAO::Session_Container * + container_; + + ::BasicSP::DataAvailableConsumer_var + consumes_data_ready_; + + }; + + class BMDISPLAY_SVNT_Export BMDisplayHome_Servant + : public virtual POA_BasicSP::BMDisplayHome, + public virtual PortableServer::RefCountServantBase + { + public: + BMDisplayHome_Servant ( + ::BasicSP::CCM_BMDisplayHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~BMDisplayHome_Servant (void); + + // Home factory and other operations. + + // Operations for keyless home 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::BMDisplay_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)); + + // Supported operations. + + protected: + // CIAO-specific operations. + + ::BasicSP::BMDisplay_ptr + _ciao_activate_component ( + ::BasicSP::CCM_BMDisplay_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BasicSP::BMDisplay_ptr comp + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BasicSP::CCM_BMDisplayHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + BMDisplay_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" BMDISPLAY_SVNT_Export ::PortableServer::Servant + createBMDisplayHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + +} + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_BMDISPLAY_SVNT_H */ + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt_export.h new file mode 100644 index 00000000000..2392da154d7 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BMDISPLAY_SVNT +// ------------------------------ +#ifndef BMDISPLAY_SVNT_EXPORT_H +#define BMDISPLAY_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BMDISPLAY_SVNT_HAS_DLL) +# define BMDISPLAY_SVNT_HAS_DLL 1 +#endif /* ! BMDISPLAY_SVNT_HAS_DLL */ + +#if defined (BMDISPLAY_SVNT_HAS_DLL) && (BMDISPLAY_SVNT_HAS_DLL == 1) +# if defined (BMDISPLAY_SVNT_BUILD_DLL) +# define BMDISPLAY_SVNT_Export ACE_Proper_Export_Flag +# define BMDISPLAY_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BMDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BMDISPLAY_SVNT_BUILD_DLL */ +# define BMDISPLAY_SVNT_Export ACE_Proper_Import_Flag +# define BMDISPLAY_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BMDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BMDISPLAY_SVNT_BUILD_DLL */ +#else /* BMDISPLAY_SVNT_HAS_DLL == 1 */ +# define BMDISPLAY_SVNT_Export +# define BMDISPLAY_SVNT_SINGLETON_DECLARATION(T) +# define BMDISPLAY_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BMDISPLAY_SVNT_HAS_DLL == 1 */ + +// Set BMDISPLAY_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BMDISPLAY_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define BMDISPLAY_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BMDISPLAY_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BMDISPLAY_SVNT_NTRACE */ + +#if (BMDISPLAY_SVNT_NTRACE == 1) +# define BMDISPLAY_SVNT_TRACE(X) +#else /* (BMDISPLAY_SVNT_NTRACE == 1) */ +# define BMDISPLAY_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BMDISPLAY_SVNT_NTRACE == 1) */ + +#endif /* BMDISPLAY_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/config b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/config new file mode 100644 index 00000000000..6d9a49031b1 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/config @@ -0,0 +1 @@ +BMDisplay_exec|createBMDisplayHome_Impl|BMDisplay_svnt|createBMDisplayHome_Servant diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP.idl new file mode 100644 index 00000000000..e8e0bf2ae2a --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP.idl @@ -0,0 +1,47 @@ +// $Id$ +//============================================================================= +/** + * @file BasicSP.idl + * + * Definition of events, and common interfaces used in the BasicSP module. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_BASIC_SP_IDL +#define CIAO_BASIC_SP_IDL + +#include <Components.idl> + +// @@NOTE: Do we need a pragma prefix. Anyway its broken now in TAO.. +// #pragma prefix "" + +module BasicSP +{ + + /** + * @NOTE: Not sure whether this is a good abstraction. Just copying + * the stuff from Cadena folks. + */ + /** + * @interface ReadData + * + */ + + interface ReadData { + string get_data (); + }; + + /** + * @eventtype Events that represent timeouts + */ + eventtype TimeOut {}; + + /** + * @eventtype Events that represent data availability + */ + eventtype DataAvailable {}; +}; + +#endif /*CIAO_BASIC_SP_IDL*/ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP.mpc b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP.mpc new file mode 100644 index 00000000000..f58c9efe005 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP.mpc @@ -0,0 +1,30 @@ +// $Id$ +// This file is generated with "generate_component_mpc.pl -n HUDisplay" + +project(BasicSP_stub): ciao_client { + + sharedname = BasicSP_stub + idlflags += -Wb,stub_export_macro=BASICSP_STUB_Export -Wb,stub_export_include=BasicSP_stub_export.h -Wb,skel_export_macro=BASICSP_SVNT_Export -Wb,skel_export_include=BasicSP_svnt_export.h + dynamicflags = BASICSP_STUB_BUILD_DLL + + IDL_Files { + BasicSP.idl + } + + Source_Files { + BasicSPC.cpp + } +} + +project(BasicSP_svnt) : ciao_server { + after += BasicSP_stub + sharedname = BasicSP_svnt + libs += BasicSP_stub + + idlflags += -Wb,export_macro=BASICSP_SVNT_Export -Wb,export_include=BasicSP_svnt_export.h + dynamicflags = BASICSP_SVNT_BUILD_DLL + + Source_Files { + BasicSPS.cpp + } +} diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP_stub_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP_stub_export.h new file mode 100644 index 00000000000..1ae476b4082 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BASICSP_STUB +// ------------------------------ +#ifndef BASICSP_STUB_EXPORT_H +#define BASICSP_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BASICSP_STUB_HAS_DLL) +# define BASICSP_STUB_HAS_DLL 1 +#endif /* ! BASICSP_STUB_HAS_DLL */ + +#if defined (BASICSP_STUB_HAS_DLL) && (BASICSP_STUB_HAS_DLL == 1) +# if defined (BASICSP_STUB_BUILD_DLL) +# define BASICSP_STUB_Export ACE_Proper_Export_Flag +# define BASICSP_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BASICSP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BASICSP_STUB_BUILD_DLL */ +# define BASICSP_STUB_Export ACE_Proper_Import_Flag +# define BASICSP_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BASICSP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BASICSP_STUB_BUILD_DLL */ +#else /* BASICSP_STUB_HAS_DLL == 1 */ +# define BASICSP_STUB_Export +# define BASICSP_STUB_SINGLETON_DECLARATION(T) +# define BASICSP_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BASICSP_STUB_HAS_DLL == 1 */ + +// Set BASICSP_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BASICSP_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define BASICSP_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BASICSP_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BASICSP_STUB_NTRACE */ + +#if (BASICSP_STUB_NTRACE == 1) +# define BASICSP_STUB_TRACE(X) +#else /* (BASICSP_STUB_NTRACE == 1) */ +# define BASICSP_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BASICSP_STUB_NTRACE == 1) */ + +#endif /* BASICSP_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP_svnt_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP_svnt_export.h new file mode 100644 index 00000000000..23c48f384d7 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BasicSP_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl BASICSP_SVNT +// ------------------------------ +#ifndef BASICSP_SVNT_EXPORT_H +#define BASICSP_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (BASICSP_SVNT_HAS_DLL) +# define BASICSP_SVNT_HAS_DLL 1 +#endif /* ! BASICSP_SVNT_HAS_DLL */ + +#if defined (BASICSP_SVNT_HAS_DLL) && (BASICSP_SVNT_HAS_DLL == 1) +# if defined (BASICSP_SVNT_BUILD_DLL) +# define BASICSP_SVNT_Export ACE_Proper_Export_Flag +# define BASICSP_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BASICSP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BASICSP_SVNT_BUILD_DLL */ +# define BASICSP_SVNT_Export ACE_Proper_Import_Flag +# define BASICSP_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BASICSP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BASICSP_SVNT_BUILD_DLL */ +#else /* BASICSP_SVNT_HAS_DLL == 1 */ +# define BASICSP_SVNT_Export +# define BASICSP_SVNT_SINGLETON_DECLARATION(T) +# define BASICSP_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BASICSP_SVNT_HAS_DLL == 1 */ + +// Set BASICSP_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BASICSP_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define BASICSP_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BASICSP_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BASICSP_SVNT_NTRACE */ + +#if (BASICSP_SVNT_NTRACE == 1) +# define BASICSP_SVNT_TRACE(X) +#else /* (BASICSP_SVNT_NTRACE == 1) */ +# define BASICSP_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (BASICSP_SVNT_NTRACE == 1) */ + +#endif /* BASICSP_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.cidl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.cidl new file mode 100644 index 00000000000..8e9ff0d5575 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.cidl @@ -0,0 +1,21 @@ +//$Id$ + +#ifndef EC_CIDL +#define EC_CIDL + +#include "EC.idl" + +composition session EC_Impl +{ + home executor ECHome_Exec + { + implements BasicSP::ECHome; + manages EC_Exec; + }; +}; + +#endif /* EC_CIDL */ + + + + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.idl new file mode 100644 index 00000000000..50ad25afd7f --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.idl @@ -0,0 +1,41 @@ +// $Id$ +//============================================================================= +/** + * @file EC.idl + * + * Definition of events, and common interfaces used in the BasicSP module. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EC_IDL +#define CIAO_EC_IDL + +#include "../BasicSP.idl" + +module BasicSP +{ + interface trigger + { + void start (); + void stop (); + }; + component EC supports trigger + { + publishes TimeOut timeout; + + /// The attribute can be configured via the home or the + /// component property file. + attribute long hertz; + + }; + + home ECHome manages EC + { + // Explicit operations + factory new_EC (in long hertz); + }; +}; + +#endif /* CIAO_EC_IDL*/ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.mpc b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.mpc new file mode 100644 index 00000000000..b5d7a251536 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC.mpc @@ -0,0 +1,91 @@ +// $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 + idlflags += -Wb,stub_export_macro=EC_STUB_Export -Wb,stub_export_include=EC_stub_export.h -Wb,skel_export_macro=EC_SVNT_Export -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 -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 -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/handcrafted/BasicSP_EC/EC/ECE.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/ECE.idl new file mode 100644 index 00000000000..cd4628601cb --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/ECE.idl @@ -0,0 +1,40 @@ +// $Id$ +#include <Components.idl> +#include "EC.idl" + +module BasicSP +{ + local interface CCM_EC : ::Components::EnterpriseComponent, ::BasicSP::trigger + { + attribute long hertz; + }; + + local interface CCM_EC_Context : ::Components::SessionContext + { + void push_timeout (in ::BasicSP::TimeOut ev); + }; + + local interface CCM_ECHomeExplicit : ::Components::HomeExecutorBase + { + ::Components::EnterpriseComponent new_EC (in long hertz); + }; + + local interface CCM_ECHomeImplicit + { + ::Components::EnterpriseComponent create () raises (::Components::CCMException); + }; + + local interface CCM_ECHome : CCM_ECHomeExplicit, CCM_ECHomeImplicit + { + }; + +}; + +module EC_Impl +{ + local interface _Context : ::BasicSP::CCM_EC_Context, ::Components::SessionContext + { + }; + +}; + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/ECEI.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/ECEI.idl new file mode 100644 index 00000000000..9b48d5c74dd --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/ECEI.idl @@ -0,0 +1,32 @@ +// $Id$ + +//============================================================================= +/** + * @file ECEI.idl + * + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= +#ifndef CIAO_ECEI_IDL +#define CIAO_ECEI_IDL + +#include "ECE.idl" + +module BasicSP +{ + /** + * @interface EC_Exec + * + * The actually EC executor need to support + * Components::SessionComponent interface. Therefore, we need to + * define the component executor interface explicitly here. + */ + local interface EC_Exec : CCM_EC, + Components::SessionComponent + { + }; + +}; + +#endif /* RATEGENEI_IDL */ diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_exec.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_exec.cpp new file mode 100644 index 00000000000..8897776433d --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_exec.cpp @@ -0,0 +1,279 @@ +// $Id$ + +#include "EC_exec.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 () +{ + return this->activate (); +} + +int +MyImpl::timeout_Handler::close () +{ + this->done_ = 1; + this->reactor ()->notify (); + + 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) +{ + 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_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + 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::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_activate\n")); + + this->pulser_.open (); +} + +void +MyImpl::EC_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_passivate\n")); + this->pulser_.close (); +} + +void +MyImpl::EC_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_remove\n")); +} + +void +MyImpl::EC_exec_i::pulse (void) +{ + ACE_TRY_NEW_ENV + { + 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_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) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::EC_exec_i (hertz); +} + +::Components::EnterpriseComponent_ptr +MyImpl::ECHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL) + 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/handcrafted/BasicSP_EC/EC/EC_exec.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_exec.h new file mode 100644 index 00000000000..457ec447e68 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_exec.h @@ -0,0 +1,182 @@ +// $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 (void); + + int close (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 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)); + + /// 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, + Components::CCMException)); + + // 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/handcrafted/BasicSP_EC/EC/EC_exec_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_exec_export.h new file mode 100644 index 00000000000..c979debf129 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_exec_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl EC_EXEC +// ------------------------------ +#ifndef EC_EXEC_EXPORT_H +#define EC_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (EC_EXEC_HAS_DLL) +# define EC_EXEC_HAS_DLL 1 +#endif /* ! EC_EXEC_HAS_DLL */ + +#if defined (EC_EXEC_HAS_DLL) && (EC_EXEC_HAS_DLL == 1) +# if defined (EC_EXEC_BUILD_DLL) +# define EC_EXEC_Export ACE_Proper_Export_Flag +# define EC_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* EC_EXEC_BUILD_DLL */ +# define EC_EXEC_Export ACE_Proper_Import_Flag +# define EC_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* EC_EXEC_BUILD_DLL */ +#else /* EC_EXEC_HAS_DLL == 1 */ +# define EC_EXEC_Export +# define EC_EXEC_SINGLETON_DECLARATION(T) +# define EC_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* EC_EXEC_HAS_DLL == 1 */ + +// Set EC_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (EC_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define EC_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define EC_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !EC_EXEC_NTRACE */ + +#if (EC_EXEC_NTRACE == 1) +# define EC_EXEC_TRACE(X) +#else /* (EC_EXEC_NTRACE == 1) */ +# define EC_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (EC_EXEC_NTRACE == 1) */ + +#endif /* EC_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_stub_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_stub_export.h new file mode 100644 index 00000000000..2ad9df9cf12 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_stub_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl EC_STUB +// ------------------------------ +#ifndef EC_STUB_EXPORT_H +#define EC_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (EC_STUB_HAS_DLL) +# define EC_STUB_HAS_DLL 1 +#endif /* ! EC_STUB_HAS_DLL */ + +#if defined (EC_STUB_HAS_DLL) && (EC_STUB_HAS_DLL == 1) +# if defined (EC_STUB_BUILD_DLL) +# define EC_STUB_Export ACE_Proper_Export_Flag +# define EC_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* EC_STUB_BUILD_DLL */ +# define EC_STUB_Export ACE_Proper_Import_Flag +# define EC_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* EC_STUB_BUILD_DLL */ +#else /* EC_STUB_HAS_DLL == 1 */ +# define EC_STUB_Export +# define EC_STUB_SINGLETON_DECLARATION(T) +# define EC_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* EC_STUB_HAS_DLL == 1 */ + +// Set EC_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (EC_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define EC_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define EC_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !EC_STUB_NTRACE */ + +#if (EC_STUB_NTRACE == 1) +# define EC_STUB_TRACE(X) +#else /* (EC_STUB_NTRACE == 1) */ +# define EC_STUB_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (EC_STUB_NTRACE == 1) */ + +#endif /* EC_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.cpp new file mode 100644 index 00000000000..dd1213cd744 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.cpp @@ -0,0 +1,1255 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#include "EC_svnt.h" +#include "Cookies.h" + +namespace CIAO_GLUE_BasicSP +{ + EC_Context::EC_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + EC_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv), + // START new event code + ciao_proxy_timeout_consumer_ (RtecEventChannelAdmin::ProxyPushConsumer::_nil ()), + ciao_event_channel_ (RtecEventChannelAdmin::EventChannel::_nil ()) + // END new event code + { + } + + EC_Context::~EC_Context (void) + { + // START new event code + this->ciao_event_channel_->destroy (); + // END new event code + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + EC_Context::get_caller_principal ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Principal::_nil ()); + } + + ::Components::CCMHome_ptr + EC_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + EC_Context::get_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::Transaction::UserTransaction_ptr + EC_Context::get_user_transaction ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::Components::Transaction::UserTransaction::_nil ()); + } + + CORBA::Boolean + EC_Context::is_caller_in_role ( + const char *role + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_UNUSED_ARG (role); + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + EC_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContext interface. + + CORBA::Object_ptr + EC_Context::get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + if (CORBA::is_nil (this->component_.in ())) + { + CORBA::Object_var obj = + this->container_->get_objref ( + this->servant_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->component_ = + ::BasicSP::EC::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + if (CORBA::is_nil (this->component_.in ())) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + } + + return ::BasicSP::EC::_duplicate ( + this->component_.in ()); + } + + // Operations for EC receptacles and event sources, + // defined in ::BasicSP::CCM_EC_Context. + + void + EC_Context::push_timeout ( + ::BasicSP::TimeOut *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + // START new event code + RtecEventComm::EventSet events (1); + events.length (1); + events[0].header.source = ACE_ES_EVENT_SOURCE_ANY + 1; + events[0].header.type = ACE_ES_EVENT_UNDEFINED + 1; + events[0].data.any_value <<= ev; + ciao_proxy_timeout_consumer_->push (events); + // END new event code + + // START old event code + /* + ACE_Active_Map_Manager<::BasicSP::TimeOutConsumer_var>::iterator end = + this->ciao_publishes_timeout_map_.end (); + + for (ACE_Active_Map_Manager<::BasicSP::TimeOutConsumer_var>::iterator iter = + this->ciao_publishes_timeout_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager<::BasicSP::TimeOutConsumer_var>::ENTRY &entry = *iter; + ::BasicSP::TimeOutConsumer_var c = + ::BasicSP::TimeOutConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_TimeOut ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + */ + // END old event code + } + + ::Components::Cookie * + EC_Context::subscribe_timeout ( + ::BasicSP::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + // START new event code + // Get a reference to the ORB. + char * argv[1] = { "EC_exec" }; + int argc = sizeof (argv) / sizeof (argv[0]); + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Get a reference to the POA + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Nil RootPOA\n"), 0); + + // Get a reference to the event channel + if (CORBA::is_nil (this->ciao_event_channel_.in ())) + { + TAO_EC_Event_Channel_Attributes attributes (root_poa.in (), root_poa.in ()); + TAO_EC_Event_Channel * ec_servant; + ACE_NEW_RETURN (ec_servant, TAO_EC_Event_Channel (attributes), 0); + ec_servant->activate (); + this->ciao_event_channel_ = ec_servant->_this (); + } + + // Establish supplier's connection to event channel if not done yet + if (CORBA::is_nil (this->ciao_proxy_timeout_consumer_.in ())) + { + RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = + this->ciao_event_channel_->for_suppliers (); + this->ciao_proxy_timeout_consumer_ = supplier_admin->obtain_push_consumer (); + + // Create and register supplier servant + timeout_Supplier_impl * supplier_servant; + ACE_NEW_RETURN (supplier_servant, timeout_Supplier_impl (orb.in ()), 0); + RtecEventComm::PushSupplier_var supplier = supplier_servant->_this (); + + // Set QoS properties and connect + ACE_SupplierQOS_Factory qos; + qos.insert (ACE_ES_EVENT_SOURCE_ANY + 1, + ACE_ES_EVENT_UNDEFINED + 1, + 0, + 1); + this->ciao_proxy_timeout_consumer_->connect_push_supplier (supplier.in (), + qos.get_SupplierQOS ()); + } // End if (ciao_proxy_timeout_consumer_ is nil) + + // Establish consumer's connection to event channel + if (CORBA::is_nil (c)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + } + + ::BasicSP::TimeOutConsumer_var sub = ::BasicSP::TimeOutConsumer::_duplicate (c); + + RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = + this->ciao_event_channel_->for_consumers (); + RtecEventChannelAdmin::ProxyPushSupplier_var ciao_proxy_timeout_supplier = + consumer_admin->obtain_push_supplier (); + + // Create and register consumer servant + timeout_Consumer_impl * consumer_servant; + ACE_NEW_RETURN (consumer_servant, timeout_Consumer_impl (orb.in (), sub.in ()), 0); + RtecEventComm::PushConsumer_var consumer = consumer_servant->_this (); + + // Put reference to this PushConsumer in the map so we can disconnect later + ACE_Active_Map_Manager_Key key; + this->ciao_proxy_timeout_supplier_map_.bind (ciao_proxy_timeout_supplier.in (), key); + + // Set QoS properties and connect + ACE_ConsumerQOS_Factory qos; + qos.start_disjunction_group (1); + qos.insert_type (ACE_ES_EVENT_UNDEFINED + 1, + 0); + ciao_proxy_timeout_supplier->connect_push_consumer (consumer.in (), + qos.get_ConsumerQOS ()); + + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + // END new event code + + // START old event code + /* + if (CORBA::is_nil (c)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + } + + ::BasicSP::TimeOutConsumer_var sub = + ::BasicSP::TimeOutConsumer::_duplicate (c); + + ACE_Active_Map_Manager_Key key; + this->ciao_publishes_timeout_map_.bind (sub.in (), key); + + sub._retn (); + + ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); + return retv._retn (); + */ + // END old event code + } + + ::BasicSP::TimeOutConsumer_ptr + EC_Context::unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + // START new event code + ACE_DEBUG ((LM_DEBUG, "EC_Context::unsubscribe_timeout\n")); + ::BasicSP::TimeOutConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::TimeOutConsumer::_nil ()); + } + + RtecEventChannelAdmin::ProxyPushSupplier_var ciao_proxy_timeout_supplier; + + if (this->ciao_proxy_timeout_supplier_map_.find (key, ciao_proxy_timeout_supplier) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::TimeOutConsumer::_nil ()); + } + + ciao_proxy_timeout_supplier->disconnect_push_supplier (); + + if (this->ciao_proxy_timeout_supplier_map_.unbind (key, ciao_proxy_timeout_supplier) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::TimeOutConsumer::_nil ()); + } + + return retv._retn (); + // END new event code + + // START old event code + /* + ::BasicSP::TimeOutConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == -1) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::TimeOutConsumer::_nil ()); + } + + if (this->ciao_publishes_timeout_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::BasicSP::TimeOutConsumer::_nil ()); + } + + return retv._retn (); + */ + // END old event code + } + + + EC_Servant::EC_Servant ( + ::BasicSP::CCM_EC_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_EC::_duplicate (exe)), + container_ (c) + { + this->context_ = new EC_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 + { + } + ACE_ENDTRY; + } + + EC_Servant::~EC_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 + { + } + ACE_ENDTRY; + + this->context_->_remove_ref (); + } + + ::Components::Cookie * + EC_Servant::subscribe_timeout ( + ::BasicSP::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_timeout ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::BasicSP::TimeOutConsumer_ptr + EC_Servant::unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + return this->context_->unsubscribe_timeout ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ::CORBA::Long + EC_Servant::hertz ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->executor_->hertz ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + void + EC_Servant::hertz ( + ::CORBA::Long val + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->hertz ( + val + ACE_ENV_ARG_PARAMETER); + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + EC_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 (), + ::CORBA::Object::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::FacetDescriptions * + EC_Servant::get_all_facets ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::FacetDescriptions * + EC_Servant::get_named_facets ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + CORBA::Boolean + EC_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 ( + the_other.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for Receptacles interface. + + ::Components::Cookie * + EC_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); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + EC_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)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + } + + ::Components::ConnectionDescriptions * + EC_Servant::get_connections ( + const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + EC_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + EC_Servant::get_named_receptacles ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for Events interface. + + ::Components::EventConsumerBase_ptr + EC_Servant::get_consumer ( + const char *sink_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + if (sink_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::Cookie * + EC_Servant::subscribe ( + const char *publisher_name, + ::Components::EventConsumerBase_ptr subscribe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection, + ::Components::ExceededConnectionLimit)) + { + if (publisher_name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + if (ACE_OS::strcmp (publisher_name, "timeout") == 0) + { + ::BasicSP::TimeOutConsumer_var _ciao_consumer = + ::BasicSP::TimeOutConsumer::_narrow ( + subscribe + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (_ciao_consumer.in ())) + { + ACE_THROW_RETURN (::Components::InvalidConnection (), 0); + } + + return this->subscribe_timeout ( + _ciao_consumer.in () + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + EC_Servant::unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)) + { + if (publisher_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + if (ACE_OS::strcmp (publisher_name, "timeout") == 0) + { + return this->unsubscribe_timeout ( + ck + ACE_ENV_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + void + EC_Servant::connect_consumer ( + const char *emitter_name, + ::Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + ACE_THROW (::CORBA::NO_IMPLEMENT ()); + } + + ::Components::EventConsumerBase_ptr + EC_Servant::disconnect_consumer ( + const char *source_name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::NoConnection)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + EC_Servant::get_all_consumers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ConsumerDescriptions * + EC_Servant::get_named_consumers ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + EC_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + EC_Servant::get_named_emitters ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + EC_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + EC_Servant::get_named_publishers ( + const ::Components::NameList &names + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + // Operations for CCMObject interface. + + CORBA::IRObject_ptr + EC_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::Components::CCMHome_ptr + EC_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 * + EC_Servant::get_primary_key ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoKeyAvailable)) + { + ACE_THROW_RETURN (::Components::NoKeyAvailable (), 0); + } + + void + EC_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + EC_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + ::Components::ComponentPortDescription * + EC_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); + ACE_CHECK_RETURN (0); + + ::Components::ReceptacleDescriptions_var receptacle_desc = + this->get_all_receptacles (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::ConsumerDescriptions_var consumer_desc = + this->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::EmitterDescriptions_var emitter_desc = + this->get_all_emitters (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ::Components::PublisherDescriptions_var publisher_desc = + this->get_all_publishers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + 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 (); + } + + CORBA::Object_ptr + EC_Servant::_get_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::SessionContext_var sc = + ::Components::SessionContext::_narrow ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::CORBA::Object::_nil ()); + + if (! ::CORBA::is_nil (sc.in ())) + { + return sc->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Components::EntityContext_var ec = + ::Components::EntityContext::_narrow ( + this->context_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::CORBA::Object::_nil ()); + + if (! ::CORBA::is_nil (ec.in ())) + { + return ec->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::CORBA::Object::_nil ()); + } + + // CIAO-specific operations. + + void + EC_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 + EC_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); + } + } + + // Supported operations. + + void + EC_Servant::start ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->start ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + void + EC_Servant::stop ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->stop ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + + ECHome_Servant::ECHome_Servant ( + ::BasicSP::CCM_ECHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::BasicSP::CCM_ECHome::_duplicate (exe)), + container_ (c) + { + } + + ECHome_Servant::~ECHome_Servant (void) + { + } + + ::BasicSP::EC_ptr + ECHome_Servant::new_EC ( + ::CORBA::Long hertz + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->new_EC ( + hertz + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + ::BasicSP::CCM_EC_var _ciao_comp = + ::BasicSP::CCM_EC::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + ECHome_Servant::create_component ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + return this->create (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + // Operations for implicit home interface. + + ::BasicSP::EC_ptr + ECHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::BasicSP::EC::_nil ()); + } + + Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + ::BasicSP::CCM_EC_var _ciao_comp = + ::BasicSP::CCM_EC::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + ECHome_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + ::CORBA::IRObject_ptr + ECHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + ECHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::BasicSP::EC_var _ciao_comp = + ::BasicSP::EC::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::BasicSP::EC_ptr + ECHome_Servant::_ciao_activate_component ( + ::BasicSP::CCM_EC_ptr exe + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var hobj = + this->container_->get_objref ( + this + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + EC_Servant *svt = + new EC_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 (::BasicSP::EC::_nil ()); + + svt->_ciao_activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + ::BasicSP::EC_var ho = + ::BasicSP::EC::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::BasicSP::EC::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + ECHome_Servant::_ciao_passivate_component ( + ::BasicSP::EC_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; + + EC_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; + } + } + + // Supported operations. + + // START new event code + timeout_Supplier_impl::timeout_Supplier_impl (void) + { + } + + timeout_Supplier_impl::timeout_Supplier_impl (CORBA::ORB_ptr orb) : + orb_ (CORBA::ORB::_duplicate (orb)) + { + } + + void timeout_Supplier_impl::disconnect_push_supplier (void) + { + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); + PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); + root_poa->deactivate_object (oid); + } + + timeout_Consumer_impl::timeout_Consumer_impl (void) + { + } + + timeout_Consumer_impl::timeout_Consumer_impl (CORBA::ORB_ptr orb, + ::BasicSP::TimeOutConsumer_ptr timeout_consumer) : + orb_ (CORBA::ORB::_duplicate (orb)), + timeout_consumer_ (::BasicSP::TimeOutConsumer::_duplicate (timeout_consumer)) + { + } + + void timeout_Consumer_impl::push (const RtecEventComm::EventSet& events) + { + ACE_DEBUG ((LM_DEBUG, "CIAO_GLUE_BasicSP::timeout_Consumer_impl::push\n")); + for (unsigned long i = 0; i < events.length (); i++) + { + ::BasicSP::TimeOut * ev; + if (events[i].data.any_value >>= ev) + { + this->timeout_consumer_->push_TimeOut (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + } + + void timeout_Consumer_impl::disconnect_push_consumer (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); + PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); + root_poa->deactivate_object (oid); + } + // END new event code + +} + +extern "C" EC_SVNT_Export ::PortableServer::Servant +createECHome_Servant ( +::Components::HomeExecutorBase_ptr p, +CIAO::Session_Container *c +ACE_ENV_ARG_DECL) +{ + if (p == 0) + { + return 0; + } + + ::BasicSP::CCM_ECHome_var x = + ::BasicSP::CCM_ECHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + ::CIAO_GLUE_BasicSP::ECHome_Servant ( + x.in (), + c); +} + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.h new file mode 100644 index 00000000000..423a901f66e --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.h @@ -0,0 +1,589 @@ +// $Id$ +// +// **** Code generated by the **** +// **** Component Integrated ACE ORB (CIAO) CIDL Compiler **** +// CIAO has been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// CIDL Compiler has been developed by: +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about CIAO is available at: +// http://www.cs.wustl.edu/~nanbor/projects/CIAO-src/docs/index.html + +#ifndef CIAO_GLUE_SESSION_EC_SVNT_H +#define CIAO_GLUE_SESSION_EC_SVNT_H +#include "ace/pre.h" + +#include "ECS.h" +#include "ECEC.h" + +#include "ciao/Container_Base.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +// START new event code +#include "orbsvcs/RtecEventCommS.h" +#include "orbsvcs/RtecEventChannelAdminC.h" +#include "Event_Utilities.h" +#include "orbsvcs/Event/EC_Event_Channel.h" +#include "orbsvcs/Event/EC_Default_Factory.h" +// END new event code + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO_GLUE_BasicSP +{ + class EC_SVNT_Export EC_Context + : public virtual ::BasicSP::CCM_EC_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class EC_Servant; + + EC_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + EC_Servant *sv); + + virtual ~EC_Context (void); + + // Operations from ::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 from ::Components::SessionContext interface. + + virtual CORBA::Object_ptr + get_CCM_object ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)); + + // Operations for EC receptacles and event sources, + // defined in ::BasicSP::CCM_EC_Context. + + virtual void + push_timeout ( + ::BasicSP::TimeOut *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + // Methods that manage this component's connections and consumers. + + virtual ::Components::Cookie * + subscribe_timeout ( + ::BasicSP::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::TimeOutConsumer_ptr + unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + protected: + ACE_Active_Map_Manager< + ::BasicSP::TimeOutConsumer_var> + ciao_publishes_timeout_map_; + + // START new event code + RtecEventChannelAdmin::ProxyPushConsumer_var + ciao_proxy_timeout_consumer_; + + ACE_Active_Map_Manager< + ::RtecEventChannelAdmin::ProxyPushSupplier_var> + ciao_proxy_timeout_supplier_map_; + + RtecEventChannelAdmin::EventChannel_var ciao_event_channel_; + // END new event code + + ::Components::CCMHome_var + home_; + + ::CIAO::Session_Container * + container_; + + EC_Servant * + servant_; + + ::BasicSP::EC_var + component_; + }; + + class EC_SVNT_Export EC_Servant + : public virtual POA_BasicSP::EC, + public virtual PortableServer::RefCountServantBase + { + public: + EC_Servant ( + ::BasicSP::CCM_EC_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~EC_Servant (void); + + 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 ::Components::Cookie * + subscribe_timeout ( + ::BasicSP::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::BasicSP::TimeOutConsumer_ptr + unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + virtual ::CORBA::Long + hertz ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + hertz ( + ::CORBA::Long + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // 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. + + 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: + ::BasicSP::CCM_EC_var + executor_; + + EC_Context * + context_; + + ::CIAO::Session_Container * + container_; + + }; + + class EC_SVNT_Export ECHome_Servant + : public virtual POA_BasicSP::ECHome, + public virtual PortableServer::RefCountServantBase + { + public: + ECHome_Servant ( + ::BasicSP::CCM_ECHome_ptr exe, + ::CIAO::Session_Container *c); + + virtual ~ECHome_Servant (void); + + // Home factory and other operations. + + virtual ::BasicSP::EC_ptr + new_EC ( + ::CORBA::Long hertzACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Operations for keyless home 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::EC_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)); + + // Supported operations. + + protected: + // CIAO-specific operations. + + ::BasicSP::EC_ptr + _ciao_activate_component ( + ::BasicSP::CCM_EC_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::BasicSP::EC_ptr comp + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::BasicSP::CCM_ECHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + EC_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" EC_SVNT_Export ::PortableServer::Servant + createECHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + // START new event code + class timeout_Supplier_impl : + public virtual POA_RtecEventComm::PushSupplier, + public virtual PortableServer::RefCountServantBase + { + public: + + timeout_Supplier_impl (void); + + timeout_Supplier_impl (CORBA::ORB_ptr orb); + + virtual void disconnect_push_supplier (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + }; + + class timeout_Consumer_impl : + public virtual POA_RtecEventComm::PushConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + + timeout_Consumer_impl (void); + + timeout_Consumer_impl (CORBA::ORB_ptr orb, + ::BasicSP::TimeOutConsumer_ptr timeout_consumer); + + virtual void push (const RtecEventComm::EventSet& events); + + virtual void disconnect_push_consumer (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + CORBA::ORB_var orb_; + ::BasicSP::TimeOutConsumer_var timeout_consumer_; + }; + // END new event code + +} + +#include "ace/post.h" +#endif /* CIAO_GLUE_SESSION_EC_SVNT_H */ + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt_export.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt_export.h new file mode 100644 index 00000000000..41da2dfc871 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl EC_SVNT +// ------------------------------ +#ifndef EC_SVNT_EXPORT_H +#define EC_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (EC_SVNT_HAS_DLL) +# define EC_SVNT_HAS_DLL 1 +#endif /* ! EC_SVNT_HAS_DLL */ + +#if defined (EC_SVNT_HAS_DLL) && (EC_SVNT_HAS_DLL == 1) +# if defined (EC_SVNT_BUILD_DLL) +# define EC_SVNT_Export ACE_Proper_Export_Flag +# define EC_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* EC_SVNT_BUILD_DLL */ +# define EC_SVNT_Export ACE_Proper_Import_Flag +# define EC_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* EC_SVNT_BUILD_DLL */ +#else /* EC_SVNT_HAS_DLL == 1 */ +# define EC_SVNT_Export +# define EC_SVNT_SINGLETON_DECLARATION(T) +# define EC_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* EC_SVNT_HAS_DLL == 1 */ + +// Set EC_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (EC_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define EC_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define EC_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !EC_SVNT_NTRACE */ + +#if (EC_SVNT_NTRACE == 1) +# define EC_SVNT_TRACE(X) +#else /* (EC_SVNT_NTRACE == 1) */ +# define EC_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (EC_SVNT_NTRACE == 1) */ + +#endif /* EC_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/client.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/client.cpp new file mode 100644 index 00000000000..7de404f4beb --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/client.cpp @@ -0,0 +1,72 @@ +// $Id$ + +//============================================================== +/** + * @file client.cpp + * + * This is a simple client test program that interact with the EC + * component implementation. This test uses the explicit factory + * operation in the home interface to create a EC component + * instance, run it for a while, and destroy the component instance. + */ +//============================================================== + +#include "ECC.h" + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + + // Resolve HomeFinder interface + + CORBA::Object_var obj + = orb->string_to_object ("file://ec.ior" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + BasicSP::ECHome_var home + = BasicSP::ECHome::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (home.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire ECHome objref\n"), -1); + + BasicSP::EC_var pulser + = home->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Place to plug in the rate + pulser->hertz (5 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_OS::sleep (45); + + pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + home->remove_component (pulser.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Who is the culprit \n"); + cerr << "Uncaught CORBA exception" << endl; + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/config b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/config new file mode 100644 index 00000000000..527aa2ba7ed --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/config @@ -0,0 +1 @@ +EC_exec|createECHome_Impl|EC_svnt|createECHome_Servant diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/controller.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/controller.cpp new file mode 100644 index 00000000000..0d6a328b217 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/controller.cpp @@ -0,0 +1,125 @@ +// $Id$ +/** + * @file controller.cpp + * + * This program interact with a EC component, and set the rate of the + * EC. + */ + + +#include "ECC.h" +#include "ace/Get_Opt.h" + + +char *rategen_ior_ = 0; +int rate = 2; +int turn_on = 1; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:r:of"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + turn_on = 1; + break; + + case 'f': + turn_on = 0; + break; + + case 'k': + rategen_ior_ = get_opts.opt_arg (); + break; + + case 'r': + rate = atoi (get_opts.opt_arg ()); + break; + + case '?': // display help for use of the server. + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + "-o (Turn on the rate generator)\n" + "-f (Turn off the rate generator)\n" + "-k <EC IOR> (default is file://rategen.ior)\n" + "-r <rate in hertz> (default is 3)\n" + "\n", + argv [0]), + -1); + } + + if (rategen_ior_ == 0) + rategen_ior_ = "file://ec.ior"; + + if (rate == 0) + rate = 3; + + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + // Initialize orb + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv ACE_ENV_ARG_PARAMETER); + + if (parse_args (argc, argv) != 0) + return -1; + + CORBA::Object_var obj + = orb->string_to_object (rategen_ior_ + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + BasicSP::EC_var pulser + = BasicSP::EC::_narrow (obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (pulser.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire 'EC' objref\n"), -1); + + pulser->hertz (rate + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (turn_on) + { + pulser->hertz (rate + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Start up the Event services\n")); + + pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, "Stop the ES\n")); + } + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Who is the culprit \n"); + cerr << "Uncaught CORBA exception" << endl; + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMClosedED.csd b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMClosedED.csd new file mode 100644 index 00000000000..e814dfcbc13 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMClosedED.csd @@ -0,0 +1,45 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../../docs/XML/softpkg.dtd"> + +<!-- GPS's Software Package Descriptor --> +<!-- This file describes various GPS executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-BMClosedED" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>BMClosedED</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A BMClosedED executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:BasicSP/BMClosedED:1.0" homeid="IDL:BasicSP/BMClosedEDHome:1.0"> + <fileinarchive name="BMClosedED.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="BMClosedED.ccd"/> + </descriptor> + + <implementation id="DCE:8E6C468D-A39F-46b4-962B-265F1AA8D538"> + + <dependency type="CIAODLL"> + <softpkgref> + <fileinarchive name="BMClosedED.ssd"/> + <implref idref="DCE:CDC06FCA-50FC-43ca-8ECC-BEFBD33FEE78"/> + </softpkgref> + </dependency> + + <code type="DLL"> + <fileinarchive name="BMClosedED_exec"/> + <entrypoint>createBMClosedEDHome_Impl</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMClosedED.ssd b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMClosedED.ssd new file mode 100644 index 00000000000..8ef62ebaa1c --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMClosedED.ssd @@ -0,0 +1,43 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../../docs/XML/softpkg.dtd"> + +<!-- RateGen's Servant Software Descriptor --> +<!-- This file describes various RateGen servant --> +<!-- implementations. --> + + +<softpkg name="CIAO-BMClosedED-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>BasicSP::BMDevice Servants</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>A EC event generator implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:BasicSP/BMClosedED:1.0" homeid="IDL:BasicSP/BMClosedEDHome:1.0"> + <fileinarchive name="BMClosedED.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="BMClosedED.ccd"/> + </descriptor> + + <implementation id="DCE:CDC06FCA-50FC-43ca-8ECC-BEFBD33FEE78"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="BMClosedED_svnt"/> + <entrypoint>createBMClosedEDHome_Servant</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDevice.csd b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDevice.csd new file mode 100644 index 00000000000..d4ae1236c6c --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDevice.csd @@ -0,0 +1,46 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../../docs/XML/softpkg.dtd"> + +<!-- GPS's Software Package Descriptor --> +<!-- This file describes various GPS executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-BMDevice" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>BMDevice</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A BMDevice executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:BasicSP/BMDevice:1.0" homeid="IDL:BasicSP/BMDeviceHome:1.0"> + <fileinarchive name="BMDevice.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="BMDevice.ccd"/> + </descriptor> + + <implementation id="DCE:82C2B032-37F0-4315-A59F-7020D3264E4D"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <fileinarchive name="BMDevice.ssd"/> + <implref idref="DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3"/> + </softpkgref> + </dependency> + + <code type="DLL"> + <fileinarchive name="BMDevice_exec"/> + <entrypoint>createBMDeviceHome_Impl</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDevice.ssd b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDevice.ssd new file mode 100644 index 00000000000..500a6284df0 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDevice.ssd @@ -0,0 +1,43 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../../docs/XML/softpkg.dtd"> + +<!-- RateGen's Servant Software Descriptor --> +<!-- This file describes various RateGen servant --> +<!-- implementations. --> + + +<softpkg name="CIAO-BMDevice-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>BasicSP::BMDevice Servants</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>A EC event generator implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:BasicSP/BMDevice:1.0" homeid="IDL:BasicSP/BMDeviceHome:1.0"> + <fileinarchive name="BMDevice.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="BMDevice.ccd"/> + </descriptor> + + <implementation id="DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="EC_svnt"/> + <entrypoint>createBMDeviceHome_Servant</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDisplay.csd b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDisplay.csd new file mode 100644 index 00000000000..1f1d5ff0060 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDisplay.csd @@ -0,0 +1,46 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../../docs/XML/softpkg.dtd"> + +<!-- GPS's Software Package Descriptor --> +<!-- This file describes various GPS executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-BMDisplay" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>BMDisplay</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.cs.wustl.edu/~doc/"/> + </author> + <description>A BMDisplay executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:BasicSP/BMDisplay:1.0" homeid="IDL:BasicSP/BMDisplayHome:1.0"> + <fileinarchive name="BMDisplay.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="BMDisplay.ccd"/> + </descriptor> + + <implementation id="DCE:8E92655E-CA07-46C8-B127-0F0872A8CC29"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <fileinarchive name="BMDisplay.ssd"/> + <implref idref="DCE:D7984625-8561-431d-9927-4E498B317C02"/> + </softpkgref> + </dependency> + + <code type="DLL"> + <fileinarchive name="BMDisplay_exec"/> + <entrypoint>createBMDisplayHome_Impl</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDisplay.ssd b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDisplay.ssd new file mode 100644 index 00000000000..37949ebccb6 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BMDisplay.ssd @@ -0,0 +1,43 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../../docs/XML/softpkg.dtd"> + +<!-- RateGen's Servant Software Descriptor --> +<!-- This file describes various RateGen servant --> +<!-- implementations. --> + + +<softpkg name="CIAO-BMDisplay-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>BasicSP::BMDisplay Servants</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>A EC event generator implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:BasicSP/BMDisplay:1.0" homeid="IDL:BasicSP/BMDisplayHome:1.0"> + <fileinarchive name="BMDisplay.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="BMDisplay.ccd"/> + </descriptor> + + <implementation id="DCE:D7984625-8561-431d-9927-4E498B317C02"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="BMDisplay_svnt"/> + <entrypoint>createBMDisplayHome_Servant</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BasicSP.cad b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BasicSP.cad new file mode 100644 index 00000000000..bd727f4475c --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/BasicSP.cad @@ -0,0 +1,109 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE componentassembly SYSTEM "../../../../docs/XML/componentassembly.dtd"> + +<componentassembly id="Single-process Basic assembly"> + <componentfiles> + <componentfile id="com-EC"> + <fileinarchive name="EC.csd"/> + </componentfile> + <componentfile id="com-BMDevice"> + <fileinarchive name="BMDevice.csd"/> + </componentfile> + <componentfile id="com-BMClosedED"> + <fileinarchive name="BMClosedED.csd"/> + </componentfile> + <componentfile id="com-BMDisplay"> + <fileinarchive name="BMDisplay.csd"/> + </componentfile> + </componentfiles> + + <partitioning> + + <!-- A plain vanilla partition. We don't even need the processcollocation tag here. --> + <homeplacement id="a_ECHome"> + <componentfileref idref="com-EC"/> + <componentinstantiation id="a_EC"> + <registercomponent> + <!-- writeiortofile is a non-standard CIAO extension. --> + <writeiortofile name="ec.ior"/> + </registercomponent> + </componentinstantiation> + </homeplacement> + <homeplacement id="a_BMDeviceHome"> + <componentfileref idref="com-BMDevice"/> + <componentinstantiation id="a_BMDevice"/> + </homeplacement> + <homeplacement id="a_BMClosedEDHome"> + <componentfileref idref="com-BMClosedED"/> + <componentinstantiation id="a_BMClosedED"/> + </homeplacement> + <homeplacement id="a_BMDisplayHome"> + <componentfileref idref="com-BMDisplay"/> + <componentinstantiation id="a_BMDisplay"/> + </homeplacement> + + </partitioning> + + <connections> + + <connectevent> + <consumesport> + <consumesidentifier>timeout</consumesidentifier> + <componentinstantiationref idref="a_BMDevice"/> + </consumesport> + <publishesport> + <publishesidentifier>timeout</publishesidentifier> + <componentinstantiationref idref="a_EC"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>in_avail</consumesidentifier> + <componentinstantiationref idref="a_BMClosedED"/> + </consumesport> + <publishesport> + <publishesidentifier>data_available</publishesidentifier> + <componentinstantiationref idref="a_BMDevice"/> + </publishesport> + </connectevent> + + <connectevent> + <consumesport> + <consumesidentifier>data_ready</consumesidentifier> + <componentinstantiationref idref="a_BMDisplay"/> + </consumesport> + <publishesport> + <publishesidentifier>out_avail</publishesidentifier> + <componentinstantiationref idref="a_BMClosedED"/> + </publishesport> + </connectevent> + + <connectinterface> + <usesport> + <usesidentifier>datain</usesidentifier> + <componentinstantiationref idref="a_BMClosedED"/> + </usesport> + <providesport> + <providesidentifier>data_read</providesidentifier> + <componentinstantiationref idref="a_BMDevice"/> + </providesport> + </connectinterface> + + <connectinterface> + <usesport> + <usesidentifier>comp_data</usesidentifier> + <componentinstantiationref idref="a_BMDisplay"/> + </usesport> + <providesport> + <providesidentifier>dataout</providesidentifier> + <componentinstantiationref idref="a_BMClosedED"/> + </providesport> + </connectinterface> + + </connections> + +</componentassembly> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/CIAO_Installation_Data.ini b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/CIAO_Installation_Data.ini new file mode 100644 index 00000000000..ba2027881c1 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/CIAO_Installation_Data.ini @@ -0,0 +1,9 @@ +[ComponentInstallation] +DCE:75309233-0E0A-4cfb-B186-3E99F69B1D40=EC_svnt +DCE:82C2B032-37F0-4315-A59F-7020D3264E4D=BMDevice_exec +DCE:8E92655E-CA07-46C8-B127-0F0872A8CC29=BMDisplay_exec +DCE:93D254CF-9538-44e8-BB98-AABCD134ADD3=BMDevice_svnt +DCE:CDC06FCA-50FC-43ca-8ECC-BEFBD33FEE78=BMClosedED_svnt +DCE:8E6C468D-A39F-46b4-962B-265F1AA8D538=BMClosedED_exec +DCE:D7984625-8561-431d-9927-4E498B317C02=BMDisplay_svnt +DCE:3148F760-F2ED-4204-A775-6B972C10E8CB=EC_exec diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/EC.csd b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/EC.csd new file mode 100644 index 00000000000..562ac252743 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/EC.csd @@ -0,0 +1,46 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../../docs/XML/softpkg.dtd"> + +<!-- RateGen's Software Package Descriptor --> +<!-- This file describes various RateGen executor --> +<!-- implementations. --> + + +<softpkg name="CIAO-EC" version="1.0"> + <pkgtype>CORBA Component</pkgtype> + <title>EC</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>A Event executor implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:BasicSP/EC:1.0" homeid="IDL:BasicSP/ECHome:1.0"> + <fileinarchive name="EC.idl"/> + </idl> + <descriptor type="CORBA Component"> + <fileinarchive name="EC.ccd"/> + </descriptor> + <implementation id="DCE:3148F760-F2ED-4204-A775-6B972C10E8CB"> + + <!-- CIAO extension --> + <dependency type="CIAODLL"> + <softpkgref> + <!-- .ssd stands for Servant Software Descriptors which is a CIAO extension --> + <fileinarchive name="EC.ssd"/> + <implref idref="DCE:75309233-0E0A-4cfb-B186-3E99F69B1D40"/> + </softpkgref> + </dependency> + + <code type="DLL"> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="EC_exec"/> + <entrypoint>createECHome_Impl</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/EC.ssd b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/EC.ssd new file mode 100644 index 00000000000..02110072580 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/EC.ssd @@ -0,0 +1,43 @@ +<?xml version="1.0"?> <!-- -*- SGML -*- --> + +<!-- If this file is moved to a different directory, make sure to change the + path to the DTD below. Otherwise the examples won't work. --> +<!DOCTYPE softpkg SYSTEM "../../../../docs/XML/softpkg.dtd"> + +<!-- RateGen's Servant Software Descriptor --> +<!-- This file describes various RateGen servant --> +<!-- implementations. --> + + +<softpkg name="CIAO-EC-Servant" version="1.0"> + <pkgtype>CIAO Servant</pkgtype> + <title>BasicSP::EC Servants</title> + <author> + <company>ISIS at Vanderbilt University</company> + <webpage href="http://www.dre.vanderbilt.edu/"/> + </author> + <description>A EC event generator implementation.</description> + <license href="http://www.cs.wustl.edu/~schmidt/ACE-copying.html"/> + <idl id="IDL:BasicSP/EC:1.0" homeid="IDL:BasicSP/ECHome:1.0"> + <fileinarchive name="EC.idl"/> + </idl> + + <descriptor type="CORBA Component"> + <fileinarchive name="EC.ccd"/> + </descriptor> + + <implementation id="DCE:75309233-0E0A-4cfb-B186-3E99F69B1D40"> + + <dependency type="ORB"> + <name>TAO</name> + </dependency> + + <code> + <!-- No need to specify extension below since ACE takes care of that, --> + <fileinarchive name="EC_svnt"/> + <entrypoint>createECHome_Servant</entrypoint> + </code> + + </implementation> + +</softpkg> diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/test.dat b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/test.dat new file mode 100644 index 00000000000..d26b3d4e070 --- /dev/null +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/descriptors/test.dat @@ -0,0 +1,2 @@ +Default corbaloc:iiop:localhost:10000/ServerActivator +Remote corbaloc:iiop:localhost:12000/ServerActivator
\ No newline at end of file diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 26ffd12bc40..f2d4bc5cce4 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,17 @@ +Thu Jul 24 15:29:37 2003 George Edwards <g.edwards@vanderbilt.edu> + + * CIAO/examples/handcrafted/BasicSP_EC/*.*: + * CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/*.*: + * CIAO/examples/handcrafted/BasicSP_EC/BMDevice/*.*: + * CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/*.*: + * CIAO/examples/handcrafted/BasicSP_EC/descriptors/*.*: + * CIAO/examples/handcrafted/BasicSP_EC/EC/*.*: + + Handcrafted BasicSP example to use TAO's RT event channel for event + propagation. This involved modifications to each component's servant + header and source files, which are normally generated by the CIDL + compiler. + Thu Jul 24 14:26:12 2003 Yamuna Krishnamurthy <yamuna@oomworks.com> * examples/Makefile: |