diff options
Diffstat (limited to 'TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl')
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl | 585 |
1 files changed, 585 insertions, 0 deletions
diff --git a/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl b/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl new file mode 100644 index 00000000000..6a24be74c1c --- /dev/null +++ b/TAO/CIAO/DAnCE/examples/Hello/Receiver/Receiver_svnt.cpp.new_impl @@ -0,0 +1,585 @@ +// $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 "Receiver_svnt.h" +#include "Cookies.h" +#include "ciao/Servant_Activator.h" +#include "ciao/Port_Activator_T.h" + +namespace Receiver_Impl +{ + namespace CIAO_GLUE_Hello + { + Receiver_Context::Receiver_Context ( + ::Components::CCMHome_ptr home, + ::CIAO::Session_Container *c, + Receiver_Servant *sv) + : ACE_NESTED_CLASS (CIAO, Context_Impl_Base (home, c)), + ctx_svnt_base (home, c, sv) + { + } + + Receiver_Context::~Receiver_Context (void) + { + } + + // Operations for Receiver receptacles and event sources, + // defined in ::Hello::CCM_Receiver_Context. + + ::Hello::ReadMessage_ptr + Receiver_Context::get_connection_read_message ( + ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return ::Hello::ReadMessage::_duplicate ( + this->ciao_uses_read_message_.in ()); + } + + void + Receiver_Context::connect_read_message ( + ::Hello::ReadMessage_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + if (!CORBA::is_nil (this->ciao_uses_read_message_.in ())) + { + ACE_THROW (::Components::AlreadyConnected ()); + } + + if (CORBA::is_nil (c)) + { + ACE_THROW (::Components::InvalidConnection ()); + } + + this->ciao_uses_read_message_ = + ::Hello::ReadMessage::_duplicate (c); + } + + ::Hello::ReadMessage_ptr + Receiver_Context::disconnect_read_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + if (CORBA::is_nil (this->ciao_uses_read_message_.in ())) + { + ACE_THROW_RETURN ( + ::Components::NoConnection (), + ::Hello::ReadMessage::_nil ()); + } + + return this->ciao_uses_read_message_._retn (); + } + + // CIAO-specific. + + Receiver_Context * + Receiver_Context::_narrow ( + ::Components::SessionContext_ptr p + ACE_ENV_ARG_DECL_NOT_USED) + { + return dynamic_cast<Receiver_Context *> (p); + } + } + + namespace CIAO_GLUE_Hello + { + Receiver_Servant::Receiver_Servant ( + ::Hello::CCM_Receiver_ptr exe, + ::Components::CCMHome_ptr h, + ::CIAO::Home_Servant_Impl_Base *home_servant, + ::CIAO::Session_Container *c) + : ACE_NESTED_CLASS (CIAO, Servant_Impl_Base (h, home_servant, c)), + comp_svnt_base (exe, h, home_servant, c) + { + this->context_ = new Receiver_Context (h, c, this); + + CIAO_REGISTER_OBV_FACTORY ( + ::Hello::TimeOut_init, + ::Hello::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; + } + + Receiver_Servant::~Receiver_Servant (void) + { + } + + void + Receiver_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); + } + } + + Receiver_Servant::TimeOutConsumer_click_in_Servant::TimeOutConsumer_click_in_Servant ( + ::Hello::CCM_Receiver_ptr executor, + ::Hello::CCM_Receiver_Context_ptr c) + : executor_ (::Hello::CCM_Receiver::_duplicate (executor)), + ctx_ (::Hello::CCM_Receiver_Context::_duplicate (c)) + { + } + + Receiver_Servant::TimeOutConsumer_click_in_Servant::~TimeOutConsumer_click_in_Servant (void) + { + } + + CORBA::Object_ptr + Receiver_Servant::TimeOutConsumer_click_in_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 + Receiver_Servant::TimeOutConsumer_click_in_Servant::push_TimeOut ( + ::Hello::TimeOut *evt + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->executor_->push_click_in ( + evt + ACE_ENV_ARG_PARAMETER); + } + + // Inherited from ::Components::EventConsumerBase. + void + Receiver_Servant::TimeOutConsumer_click_in_Servant::push_event ( + ::Components::EventBase *ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::BadEventType)) + { + ::Hello::TimeOut_var ev_type = + ::Hello::TimeOut::_downcast (ev); + + if (ev_type.in () != 0) + { + this->push_TimeOut ( + ev_type.in () + ACE_ENV_ARG_PARAMETER); + + return; + } + + ACE_THROW (::Components::BadEventType ()); + } + + ::Hello::TimeOutConsumer_ptr + Receiver_Servant::get_consumer_click_in ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (! ::CORBA::is_nil (this->consumes_click_in_.in ())) + { + return ::Hello::TimeOutConsumer::_duplicate (this->consumes_click_in_.in ()); + } + + ::Components::EventConsumerBase_var obj = + this->get_consumer_click_in_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::TimeOutConsumer::_nil ()); + + ::Hello::TimeOutConsumer_var eco = + ::Hello::TimeOutConsumer::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::TimeOutConsumer::_nil ()); + + this->consumes_click_in_ = eco; + return ::Hello::TimeOutConsumer::_duplicate (this->consumes_click_in_.in ()); + } + + ::Components::EventConsumerBase_ptr + Receiver_Servant::get_consumer_click_in_i ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ::Components::EventConsumerBase_ptr ret = + this->lookup_consumer ("click_in"); + + if (! ::CORBA::is_nil (ret)) + { + return ret; + } + + CIAO::Port_Activator_T< + Receiver_Servant::TimeOutConsumer_click_in_Servant, + ::Hello::CCM_Receiver, + ::Hello::CCM_Receiver_Context, + Receiver_Servant > *tmp = 0; + + typedef CIAO::Port_Activator_T< + Receiver_Servant::TimeOutConsumer_click_in_Servant, + ::Hello::CCM_Receiver, + ::Hello::CCM_Receiver_Context, + Receiver_Servant > + MACRO_MADNESS_TYPEDEF; + + + ACE_NEW_THROW_EX ( + tmp, + MACRO_MADNESS_TYPEDEF ( + "Hello_Receiver_click_in", + "click_in", + 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 ( + "Hello_Receiver_click_in", + "IDL:Hello/TimeOutConsumer:1.0", + CIAO::Container::Facet_Consumer + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::TimeOutConsumer::_nil ()); + + ::Components::EventConsumerBase_var ecb = + ::Components::EventConsumerBase::_narrow ( + obj.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (::Hello::TimeOutConsumer::_nil ()); + + this->add_consumer ( + "click_in", + ecb.in ()); + + return ecb._retn (); + } + + ::Components::Cookie * + Receiver_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, "read_message") == 0) + { + ::Hello::ReadMessage_var _ciao_conn = + ::Hello::ReadMessage::_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_read_message ( + _ciao_conn.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return 0; + } + + ACE_THROW_RETURN (::Components::InvalidName (), 0); + } + + CORBA::Object_ptr + Receiver_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, "read_message") == 0) + { + // Simplex disconnect. + return this->disconnect_read_message (ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ACE_THROW_RETURN ( + ::Components::InvalidName (), + ::CORBA::Object::_nil ()); + + ACE_UNUSED_ARG (ck); + } + + void + Receiver_Servant::connect_read_message ( + ::Hello::ReadMessage_ptr c + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::AlreadyConnected, + ::Components::InvalidConnection)) + { + this->context_->connect_read_message ( + c + ACE_ENV_ARG_PARAMETER); + } + + ::Hello::ReadMessage_ptr + Receiver_Servant::disconnect_read_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Components::NoConnection)) + { + return this->context_->disconnect_read_message ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + ::Hello::ReadMessage_ptr + Receiver_Servant::get_connection_read_message ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->context_->get_connection_read_message ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + + void + Receiver_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 * + Receiver_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 + Receiver_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 + Receiver_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 + Receiver_Servant::populate_port_tables ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_ENV_ARG_NOT_USED; + ::CORBA::Object_var obj_var; + ::Components::EventConsumerBase_var ecb_var; + + ecb_var = + this->get_consumer_click_in_i ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + } + + namespace CIAO_GLUE_Hello + { + ReceiverHome_Servant::ReceiverHome_Servant ( + ::Hello::CCM_ReceiverHome_ptr exe, + ::CIAO::Session_Container *c) + : ACE_NESTED_CLASS (CIAO, Home_Servant_Impl_Base (c)), + home_svnt_base (exe, c) + { + } + + ReceiverHome_Servant::~ReceiverHome_Servant (void) + { + } + + // Home operations. + + // Home supported interface operations. + + // Home factory and finder operations. + + // Home attribute operations. + } + + extern "C" RECEIVER_SVNT_Export ::PortableServer::Servant + createReceiverHome_Servant ( + ::Components::HomeExecutorBase_ptr p, + CIAO::Session_Container *c + ACE_ENV_ARG_DECL) + { + if (p == 0) + { + return 0; + } + + ::Hello::CCM_ReceiverHome_var x = + ::Hello::CCM_ReceiverHome::_narrow ( + p + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + if (::CORBA::is_nil (x.in ())) + { + return 0; + } + + return new + CIAO_GLUE_Hello::ReceiverHome_Servant ( + x.in (), + c); + } +} + |