diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-22 18:02:04 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-22 18:02:04 +0000 |
commit | 1855b744051df9331c93f611b6da93a06102cadf (patch) | |
tree | bb703e04cb2cc6553daa18a599dc47edc86a6141 | |
parent | 4357c8e11a383c505eaed8f6431156ad27bf0572 (diff) | |
download | ATCD-1855b744051df9331c93f611b6da93a06102cadf.tar.gz |
*** empty log message ***
29 files changed, 4661 insertions, 4 deletions
diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/descriptors/Deployment.xsd b/TAO/CIAO/DAnCE/examples/BasicSP/descriptors/Deployment.xsd index 202488153a4..b21fc929fc5 100644 --- a/TAO/CIAO/DAnCE/examples/BasicSP/descriptors/Deployment.xsd +++ b/TAO/CIAO/DAnCE/examples/BasicSP/descriptors/Deployment.xsd @@ -761,9 +761,9 @@ <xsd:enumeration value="EventEmitter"/> <xsd:enumeration value="EventPublisher"/> <xsd:enumeration value="EventConsumer"/> - <xsd:enumeration value="cosEventEmitter"/> - <xsd:enumeration value="cosEventPublisher"/> - <xsd:enumeration value="cosEventConsumer"/> + <xsd:enumeration value="ecEventEmitter"/> + <xsd:enumeration value="ecEventPublisher"/> + <xsd:enumeration value="ecEventConsumer"/> <xsd:enumeration value="rtecEventEmitter"/> <xsd:enumeration value="rtecEventPublisher"/> <xsd:enumeration value="rtecEventConsumer"/> diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/descriptors/GPS.ccd b/TAO/CIAO/DAnCE/examples/BasicSP/descriptors/GPS.ccd index 3d7d99491c8..a0eddcb4f94 100644 --- a/TAO/CIAO/DAnCE/examples/BasicSP/descriptors/GPS.ccd +++ b/TAO/CIAO/DAnCE/examples/BasicSP/descriptors/GPS.ccd @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <Deployment:ComponentInterfaceDescription xmlns:Deployment="http://www.omg.org/Deployment" xmlns:xmi="http://www.omg.org/XMI" diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.cidl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.cidl new file mode 100644 index 00000000000..ecf5a3ca019 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.cidl @@ -0,0 +1,19 @@ +//$Id$ + +#ifndef CONSUMER_CIDL +#define CONSUMER_CIDL + +#include "Consumer.idl" + +composition session Consumer_Impl +{ + home executor ConsumerHome_Exec + { + implements EC_Benchmark::ConsumerHome; + manages Consumer_Exec; + }; +}; + +#endif /* CONSUMER_CIDL */ + + diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.idl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.idl new file mode 100644 index 00000000000..3f96350fe48 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.idl @@ -0,0 +1,28 @@ +//$Id$ +//============================================================================= +/** + * @file Consumer.idl + * + * Definition of the Consumer component + * + * @author Gan Deng <gan.deng@vanderbilt.edu> + */ +//============================================================================= +#ifndef CIAO_CONSUMER_IDL +#define CIAO_CONSUMER_IDL + +#include "../EC_Benchmark.idl" + +module EC_Benchmark +{ + component Consumer + { + consumes TimeOut timeout; + }; + + home ConsumerHome manages Consumer + { + }; +}; + +#endif /*CIAO_CONSUMER_IDL */ diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.mpc b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.mpc new file mode 100644 index 00000000000..ca9bee0cc68 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer.mpc @@ -0,0 +1,60 @@ +// $Id$ + +project(Consumer_stub): ciao_client_dnc { + after += EC_Benchmark_stub + sharedname = Consumer_stub + + idlflags += -Wb,stub_export_macro=CONSUMER_STUB_Export -Wb,stub_export_include=Consumer_stub_export.h -Wb,skel_export_macro=CONSUMER_SVNT_Export -Wb,skel_export_include=Consumer_svnt_export.h + libpaths += .. + libs += EC_Benchmark_stub + dynamicflags = CONSUMER_STUB_BUILD_DLL + + IDL_Files { + Consumer.idl + } + + Source_Files { + ConsumerC.cpp + } +} + +project(Consumer_svnt) : ciao_servant_dnc { + after += EC_Benchmark_svnt Consumer_stub + sharedname = Consumer_svnt + libs += Consumer_stub EC_Benchmark_stub EC_Benchmark_svnt + libpaths += .. + idlflags += -Wb,export_macro=CONSUMER_SVNT_Export -Wb,export_include=Consumer_svnt_export.h + dynamicflags = CONSUMER_SVNT_BUILD_DLL + + CIDL_Files { + Consumer.cidl + } + + IDL_Files { + ConsumerE.idl + } + + Source_Files { + ConsumerEC.cpp + ConsumerS.cpp + Consumer_svnt.cpp + } +} + + +project(Consumer_exec) : ciao_component_dnc { + after += Consumer_svnt + sharedname = Consumer_exec + libs += Consumer_stub Consumer_svnt EC_Benchmark_stub EC_Benchmark_svnt + libpaths += .. + idlflags += -Wb,export_macro=CONSUMER_EXEC_Export -Wb,export_include=Consumer_exec_export.h + dynamicflags = CONSUMER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Consumer_exec.cpp + } +} + diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/ConsumerE.idl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/ConsumerE.idl new file mode 100644 index 00000000000..f19ade75a88 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/ConsumerE.idl @@ -0,0 +1,51 @@ +// $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.dre.vanderbilt.edu/CIAO + +#include "Consumer.idl" +module EC_Benchmark +{ + local interface CCM_Consumer : ::Components::EnterpriseComponent + { + void push_timeout (in ::EC_Benchmark::TimeOut e); + }; + local interface CCM_Consumer_Context : ::Components::SessionContext + { + }; + local interface CCM_ConsumerHomeImplicit + { + ::Components::EnterpriseComponent create () raises (::Components::CCMException); + }; + local interface CCM_ConsumerHomeExplicit : ::Components::HomeExecutorBase + { + }; + local interface CCM_ConsumerHome : CCM_ConsumerHomeExplicit, CCM_ConsumerHomeImplicit + { + }; +}; +module Consumer_Impl +{ + typedef ::EC_Benchmark::CCM_Consumer_Context Consumer_Exec_Context; + local interface Consumer_Exec : ::EC_Benchmark::CCM_Consumer, ::Components::SessionComponent + { + }; + local interface ConsumerHome_Exec : ::EC_Benchmark::CCM_ConsumerHome + { + }; +}; diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.cpp b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.cpp new file mode 100644 index 00000000000..e50238e2ef4 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.cpp @@ -0,0 +1,169 @@ +// $Id$ + +#include "ciao/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_NOT_USED) + 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; + + if (CIAO::debug_level () > 0) + { + 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 CORBA::string_dup (this->str_); +} + +char * +MyImpl::BMDevice_exec_i::get_data (ACE_ENV_SINGLE_ARG_DECL) + 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)) +{ + if (CIAO::debug_level () > 0) + { + 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::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::BMDevice_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::BMDevice_exec_i::ccm_activate\n")); + } + +} + +void +MyImpl::BMDevice_exec_i::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::BMDevice_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + { + ACE_DEBUG ((LM_DEBUG, + "MyImpl::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)) +{ + if (CIAO::debug_level () > 0) + { + 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)) +{ + Components::EnterpriseComponent_ptr tmp= 0; + ACE_NEW_THROW_EX (tmp, + MyImpl::BMDevice_exec_i, + CORBA::NO_MEMORY ()); + + return tmp; +} + + +extern "C" BMDEVICE_EXEC_Export ::Components::HomeExecutorBase_ptr +createBMDeviceHome_Impl (void) +{ + return new MyImpl::BMDeviceHome_exec_i; +} diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.h new file mode 100644 index 00000000000..a33f82e5006 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec.h @@ -0,0 +1,132 @@ +// $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 + ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + virtual void + ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + + virtual void + ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void + ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + protected: + const 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/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec_export.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec_export.h new file mode 100644 index 00000000000..9099ed5fb79 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_exec_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CONSUMER_EXEC +// ------------------------------ +#ifndef CONSUMER_EXEC_EXPORT_H +#define CONSUMER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CONSUMER_EXEC_HAS_DLL) +# define CONSUMER_EXEC_HAS_DLL 1 +#endif /* ! CONSUMER_EXEC_HAS_DLL */ + +#if defined (CONSUMER_EXEC_HAS_DLL) && (CONSUMER_EXEC_HAS_DLL == 1) +# if defined (CONSUMER_EXEC_BUILD_DLL) +# define CONSUMER_EXEC_Export ACE_Proper_Export_Flag +# define CONSUMER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CONSUMER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CONSUMER_EXEC_BUILD_DLL */ +# define CONSUMER_EXEC_Export ACE_Proper_Import_Flag +# define CONSUMER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CONSUMER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CONSUMER_EXEC_BUILD_DLL */ +#else /* CONSUMER_EXEC_HAS_DLL == 1 */ +# define CONSUMER_EXEC_Export +# define CONSUMER_EXEC_SINGLETON_DECLARATION(T) +# define CONSUMER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CONSUMER_EXEC_HAS_DLL == 1 */ + +// Set CONSUMER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CONSUMER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define CONSUMER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CONSUMER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CONSUMER_EXEC_NTRACE */ + +#if (CONSUMER_EXEC_NTRACE == 1) +# define CONSUMER_EXEC_TRACE(X) +#else /* (CONSUMER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CONSUMER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CONSUMER_EXEC_NTRACE == 1) */ + +#endif /* CONSUMER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_stub_export.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_stub_export.h new file mode 100644 index 00000000000..cd2fcb6fd5c --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CONSUMER_STUB +// ------------------------------ +#ifndef CONSUMER_STUB_EXPORT_H +#define CONSUMER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CONSUMER_STUB_HAS_DLL) +# define CONSUMER_STUB_HAS_DLL 1 +#endif /* ! CONSUMER_STUB_HAS_DLL */ + +#if defined (CONSUMER_STUB_HAS_DLL) && (CONSUMER_STUB_HAS_DLL == 1) +# if defined (CONSUMER_STUB_BUILD_DLL) +# define CONSUMER_STUB_Export ACE_Proper_Export_Flag +# define CONSUMER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CONSUMER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CONSUMER_STUB_BUILD_DLL */ +# define CONSUMER_STUB_Export ACE_Proper_Import_Flag +# define CONSUMER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CONSUMER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CONSUMER_STUB_BUILD_DLL */ +#else /* CONSUMER_STUB_HAS_DLL == 1 */ +# define CONSUMER_STUB_Export +# define CONSUMER_STUB_SINGLETON_DECLARATION(T) +# define CONSUMER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CONSUMER_STUB_HAS_DLL == 1 */ + +// Set CONSUMER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CONSUMER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define CONSUMER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CONSUMER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CONSUMER_STUB_NTRACE */ + +#if (CONSUMER_STUB_NTRACE == 1) +# define CONSUMER_STUB_TRACE(X) +#else /* (CONSUMER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CONSUMER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CONSUMER_STUB_NTRACE == 1) */ + +#endif /* CONSUMER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.cpp b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.cpp new file mode 100644 index 00000000000..c6cb88ae43c --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.cpp @@ -0,0 +1,937 @@ +// $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.dre.vanderbilt.edu/CIAO + +#include "Consumer_svnt.h" +#include "Cookies.h" +#include "ciao/Servant_Activator.h" +#include "ciao/Port_Activator_T.h" + +namespace Consumer_Impl +{ + namespace CIAO_GLUE_EC_Benchmark + { + Consumer_Context::Consumer_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Consumer_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + Consumer_Context::~Consumer_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + Consumer_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 + Consumer_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + Consumer_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 + Consumer_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 + Consumer_Context::is_caller_in_role ( + const char * /* role */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + Consumer_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContextinterface. + + CORBA::Object_ptr + Consumer_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_ = + ::EC_Benchmark::Consumer::_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 ::EC_Benchmark::Consumer::_duplicate ( + this->component_.in ()); + } + + // Operations for Consumer receptacles and event sources, + // defined in ::EC_Benchmark::CCM_Consumer_Context. + + // CIAO-specific. + + ::CIAO::Session_Container * + Consumer_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + Consumer_Context * + Consumer_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<Consumer_Context *> (p); + } + } + + namespace CIAO_GLUE_EC_Benchmark + { + Consumer_Servant::Consumer_Servant ( + ::EC_Benchmark::CCM_Consumer_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : our_base (exe, c) + { + this->context_ = new Consumer_Context (h, c, this); + + CIAO_REGISTER_OBV_FACTORY ( + ::EC_Benchmark::TimeOut_init, + ::EC_Benchmark::TimeOut); + + 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_TRY_CHECK; + } + + this->populate_port_tables ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + ACE_CATCHANY + { + } + + ACE_ENDTRY; + } + + Consumer_Servant::~Consumer_Servant (void) + { + } + + void + Consumer_Servant::set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL_NOT_USED) + { + for (CORBA::ULong i = 0; + i < descr.length (); + ++i) + { + const char *descr_name = descr[i]->name (); + ::CORBA::Any &descr_value = descr[i]->value (); + + ACE_UNUSED_ARG (descr_name); + ACE_UNUSED_ARG (descr_value); + } + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + Consumer_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 * + Consumer_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); + } + + ::Components::EmitterDescriptions * + Consumer_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + Consumer_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); + } + + Consumer_Servant::TimeOutConsumer_timeout_Servant::TimeOutConsumer_timeout_Servant ( + ::EC_Benchmark::CCM_Consumer_ptr executor, + ::EC_Benchmark::CCM_Consumer_Context_ptr c) + : executor_ (::EC_Benchmark::CCM_Consumer::_duplicate (executor)), + ctx_ (::EC_Benchmark::CCM_Consumer_Context::_duplicate (c)) + { + } + + Consumer_Servant::TimeOutConsumer_timeout_Servant::~TimeOutConsumer_timeout_Servant (void) + { + } + + CORBA::Object_ptr + Consumer_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 + Consumer_Servant::TimeOutConsumer_timeout_Servant::push_TimeOut ( + ::EC_Benchmark::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 + Consumer_Servant::TimeOutConsumer_timeout_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::EC_Benchmark::TimeOut_var ev_type = + ::EC_Benchmark::TimeOut::_downcast (ev); + + if (ev_type != 0) + { + this->push_TimeOut ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::EC_Benchmark::TimeOutConsumer_ptr + Consumer_Servant::get_consumer_timeout ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->consumes_timeout_.in ())) + { + return ::EC_Benchmark::TimeOutConsumer::_duplicate (this->consumes_timeout_.in ()); + } + + ::Components::EventConsumerBase_var obj = + this->get_consumer_timeout_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::TimeOutConsumer::_nil ()); + + ::EC_Benchmark::TimeOutConsumer_var eco = + ::EC_Benchmark::TimeOutConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::TimeOutConsumer::_nil ()); + + this->consumes_timeout_ = eco; + return ::EC_Benchmark::TimeOutConsumer::_duplicate (this->consumes_timeout_.in ()); + } + + ::Components::EventConsumerBase_ptr + Consumer_Servant::get_consumer_timeout_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::EventConsumerBase_ptr ret = + this->lookup_consumer ("timeout"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + CIAO::Port_Activator_T< + Consumer_Servant::TimeOutConsumer_timeout_Servant, + ::EC_Benchmark::CCM_Consumer, + ::EC_Benchmark::CCM_Consumer_Context, + Consumer_Servant > *tmp = 0; + + typedef CIAO::Port_Activator_T< + Consumer_Servant::TimeOutConsumer_timeout_Servant, + ::EC_Benchmark::CCM_Consumer, + ::EC_Benchmark::CCM_Consumer_Context, + Consumer_Servant > + MACRO_MADNESS_TYPEDEF; + + + ACE_NEW_THROW_EX ( + tmp, + MACRO_MADNESS_TYPEDEF ( + "EC_Benchmark_Consumer_timeout", + "timeout", + CIAO::Port_Activator::Sink, + this->executor_.in (), + this->context_, + this), + CORBA::NO_MEMORY ()); + + + CIAO::Servant_Activator *sa = + this->container_->ports_servant_activator (); + + if (!sa->register_port_activator (tmp)) + return 0; + + ::CORBA::Object_var obj = + this->container_->generate_reference ( + "EC_Benchmark_Consumer_timeout", + "IDL:EC_Benchmark/TimeOutConsumer:1.0", + CIAO::Container::Facet_Consumer + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::TimeOutConsumer::_nil ()); + + ::Components::EventConsumerBase_var ecb = + ::Components::EventConsumerBase::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::TimeOutConsumer::_nil ()); + + this->add_consumer ( + "timeout", + ecb.in ()); + + return ecb._retn (); + } + + ::Components::Cookie * + Consumer_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 the component has no receptacles, this will be unused. + ACE_UNUSED_ARG (connection); + + if (name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + Consumer_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 ()); + + ACE_UNUSED_ARG (ck); + } + + ::Components::ConnectionDescriptions * + Consumer_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 * + Consumer_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + Consumer_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); + } + + ::Components::EventConsumerBase_ptr + Consumer_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 ()); + } + + void + Consumer_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)) + { + if (emitter_name == 0) + { + ACE_THROW (::CORBA::BAD_PARAM ()); + } + + ACE_UNUSED_ARG (consumer); + ACE_THROW (::Components::InvalidName ()); + } + + ::Components::EventConsumerBase_ptr + Consumer_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 * + Consumer_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::Cookie * + Consumer_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)) + { + // Just in case there are no if blocks + ACE_UNUSED_ARG (subscribe); + + if (publisher_name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ::Components::EventConsumerBase_ptr + Consumer_Servant::unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)) + { + // Just in case there are no if blocks + ACE_UNUSED_ARG (ck); + + if (publisher_name == 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::Components::EventConsumerBase::_nil ()); + } + + ::Components::PublisherDescriptions * + Consumer_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + Consumer_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. + + void + Consumer_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + Consumer_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + + CORBA::IRObject_ptr + Consumer_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + Consumer_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + Consumer_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + CORBA::Object_ptr + Consumer_Servant::get_facet_executor (const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::CORBA::BAD_PARAM (), + ::CORBA::Object::_nil ()); + } + + return CORBA::Object::_nil (); + } + + // Supported operations. + + // Component attribute operations. + + // Private method to populate the port tables. + void + Consumer_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + + ecb_var = + this->get_consumer_timeout_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } + + namespace CIAO_GLUE_EC_Benchmark + { + ConsumerHome_Servant::ConsumerHome_Servant ( + ::EC_Benchmark::CCM_ConsumerHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::EC_Benchmark::CCM_ConsumerHome::_duplicate (exe)), + container_ (c) + { + } + + ConsumerHome_Servant::~ConsumerHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + ConsumerHome_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. + + ::EC_Benchmark::Consumer_ptr + ConsumerHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::EC_Benchmark::Consumer::_nil ()); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::Consumer::_nil ()); + + ::EC_Benchmark::CCM_Consumer_var _ciao_comp = + ::EC_Benchmark::CCM_Consumer::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::Consumer::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + ConsumerHome_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 + ConsumerHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + ConsumerHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::EC_Benchmark::Consumer_var _ciao_comp = + ::EC_Benchmark::Consumer::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::EC_Benchmark::Consumer_ptr + ConsumerHome_Servant::_ciao_activate_component ( + ::EC_Benchmark::CCM_Consumer_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 (::EC_Benchmark::Consumer::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::Consumer::_nil ()); + + Consumer_Servant *svt = + new Consumer_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 (::EC_Benchmark::Consumer::_nil ()); + + ::EC_Benchmark::Consumer_var ho = + ::EC_Benchmark::Consumer::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::Consumer::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + ConsumerHome_Servant::_ciao_passivate_component ( + ::EC_Benchmark::Consumer_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component ( + comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Consumer_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; + } + } + } + + extern "C" CONSUMER_SVNT_Export ::PortableServer::Servant + createConsumerHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::EC_Benchmark::CCM_ConsumerHome_var x = + ::EC_Benchmark::CCM_ConsumerHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_EC_Benchmark::ConsumerHome_Servant ( + x.in (), + c); + } +} + diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.h new file mode 100644 index 00000000000..4b1f9308bf4 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt.h @@ -0,0 +1,525 @@ +// $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.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_GLUE_SESSION_CONSUMER_SVNT_H +#define CIAO_GLUE_SESSION_CONSUMER_SVNT_H + +#include /**/ "ace/pre.h" + +#include "ConsumerEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "ciao/Servant_Impl_T.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "ConsumerS.h" + +namespace Consumer_Impl +{ + namespace CIAO_GLUE_EC_Benchmark + { + class CONSUMER_SVNT_Export Consumer_Context + : public virtual ::EC_Benchmark::CCM_Consumer_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class Consumer_Servant; + + Consumer_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Consumer_Servant *sv); + + virtual ~Consumer_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_NOT_USED) + 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 Consumer receptacles and event sources, + // defined in ::EC_Benchmark::CCM_Consumer_Context. + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static Consumer_Context * + _narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + protected: + // Methods that manage this component's connections and consumers. + + protected: + ::Components::CCMHome_var home_; + ::CIAO::Session_Container *container_; + + Consumer_Servant *servant_; + ::EC_Benchmark::Consumer_var component_; + }; + } + + namespace CIAO_GLUE_EC_Benchmark + { + class CONSUMER_SVNT_Export Consumer_Servant + : public virtual CIAO::Servant_Impl< + POA_EC_Benchmark::Consumer, + ::EC_Benchmark::CCM_Consumer, + ::EC_Benchmark::CCM_Consumer_var, + Consumer_Context + >, + public virtual PortableServer::RefCountServantBase + { + public: + /// Hack for VC6 the most sucky compiler + typedef CIAO::Servant_Impl< + POA_EC_Benchmark::Consumer, + ::EC_Benchmark::CCM_Consumer, + ::EC_Benchmark::CCM_Consumer_var, + Consumer_Context + > our_base; + + Consumer_Servant ( + ::EC_Benchmark::CCM_Consumer_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~Consumer_Servant (void); + + virtual void + set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL); + + // Supported operations. + + // Public port operations. + + // Servant class for the timeout consumer. + class CONSUMER_SVNT_Export TimeOutConsumer_timeout_Servant + : public virtual POA_EC_Benchmark::TimeOutConsumer, + public virtual PortableServer::RefCountServantBase + { + public: + TimeOutConsumer_timeout_Servant ( + ::EC_Benchmark::CCM_Consumer_ptr executor, + ::EC_Benchmark::CCM_Consumer_Context_ptr c); + + virtual ~TimeOutConsumer_timeout_Servant (void); + + virtual void + push_TimeOut ( + ::EC_Benchmark::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: + ::EC_Benchmark::CCM_Consumer_var + executor_; + + ::EC_Benchmark::CCM_Consumer_Context_var + ctx_; + }; + + virtual ::EC_Benchmark::TimeOutConsumer_ptr + get_consumer_timeout ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Component attribute operations. + + // 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_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // 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_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 void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)); + + virtual void + remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + // CIAO specific operations on the servant + CORBA::Object_ptr + get_facet_executor (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException)); + + private: + + ::EC_Benchmark::TimeOutConsumer_var + consumes_timeout_; + + private: + + void + populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ::Components::EventConsumerBase_ptr + get_consumer_timeout_i ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + ACE_CString component_UUID_; + }; + } + + namespace CIAO_GLUE_EC_Benchmark + { + class CONSUMER_SVNT_Export ConsumerHome_Servant + : public virtual POA_EC_Benchmark::ConsumerHome, + public virtual PortableServer::RefCountServantBase + { + public: + ConsumerHome_Servant ( + ::EC_Benchmark::CCM_ConsumerHome_ptr exe, + ::CIAO::Session_Container *c); + virtual ~ConsumerHome_Servant (void); + + // Home operations. + + // Home factory and finder operations. + + // Attribute 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 ::EC_Benchmark::Consumer_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. + + ::EC_Benchmark::Consumer_ptr + _ciao_activate_component ( + ::EC_Benchmark::CCM_Consumer_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::EC_Benchmark::Consumer_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::EC_Benchmark::CCM_ConsumerHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + Consumer_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" CONSUMER_SVNT_Export ::PortableServer::Servant + createConsumerHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_CONSUMER_SVNT_H */ + diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt_export.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt_export.h new file mode 100644 index 00000000000..100ac384d4f --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Consumer/Consumer_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CONSUMER_SVNT +// ------------------------------ +#ifndef CONSUMER_SVNT_EXPORT_H +#define CONSUMER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CONSUMER_SVNT_HAS_DLL) +# define CONSUMER_SVNT_HAS_DLL 1 +#endif /* ! CONSUMER_SVNT_HAS_DLL */ + +#if defined (CONSUMER_SVNT_HAS_DLL) && (CONSUMER_SVNT_HAS_DLL == 1) +# if defined (CONSUMER_SVNT_BUILD_DLL) +# define CONSUMER_SVNT_Export ACE_Proper_Export_Flag +# define CONSUMER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CONSUMER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CONSUMER_SVNT_BUILD_DLL */ +# define CONSUMER_SVNT_Export ACE_Proper_Import_Flag +# define CONSUMER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CONSUMER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CONSUMER_SVNT_BUILD_DLL */ +#else /* CONSUMER_SVNT_HAS_DLL == 1 */ +# define CONSUMER_SVNT_Export +# define CONSUMER_SVNT_SINGLETON_DECLARATION(T) +# define CONSUMER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CONSUMER_SVNT_HAS_DLL == 1 */ + +// Set CONSUMER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CONSUMER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define CONSUMER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CONSUMER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CONSUMER_SVNT_NTRACE */ + +#if (CONSUMER_SVNT_NTRACE == 1) +# define CONSUMER_SVNT_TRACE(X) +#else /* (CONSUMER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CONSUMER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CONSUMER_SVNT_NTRACE == 1) */ + +#endif /* CONSUMER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.idl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.idl new file mode 100644 index 00000000000..431b6960ee0 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.idl @@ -0,0 +1,25 @@ +// $Id$ +//============================================================================= +/** + * @file EC_Benchmark.idl + * + * Definition of events used in the EC_Benchmark module. + * + * @author Gan Deng <gan.deng@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EC_BENCHMARK_IDL +#define CIAO_EC_BENCHMARK_IDL + +#include <Components.idl> + +module EC_Benchmark +{ + /** + * @eventtype Events that represent timeouts + */ + eventtype TimeOut {}; +}; + +#endif /*CIAO_EC_BENCHMARK_IDL*/ diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.mpc b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.mpc new file mode 100644 index 00000000000..dab8d831448 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark.mpc @@ -0,0 +1,29 @@ +// $Id$ + +project(EC_Benchmark_stub): ciao_client_dnc { + + sharedname = EC_Benchmark_stub + idlflags += -Wb,stub_export_macro=EC_BENCHMARK_STUB_Export -Wb,stub_export_include=EC_Benchmark_stub_export.h -Wb,skel_export_macro=EC_BENCHMARK_SVNT_Export -Wb,skel_export_include=EC_Benchmark_svnt_export.h + dynamicflags = EC_BENCHMARK_STUB_BUILD_DLL + + IDL_Files { + EC_Benchmark.idl + } + + Source_Files { + EC_BenchmarkC.cpp + } +} + +project(EC_Benchmark_svnt) : ciao_server_dnc { + after += EC_Benchmark_stub + sharedname = EC_Benchmark_svnt + libs += EC_Benchmark_stub + + idlflags += -Wb,stub_export_macro=EC_BENCHMARK_STUB_Export -Wb,stub_export_include=EC_Benchmark_stub_export.h -Wb,skel_export_macro=EC_BENCHMARK_SVNT_Export -Wb,skel_export_include=EC_Benchmark_svnt_export.h + dynamicflags = EC_BENCHMARK_SVNT_BUILD_DLL + + Source_Files { + EC_BenchmarkS.cpp + } +} diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark_stub_export.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark_stub_export.h new file mode 100644 index 00000000000..ae89274a0e5 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl EC_BENCHMARK_STUB +// ------------------------------ +#ifndef EC_BENCHMARK_STUB_EXPORT_H +#define EC_BENCHMARK_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (EC_BENCHMARK_STUB_HAS_DLL) +# define EC_BENCHMARK_STUB_HAS_DLL 1 +#endif /* ! EC_BENCHMARK_STUB_HAS_DLL */ + +#if defined (EC_BENCHMARK_STUB_HAS_DLL) && (EC_BENCHMARK_STUB_HAS_DLL == 1) +# if defined (EC_BENCHMARK_STUB_BUILD_DLL) +# define EC_BENCHMARK_STUB_Export ACE_Proper_Export_Flag +# define EC_BENCHMARK_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define EC_BENCHMARK_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* EC_BENCHMARK_STUB_BUILD_DLL */ +# define EC_BENCHMARK_STUB_Export ACE_Proper_Import_Flag +# define EC_BENCHMARK_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define EC_BENCHMARK_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* EC_BENCHMARK_STUB_BUILD_DLL */ +#else /* EC_BENCHMARK_STUB_HAS_DLL == 1 */ +# define EC_BENCHMARK_STUB_Export +# define EC_BENCHMARK_STUB_SINGLETON_DECLARATION(T) +# define EC_BENCHMARK_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* EC_BENCHMARK_STUB_HAS_DLL == 1 */ + +// Set EC_BENCHMARK_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (EC_BENCHMARK_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define EC_BENCHMARK_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define EC_BENCHMARK_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !EC_BENCHMARK_STUB_NTRACE */ + +#if (EC_BENCHMARK_STUB_NTRACE == 1) +# define EC_BENCHMARK_STUB_TRACE(X) +#else /* (EC_BENCHMARK_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define EC_BENCHMARK_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (EC_BENCHMARK_STUB_NTRACE == 1) */ + +#endif /* EC_BENCHMARK_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark_svnt_export.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark_svnt_export.h new file mode 100644 index 00000000000..c9ee04ed64a --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/EC_Benchmark_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl EC_BENCHMARK_SVNT +// ------------------------------ +#ifndef EC_BENCHMARK_SVNT_EXPORT_H +#define EC_BENCHMARK_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (EC_BENCHMARK_SVNT_HAS_DLL) +# define EC_BENCHMARK_SVNT_HAS_DLL 1 +#endif /* ! EC_BENCHMARK_SVNT_HAS_DLL */ + +#if defined (EC_BENCHMARK_SVNT_HAS_DLL) && (EC_BENCHMARK_SVNT_HAS_DLL == 1) +# if defined (EC_BENCHMARK_SVNT_BUILD_DLL) +# define EC_BENCHMARK_SVNT_Export ACE_Proper_Export_Flag +# define EC_BENCHMARK_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define EC_BENCHMARK_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* EC_BENCHMARK_SVNT_BUILD_DLL */ +# define EC_BENCHMARK_SVNT_Export ACE_Proper_Import_Flag +# define EC_BENCHMARK_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define EC_BENCHMARK_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* EC_BENCHMARK_SVNT_BUILD_DLL */ +#else /* EC_BENCHMARK_SVNT_HAS_DLL == 1 */ +# define EC_BENCHMARK_SVNT_Export +# define EC_BENCHMARK_SVNT_SINGLETON_DECLARATION(T) +# define EC_BENCHMARK_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* EC_BENCHMARK_SVNT_HAS_DLL == 1 */ + +// Set EC_BENCHMARK_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (EC_BENCHMARK_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define EC_BENCHMARK_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define EC_BENCHMARK_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !EC_BENCHMARK_SVNT_NTRACE */ + +#if (EC_BENCHMARK_SVNT_NTRACE == 1) +# define EC_BENCHMARK_SVNT_TRACE(X) +#else /* (EC_BENCHMARK_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define EC_BENCHMARK_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (EC_BENCHMARK_SVNT_NTRACE == 1) */ + +#endif /* EC_BENCHMARK_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.cidl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.cidl new file mode 100644 index 00000000000..cb8fa192548 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.cidl @@ -0,0 +1,21 @@ +//$Id$ + +#ifndef PRODUCER_CIDL +#define PRODUCER_CIDL + +#include "Producer.idl" + +composition session Producer_Impl +{ + home executor ProducerHome_Exec + { + implements EC_Benchmark::ProducerHome; + manages Producer_Exec; + }; +}; + +#endif /* PRODUCER_CIDL */ + + + + diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.idl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.idl new file mode 100644 index 00000000000..a857a603d88 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.idl @@ -0,0 +1,37 @@ +// $Id$ +//============================================================================= +/** + * @file Producer.idl + * + * Definition of the Producer component. + * + * @author Gan Deng <gan.deng@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_PRODUCER_IDL +#define CIAO_PRODUCER_IDL + +#include "../EC_Benchmark.idl" + +module EC_Benchmark +{ + interface trigger + { + void start (); + void stop (); + }; + + component Producer supports trigger + { + publishes TimeOut timeout; + }; + + home ProducerHome manages Producer + { + // Explicit operations + //factory new_EC (in long hertz); + }; +}; + +#endif /* CIAO_PRODUCER_IDL */ diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.mpc b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.mpc new file mode 100644 index 00000000000..ec7c469e181 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer.mpc @@ -0,0 +1,74 @@ +// $Id$ + +project(Producer_stub): ciao_client_dnc { + after += EC_Benchmark_stub + sharedname = Producer_stub + + idlflags += -Wb,stub_export_macro=PRODUCER_STUB_Export -Wb,stub_export_include=Producer_stub_export.h -Wb,skel_export_macro=PRODUCER_SVNT_Export -Wb,skel_export_include=Producer_svnt_export.h + libpaths += .. + libs += EC_Benchmark_stub + dynamicflags = PRODUCER_STUB_BUILD_DLL + + IDL_Files { + Producer.idl + } + + Source_Files { + ProducerC.cpp + } +} + +project(Producer_svnt) : ciao_servant_dnc { + after += EC_Benchmark_svnt Producer_stub + sharedname = Producer_svnt + libs += Producer_stub EC_Benchmark_stub EC_Benchmark_svnt + libpaths += .. + idlflags += -Wb,skel_export_macro=PRODUCER_SVNT_Export -Wb,skel_export_include=Producer_svnt_export.h + dynamicflags = PRODUCER_SVNT_BUILD_DLL + + CIDL_Files { + Producer.cidl + } + + IDL_Files { + ProducerE.idl + } + + Source_Files { + ProducerEC.cpp + ProducerS.cpp + Producer_svnt.cpp + } +} + + +project(Producer_exec) : ciao_component_dnc { + after += Producer_svnt + sharedname = Producer_exec + libs += Producer_stub EC_Benchmark_stub Producer_svnt + libpaths += .. + idlflags += -Wb,export_macro=PRODUCER_EXEC_Export -Wb,export_include=Producer_exec_export.h + dynamicflags = PRODUCER_EXEC_BUILD_DLL + + IDL_Files { + } + + Source_Files { + Producer_exec.cpp + } +} + +project (Producer_controller) : ciao_client_dnc, valuetype { + exename = controller + after += Producer_stub + libs += Producer_stub EC_Benchmark_stub + libpaths += .. + + IDL_Files { + } + + Source_Files { + controller.cpp + } +} + diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/ProducerE.idl b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/ProducerE.idl new file mode 100644 index 00000000000..5d25793962a --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/ProducerE.idl @@ -0,0 +1,51 @@ +// $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.dre.vanderbilt.edu/CIAO + +#include "Producer.idl" +module EC_Benchmark +{ + local interface CCM_Producer : ::Components::EnterpriseComponent + { + }; + local interface CCM_Producer_Context : ::Components::SessionContext + { + void push_timeout (in ::EC_Benchmark::TimeOut e); + }; + local interface CCM_ProducerHomeImplicit + { + ::Components::EnterpriseComponent create () raises (::Components::CCMException); + }; + local interface CCM_ProducerHomeExplicit : ::Components::HomeExecutorBase + { + }; + local interface CCM_ProducerHome : CCM_ProducerHomeExplicit, CCM_ProducerHomeImplicit + { + }; +}; +module Producer_Impl +{ + typedef ::EC_Benchmark::CCM_Producer_Context Producer_Exec_Context; + local interface Producer_Exec : ::EC_Benchmark::CCM_Producer, ::Components::SessionComponent + { + }; + local interface ProducerHome_Exec : ::EC_Benchmark::CCM_ProducerHome + { + }; +}; diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.cpp b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.cpp new file mode 100644 index 00000000000..0a7d012fc7e --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.cpp @@ -0,0 +1,300 @@ +// $Id$ + +#include "EC_exec.h" +#include "CIAO_common.h" +#include "ace/Timer_Queue.h" +#include "ace/Reactor.h" + +//================================================================= + +MyImpl::timeout_Handler::timeout_Handler (MyImpl::EC_exec_i *cb) + : active_ (0), + done_ (0), + tid_ (0), + pulse_callback_ (cb) +{ + // Nothing + this->reactor (new ACE_Reactor); +} + +MyImpl::timeout_Handler::~timeout_Handler () +{ + delete this->reactor (); + this->reactor (0); +} + +int +MyImpl::timeout_Handler::open () +{ + return this->activate (); +} + +int +MyImpl::timeout_Handler::close () +{ + this->done_ = 1; + this->reactor ()->notify (); + + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "Waiting\n")); + return this->wait (); +} + +int +MyImpl::timeout_Handler::start (CORBA::Long hertz) +{ + if (hertz == 0 || this->active_ != 0) // Not valid + return -1; + + long usec = 1000000 / hertz; + + this->tid_ = this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (0, usec), + ACE_Time_Value (0, usec)); + + this->active_ = 1; + return 0; +} + +int +MyImpl::timeout_Handler::stop (void) +{ + if (this->active_ == 0) // Not valid. + return -1; + + this->reactor ()->cancel_timer (this); + + this->active_ = 0; + return 0; +} + +int +MyImpl::timeout_Handler::active (void) +{ + return this->active_; +} + +int +MyImpl::timeout_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("[%x] handle = %d, close_mask = %d\n"), + this, + handle, + close_mask)); + + return 0; +} + +int +MyImpl::timeout_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + this->pulse_callback_->pulse (); + +// ACE_DEBUG ((LM_DEBUG, +// ACE_TEXT ("[%x] with count #%05d timed out at %d.%d!\n"), +// this, +// tv.sec (), +// tv.usec ())); + + return 0; +} + +int +MyImpl::timeout_Handler::svc (void) +{ + this->reactor ()->owner (ACE_OS::thr_self ()); + + while (!this->done_) + this->reactor ()->handle_events (); + + return 0; +} + +//================================================================= + +MyImpl::EC_exec_i::EC_exec_i () + : hertz_ (0), + pulser_ (this) +{ + +} + +MyImpl::EC_exec_i::EC_exec_i (CORBA::Long hz) + : hertz_ (hz), + pulser_ (this) +{ +} + +MyImpl::EC_exec_i::~EC_exec_i () +{ +} + +CORBA::Long +MyImpl::EC_exec_i::hertz (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->hertz_; +} + +void +MyImpl::EC_exec_i::hertz (CORBA::Long hertz + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->hertz_ = hertz; +} + +// Operations from supported interface(s) + +void +MyImpl::EC_exec_i::start (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (this->hertz_ == 0 || this->pulser_.active()) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + // @@ Start the rate generator + this->pulser_.start (this->hertz_); +} + +void +MyImpl::EC_exec_i::stop (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (! this->pulser_.active ()) + ACE_THROW (CORBA::BAD_INV_ORDER ()); + + // @@ stop the rate generator + this->pulser_.stop (); +} + +CORBA::Boolean +MyImpl::EC_exec_i::active (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->pulser_.active (); +} + +// Operations from Components::SessionComponent + +void +MyImpl::EC_exec_i::set_session_context (Components::SessionContext_ptr ctx + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::set_session_context\n")); + + this->context_ = + BasicSP::CCM_EC_Context::_narrow (ctx + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (this->context_.in ())) + ACE_THROW (CORBA::INTERNAL ()); + // Urm, we actually discard exceptions thown from this operation. + +} + +void +MyImpl::EC_exec_i::ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::EC_exec_i::ccm_activate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_activate\n")); + + this->pulser_.open (); +} + +void +MyImpl::EC_exec_i::ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ +} + +void +MyImpl::EC_exec_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_passivate\n")); + this->pulser_.close (); +} + +void +MyImpl::EC_exec_i::ccm_remove (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, "MyImpl::EC_exec_i::ccm_remove\n")); +} + +void +MyImpl::EC_exec_i::pulse (void) +{ + ACE_TRY_NEW_ENV + { + if (CIAO::debug_level () > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Pushing BasicSP::TimeOut event!\n"))); + + BasicSP::TimeOut_var ev = new OBV_BasicSP::TimeOut (); + + this->context_->push_timeout (ev.in () + ACE_ENV_ARG_PARAMETER); + } + ACE_CATCHANY + { + // @@ do nothing? + } + ACE_ENDTRY; + +} + +MyImpl::ECHome_exec_i::ECHome_exec_i () +{ +} + +MyImpl::ECHome_exec_i::~ECHome_exec_i () +{ +} + +::Components::EnterpriseComponent_ptr +MyImpl::ECHome_exec_i::new_EC (CORBA::Long hertz + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return new MyImpl::EC_exec_i (hertz); +} + +::Components::EnterpriseComponent_ptr +MyImpl::ECHome_exec_i::create (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)) +{ + return new MyImpl::EC_exec_i (); +} + + +extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr +createECHome_Impl (void) +{ + return new MyImpl::ECHome_exec_i (); +} diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.h new file mode 100644 index 00000000000..c0181bdf37c --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec.h @@ -0,0 +1,190 @@ +// $Id$ + +//============================================================ +/** + * @file EC_exec.h + * + * Header file for the actualy EC and ECHome component + * implementation. + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================ + +#ifndef EC_EXEC_H +#define EC_EXEC_H + +#include "ECEIC.h" +#include "tao/LocalObject.h" +#include "ace/Thread_Manager.h" +#include "ace/Task.h" + +namespace MyImpl +{ + // Forward decl. + class EC_exec_i; + + /** + * @brief Active pulse generater + */ + class timeout_Handler : public ACE_Task_Base + { + public: + // Default constructor + timeout_Handler (EC_exec_i *cb); + ~timeout_Handler (); + + int open (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 ciao_preactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_activate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ciao_postactivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + + virtual void ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + virtual void ccm_remove (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + + /// Helper function to be called back by timeout_Handler + void pulse (void); + + protected: + /// Frequency + CORBA::Long hertz_; + + /// Copmponent specific context + BasicSP::CCM_EC_Context_var context_; + + /// An active object that actually trigger the generation of + /// periodic events. + timeout_Handler pulser_; + }; + + /** + * @class ECHome_exec_i + * + * EC home executor implementation class. + */ + class EC_EXEC_Export ECHome_exec_i : + public virtual BasicSP::CCM_ECHome, + public virtual TAO_Local_RefCounted_Object + { + public: + /// Default ctor. + ECHome_exec_i (); + + /// Default dtor. + ~ECHome_exec_i (); + + // Explicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + new_EC (CORBA::Long hertz + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Implicit home operations. + + virtual ::Components::EnterpriseComponent_ptr + create (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::CCMException)); + }; + +} + +extern "C" EC_EXEC_Export ::Components::HomeExecutorBase_ptr +createECHome_Impl (void); + +#endif /* CIAO_ECGEN_EXEC_H */ diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec_export.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec_export.h new file mode 100644 index 00000000000..9ca33d4c4e0 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_exec_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl PRODUCER_EXEC +// ------------------------------ +#ifndef PRODUCER_EXEC_EXPORT_H +#define PRODUCER_EXEC_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (PRODUCER_EXEC_HAS_DLL) +# define PRODUCER_EXEC_HAS_DLL 1 +#endif /* ! PRODUCER_EXEC_HAS_DLL */ + +#if defined (PRODUCER_EXEC_HAS_DLL) && (PRODUCER_EXEC_HAS_DLL == 1) +# if defined (PRODUCER_EXEC_BUILD_DLL) +# define PRODUCER_EXEC_Export ACE_Proper_Export_Flag +# define PRODUCER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define PRODUCER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* PRODUCER_EXEC_BUILD_DLL */ +# define PRODUCER_EXEC_Export ACE_Proper_Import_Flag +# define PRODUCER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define PRODUCER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* PRODUCER_EXEC_BUILD_DLL */ +#else /* PRODUCER_EXEC_HAS_DLL == 1 */ +# define PRODUCER_EXEC_Export +# define PRODUCER_EXEC_SINGLETON_DECLARATION(T) +# define PRODUCER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* PRODUCER_EXEC_HAS_DLL == 1 */ + +// Set PRODUCER_EXEC_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (PRODUCER_EXEC_NTRACE) +# if (ACE_NTRACE == 1) +# define PRODUCER_EXEC_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define PRODUCER_EXEC_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !PRODUCER_EXEC_NTRACE */ + +#if (PRODUCER_EXEC_NTRACE == 1) +# define PRODUCER_EXEC_TRACE(X) +#else /* (PRODUCER_EXEC_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define PRODUCER_EXEC_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (PRODUCER_EXEC_NTRACE == 1) */ + +#endif /* PRODUCER_EXEC_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_stub_export.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_stub_export.h new file mode 100644 index 00000000000..afa988f77d3 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_stub_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl PRODUCER_STUB +// ------------------------------ +#ifndef PRODUCER_STUB_EXPORT_H +#define PRODUCER_STUB_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (PRODUCER_STUB_HAS_DLL) +# define PRODUCER_STUB_HAS_DLL 1 +#endif /* ! PRODUCER_STUB_HAS_DLL */ + +#if defined (PRODUCER_STUB_HAS_DLL) && (PRODUCER_STUB_HAS_DLL == 1) +# if defined (PRODUCER_STUB_BUILD_DLL) +# define PRODUCER_STUB_Export ACE_Proper_Export_Flag +# define PRODUCER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define PRODUCER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* PRODUCER_STUB_BUILD_DLL */ +# define PRODUCER_STUB_Export ACE_Proper_Import_Flag +# define PRODUCER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define PRODUCER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* PRODUCER_STUB_BUILD_DLL */ +#else /* PRODUCER_STUB_HAS_DLL == 1 */ +# define PRODUCER_STUB_Export +# define PRODUCER_STUB_SINGLETON_DECLARATION(T) +# define PRODUCER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* PRODUCER_STUB_HAS_DLL == 1 */ + +// Set PRODUCER_STUB_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (PRODUCER_STUB_NTRACE) +# if (ACE_NTRACE == 1) +# define PRODUCER_STUB_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define PRODUCER_STUB_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !PRODUCER_STUB_NTRACE */ + +#if (PRODUCER_STUB_NTRACE == 1) +# define PRODUCER_STUB_TRACE(X) +#else /* (PRODUCER_STUB_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define PRODUCER_STUB_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (PRODUCER_STUB_NTRACE == 1) */ + +#endif /* PRODUCER_STUB_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt.cpp b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt.cpp new file mode 100644 index 00000000000..ae2ef12c70a --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt.cpp @@ -0,0 +1,922 @@ +// $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.dre.vanderbilt.edu/CIAO + +#include "Producer_svnt.h" +#include "Cookies.h" +#include "ciao/Servant_Activator.h" +#include "ciao/Port_Activator_T.h" + +namespace Producer_Impl +{ + namespace CIAO_GLUE_EC_Benchmark + { + Producer_Context::Producer_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Producer_Servant *sv) + : home_ (::Components::CCMHome::_duplicate (home)), + container_ (c), + servant_ (sv) + { + } + + Producer_Context::~Producer_Context (void) + { + } + + // Operations from ::Components::CCMContext. + + ::Components::Principal_ptr + Producer_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 + Producer_Context::get_CCM_home ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Components::CCMHome::_duplicate (this->home_.in ()); + } + + CORBA::Boolean + Producer_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 + Producer_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 + Producer_Context::is_caller_in_role ( + const char * /* role */ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void + Producer_Context::set_rollback_only ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::IllegalState)) + { + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Operations from ::Components::SessionContextinterface. + + CORBA::Object_ptr + Producer_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_ = + ::EC_Benchmark::Producer::_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 ::EC_Benchmark::Producer::_duplicate ( + this->component_.in ()); + } + + // Operations for Producer receptacles and event sources, + // defined in ::EC_Benchmark::CCM_Producer_Context. + + void + Producer_Context::push_timeout ( + ::EC_Benchmark::TimeOut *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_CString my_uuid = this->servant_->component_UUID (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + my_uuid += "_data_available_publisher"; + + this->container_->push_event (ev, + my_uuid.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + /* + ACE_Active_Map_Manager< + ::EC_Benchmark::TimeOutConsumer_var>::iterator end = + this->ciao_publishes_timeout_map_.end (); + + for (ACE_Active_Map_Manager< + ::EC_Benchmark::TimeOutConsumer_var>::iterator iter = + this->ciao_publishes_timeout_map_.begin (); + iter != end; + ++iter) + { + ACE_Active_Map_Manager< + ::EC_Benchmark::TimeOutConsumer_var>::ENTRY &entry = *iter; + + ::EC_Benchmark::TimeOutConsumer_var c = + ::EC_Benchmark::TimeOutConsumer::_narrow ( + entry.int_id_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + entry.int_id_->push_TimeOut ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + */ + } + + ::Components::Cookie * + Producer_Context::subscribe_timeout ( + ::EC_Benchmark::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + if (CORBA::is_nil (c)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + } + + ::EC_Benchmark::TimeOutConsumer_var sub = + ::EC_Benchmark::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 (); + } + + ::EC_Benchmark::TimeOutConsumer_ptr + Producer_Context::unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)) + { + ::EC_Benchmark::TimeOutConsumer_var retv; + ACE_Active_Map_Manager_Key key; + + if (ck == 0 || ::CIAO::Map_Key_Cookie::extract (ck, key) == false) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::EC_Benchmark::TimeOutConsumer::_nil ()); + } + + if (this->ciao_publishes_timeout_map_.unbind (key, retv) != 0) + { + ACE_THROW_RETURN ( + ::Components::InvalidConnection (), + ::EC_Benchmark::TimeOutConsumer::_nil ()); + } + + return retv._retn (); + } + + // CIAO-specific. + + ::CIAO::Session_Container * + Producer_Context::_ciao_the_Container (void) const + { + return this->container_; + } + + Producer_Context * + Producer_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<Producer_Context *> (p); + } + } + + namespace CIAO_GLUE_EC_Benchmark + { + Producer_Servant::Producer_Servant ( + ::EC_Benchmark::CCM_Producer_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Session_Container *c) + : our_base (exe, c) + { + this->context_ = new Producer_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_TRY_CHECK; + } + + this->populate_port_tables ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + ACE_CATCHANY + { + } + + ACE_ENDTRY; + } + + Producer_Servant::~Producer_Servant (void) + { + } + + void + Producer_Servant::set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL_NOT_USED) + { + for (CORBA::ULong i = 0; + i < descr.length (); + ++i) + { + const char *descr_name = descr[i]->name (); + ::CORBA::Any &descr_value = descr[i]->value (); + + ACE_UNUSED_ARG (descr_name); + ACE_UNUSED_ARG (descr_value); + } + } + + // Operations for Navigation interface. + + CORBA::Object_ptr + Producer_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 * + Producer_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); + } + + ::Components::EmitterDescriptions * + Producer_Servant::get_all_emitters ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::EmitterDescriptions * + Producer_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::Cookie * + Producer_Servant::subscribe_timeout ( + ::EC_Benchmark::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)) + { + return this->context_->subscribe_timeout ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::EC_Benchmark::TimeOutConsumer_ptr + Producer_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); + } + + ::Components::Cookie * + Producer_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 the component has no receptacles, this will be unused. + ACE_UNUSED_ARG (connection); + + if (name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + Producer_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 ()); + + ACE_UNUSED_ARG (ck); + } + + ::Components::ConnectionDescriptions * + Producer_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 * + Producer_Servant::get_all_receptacles ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::ReceptacleDescriptions * + Producer_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); + } + + ::Components::EventConsumerBase_ptr + Producer_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 ()); + } + + void + Producer_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)) + { + if (emitter_name == 0) + { + ACE_THROW (::CORBA::BAD_PARAM ()); + } + + ACE_UNUSED_ARG (consumer); + ACE_THROW (::Components::InvalidName ()); + } + + ::Components::EventConsumerBase_ptr + Producer_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 * + Producer_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::Cookie * + Producer_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)) + { + // Just in case there are no if blocks + ACE_UNUSED_ARG (subscribe); + + if (publisher_name == 0) + { + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + if (ACE_OS::strcmp (publisher_name, "timeout") == 0) + { + ::EC_Benchmark::TimeOutConsumer_var _ciao_consumer = + ::EC_Benchmark::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 + Producer_Servant::unsubscribe ( + const char *publisher_name, + ::Components::Cookie *ck + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName, + ::Components::InvalidConnection)) + { + // Just in case there are no if blocks + ACE_UNUSED_ARG (ck); + + 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 ()); + } + + ::Components::PublisherDescriptions * + Producer_Servant::get_all_publishers ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (::CORBA::NO_IMPLEMENT (), 0); + } + + ::Components::PublisherDescriptions * + Producer_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. + + void + Producer_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + Producer_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + + CORBA::IRObject_ptr + Producer_Servant::get_component_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + Producer_Servant::configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)) + { + // CIAO to-do + } + + void + Producer_Servant::remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + // CIAO to-do + } + + CORBA::Object_ptr + Producer_Servant::get_facet_executor (const char *name + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException)) + { + if (name == 0) + { + ACE_THROW_RETURN ( + ::CORBA::BAD_PARAM (), + ::CORBA::Object::_nil ()); + } + + return CORBA::Object::_nil (); + } + + // Supported operations. + + // Component attribute operations. + + // Private method to populate the port tables. + void + Producer_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + } + } + + namespace CIAO_GLUE_EC_Benchmark + { + ProducerHome_Servant::ProducerHome_Servant ( + ::EC_Benchmark::CCM_ProducerHome_ptr exe, + ::CIAO::Session_Container *c) + : executor_ (::EC_Benchmark::CCM_ProducerHome::_duplicate (exe)), + container_ (c) + { + } + + ProducerHome_Servant::~ProducerHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + // Home attribute operations. + + // Operations for keyless home interface. + + ::Components::CCMObject_ptr + ProducerHome_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. + + ::EC_Benchmark::Producer_ptr + ProducerHome_Servant::create ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::CreateFailure)) + { + if (this->executor_.in () == 0) + { + ACE_THROW_RETURN ( + ::CORBA::INTERNAL (), + ::EC_Benchmark::Producer::_nil ()); + } + + ::Components::EnterpriseComponent_var _ciao_ec = + this->executor_->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::Producer::_nil ()); + + ::EC_Benchmark::CCM_Producer_var _ciao_comp = + ::EC_Benchmark::CCM_Producer::_narrow ( + _ciao_ec.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::Producer::_nil ()); + + return this->_ciao_activate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // Operations for CCMHome interface. + + ::CORBA::IRObject_ptr + ProducerHome_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 + ProducerHome_Servant::get_home_def ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN ( + ::CORBA::NO_IMPLEMENT (), + ::CORBA::IRObject::_nil ()); + } + + void + ProducerHome_Servant::remove_component ( + ::Components::CCMObject_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)) + { + ::EC_Benchmark::Producer_var _ciao_comp = + ::EC_Benchmark::Producer::_narrow ( + comp + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (_ciao_comp.in ())) + { + ACE_THROW (CORBA::INTERNAL ()); + } + + _ciao_comp->remove (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->_ciao_passivate_component ( + _ciao_comp.in () + ACE_ENV_ARG_PARAMETER); + } + + // CIAO-specific operations. + + ::EC_Benchmark::Producer_ptr + ProducerHome_Servant::_ciao_activate_component ( + ::EC_Benchmark::CCM_Producer_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 (::EC_Benchmark::Producer::_nil ()); + + ::Components::CCMHome_var home = + ::Components::CCMHome::_narrow ( + hobj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::Producer::_nil ()); + + Producer_Servant *svt = + new Producer_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 (::EC_Benchmark::Producer::_nil ()); + + ::EC_Benchmark::Producer_var ho = + ::EC_Benchmark::Producer::_narrow ( + objref.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::EC_Benchmark::Producer::_nil ()); + + if (this->component_map_.bind (oid.in (), svt) == 0) + { + safe._retn (); + } + + return ho._retn (); + } + + void + ProducerHome_Servant::_ciao_passivate_component ( + ::EC_Benchmark::Producer_ptr comp + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + PortableServer::ObjectId_var oid; + + this->container_->uninstall_component ( + comp, + oid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Producer_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; + } + } + } + + extern "C" PRODUCER_SVNT_Export ::PortableServer::Servant + createProducerHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::EC_Benchmark::CCM_ProducerHome_var x = + ::EC_Benchmark::CCM_ProducerHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_EC_Benchmark::ProducerHome_Servant ( + x.in (), + c); + } +} + diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt.h new file mode 100644 index 00000000000..4b8d8615262 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt.h @@ -0,0 +1,512 @@ +// $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.dre.vanderbilt.edu/CIAO + +#ifndef CIAO_GLUE_SESSION_PRODUCER_SVNT_H +#define CIAO_GLUE_SESSION_PRODUCER_SVNT_H + +#include /**/ "ace/pre.h" + +#include "ProducerEC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ciao/Container_Base.h" +#include "ciao/Servant_Impl_T.h" +#include "tao/LocalObject.h" +#include "tao/PortableServer/Key_Adapters.h" +#include "ace/Active_Map_Manager_T.h" + +#include "ProducerS.h" + +namespace Producer_Impl +{ + namespace CIAO_GLUE_EC_Benchmark + { + class PRODUCER_SVNT_Export Producer_Context + : public virtual ::EC_Benchmark::CCM_Producer_Context, + public virtual TAO_Local_RefCounted_Object + { + public: + // We will allow the servant glue code we generate to access our state. + friend class Producer_Servant; + + Producer_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Producer_Servant *sv); + + virtual ~Producer_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_NOT_USED) + 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 Producer receptacles and event sources, + // defined in ::EC_Benchmark::CCM_Producer_Context. + + virtual void + push_timeout ( + ::EC_Benchmark::TimeOut *ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // CIAO-specific. + + ::CIAO::Session_Container * + _ciao_the_Container (void) const; + + static Producer_Context * + _narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + + protected: + // Methods that manage this component's connections and consumers. + + virtual ::Components::Cookie * + subscribe_timeout ( + ::EC_Benchmark::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::EC_Benchmark::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< + ::EC_Benchmark::TimeOutConsumer_var> + ciao_publishes_timeout_map_; + + ::Components::CCMHome_var home_; + ::CIAO::Session_Container *container_; + + Producer_Servant *servant_; + ::EC_Benchmark::Producer_var component_; + }; + } + + namespace CIAO_GLUE_EC_Benchmark + { + class PRODUCER_SVNT_Export Producer_Servant + : public virtual CIAO::Servant_Impl< + POA_EC_Benchmark::Producer, + ::EC_Benchmark::CCM_Producer, + ::EC_Benchmark::CCM_Producer_var, + Producer_Context + >, + public virtual PortableServer::RefCountServantBase + { + public: + /// Hack for VC6 the most sucky compiler + typedef CIAO::Servant_Impl< + POA_EC_Benchmark::Producer, + ::EC_Benchmark::CCM_Producer, + ::EC_Benchmark::CCM_Producer_var, + Producer_Context + > our_base; + + Producer_Servant ( + ::EC_Benchmark::CCM_Producer_ptr executor, + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c); + + virtual ~Producer_Servant (void); + + virtual void + set_attributes ( + const ::Components::ConfigValues &descr + ACE_ENV_ARG_DECL); + + // Supported operations. + + // Public port operations. + + virtual ::Components::Cookie * + subscribe_timeout ( + ::EC_Benchmark::TimeOutConsumer_ptr c + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::ExceededConnectionLimit)); + + virtual ::EC_Benchmark::TimeOutConsumer_ptr + unsubscribe_timeout ( + ::Components::Cookie *ck + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConnection)); + + // Component attribute operations. + + // 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_named_facets ( + const ::Components::NameList & /* names */ + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidName)); + + // 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_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 void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::IRObject_ptr + get_component_def ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + configuration_complete ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::InvalidConfiguration)); + + virtual void + remove ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::RemoveFailure)); + + // CIAO specific operations on the servant + CORBA::Object_ptr + get_facet_executor (const char *name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException)); + + private: + + private: + + void + populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + }; + } + + namespace CIAO_GLUE_EC_Benchmark + { + class PRODUCER_SVNT_Export ProducerHome_Servant + : public virtual POA_EC_Benchmark::ProducerHome, + public virtual PortableServer::RefCountServantBase + { + public: + ProducerHome_Servant ( + ::EC_Benchmark::CCM_ProducerHome_ptr exe, + ::CIAO::Session_Container *c); + virtual ~ProducerHome_Servant (void); + + // Home operations. + + // Home factory and finder operations. + + // Attribute 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 ::EC_Benchmark::Producer_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. + + ::EC_Benchmark::Producer_ptr + _ciao_activate_component ( + ::EC_Benchmark::CCM_Producer_ptr exe + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void + _ciao_passivate_component ( + ::EC_Benchmark::Producer_ptr comp + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + protected: + ::EC_Benchmark::CCM_ProducerHome_var + executor_; + + ::CIAO::Session_Container * + container_; + + ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + Producer_Servant *, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + ACE_SYNCH_MUTEX> + component_map_; + }; + + extern "C" PRODUCER_SVNT_Export ::PortableServer::Servant + createProducerHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL_WITH_DEFAULTS); + } +} + +#include /**/ "ace/post.h" + +#endif /* CIAO_GLUE_SESSION_PRODUCER_SVNT_H */ + diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt_export.h b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt_export.h new file mode 100644 index 00000000000..90a2bc88240 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/Producer_svnt_export.h @@ -0,0 +1,54 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl PRODUCER_SVNT +// ------------------------------ +#ifndef PRODUCER_SVNT_EXPORT_H +#define PRODUCER_SVNT_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (PRODUCER_SVNT_HAS_DLL) +# define PRODUCER_SVNT_HAS_DLL 1 +#endif /* ! PRODUCER_SVNT_HAS_DLL */ + +#if defined (PRODUCER_SVNT_HAS_DLL) && (PRODUCER_SVNT_HAS_DLL == 1) +# if defined (PRODUCER_SVNT_BUILD_DLL) +# define PRODUCER_SVNT_Export ACE_Proper_Export_Flag +# define PRODUCER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define PRODUCER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* PRODUCER_SVNT_BUILD_DLL */ +# define PRODUCER_SVNT_Export ACE_Proper_Import_Flag +# define PRODUCER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define PRODUCER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* PRODUCER_SVNT_BUILD_DLL */ +#else /* PRODUCER_SVNT_HAS_DLL == 1 */ +# define PRODUCER_SVNT_Export +# define PRODUCER_SVNT_SINGLETON_DECLARATION(T) +# define PRODUCER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* PRODUCER_SVNT_HAS_DLL == 1 */ + +// Set PRODUCER_SVNT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (PRODUCER_SVNT_NTRACE) +# if (ACE_NTRACE == 1) +# define PRODUCER_SVNT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define PRODUCER_SVNT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !PRODUCER_SVNT_NTRACE */ + +#if (PRODUCER_SVNT_NTRACE == 1) +# define PRODUCER_SVNT_TRACE(X) +#else /* (PRODUCER_SVNT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define PRODUCER_SVNT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (PRODUCER_SVNT_NTRACE == 1) */ + +#endif /* PRODUCER_SVNT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/controller.cpp b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/controller.cpp new file mode 100644 index 00000000000..d52ac54dba9 --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/EC_Benchmark/Producer/controller.cpp @@ -0,0 +1,143 @@ +// $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" +#include "ace/streams.h" + +const 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); + break; + } + } + + 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); + ACE_TRY_CHECK; + + 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"); + ACE_ERROR_RETURN ((LM_ERROR, + "Uncaught CORBA exception\n"), + 1); + } + ACE_ENDTRY; + + return 0; +} |