diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-06 16:58:11 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-09-06 16:58:11 +0000 |
commit | d45b4f3ba12418f096e21842e31dea3c96f95ea8 (patch) | |
tree | 6951a41f798e53aaa62a349c359cdd95b9f8cd34 | |
parent | afb7e039a7b6f472961e41604871ccde39374d9d (diff) | |
download | ATCD-d45b4f3ba12418f096e21842e31dea3c96f95ea8.tar.gz |
Mon Sep 06 11:35:00 2004 Gan Deng <gan.deng@vanderbilt.edu>
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.cpp | 477 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.h | 317 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.idl | 37 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.cpp | 236 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.h | 199 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.idl | 28 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_EventServiceBase.h | 110 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory.cpp | 28 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory.h | 81 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory_impl.cpp | 321 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory_impl.h | 125 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_Events.idl | 178 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_Events_Export.h | 53 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.cpp | 504 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.h | 309 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.idl | 48 |
16 files changed, 3051 insertions, 0 deletions
diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.cpp b/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.cpp new file mode 100644 index 00000000000..42773eb45fc --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.cpp @@ -0,0 +1,477 @@ +// -*- C++ -*- +//$Id$ +#include "CIAO_CosNotify.h" + +// @@ George, ACE_RCSID please.. + +namespace CIAO +{ + + CosNotifyService::CosNotifyService ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + CosNotifyChannelAdmin::EventChannel_ptr ec) + : orb_ (CORBA::ORB::_duplicate (orb)) + , root_poa_ (PortableServer::POA::_duplicate (poa)) + , notify_channel_ (CosNotifyChannelAdmin::EventChannel::_duplicate (ec)) + , type_id_ ("Any") + , source_id_ ("Any") + { + } + + void + CosNotifyService::connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, + "CIAO::CosNotifyService::connect_event_supplier\n")); + + CosNotifyChannelAdmin::AdminID admin_id; + + CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = + this->notify_channel_->new_for_suppliers ( + CosNotifyChannelAdmin::OR_OP, + admin_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNotifyChannelAdmin::ProxyID proxy_id; + + // @@ George, what happens if my_proxy is NULL? + CosNotifyChannelAdmin::ProxyConsumer_var my_proxy = + supplier_admin->obtain_notification_push_consumer ( + CosNotifyChannelAdmin::STRUCTURED_EVENT, + proxy_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_ = + CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (my_proxy.in ()); + + // @@ George, This check is good, but you should probably return. + if (CORBA::is_nil (this->proxy_consumer_.in ())) + { + ACE_ERROR ((LM_ERROR, + " (%P|%t) CosNotifyService::connect_event_supplier\n")); + } + + // Create and register supplier servant + CosNotifyServiceSupplier_impl * supplier_servant = 0; + + // @@ George, THROW_EX please.. + ACE_NEW (supplier_servant, + CosNotifyServiceSupplier_impl (orb_.in ())); + + CosNotifyComm::StructuredPushSupplier_var push_supplier = + supplier_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotify_Supplier_Config_ptr notify_config = + CosNotify_Supplier_Config::_narrow (supplier_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (notify_config)) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + + CosNotifyFilter::Filter_var filter = + notify_config->notify_filter (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotification::QoSProperties_var qos = + notify_config->notify_qos (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // @@ George, isin't this a good place to get the QoS values from + // the meta level for the conenction?? Do we have any hooks that + // can achieve this? + + // @@ George, what happens if these calls fail? Yes, the exception + // would be raised. Do we want to propogate the exception, + // probably to the deployer? If so, the exception specification + // for this method wouldn't help you at all. You have declared + // SystemException. This would mean none of the user exceptions + // would get propogated. The deployer would get a UNKNOWN + // exception. That isn't very useful, isn't it? + this->proxy_consumer_->add_filter (filter.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_->set_qos (qos.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_->connect_structured_push_supplier ( + push_supplier.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + void + CosNotifyService::connect_event_consumer ( + Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + Components::EventConsumerBase_var consumer = + consumer_config->consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // @@ George, the same comments about exceptions, return values + // etc etc. apply. + CosNotifyChannelAdmin::AdminID admin_id; + CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = + this->notify_channel_->new_for_consumers (CosNotifyChannelAdmin::OR_OP, + admin_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNotifyChannelAdmin::ProxyID proxy_id; + CosNotifyChannelAdmin::ProxySupplier_var my_proxy = + consumer_admin->obtain_notification_push_supplier ( + CosNotifyChannelAdmin::STRUCTURED_EVENT, + proxy_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxy_supplier = + CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow (my_proxy.in ()); + if (CORBA::is_nil (proxy_supplier.in ())) + { + ACE_ERROR ((LM_ERROR, + " (%P|%t) CosNotifyService::connect_event_consumer\n")); + } + + // Create and register consumer servant + CosNotifyServiceConsumer_impl * consumer_servant = 0; + + ACE_NEW (consumer_servant, + CosNotifyServiceConsumer_impl (orb_.in (), + consumer.in ())); + + CosNotifyComm::StructuredPushConsumer_var push_consumer = + consumer_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotify_Consumer_Config_ptr notify_config = + CosNotify_Consumer_Config::_narrow (consumer_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (notify_config)) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + + CosNotifyFilter::Filter_var filter = + notify_config->notify_filter (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotification::QoSProperties_var qos = + notify_config->notify_qos (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + proxy_supplier->add_filter (filter.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + proxy_supplier->set_qos (qos.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + proxy_supplier->connect_structured_push_consumer (push_consumer.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_CString consumer_id = + consumer_config->consumer_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // @@ George, What happens if the bind fails? Don't we want to + // roll all this back ie. close the connection etc. ? + this->proxy_supplier_map_.bind (consumer_id.c_str (), + proxy_supplier._retn ()); + } + + void + CosNotifyService::disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + // @@ Comments about exception applies... + this->proxy_consumer_->disconnect_structured_push_consumer ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + } + + void + CosNotifyService::disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + + CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxy_supplier; + + this->proxy_supplier_map_.unbind (connection_id, proxy_supplier); + + proxy_supplier->disconnect_structured_push_supplier ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + } + + void + CosNotifyService::push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::CosNotifyService::push_event\n")); + + CosNotification::StructuredEvent event; + + // @@ George, not now, but later we may want to cache these + // details that are in the critical path that way we don't need to + // pay for this every call. Just leave the comment around so that + // we can get to it once we are done with other things. + event.header.fixed_header.event_type.domain_name = + CORBA::string_dup ("CIAO_Events"); + event.header.fixed_header.event_type.type_name = + this->type_id_.c_str (); + event.header.fixed_header.event_name = + this->source_id_.c_str (); + + event.remainder_of_body <<= ev; + + this->proxy_consumer_->push_structured_event ( + event + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + CosNotifyServiceSupplier_impl::CosNotifyServiceSupplier_impl (void) + { + } + + CosNotifyServiceSupplier_impl::CosNotifyServiceSupplier_impl (CORBA::ORB_ptr orb) + : orb_ (CORBA::ORB::_duplicate (orb)) + { + } + + void + CosNotifyServiceSupplier_impl::disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + } + + void + CosNotifyServiceSupplier_impl::subscription_change ( + const CosNotification::EventTypeSeq& events_added, + const CosNotification::EventTypeSeq& events_removed + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType)) + { + } + + CosNotifyServiceConsumer_impl::CosNotifyServiceConsumer_impl (void) + { + } + + CosNotifyServiceConsumer_impl::CosNotifyServiceConsumer_impl ( + CORBA::ORB_ptr orb, + Components::EventConsumerBase_ptr consumer) + : orb_ (CORBA::ORB::_duplicate (orb)), + event_consumer_ (Components::EventConsumerBase::_duplicate (consumer)) + { + } + + void + CosNotifyServiceConsumer_impl::push_structured_event ( + const CosNotification::StructuredEvent& event) + ACE_THROW_SPEC ((CORBA::SystemException, + CosEventComm::Disconnected)) + { + ACE_DEBUG ((LM_DEBUG, + "CosNotifyServiceConsumer_impl::push_structured_event\n")); + + Components::EventBase *ev = 0; + + if (event.remainder_of_body >>= ev) + { + // @@ George, is this add_ref () required? + ev->_add_ref (); + + this->event_consumer_->push_event (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + void + CosNotifyServiceConsumer_impl::disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + } + + void + CosNotifyServiceConsumer_impl::offer_change ( + const CosNotification::EventTypeSeq& events_added, + const CosNotification::EventTypeSeq& events_removed + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType)) + { + } + + CosNotify_Consumer_Config_impl::CosNotify_Consumer_Config_impl (PortableServer::POA_ptr poa) : + service_type_ (NOTIFY), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + void + CosNotify_Consumer_Config_impl::consumer_id (const char * consumer_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->consumer_id_ = consumer_id; + } + + void + CosNotify_Consumer_Config_impl::supplier_id (const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + } + + void + CosNotify_Consumer_Config_impl::consumer (Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->consumer_ = consumer; + } + + CONNECTION_ID + CosNotify_Consumer_Config_impl::consumer_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->consumer_id_.c_str ()); + } + + CONNECTION_ID + CosNotify_Consumer_Config_impl::supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + CosNotify_Consumer_Config_impl::service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->service_type_; + } + + Components::EventConsumerBase_ptr + CosNotify_Consumer_Config_impl::consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return Components::EventConsumerBase::_duplicate (this->consumer_.in ()); + } + + CosNotifyFilter::Filter * + CosNotify_Consumer_Config_impl::notify_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->filter_._retn (); + } + + CosNotification::QoSProperties * + CosNotify_Consumer_Config_impl::notify_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->qos_._retn (); + } + + void + CosNotify_Consumer_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + CosNotify_Supplier_Config_impl::CosNotify_Supplier_Config_impl (PortableServer::POA_ptr poa) : + service_type_ (NOTIFY), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + void + CosNotify_Supplier_Config_impl::supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + } + + CONNECTION_ID + CosNotify_Supplier_Config_impl::supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + CosNotify_Supplier_Config_impl::service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->service_type_; + } + + CosNotifyFilter::Filter_ptr + CosNotify_Supplier_Config_impl::notify_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->filter_._retn (); + } + + CosNotification::QoSProperties * + CosNotify_Supplier_Config_impl::notify_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->qos_._retn (); + } + + void + CosNotify_Supplier_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + +} diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.h b/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.h new file mode 100644 index 00000000000..e5fc5e587b4 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.h @@ -0,0 +1,317 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_CosNotify.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_COSNOTIFY_H +#define CIAO_COSNOTIFY_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventServiceBase.h" +#include "CIAO_CosNotifyS.h" + +#include "orbsvcs/orbsvcs/CosNotifyChannelAdminC.h" + +namespace CIAO +{ + /** + * @class CosNotifyService + * + * @brief An implementation of EventServiceBase to use the + * CosNotification service. + */ + class CosNotifyService : + public virtual EventServiceBase + { + + public: + + CosNotifyService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + CosNotifyChannelAdmin::EventChannel_ptr ec); + + // @@ George, just a place holder for you to add documentation. + virtual void connect_event_supplier ( + CIAO::Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void connect_event_consumer ( + CIAO::Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void disconnect_event_supplier (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + // Reference to the ORB + CORBA::ORB_var orb_; + + // Reference to the Root POA + PortableServer::POA_var root_poa_; + + /** + * @var CosNotifyChannelAdmin::EventChannel_var notify_channel_ + * + * Reference to the notification channel. + */ + CosNotifyChannelAdmin::EventChannel_var notify_channel_; + + /** + * @var ACE_CString type_id_ + * + * The type of event. + */ + ACE_CString type_id_; + + /** + * @var ACE_CString source_id_ + * + * The supplier id. + */ + ACE_CString source_id_; + + /** + * @var CosNotifyChannelAdmin::StructuredProxyPushConsumer_var proxy_consumer_ + * + * The proxy consumer to which events are pushed. + */ + CosNotifyChannelAdmin::StructuredProxyPushConsumer_var proxy_consumer_; + + /** + * @var ACE_Hash_Map_Manager<> proxy_supplier_map_ + * + * Mapping of each event sink to a proxy supplier for disconnect purposes. + */ + ACE_Hash_Map_Manager<ACE_CString, + CosNotifyChannelAdmin::StructuredProxyPushSupplier_ptr, + ACE_Null_Mutex> proxy_supplier_map_; + + }; + + /** + * @class CosNotifyServiceSupplier_impl + * + * An implementation of the StructuredPushSupplier interface. + */ + class CosNotifyServiceSupplier_impl : + public virtual POA_CosNotifyComm::StructuredPushSupplier, + public virtual PortableServer::RefCountServantBase + { + + public: + + // @@ George, is it okay to have a default constructor? + CosNotifyServiceSupplier_impl (void); + + CosNotifyServiceSupplier_impl ( + CORBA::ORB_ptr orb); + + virtual void disconnect_structured_push_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void subscription_change ( + const CosNotification::EventTypeSeq& events_added, + const CosNotification::EventTypeSeq& events_removed + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType)); + + private: + + CORBA::ORB_var orb_; + }; + + + /** + * @class CosNotifyServiceConsumer_impl + * + * An implementation of the StructuredPushConsumer interface. + */ + class CosNotifyServiceConsumer_impl : + public virtual POA_CosNotifyComm::StructuredPushConsumer, + public virtual PortableServer::RefCountServantBase + { + + public: + + CosNotifyServiceConsumer_impl (void); + + CosNotifyServiceConsumer_impl ( + CORBA::ORB_ptr orb, + Components::EventConsumerBase_ptr consumer); + + virtual void push_structured_event ( + const CosNotification::StructuredEvent& event) + ACE_THROW_SPEC (( + CosEventComm::Disconnected, + CORBA::SystemException)); + + virtual void disconnect_structured_push_consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void offer_change ( + const CosNotification::EventTypeSeq& events_added, + const CosNotification::EventTypeSeq& events_removed + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType)); + + private: + + CORBA::ORB_var orb_; + + Components::EventConsumerBase_var event_consumer_; + + }; + + /** + * @class CosNotify_Consumer_Config_impl + * + * Implementation of the CosNotify_Consumer_Config IDL interface that + * configures the CosNotification service. An object of this type will be + * returned from @c CIAO::Container::create_consumer_config () when @c NOTIFY + * is specified as the event service type. + */ + class CosNotify_Consumer_Config_impl : + public virtual POA_CIAO::CosNotify_Consumer_Config + { + + public: + + CosNotify_Consumer_Config_impl (PortableServer::POA_ptr poa); + + virtual void consumer_id (const char * consumer_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID consumer_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Components::EventConsumerBase_ptr consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CosNotifyFilter::Filter_ptr notify_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CosNotification::QoSProperties * notify_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString consumer_id_; + + ACE_CString supplier_id_; + + Components::EventConsumerBase_var consumer_; + + EventServiceType service_type_; + + CosNotifyFilter::Filter_var filter_; + + CosNotification::QoSProperties_var qos_; + + PortableServer::POA_var poa_; + + }; + + /** + * @class CosNotify_Supplier_Config_impl + * + * Implementation of the CosNotify_Supplier_Config IDL interface that + * configures the CosNotification service. An object of this type will be + * returned from @c CIAO::Container::create_supplier_config () when @c NOTIFY + * is specified as the event service type. + */ + class CosNotify_Supplier_Config_impl : + public virtual POA_CIAO::CosNotify_Supplier_Config + { + + public: + + CosNotify_Supplier_Config_impl (PortableServer::POA_ptr poa); + + virtual void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual char * supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CosNotifyFilter::Filter_ptr notify_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CosNotification::QoSProperties * notify_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString supplier_id_; + + EventServiceType service_type_; + + CosNotifyFilter::Filter_var filter_; + + CosNotification::QoSProperties_var qos_; + + PortableServer::POA_var poa_; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_COSNOTIFY_H */ diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.idl b/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.idl new file mode 100644 index 00000000000..ae2a19acff2 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_CosNotify.idl @@ -0,0 +1,37 @@ +// $Id$ + +/** + * @file CIAO_CosNotify.idl + * + * @author George Edwards + * + * @brief Interfaces for configuring CIAO's notification service. + */ + +#include "CIAO_Events.idl" +#include <orbsvcs/orbsvcs/CosNotifyFilter.idl> + +module CIAO +{ + + interface CosNotify_Consumer_Config : + Consumer_Config + { + + readonly attribute CosNotifyFilter::Filter notify_filter; + + readonly attribute CosNotification::QoSProperties notify_qos; + + }; + + interface CosNotify_Supplier_Config : + Supplier_Config + { + + readonly attribute CosNotifyFilter::Filter notify_filter; + + readonly attribute CosNotification::QoSProperties notify_qos; + + }; + +}; diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.cpp b/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.cpp new file mode 100644 index 00000000000..93ef82fbdce --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.cpp @@ -0,0 +1,236 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_DirectEvent.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_DirectEvent.h" + +namespace CIAO +{ + + DirectEventService::DirectEventService ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa) + : orb_ (CORBA::ORB::_duplicate (orb)) + , root_poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + void + DirectEventService::connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + } + + void + DirectEventService::connect_event_consumer ( + Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + Components::EventConsumerBase_var consumer = + consumer_config->consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->consumer_array_.size (this->consumer_array_.size () + 1); + + this->consumer_array_.set (Components::EventConsumerBase::_duplicate (consumer.in ()), + this->consumer_array_.size () - 1); + + } + + void + DirectEventService::disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + } + + void + DirectEventService::disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + } + + void + DirectEventService::push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO::DirectEventService::push_event\n")); + + size_t end = this->consumer_array_.size (); + + // Iterate through the array, pushing the event to each consumer. + for (size_t iter = 0; iter != end; ++iter) + { + // @@ George, is this required? Since the push_event () is + // going to make a copy, why would this be required? + ev->_add_ref (); + this->consumer_array_[iter]->push_event ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + Direct_Consumer_Config_impl::Direct_Consumer_Config_impl (PortableServer::POA_ptr poa) : + service_type_ (DIRECT), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + Direct_Consumer_Config_impl::~Direct_Consumer_Config_impl (void) + { + ACE_DEBUG ((LM_DEBUG, "Direct_Consumer_Config_impl::~Direct_Consumer_Config_impl\n")); + } + + void + Direct_Consumer_Config_impl::consumer_id ( + const char * consumer_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->consumer_id_ = consumer_id; + } + + void + Direct_Consumer_Config_impl::supplier_id ( + const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + } + + void + Direct_Consumer_Config_impl::consumer ( + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->consumer_ = Components::EventConsumerBase::_duplicate (consumer); + } + + CONNECTION_ID + Direct_Consumer_Config_impl::consumer_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->consumer_id_.c_str ()); + } + + CONNECTION_ID + Direct_Consumer_Config_impl::supplier_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + Direct_Consumer_Config_impl::service_type ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return this->service_type_; + } + + Components::EventConsumerBase_ptr + Direct_Consumer_Config_impl::consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return Components::EventConsumerBase::_duplicate (this->consumer_.in ()); + } + + void + Direct_Consumer_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + Direct_Supplier_Config_impl::Direct_Supplier_Config_impl (PortableServer::POA_ptr poa) + : service_type_ (DIRECT), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + Direct_Supplier_Config_impl::~Direct_Supplier_Config_impl (void) + { + ACE_DEBUG ((LM_DEBUG, "Direct_Supplier_Config_impl::~Direct_Supplier_Config_impl\n")); + } + + void + Direct_Supplier_Config_impl::supplier_id ( + const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + } + + CONNECTION_ID + Direct_Supplier_Config_impl::supplier_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + Direct_Supplier_Config_impl::service_type ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return this->service_type_; + } + + void + Direct_Supplier_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + +} diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.h b/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.h new file mode 100644 index 00000000000..edf400f4114 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.h @@ -0,0 +1,199 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_DirectEvent.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_DIRECTEVENT_H +#define CIAO_DIRECTEVENT_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventServiceBase.h" +#include "CIAO_DirectEventS.h" + +#include "ace/Array.h" + +namespace CIAO +{ + + /** + * @class DirectEventService + * + * An implementation of EventServiceBase using direct communication. + */ + class DirectEventService : + public virtual EventServiceBase + { + + public: + + DirectEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa); + + virtual void connect_event_supplier ( + CIAO::Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void connect_event_consumer ( + CIAO::Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + // Reference to the ORB + CORBA::ORB_var orb_; + + // Reference to the Root POA + PortableServer::POA_var root_poa_; + + /** + * @var ACE_Array<Components::EventConsumerBase_ptr> consumer_array_ + * + * List of consumers. + */ + /// @@ George, this is cool! Do you want to use a _var or _ptr? + ACE_Array<Components::EventConsumerBase_var> consumer_array_; + + }; + + + /** + * @class Direct_Consumer_Config_impl + * + * Implementation of the Direct_Consumer_Config IDL interface that + * configures TAO's direct event mechanism. An object of this type will be + * returned from @c CIAO::Container::create_consumer_config () when @c DIRECT + * is specified as the event service type. + */ + class Direct_Consumer_Config_impl : + public virtual POA_CIAO::Direct_Consumer_Config, + public virtual PortableServer::RefCountServantBase + { + + public: + + Direct_Consumer_Config_impl (PortableServer::POA_ptr poa); + + virtual ~Direct_Consumer_Config_impl (void); + + virtual void consumer_id (const char * consumer_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID consumer_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void supplier_id (const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Components::EventConsumerBase_ptr consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // @@ george, probably this should be const'ified? + virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString consumer_id_; + + ACE_CString supplier_id_; + + Components::EventConsumerBase_var consumer_; + + EventServiceType service_type_; + + PortableServer::POA_var poa_; + + }; + + /** + * @class Direct_Supplier_Config_impl + * + * Implementation of the Direct_Supplier_Config IDL interface that + * configures TAO's direct event mechanism. An object of this type will be + * returned from @c CIAO::Container::create_supplier_config () when @c DIRECT + * is specified as the event service type. + */ + class Direct_Supplier_Config_impl : + public virtual POA_CIAO::Direct_Supplier_Config, + public virtual PortableServer::RefCountServantBase + { + + public: + + Direct_Supplier_Config_impl (PortableServer::POA_ptr poa); + + virtual ~Direct_Supplier_Config_impl (void); + + void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + char * supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString supplier_id_; + + EventServiceType service_type_; + + PortableServer::POA_var poa_; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_DIRECTEVENT_H */ diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.idl b/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.idl new file mode 100644 index 00000000000..917e5007cb9 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_DirectEvent.idl @@ -0,0 +1,28 @@ +// $Id$ + +/** + * @file CIAO_DirectEvent.idl + * + * @author George Edwards + * + * @brief Interfaces for configuring CIAO's direct event service. + */ + +#include "CIAO_Events.idl" + +module CIAO +{ + + interface Direct_Consumer_Config : + Consumer_Config + { + + }; + + interface Direct_Supplier_Config : + Supplier_Config + { + + }; + +}; diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_EventServiceBase.h b/TAO/CIAO/DAnCE/ciao/CIAO_EventServiceBase.h new file mode 100644 index 00000000000..c87d52ce490 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_EventServiceBase.h @@ -0,0 +1,110 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventServiceBase.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICEBASE_H +#define CIAO_EVENTSERVICEBASE_H +#include /**/ "ace/pre.h" + +#include "CIAO_EventsS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + + +namespace CIAO +{ + + /** + * @class EventServiceBase + * + * An abstract base class; derived classes will provide appropriate + * implementations of the connect, disconnect, and push methods depending on + * the event mechanism used. @c EventServiceBase objects are created on a + * 1-per-supplier basis. Each event source and sink has an associated + * @c EventServiceBase object, stored in a map in CIAO::Container. + */ + // @@ George, any particular reason that this cannot be a local + /// interface in an idl? The above struct can also be pushed into + /// an IDL, unless you don't want to have object semantics. + class CIAO_EVENTS_Export EventServiceBase + { + + public: + + /** + * @fn void connect_event_supplier (Supplier_Config_ptr supplier_config) + * + * Connects an event supplier using the options specified by + * @c supplier_config. + */ + virtual void connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) = 0; + + /** + * @fn void connect_event_consumer (Consumer_Config_ptr consumer_config) + * + * Connects an event consumer using the options specified by + * @c consumer_config. + */ + virtual void connect_event_consumer ( + Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) = 0; + + /** + * @fn void disconnect_event_supplier () + * + * Disconnects the event supplier associated with this object. + */ + virtual void disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) = 0; + + /** + * @fn void disconnect_event_consumer (CONNECTION_ID consumer_id) + * + * Disconnects the event consumer with UUID @c consumer_id. + */ + virtual void disconnect_event_consumer ( + const char * consumer_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) = 0; + + /** + * @fn void push_event (Components::EventBase * ev) + * + * Pushes event @c ev to all consumers. + */ + virtual void push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) = 0; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_EVENTSERVICEBASE_H */ diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory.cpp b/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory.cpp new file mode 100644 index 00000000000..2118a7068c3 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory.cpp @@ -0,0 +1,28 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_EventService_Factory.h" +#include "ace/Dynamic_Service.h" + +CIAO::EventService_Factory::~EventService_Factory (void) +{ +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Dynamic_Service<EventService_Factory>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Dynamic_Service<EventService_Factory> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory.h b/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory.h new file mode 100644 index 00000000000..811bc8bb5ff --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory.h @@ -0,0 +1,81 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICE_FACTORY_H +#define CIAO_EVENTSERVICE_FACTORY_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventServiceBase.h" + +namespace CIAO +{ + /** + * @class EventService_Factory + * + * An abstract factory that creates event configuration and service objects. + * A concrete implementation is obtained by CIAO::Container via the ACE + * service configurator. + */ + class CIAO_EVENTS_Export EventService_Factory : + public ACE_Service_Object + { + + public: + + /** + * @fn ~EventService_Factory (void) + * + * Destructor. + */ + virtual ~EventService_Factory (void); + + /** + * @fn Consumer_Config_ptr create_consumer_config (EventServiceType type) + * + * Creates and returns a new Consumer_Config object corresponding to the + * type specified by @c type. + */ + virtual Consumer_Config_ptr create_consumer_config ( + EventServiceType type) = 0; + + /** + * @fn Supplier_Config_ptr create_supplier_config (EventServiceType type) + * + * Creates and returns a new Supplier_Config object corresponding to the + * type specified by @c type. + */ + virtual Supplier_Config_ptr create_supplier_config ( + EventServiceType type) = 0; + + /** + * @fn EventServiceBase * create (EventServiceType type) + * + * Creates and returns a new EventServiceBase object corresponding to the + * type specified by @c type. + */ + virtual EventServiceBase * create ( + EventServiceType type) = 0; + + virtual void init ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa) = 0; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_EVENTSERVICE_FACTORY_H */ diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory_impl.cpp b/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory_impl.cpp new file mode 100644 index 00000000000..b129e948fea --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory_impl.cpp @@ -0,0 +1,321 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory_impl.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_EventService_Factory_impl.h" +#include "CIAO_DirectEvent.h" +#include "CIAO_RTEvent.h" +#include "CIAO_CosNotify.h" + +#include "orbsvcs/orbsvcs/Event/EC_Event_Channel.h" + +/// Initialize the RTEventService object. Will eventually be moved to a separate init () +/// method so exceptions can be handled properly. + +// @@ George, an init () method in the base class sounds like a better option. + +namespace CIAO +{ + + EventService_Factory_impl::EventService_Factory_impl (void) : + rt_event_channel_ (RtecEventChannelAdmin::EventChannel::_nil ()), + notify_channel_ (CosNotifyChannelAdmin::EventChannel::_nil ()) + { + } + + EventService_Factory_impl::~EventService_Factory_impl (void) + { + } + + Consumer_Config_ptr + EventService_Factory_impl::create_consumer_config (EventServiceType type) + { + + switch (type) + { + case DIRECT: + { + Direct_Consumer_Config_impl * consumer_config = 0; + ACE_NEW_RETURN (consumer_config, + Direct_Consumer_Config_impl (this->root_poa_.in ()), + Consumer_Config::_nil ()); + Direct_Consumer_Config_var return_direct = + consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_direct._retn (); + break; + } + case RTEC: + { + RTEvent_Consumer_Config_impl * consumer_config = 0; + ACE_NEW_RETURN (consumer_config, + RTEvent_Consumer_Config_impl (this->root_poa_.in ()), + Consumer_Config::_nil ()); + RTEvent_Consumer_Config_var return_rtec = + consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_rtec._retn (); + break; + } + case NOTIFY: + { + CosNotify_Consumer_Config_impl * consumer_config = 0; + ACE_NEW_RETURN (consumer_config, + CosNotify_Consumer_Config_impl (this->root_poa_.in ()), + Consumer_Config::_nil ()); + CosNotify_Consumer_Config_var return_notify = + consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_notify._retn (); + break; + } + } + + return Consumer_Config::_nil (); + + } + + Supplier_Config_ptr + EventService_Factory_impl::create_supplier_config (EventServiceType type) + { + + // @@George, at this place we should be able to load from a library. + // @@ And oh, BTW, keep direct as default. If there are no strings + // for then we should use the direct mode of connection. + + switch (type) + { + case DIRECT: + { + Direct_Supplier_Config_impl * supplier_config = 0; + ACE_NEW_RETURN (supplier_config, + Direct_Supplier_Config_impl (this->root_poa_.in ()), + Supplier_Config::_nil ()); + Direct_Supplier_Config_var return_direct = + supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_direct._retn (); + break; + } + case RTEC: + { + RTEvent_Supplier_Config_impl * supplier_config = 0; + ACE_NEW_RETURN (supplier_config, + RTEvent_Supplier_Config_impl (this->root_poa_.in ()), + Supplier_Config::_nil ()); + RTEvent_Supplier_Config_var return_rtec = + supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_rtec._retn (); + break; + } + case NOTIFY: + { + CosNotify_Supplier_Config_impl * supplier_config = 0; + ACE_NEW_RETURN (supplier_config, + CosNotify_Supplier_Config_impl (this->root_poa_.in ()), + Supplier_Config::_nil ()); + CosNotify_Supplier_Config_var return_notify = + supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_notify._retn (); + break; + } + } + + return Supplier_Config::_nil (); + + } + + EventServiceBase * + EventService_Factory_impl::create (EventServiceType type) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_event_service\n")); + + switch (type) + { + case DIRECT: + { + DirectEventService * event_service = 0; + ACE_NEW_RETURN (event_service, + DirectEventService (this->orb_.in (), + this->root_poa_.in ()), + 0); + return event_service; + break; + } + case RTEC: + { + if (CORBA::is_nil (this->rt_event_channel_.in ())) + { + this->create_rt_event_channel (ACE_ENV_SINGLE_ARG_DECL); + ACE_CHECK; + } + RTEventService * event_service = 0; + ACE_NEW_RETURN (event_service, + RTEventService (this->orb_.in (), + this->root_poa_.in (), + this->rt_event_channel_.in ()), + 0); + return event_service; + break; + } + case NOTIFY: + { + if (CORBA::is_nil (this->notify_channel_.in ())) + { + this->create_notify_channel (ACE_ENV_SINGLE_ARG_DECL); + ACE_CHECK; + } + CosNotifyService * event_service = 0; + ACE_NEW_RETURN (event_service, + CosNotifyService (this->orb_.in (), + this->root_poa_.in (), + this->notify_channel_.in ()), + 0); + return event_service; + break; + } + } + + return 0; + + } + + /*EventConsumerInfo + Events_Manager::find_consumer_info (CONNECTION_ID connection_id) + { + + EventConsumerInfo consumer_info; + + if (this->consumer_info_map_.find (connection_id, consumer_info) == -1) + { + ACE_THROW ((CORBA::BAD_PARAM ())); + } + + return consumer_info; + + } + + void + Events_Manager::bind_consumer_info (EventConsumerInfo consumer_info, + CONNECTION_ID connection_id) + { + + /// Save the consumer's disconnect info in a map. + this->consumer_info_map_.bind (connection_id, + consumer_info); + + } + + RtecEventComm::EventType + Events_Manager::find_rtec_type_id (CONNECTION_ID connection_id) + { + + RtecEventComm::EventType event_type_id; + + if (this->event_types_map_.find (connection_id, event_type_id) == -1) + { + event_type_id = + ACE_ES_EVENT_ANY + 1 + this->event_types_map_.current_size (); + this->event_types_map_.bind (connection_id, event_type_id); + } + + return event_type_id; + + } + + RtecEventComm::EventSourceID + Events_Manager::find_rtec_source_id (CONNECTION_ID connection_id) + { + + RtecEventComm::EventSourceID event_source_id; + + if (this->publishers_map_.find (connection_id, event_source_id) == -1) + { + event_source_id = + ACE_ES_EVENT_SOURCE_ANY + 1 + this->publishers_map_.current_size (); + this->publishers_map_.bind (connection_id, event_source_id); + } + + return event_source_id; + + }*/ + + // @@ George, not sure how we plan to get the svc.conf file options + // into the channel. Just a place holder to think about it. + void + EventService_Factory_impl::create_rt_event_channel ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_rt_event_channel\n")); + + TAO_EC_Event_Channel_Attributes attributes (this->root_poa_.in (), + this->root_poa_.in ()); + TAO_EC_Event_Channel * ec_servant; + ACE_NEW (ec_servant, TAO_EC_Event_Channel (attributes)); + ec_servant->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + this->rt_event_channel_ = ec_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + + void + EventService_Factory_impl::create_notify_channel ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_notify_channel\n")); + + CosNotifyChannelAdmin::EventChannelFactory_var notify_factory; + CosNotifyChannelAdmin::ChannelID id; + CosNotification::QoSProperties initial_qos; + CosNotification::AdminProperties initial_admin; + this->notify_channel_ = notify_factory->create_channel (initial_qos, + initial_admin, + id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + int + EventService_Factory_impl::Initializer (void) + { + return + ACE_Service_Config::process_directive ( + ace_svc_desc_EventService_Factory_impl + ); + } + + void EventService_Factory_impl::init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa) + { + this->orb_ = CORBA::ORB::_duplicate (orb); + this->root_poa_ = PortableServer::POA::_duplicate (poa); + } + +ACE_STATIC_SVC_DEFINE ( + EventService_Factory_impl, + ACE_TEXT ("CIAO_EventService_Factory"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (EventService_Factory_impl), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0 + ) + +ACE_FACTORY_DEFINE (CIAO_EVENTS, EventService_Factory_impl) + +} // namespace CIAO + diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory_impl.h b/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory_impl.h new file mode 100644 index 00000000000..f1c3837e3a5 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_EventService_Factory_impl.h @@ -0,0 +1,125 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory_impl.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICE_FACTORY_IMPL_H +#define CIAO_EVENTSERVICE_FACTORY_IMPL_H +#include /**/ "ace/pre.h" + +#include "CIAO_EventService_Factory.h" + +#include "orbsvcs/orbsvcs/RtecEventChannelAdminC.h" +#include "orbsvcs/orbsvcs/CosNotifyChannelAdminC.h" +#include "tao/PortableServer/PortableServer.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + + class CIAO_EVENTS_Export EventService_Factory_impl + : public virtual EventService_Factory + { + + public: + // @@ George, why don't you initialize with the POA pointer. Just + // curious. + EventService_Factory_impl (void); + + virtual ~EventService_Factory_impl (void); + + virtual Consumer_Config_ptr create_consumer_config (EventServiceType type); + + virtual Supplier_Config_ptr create_supplier_config (EventServiceType type); + + virtual EventServiceBase * create (EventServiceType type); + + virtual void init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa); + + // Used to force the initialization. + static int Initializer (void); + + //RtecEventComm::EventType find_rtec_type_id (CONNECTION_ID connection_id); + + //RtecEventComm::EventSourceID find_rtec_source_id (CONNECTION_ID connection_id); + + //EventConsumerInfo find_consumer_info (CONNECTION_ID connection_id); + + //void bind_consumer_info (EventConsumerInfo consumer_info, CONNECTION_ID connection_id); + + private: + + // @George, all these can be moved to a different + // library. Further, they probably need to be delegated to the + // underlying concrete type to create it for you instead of + // providing interfaces. + void create_rt_event_channel ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + void create_notify_channel ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + // Reference to the ORB + CORBA::ORB_var orb_; + + // Reference to the Root POA + PortableServer::POA_var root_poa_; + + /// Reference to the RT event channel + RtecEventChannelAdmin::EventChannel_var rt_event_channel_; + + /// Reference to the notification channel + CosNotifyChannelAdmin::EventChannel_var notify_channel_; + + /// Map of rt event type ids + //ACE_Hash_Map_Manager<CONNECTION_ID, RtecEventComm::EventType, ACE_Null_Mutex> + // event_types_map_; + + /// Map of rt supplier ids + //ACE_Hash_Map_Manager<CONNECTION_ID, RtecEventComm::EventSourceID, ACE_Null_Mutex> + // publishers_map_; + + /// Mapping of consumers to state/disconnect info. + //ACE_Hash_Map_Manager<CIAO_Events::CONNECTION_ID, + // CIAO_Events::EventConsumerInfo, + // ACE_Null_Mutex> consumer_info_map_; + + }; + +ACE_STATIC_SVC_DECLARE (EventService_Factory_impl) +ACE_FACTORY_DECLARE (CIAO_EVENTS, EventService_Factory_impl) + +} + +#if defined (ACE_HAS_BROKEN_STATIC_CONSTRUCTORS) + +typedef int (*CIAO_Module_Initializer) (void); + +static CIAO_Module_Initializer +CIAO_Requires_EventService_Initializer = + &CIAO::EventService_Factory_impl::Initializer; + +#else + +static int +CIAO_Requires_EventService_Initializer = + CIAO::EventService_Factory_impl::Initializer (); + +#endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */ + +#include /**/ "ace/post.h" +#endif /* CIAO_EVENTSERVICE_FACTORY_IMPL_H */ diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_Events.idl b/TAO/CIAO/DAnCE/ciao/CIAO_Events.idl new file mode 100644 index 00000000000..8533bc69afa --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_Events.idl @@ -0,0 +1,178 @@ +// $Id$ + +/** + * @file CIAO_Events.idl + * + * @author George Edwards <g.edwards@vanderbilt.edu> + * + * @brief Interfaces for configuring CIAO's event mechanism. + */ + +#include "CCM_Event.idl" + +module CIAO +{ + + /// A component's UUID + port name. + typedef string CONNECTION_ID; + + enum EventServiceType + { + DIRECT, + EC, + RTEC, + NOTIFY, + RTNOTIFY + }; + + interface Supplier_Config + { + + attribute CONNECTION_ID supplier_id; + + readonly attribute EventServiceType service_type; + + void destroy (); + + }; + + interface Consumer_Config : Supplier_Config + { + + attribute CONNECTION_ID consumer_id; + + attribute Components::EventConsumerBase consumer; + + }; + + interface ContainerEventService + { + + Supplier_Config create_supplier_config (in EventServiceType type); + + Consumer_Config create_consumer_config (in EventServiceType type); + + void connect_event_supplier (in Supplier_Config supplier_config); + + void disconnect_event_supplier (in CONNECTION_ID connection_id) + raises (Components::InvalidConnection, Components::InvalidName); + + void connect_event_consumer (in Consumer_Config consumer_config); + + void disconnect_event_consumer (in CONNECTION_ID connection_id) + raises (Components::InvalidConnection, Components::InvalidName); + + void push_event (in Components::EventBase ev, + in CONNECTION_ID connection_id); + }; + + /// An object for setting consumer QoS requirements. This will be expanded to + /// allow filtering, correlation, etc. A Consumer_Config object is passed as + /// a parameter to CIAO::Container::_ciao_connect_event_consumer (). + /// Consumer_Config objects are created via + /// CIAO::Container::_ciao_create_event_consumer_config (). + + // @@ George, We may want to define exceptions that would be used if + // the operations fail. + + // @@ George, here is one idea to decouple RtEC and + // Notification. How about this + + // interface Consumer_Config + // { + // attribute long supplier_id; + // attribute long consumer_id; + // attribute Components::EventConsumerBase consumer; + // readonly attribute EventServiceType service_type; + // }; + // + // In another IDL file for RTEvents + // + // interface RTEvent_Consumer_Config : Consumer_config + // { + // readonly attribute RtecEventChannelAdmin::ConsumerQOS rt_event_qos; + // }; + // + // In another IDL file put the Notification stuff. + // + // This is an idea. Just think over it. This wold give us the + // following + // 1. Keep RtEvent, Notification etc. stuff in a different library + // that we can load through the service configurator mechanism. + // 2. Decouple different services from polluting the CIAO container + // code. + // + // Please think about this and we can discuss when both of us find + // time. + // + // + /* + interface Consumer_Config + { + // @@ George, when you have time, could you please document the + // semantics of these methods? + + // Configuring methods. + void start_conjunction_group (in long size); + + void start_disjunction_group (in long size); + + // @@ George Can't we call it set_cupplier_id. Please see above. + void insert_supplier_id (in CONNECTION_ID connection_id); + + void set_consumer_id (in CONNECTION_ID connection_id); + + void set_consumer (in Components::EventConsumerBase consumer); + + // Access methods. + // @@ George, why not use "read only attributes" here? It would be + // nice if you have something like this + // + // readonly attribute consumer_id; // I would put this as an + // attribute since I see both read and write access.// + // readonly attribute supplier_id; + // ... + CONNECTION_ID get_consumer_id (); + + CONNECTION_ID get_supplier_id (); + + Components::EventConsumerBase get_consumer (); + + EventServiceType get_service_type (); + + // @@ George, see that this creates a tight coupling between all + // the event based services. Need to think of a way to decouple + // them and use only what we want ... This is okay for the first + // cut. + RtecEventChannelAdmin::ConsumerQOS get_rt_event_qos (); + + CosNotifyFilter::Filter get_notify_filter (); + + CosNotification::QoSProperties get_notify_qos (); + }; + + + /// An object for setting supplier QoS requirements. + /// Passed as a parameter to CIAO::Container::_ciao_connect_event_supplier (). + /// Created via CIAO::Container::_ciao_create_event_supplier_config (). + interface Supplier_Config + { + + // Configuring methods. + void set_supplier_id (in CONNECTION_ID connection_id); + + // @@ George same here ie. read only attributes. + // Access methods. + CONNECTION_ID get_supplier_id (); + + EventServiceType get_service_type (); + + RtecEventChannelAdmin::SupplierQOS get_rt_event_qos (); + + CosNotifyFilter::Filter get_notify_filter (); + + CosNotification::QoSProperties get_notify_qos (); + }; + */ + +}; diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_Events_Export.h b/TAO/CIAO/DAnCE/ciao/CIAO_Events_Export.h new file mode 100644 index 00000000000..6678cef4bcc --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_Events_Export.h @@ -0,0 +1,53 @@ +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_EVENTS +// ------------------------------ +#ifndef CIAO_EVENTS_EXPORT_H +#define CIAO_EVENTS_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_EVENTS_HAS_DLL) +# define CIAO_EVENTS_HAS_DLL 1 +#endif /* ! CIAO_EVENTS_HAS_DLL */ + +#if defined (CIAO_EVENTS_HAS_DLL) && (CIAO_EVENTS_HAS_DLL == 1) +# if defined (CIAO_EVENTS_BUILD_DLL) +# define CIAO_EVENTS_Export ACE_Proper_Export_Flag +# define CIAO_EVENTS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_EVENTS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_EVENTS_BUILD_DLL */ +# define CIAO_EVENTS_Export ACE_Proper_Import_Flag +# define CIAO_EVENTS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_EVENTS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_EVENTS_BUILD_DLL */ +#else /* CIAO_EVENTS_HAS_DLL == 1 */ +# define CIAO_EVENTS_Export +# define CIAO_EVENTS_SINGLETON_DECLARATION(T) +# define CIAO_EVENTS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_EVENTS_HAS_DLL == 1 */ + +// Set CIAO_EVENTS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_EVENTS_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_EVENTS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_EVENTS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_EVENTS_NTRACE */ + +#if (CIAO_EVENTS_NTRACE == 1) +# define CIAO_EVENTS_TRACE(X) +#else /* (CIAO_EVENTS_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CIAO_EVENTS_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CIAO_EVENTS_NTRACE == 1) */ + +#endif /* CIAO_EVENTS_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.cpp b/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.cpp new file mode 100644 index 00000000000..a4b6b7610c6 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.cpp @@ -0,0 +1,504 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_RTEvent.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_RTEvent.h" + +namespace CIAO +{ + + RTEventService::RTEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + RtecEventChannelAdmin::EventChannel_ptr ec) : + orb_ (CORBA::ORB::_duplicate (orb)), + root_poa_ (PortableServer::POA::_duplicate (poa)), + rt_event_channel_ (RtecEventChannelAdmin::EventChannel::_duplicate (ec)), + type_id_ (ACE_ES_EVENT_ANY), + source_id_ (ACE_ES_EVENT_SOURCE_ANY) + { + } + + RTEventService::~RTEventService (void) + { + } + + void + RTEventService::connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + //ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventService::connect_event_supplier\n")); + + ACE_Hash<ACE_CString> hasher; + this->source_id_ = hasher (supplier_config->supplier_id (ACE_ENV_SINGLE_ARG_PARAMETER)); + ACE_CHECK; + this->type_id_ = this->source_id_; + + //ACE_DEBUG ((LM_DEBUG, "connect source id: %i\n", this->source_id_)); + + RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = + this->rt_event_channel_->for_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_ = + supplier_admin->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Create and register supplier servant + RTEventServiceSupplier_impl * supplier_servant = 0; + ACE_NEW (supplier_servant, + RTEventServiceSupplier_impl (root_poa_.in ())); + RtecEventComm::PushSupplier_var push_supplier = + supplier_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + RTEvent_Supplier_Config_ptr rt_config = + RTEvent_Supplier_Config::_narrow (supplier_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (rt_config)) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + + RtecEventChannelAdmin::SupplierQOS_var qos = + rt_config->rt_event_qos (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_->connect_push_supplier (push_supplier.in (), + qos.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + } + + void + RTEventService::connect_event_consumer ( + Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventService::connect_event_consumer\n")); + + Components::EventConsumerBase_var consumer = + consumer_config->consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (consumer)) + ACE_DEBUG ((LM_DEBUG, "nil event consumer\n")); + + RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = + this->rt_event_channel_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + RtecEventChannelAdmin::ProxyPushSupplier_var proxy_supplier = + consumer_admin->obtain_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Create and register consumer servant + RTEventServiceConsumer_impl * consumer_servant = 0; + ACE_NEW (consumer_servant, + RTEventServiceConsumer_impl ( + root_poa_.in (), + consumer.in ())); + RtecEventComm::PushConsumer_var push_consumer = + consumer_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + RTEvent_Consumer_Config_ptr rt_config = + RTEvent_Consumer_Config::_narrow (consumer_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (rt_config)) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + + RtecEventChannelAdmin::ConsumerQOS_var qos = + rt_config->rt_event_qos (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + proxy_supplier->connect_push_consumer (push_consumer.in (), + qos.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_CString consumer_id = + consumer_config->consumer_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_supplier_map_.bind (consumer_id.c_str (), proxy_supplier._retn ()); + + } + + void + RTEventService::disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + + this->proxy_consumer_->disconnect_push_consumer ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // What to do with the consumers?! + + } + + void + RTEventService::disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + + RtecEventChannelAdmin::ProxyPushSupplier_var proxy_supplier; + + this->proxy_supplier_map_.unbind (connection_id, proxy_supplier); + + proxy_supplier->disconnect_push_supplier ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + } + + void + RTEventService::push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + //ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventService::push_event\n")); + + RtecEventComm::EventSet events (1); + events.length (1); + events[0].header.source = ACE_ES_EVENT_SOURCE_ANY; //this->source_id_; + events[0].header.type = ACE_ES_EVENT_ANY; //this->type_id_; + events[0].data.any_value <<= ev; + /** + * @@George, a place holder for reliable oneways if we get to + * support it. + */ + this->proxy_consumer_->push (events ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + } + + RTEventServiceSupplier_impl::RTEventServiceSupplier_impl ( + PortableServer::POA_ptr poa) : + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + void + RTEventServiceSupplier_impl::disconnect_push_supplier (void) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + RTEventServiceConsumer_impl::RTEventServiceConsumer_impl ( + PortableServer::POA_ptr poa, + Components::EventConsumerBase_ptr consumer) : + poa_ (PortableServer::POA::_duplicate (poa)), + event_consumer_ (Components::EventConsumerBase::_duplicate (consumer)) + { + } + + void + RTEventServiceConsumer_impl::push (const RtecEventComm::EventSet& events) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + //ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventServiceConsumer_impl::push\n")); + + for (size_t i = 0; i < events.length (); ++i) + { + Components::EventBase * ev; + if (events[i].data.any_value >>= ev) + { + ev->_add_ref (); + this->event_consumer_->push_event (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + } + + void + RTEventServiceConsumer_impl::disconnect_push_consumer (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + //ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventServiceConsumer_impl::disconnect_push_consumer\n")); + + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + RTEvent_Consumer_Config_impl::RTEvent_Consumer_Config_impl (PortableServer::POA_ptr poa) : + service_type_ (RTEC), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + RTEvent_Consumer_Config_impl::~RTEvent_Consumer_Config_impl (void) + { + ACE_DEBUG + ((LM_DEBUG, "RTEvent_Consumer_Config_impl::~RTEvent_Consumer_Config_impl\n")); + } + + void + RTEvent_Consumer_Config_impl::start_conjunction_group ( + CORBA::Long size ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->qos_.start_conjunction_group (size); + } + + void + RTEvent_Consumer_Config_impl::start_disjunction_group ( + CORBA::Long size + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->qos_.start_disjunction_group (size); + } + + void + RTEvent_Consumer_Config_impl::insert_source ( + const char * source_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_Hash<ACE_CString> hasher; + RtecEventComm::EventSourceID int_source_id = + hasher (source_id); + + this->qos_.insert (int_source_id, + int_source_id, + 0); + } + + void + RTEvent_Consumer_Config_impl::consumer_id ( + const char * consumer_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "RTEvent_Consumer_Config_impl::set_consumer_id\n")); + + this->consumer_id_ = consumer_id; + } + + void + RTEvent_Consumer_Config_impl::supplier_id ( + const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "RTEvent_Consumer_Config_impl::set_supplier_id\n")); + + this->supplier_id_ = supplier_id; + + ACE_Hash<ACE_CString> hasher; + RtecEventComm::EventSourceID source_id = + hasher (this->supplier_id_.c_str ()); + + this->qos_.start_disjunction_group (1); + this->qos_.insert (source_id, + source_id, + 0); + } + + void + RTEvent_Consumer_Config_impl::consumer ( + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->consumer_ = Components::EventConsumerBase::_duplicate (consumer); + } + + CONNECTION_ID + RTEvent_Consumer_Config_impl::consumer_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->consumer_id_.c_str ()); + } + + CONNECTION_ID + RTEvent_Consumer_Config_impl::supplier_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "RTEvent_Consumer_Config_impl::get_supplier_id\n")); + + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + RTEvent_Consumer_Config_impl::service_type ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return this->service_type_; + } + + Components::EventConsumerBase_ptr + RTEvent_Consumer_Config_impl::consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + ACE_DEBUG ((LM_DEBUG, "RTEvent_Consumer_Config_impl::get_consumer\n")); + + return Components::EventConsumerBase::_duplicate (this->consumer_.in ()); + } + + RtecEventChannelAdmin::ConsumerQOS * + RTEvent_Consumer_Config_impl::rt_event_qos ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + RtecEventChannelAdmin::ConsumerQOS * consumer_qos = 0; + ACE_NEW_RETURN (consumer_qos, + RtecEventChannelAdmin::ConsumerQOS (this->qos_.get_ConsumerQOS ()), + 0); + return consumer_qos; + + } + + void + RTEvent_Consumer_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG + ((LM_DEBUG, "RTEvent_Consumer_Config_impl::destroy\n")); + + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + RTEvent_Supplier_Config_impl::RTEvent_Supplier_Config_impl (PortableServer::POA_ptr poa) : + service_type_ (RTEC), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + RTEvent_Supplier_Config_impl::~RTEvent_Supplier_Config_impl (void) + { + ACE_DEBUG + ((LM_DEBUG, "RTEvent_Supplier_Config_impl::~RTEvent_Supplier_Config_impl\n")); + } + + void + RTEvent_Supplier_Config_impl::supplier_id ( + const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + + ACE_Hash<ACE_CString> hasher; + RtecEventComm::EventSourceID source_id = + hasher (this->supplier_id_.c_str ()); + + ACE_DEBUG ((LM_DEBUG, "supplier's source id: %i\n", source_id)); + + this->qos_.insert (source_id, + source_id, + 0, + 1); + } + + CONNECTION_ID + RTEvent_Supplier_Config_impl::supplier_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + RTEvent_Supplier_Config_impl::service_type ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return this->service_type_; + } + + RtecEventChannelAdmin::SupplierQOS * + RTEvent_Supplier_Config_impl::rt_event_qos ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + RtecEventChannelAdmin::SupplierQOS * supplier_qos = 0; + ACE_NEW_RETURN (supplier_qos, RtecEventChannelAdmin::SupplierQOS (this->qos_.get_SupplierQOS ()), 0); + return supplier_qos; + + } + + void + RTEvent_Supplier_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + +} diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.h b/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.h new file mode 100644 index 00000000000..bc360ce60a7 --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.h @@ -0,0 +1,309 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_RTEvent.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_RTEVENT_H +#define CIAO_RTEVENT_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventServiceBase.h" +#include "CIAO_RTEventS.h" + +#include "ace/Hash_Map_Manager.h" +#include "orbsvcs/orbsvcs/Event_Utilities.h" + +namespace CIAO +{ + + /** + * @class RTEventService + * + * An implementation of EventServiceBase using the RT event channel. + */ + class RTEventService : + public virtual EventServiceBase + { + + public: + + RTEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + RtecEventChannelAdmin::EventChannel_ptr ec); + + virtual ~RTEventService (void); + + virtual void connect_event_supplier ( + CIAO::Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void connect_event_consumer ( + CIAO::Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + // Reference to the ORB + CORBA::ORB_var orb_; + + // Reference to the Root POA + PortableServer::POA_var root_poa_; + + /** + * @var RtecEventChannelAdmin::EventChannel_var rt_event_channel_ + * + * Reference to the RT event channel. + */ + RtecEventChannelAdmin::EventChannel_var rt_event_channel_; + + /** + * @var RtecEventComm::EventType type_id_ + * + * The type of event. + */ + RtecEventComm::EventType type_id_; + + /** + * @var RtecEventComm::EventSourceID source_id_ + * + * The supplier id. + */ + RtecEventComm::EventSourceID source_id_; + + /** + * @var RtecEventChannelAdmin::ProxyPushConsumer_var proxy_consumer_ + * + * The proxy consumer to which events are pushed. + */ + RtecEventChannelAdmin::ProxyPushConsumer_var proxy_consumer_; + + /** + * @var ACE_Hash_Map_Manager<> proxy_supplier_map_ + * + * Mapping of each event sink to a proxy supplier for disconnect purposes. + */ + ACE_Hash_Map_Manager_Ex<ACE_CString, + RtecEventChannelAdmin::ProxyPushSupplier_ptr, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> proxy_supplier_map_; + + }; + + /** + * @class RTEventServiceSupplier_impl + * + * An implementation of the PushSupplier interface. + */ + class RTEventServiceSupplier_impl : + public virtual POA_RtecEventComm::PushSupplier, + public virtual PortableServer::RefCountServantBase + { + + public: + + RTEventServiceSupplier_impl ( + PortableServer::POA_ptr poa); + + virtual void disconnect_push_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + PortableServer::POA_var poa_; + + }; + + /** + * @class RTEventServiceConsumer_impl + * + * An implementation of the PushConsumer interface. + */ + class RTEventServiceConsumer_impl : + public virtual POA_RtecEventComm::PushConsumer, + public virtual PortableServer::RefCountServantBase + { + + public: + + RTEventServiceConsumer_impl ( + PortableServer::POA_ptr poa, + Components::EventConsumerBase_ptr consumer); + + virtual void push ( + const RtecEventComm::EventSet& events) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void disconnect_push_consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + PortableServer::POA_var poa_; + + Components::EventConsumerBase_var event_consumer_; + + }; + + /** + * @class RTEvent_Consumer_Config_impl + * + * Implementation of the RTEvent_Consumer_Config IDL interface that + * configures TAO's RT event channel. An object of this type will be returned + * from @c CIAO::Container::create_consumer_config () when @c RTEC is + * specified as the event service type. + */ + class RTEvent_Consumer_Config_impl : + public virtual POA_CIAO::RTEvent_Consumer_Config, + public virtual PortableServer::RefCountServantBase + { + + public: + + RTEvent_Consumer_Config_impl (PortableServer::POA_ptr poa); + + virtual ~RTEvent_Consumer_Config_impl (void); + + virtual void start_conjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void start_disjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void insert_source (const char * source_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer_id (const char * consumer_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID consumer_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Components::EventConsumerBase_ptr consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual RtecEventChannelAdmin::ConsumerQOS * rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString consumer_id_; + + ACE_CString supplier_id_; + + Components::EventConsumerBase_var consumer_; + + EventServiceType service_type_; + + ACE_ConsumerQOS_Factory qos_; + + PortableServer::POA_var poa_; + + }; + + /** + * @class RTEvent_Supplier_Config_impl + * + * Implementation of the RTEvent_Supplier_Config IDL interface that + * configures TAO's RT event channel. An object of this type will be returned + * from @c CIAO::Container::create_supplier_config () when @c RTEC is + * specified as the event service type. + */ + class RTEvent_Supplier_Config_impl : + public virtual POA_CIAO::RTEvent_Supplier_Config, + public virtual PortableServer::RefCountServantBase + { + + public: + + RTEvent_Supplier_Config_impl (PortableServer::POA_ptr poa); + + virtual ~RTEvent_Supplier_Config_impl (void); + + void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + RtecEventChannelAdmin::SupplierQOS * rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString supplier_id_; + + EventServiceType service_type_; + + ACE_SupplierQOS_Factory qos_; + + PortableServer::POA_var poa_; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_RTEVENT_H */ diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.idl b/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.idl new file mode 100644 index 00000000000..a87988b074f --- /dev/null +++ b/TAO/CIAO/DAnCE/ciao/CIAO_RTEvent.idl @@ -0,0 +1,48 @@ +// $Id$ + +/** + * @file CIAO_RTEvent.idl + * + * @author George Edwards + * + * @brief Interfaces for configuring CIAO's RT event channel. + */ + +#include "CIAO_Events.idl" +#include <orbsvcs/orbsvcs/RtecEventChannelAdmin.idl> + +module CIAO +{ + + interface RTEvent_Consumer_Config : + Consumer_Config + { + + void start_conjunction_group (in long size); + + void start_disjunction_group (in long size); + + void insert_source (in CONNECTION_ID source_id); + + //void start_logical_and_group (in long size); + + //void start_negation (); + + //void insert_bitmasked_value (in long source_mask, + // in long type_mask, + // in long source_value, + // in long type_value); + + readonly attribute RtecEventChannelAdmin::ConsumerQOS rt_event_qos; + + }; + + interface RTEvent_Supplier_Config : + Supplier_Config + { + + readonly attribute RtecEventChannelAdmin::SupplierQOS rt_event_qos; + + }; + +}; |