summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp')
-rw-r--r--TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp601
1 files changed, 601 insertions, 0 deletions
diff --git a/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp b/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp
new file mode 100644
index 00000000000..a7929e736b4
--- /dev/null
+++ b/TAO/CIAO/DAnCE/examples/BasicSP/BMDisplay/BMDisplay_svnt.cpp
@@ -0,0 +1,601 @@
+// $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 "BMDisplay_svnt.h"
+#include "Cookies.h"
+#include "ciao/Servant_Activator.h"
+#include "ciao/Port_Activator_T.h"
+
+namespace BMDisplay_Impl
+{
+ namespace CIAO_GLUE_BasicSP
+ {
+ BMDisplay_Context::BMDisplay_Context (
+ ::Components::CCMHome_ptr home,
+ ::CIAO::Session_Container *c,
+ BMDisplay_Servant *sv)
+ : Context_Impl_Base (home, c),
+ ctx_svnt_base (home, c, sv)
+ {
+ }
+
+ BMDisplay_Context::~BMDisplay_Context (void)
+ {
+ }
+
+ // Operations for BMDisplay receptacles and event sources,
+ // defined in ::BasicSP::CCM_BMDisplay_Context.
+
+ ::BasicSP::ReadData_ptr
+ BMDisplay_Context::get_connection_comp_data (
+ ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return ::BasicSP::ReadData::_duplicate (
+ this->ciao_uses_comp_data_.in ());
+ }
+
+ void
+ BMDisplay_Context::connect_comp_data (
+ ::BasicSP::ReadData_ptr c
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::AlreadyConnected,
+ ::Components::InvalidConnection))
+ {
+ if (!CORBA::is_nil (this->ciao_uses_comp_data_.in ()))
+ {
+ ACE_THROW (::Components::AlreadyConnected ());
+ }
+
+ if (CORBA::is_nil (c))
+ {
+ ACE_THROW (::Components::InvalidConnection ());
+ }
+
+ this->ciao_uses_comp_data_ =
+ ::BasicSP::ReadData::_duplicate (c);
+ }
+
+ ::BasicSP::ReadData_ptr
+ BMDisplay_Context::disconnect_comp_data (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::NoConnection))
+ {
+ if (CORBA::is_nil (this->ciao_uses_comp_data_.in ()))
+ {
+ ACE_THROW_RETURN (
+ ::Components::NoConnection (),
+ ::BasicSP::ReadData::_nil ());
+ }
+
+ return this->ciao_uses_comp_data_._retn ();
+ }
+
+ // CIAO-specific.
+
+ BMDisplay_Context *
+ BMDisplay_Context::_narrow (
+ ::Components::SessionContext_ptr p
+ ACE_ENV_ARG_DECL_NOT_USED)
+ {
+ return dynamic_cast<BMDisplay_Context *> (p);
+ }
+ }
+
+ namespace CIAO_GLUE_BasicSP
+ {
+ void
+ BMDisplay_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
+ BMDisplay_Servant::component_UUID (
+ ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return CORBA::string_dup (this->component_UUID_.c_str ());
+ }
+
+
+ BMDisplay_Servant::BMDisplay_Servant (
+ ::BasicSP::CCM_BMDisplay_ptr exe,
+ ::Components::CCMHome_ptr h,
+ ::CIAO::Session_Container *c)
+ : Servant_Impl_Base (c),
+ comp_svnt_base (exe, c)
+ {
+ this->context_ = new BMDisplay_Context (h, c, this);
+
+ CIAO_REGISTER_OBV_FACTORY (
+ ::BasicSP::DataAvailable_init,
+ ::BasicSP::DataAvailable);
+
+ 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;
+ }
+
+ BMDisplay_Servant::~BMDisplay_Servant (void)
+ {
+ }
+
+ void
+ BMDisplay_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);
+ }
+ }
+
+ BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::DataAvailableConsumer_data_ready_Servant (
+ ::BasicSP::CCM_BMDisplay_ptr executor,
+ ::BasicSP::CCM_BMDisplay_Context_ptr c)
+ : executor_ (::BasicSP::CCM_BMDisplay::_duplicate (executor)),
+ ctx_ (::BasicSP::CCM_BMDisplay_Context::_duplicate (c))
+ {
+ }
+
+ BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::~DataAvailableConsumer_data_ready_Servant (void)
+ {
+ }
+
+ CORBA::Object_ptr
+ BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::_get_component (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return this->ctx_->get_CCM_object (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+
+ void
+ BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::push_DataAvailable (
+ ::BasicSP::DataAvailable *evt
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ this->executor_->push_data_ready (
+ evt
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ // Inherited from ::Components::EventConsumerBase.
+ void
+ BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant::push_event (
+ ::Components::EventBase *ev
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::BadEventType))
+ {
+ ::BasicSP::DataAvailable_var ev_type =
+ ::BasicSP::DataAvailable::_downcast (ev);
+
+ if (ev_type != 0)
+ {
+ this->push_DataAvailable (
+ ev_type.in ()
+ ACE_ENV_ARG_PARAMETER);
+
+ return;
+ }
+
+ ACE_THROW (::Components::BadEventType ());
+ }
+
+ ::BasicSP::DataAvailableConsumer_ptr
+ BMDisplay_Servant::get_consumer_data_ready (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ if (! ::CORBA::is_nil (this->consumes_data_ready_.in ()))
+ {
+ return ::BasicSP::DataAvailableConsumer::_duplicate (this->consumes_data_ready_.in ());
+ }
+
+ ::Components::EventConsumerBase_var obj =
+ this->get_consumer_data_ready_i (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ());
+
+ ::BasicSP::DataAvailableConsumer_var eco =
+ ::BasicSP::DataAvailableConsumer::_narrow (
+ obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ());
+
+ this->consumes_data_ready_ = eco;
+ return ::BasicSP::DataAvailableConsumer::_duplicate (this->consumes_data_ready_.in ());
+ }
+
+ ::Components::EventConsumerBase_ptr
+ BMDisplay_Servant::get_consumer_data_ready_i (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ::Components::EventConsumerBase_ptr ret =
+ this->lookup_consumer ("data_ready");
+
+ if (! ::CORBA::is_nil (ret))
+ {
+ return ret;
+ }
+
+ CIAO::Port_Activator_T<
+ BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant,
+ ::BasicSP::CCM_BMDisplay,
+ ::BasicSP::CCM_BMDisplay_Context,
+ BMDisplay_Servant > *tmp = 0;
+
+ typedef CIAO::Port_Activator_T<
+ BMDisplay_Servant::DataAvailableConsumer_data_ready_Servant,
+ ::BasicSP::CCM_BMDisplay,
+ ::BasicSP::CCM_BMDisplay_Context,
+ BMDisplay_Servant >
+ MACRO_MADNESS_TYPEDEF;
+
+
+ ACE_NEW_THROW_EX (
+ tmp,
+ MACRO_MADNESS_TYPEDEF (
+ "BasicSP_BMDisplay_data_ready",
+ "data_ready",
+ 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 (
+ "BasicSP_BMDisplay_data_ready",
+ "IDL:BasicSP/DataAvailableConsumer:1.0",
+ CIAO::Container::Facet_Consumer
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ());
+
+ ::Components::EventConsumerBase_var ecb =
+ ::Components::EventConsumerBase::_narrow (
+ obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (::BasicSP::DataAvailableConsumer::_nil ());
+
+ this->add_consumer (
+ "data_ready",
+ ecb.in ());
+
+ return ecb._retn ();
+ }
+
+ ::Components::Cookie *
+ BMDisplay_Servant::connect (
+ const char *name,
+ ::CORBA::Object_ptr connection
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::InvalidName,
+ ::Components::InvalidConnection,
+ ::Components::AlreadyConnected,
+ ::Components::ExceededConnectionLimit))
+ {
+ // If the component has no receptacles, this will be unused.
+ ACE_UNUSED_ARG (connection);
+
+ if (name == 0)
+ {
+ ACE_THROW_RETURN (::Components::InvalidName (), 0);
+ }
+
+ if (ACE_OS::strcmp (name, "comp_data") == 0)
+ {
+ ::BasicSP::ReadData_var _ciao_conn =
+ ::BasicSP::ReadData::_narrow (
+ connection
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (::CORBA::is_nil (_ciao_conn.in ()))
+ {
+ ACE_THROW_RETURN (::Components::InvalidConnection (), 0);
+ }
+
+ // Simplex connect.
+ this->connect_comp_data (
+ _ciao_conn.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ return 0;
+ }
+
+ ACE_THROW_RETURN (::Components::InvalidName (), 0);
+ }
+
+ CORBA::Object_ptr
+ BMDisplay_Servant::disconnect (
+ const char *name,
+ ::Components::Cookie * ck
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::InvalidName,
+ ::Components::InvalidConnection,
+ ::Components::CookieRequired,
+ ::Components::NoConnection))
+ {
+ if (name == 0)
+ {
+ ACE_THROW_RETURN (
+ ::Components::InvalidName (),
+ ::CORBA::Object::_nil ());
+ }
+
+ if (ACE_OS::strcmp (name, "comp_data") == 0)
+ {
+ // Simplex disconnect.
+ return this->disconnect_comp_data (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+
+ ACE_THROW_RETURN (
+ ::Components::InvalidName (),
+ ::CORBA::Object::_nil ());
+
+ ACE_UNUSED_ARG (ck);
+ }
+
+ void
+ BMDisplay_Servant::connect_comp_data (
+ ::BasicSP::ReadData_ptr c
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::AlreadyConnected,
+ ::Components::InvalidConnection))
+ {
+ this->context_->connect_comp_data (
+ c
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ ::BasicSP::ReadData_ptr
+ BMDisplay_Servant::disconnect_comp_data (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::NoConnection))
+ {
+ return this->context_->disconnect_comp_data (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+
+ ::BasicSP::ReadData_ptr
+ BMDisplay_Servant::get_connection_comp_data (
+ ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return this->context_->get_connection_comp_data (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+
+ void
+ BMDisplay_Servant::connect_consumer (
+ const char * emitter_name,
+ ::Components::EventConsumerBase_ptr consumer
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::InvalidName,
+ ::Components::AlreadyConnected,
+ ::Components::InvalidConnection))
+ {
+ if (emitter_name == 0)
+ {
+ ACE_THROW (::CORBA::BAD_PARAM ());
+ }
+
+ ACE_UNUSED_ARG (consumer);
+ ACE_THROW (::Components::InvalidName ());
+ }
+
+ ::Components::Cookie *
+ BMDisplay_Servant::subscribe (
+ const char *publisher_name,
+ ::Components::EventConsumerBase_ptr subscribe
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException,
+ ::Components::InvalidName,
+ ::Components::InvalidConnection,
+ ::Components::ExceededConnectionLimit))
+ {
+ // 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
+ BMDisplay_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 ());
+ }
+
+ CORBA::Object_ptr
+ BMDisplay_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
+ BMDisplay_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_data_ready_i (
+ ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+ }
+
+ namespace CIAO_GLUE_BasicSP
+ {
+ BMDisplayHome_Servant::BMDisplayHome_Servant (
+ ::BasicSP::CCM_BMDisplayHome_ptr exe,
+ ::CIAO::Session_Container *c)
+ : CIAO::Home_Servant_Impl_Base (c),
+ home_svnt_base (exe, c)
+ {
+ }
+
+ BMDisplayHome_Servant::~BMDisplayHome_Servant (void)
+ {
+ }
+
+ // Home operations.
+
+ // Home supported interface operations.
+
+ // Home factory and finder operations.
+
+ // Home attribute operations.
+ }
+
+ extern "C" BMDISPLAY_SVNT_Export ::PortableServer::Servant
+ createBMDisplayHome_Servant (
+ ::Components::HomeExecutorBase_ptr p,
+ CIAO::Session_Container *c
+ ACE_ENV_ARG_DECL)
+ {
+ if (p == 0)
+ {
+ return 0;
+ }
+
+ ::BasicSP::CCM_BMDisplayHome_var x =
+ ::BasicSP::CCM_BMDisplayHome::_narrow (
+ p
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (::CORBA::is_nil (x.in ()))
+ {
+ return 0;
+ }
+
+ return new
+ CIAO_GLUE_BasicSP::BMDisplayHome_Servant (
+ x.in (),
+ c);
+ }
+}
+