diff options
Diffstat (limited to 'TAO/orbsvcs')
20 files changed, 617 insertions, 19 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp index c65c674881f..582112f90d7 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp @@ -31,8 +31,8 @@ void TAO_EC_ConsumerAdmin::connected (TAO_EC_ProxyPushConsumer *consumer, CORBA::Environment &ACE_TRY_ENV) { - SupplierSetIterator end = this->all_suppliers_.end (); - for (SupplierSetIterator i = this->all_suppliers_.begin (); + SupplierSetIterator end = this->end (); + for (SupplierSetIterator i = this->begin (); i != end; ++i) { @@ -44,8 +44,8 @@ void TAO_EC_ConsumerAdmin::disconnected (TAO_EC_ProxyPushConsumer *consumer, CORBA::Environment &ACE_TRY_ENV) { - SupplierSetIterator end = this->all_suppliers_.end (); - for (SupplierSetIterator i = this->all_suppliers_.begin (); + SupplierSetIterator end = this->end (); + for (SupplierSetIterator i = this->begin (); i != end; ++i) { @@ -87,3 +87,15 @@ TAO_EC_ConsumerAdmin::_default_POA (CORBA::Environment&) { return PortableServer::POA::_duplicate (this->default_POA_.in ()); } + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Unbounded_Set<TAO_EC_ProxyPushSupplier*>; +template class ACE_Unbounded_Set_Iterator<TAO_EC_ProxyPushSupplier*>; + +#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Unbounded_Set<TAO_EC_ProxyPushSupplier*> +#pragma instantiate ACE_Unbounded_Set_Iterator<TAO_EC_ProxyPushSupplier*> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h index 3c2c2176f6f..6bdee9c1e99 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h @@ -71,6 +71,13 @@ public: virtual ~TAO_EC_ConsumerAdmin (void); // destructor... + typedef ACE_Unbounded_Set<TAO_EC_ProxyPushSupplier*> SupplierSet; + typedef ACE_Unbounded_Set_Iterator<TAO_EC_ProxyPushSupplier*> SupplierSetIterator; + + SupplierSetIterator begin (void); + SupplierSetIterator end (void); + // Iterators over the set of ProxyPushSuppliers + void set_default_POA (PortableServer::POA_ptr poa); // Set this servant's default POA @@ -102,8 +109,6 @@ private: PortableServer::POA_var default_POA_; // Store the default POA. - typedef ACE_Unbounded_Set<TAO_EC_ProxyPushSupplier*> SupplierSet; - typedef ACE_Unbounded_Set_Iterator<TAO_EC_ProxyPushSupplier*> SupplierSetIterator; SupplierSet all_suppliers_; }; diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.i b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.i index cfa1da318d3..061e81dba2b 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.i +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.i @@ -1 +1,13 @@ // $Id$ + +ACE_INLINE TAO_EC_ConsumerAdmin::SupplierSetIterator +TAO_EC_ConsumerAdmin::begin (void) +{ + return this->all_suppliers_.begin (); +} + +ACE_INLINE TAO_EC_ConsumerAdmin::SupplierSetIterator +TAO_EC_ConsumerAdmin::end (void) +{ + return this->all_suppliers_.end (); +} diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h index f4814447695..f9fabc650ec 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h @@ -69,7 +69,7 @@ public: CORBA::Environment& env) = 0; virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy, RtecEventComm::EventSet& event, - const TAO_EC_QOS_Info& qos_info, + TAO_EC_QOS_Info& qos_info, CORBA::Environment& env) = 0; // The consumer represented by <proxy> should receive <event>. // It can use the information in <qos_info> to determine the event @@ -78,7 +78,7 @@ public: // **************************************************************** -class TAO_EC_Reactive_Dispatching +class TAO_EC_Reactive_Dispatching : public TAO_EC_Dispatching { // = TITLE // Dispatch using the caller thread. diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h index 21b92ed273f..08a78dec01a 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h @@ -114,4 +114,4 @@ public: #include "EC_Factory.i" #endif /* __ACE_INLINE__ */ -#endif /* TAO_EC_FILTER_H */ +#endif /* TAO_EC_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h index 4f03d363efc..d8d6b8e29eb 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h @@ -60,7 +60,7 @@ public: // **************************************************************** -class TAO_EC_Null_Filter_Builder +class TAO_EC_Null_Filter_Builder : public TAO_EC_Filter_Builder { // = TITLE // A simple implementation of the filter builder. diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.cpp new file mode 100644 index 00000000000..c0de22b6a02 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.cpp @@ -0,0 +1,126 @@ +// $Id$ + +#include "EC_Null_Factory.h" +#include "EC_Dispatching.h" +#include "EC_Filter_Builder.h" +#include "EC_ConsumerAdmin.h" +#include "EC_SupplierAdmin.h" +#include "EC_ProxyConsumer.h" +#include "EC_ProxySupplier.h" +#include "EC_SupplierFiltering.h" +#include "Timer_Module.h" + +#if ! defined (__ACE_INLINE__) +#include "EC_Null_Factory.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(Event, EC_Null_Factory, "$Id$") + +TAO_EC_Null_Factory::~TAO_EC_Null_Factory (void) +{ + delete this->supplier_filtering_; + this->supplier_filtering_ = 0; +} + +TAO_EC_Dispatching* +TAO_EC_Null_Factory::create_dispatching (TAO_EC_Event_Channel *) +{ + return new TAO_EC_Reactive_Dispatching (); +} + +void +TAO_EC_Null_Factory::destroy_dispatching (TAO_EC_Dispatching *x) +{ + delete x; +} + +TAO_EC_Filter_Builder* +TAO_EC_Null_Factory::create_filter_builder (TAO_EC_Event_Channel *) +{ + return new TAO_EC_Null_Filter_Builder; +} + +void +TAO_EC_Null_Factory::destroy_filter_builder (TAO_EC_Filter_Builder *x) +{ + delete x; +} + +TAO_EC_ConsumerAdmin* +TAO_EC_Null_Factory::create_consumer_admin (TAO_EC_Event_Channel *ec) +{ + return new TAO_EC_ConsumerAdmin (ec); +} + +void +TAO_EC_Null_Factory::destroy_consumer_admin (TAO_EC_ConsumerAdmin *x) +{ + delete x; +} + +TAO_EC_SupplierAdmin* +TAO_EC_Null_Factory::create_supplier_admin (TAO_EC_Event_Channel *ec) +{ + return new TAO_EC_SupplierAdmin (ec); +} + +void +TAO_EC_Null_Factory::destroy_supplier_admin (TAO_EC_SupplierAdmin *x) +{ + delete x; +} + +TAO_EC_ProxyPushSupplier* +TAO_EC_Null_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel *ec) +{ + return new TAO_EC_ProxyPushSupplier (ec); +} + +void +TAO_EC_Null_Factory::destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier *x) +{ + delete x; +} + +TAO_EC_ProxyPushConsumer* +TAO_EC_Null_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel *ec) +{ + if (this->supplier_filtering_ == 0) + ACE_NEW_RETURN (this->supplier_filtering_, + TAO_EC_Null_SupplierFiltering (ec), + 0); + return new TAO_EC_ProxyPushConsumer (ec, this->supplier_filtering_); +} + +void +TAO_EC_Null_Factory::destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer *x) +{ + delete x; +} + +TAO_EC_Timer_Module* +TAO_EC_Null_Factory::create_timer_module (TAO_EC_Event_Channel *ec) +{ + // @@ TODO fixme + TAO_ORB_Core* orb_core = TAO_ORB_Core_instance (); + return new TAO_EC_ST_Timer_Module (orb_core->reactor ()); +} + +void +TAO_EC_Null_Factory::destroy_timer_module (TAO_EC_Timer_Module *x) +{ + delete x; +} + +PortableServer::POA_ptr +TAO_EC_Null_Factory::consumer_poa (CORBA::Environment&) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +PortableServer::POA_ptr +TAO_EC_Null_Factory::supplier_poa (CORBA::Environment&) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.h new file mode 100644 index 00000000000..714ea980582 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.h @@ -0,0 +1,107 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Real-time Event Channel +// +// = FILENAME +// EC_Filter +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = DESCRIPTION +// A factory for a simple event channel: no filtering or any +// real-time features. +// +// = CREDITS +// Based on previous work by Tim Harrison (harrison@cs.wustl.edu) +// and other members of the DOC group. +// More details can be found in: +// http://www.cs.wustl.edu/~schmidt/oopsla.ps.gz +// http://www.cs.wustl.edu/~schmidt/JSAC-98.ps.gz +// +// +// ============================================================================ + +#ifndef TAO_EC_NULL_FACTORY_H +#define TAO_EC_NULL_FACTORY_H + +#include "EC_Factory.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class TAO_EC_SupplierFiltering; + +class TAO_EC_Null_Factory : public TAO_EC_Factory +{ + // = TITLE + // The factory for a simple event channel. + // + // = DESCRIPTION + // The simplest configuration for an event channel does no + // filtering and uses reactive dispatching. This class is used to + // configure such an event channel. + // A fixed POA is used for servant activation. + // This object creates a single instance of the Supplier + // + // = MEMORY MANAGMENT + // +public: + TAO_EC_Null_Factory (PortableServer::POA_ptr poa); + // Constructor + + virtual ~TAO_EC_Null_Factory (void); + // destructor... + + // = The EC_Factory methods + virtual TAO_EC_Dispatching* + create_dispatching (TAO_EC_Event_Channel*); + virtual void + destroy_dispatching (TAO_EC_Dispatching*); + virtual TAO_EC_Filter_Builder* + create_filter_builder (TAO_EC_Event_Channel*); + virtual void + destroy_filter_builder (TAO_EC_Filter_Builder*); + virtual TAO_EC_ConsumerAdmin* + create_consumer_admin (TAO_EC_Event_Channel*); + virtual void + destroy_consumer_admin (TAO_EC_ConsumerAdmin*); + virtual TAO_EC_SupplierAdmin* + create_supplier_admin (TAO_EC_Event_Channel*); + virtual void + destroy_supplier_admin (TAO_EC_SupplierAdmin*); + virtual TAO_EC_ProxyPushSupplier* + create_proxy_push_supplier (TAO_EC_Event_Channel*); + virtual void + destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*); + virtual TAO_EC_ProxyPushConsumer* + create_proxy_push_consumer (TAO_EC_Event_Channel*); + virtual void + destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*); + virtual TAO_EC_Timer_Module* + create_timer_module (TAO_EC_Event_Channel*); + virtual void + destroy_timer_module (TAO_EC_Timer_Module*); + virtual PortableServer::POA_ptr + consumer_poa (CORBA::Environment& env); + virtual PortableServer::POA_ptr + supplier_poa (CORBA::Environment& env); + +private: + PortableServer::POA_var poa_; + // The POA + + TAO_EC_SupplierFiltering* supplier_filtering_; + // The filtering strategy +}; + +#if defined (__ACE_INLINE__) +#include "EC_Null_Factory.i" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_EC_NULL_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.i b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.i new file mode 100644 index 00000000000..fc4fe54600b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Null_Factory.i @@ -0,0 +1,7 @@ +// $Id$ + +ACE_INLINE +TAO_EC_Null_Factory::TAO_EC_Null_Factory (PortableServer::POA_ptr poa) + : poa_ (PortableServer::POA::_duplicate (poa)) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp index a5fd3ccf946..35bc2b5a54a 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp @@ -2,6 +2,7 @@ #include "EC_ProxyConsumer.h" #include "EC_Event_Channel.h" +#include "EC_SupplierFiltering.h" #if ! defined (__ACE_INLINE__) #include "EC_ProxyConsumer.i" @@ -9,9 +10,13 @@ ACE_RCSID(Event, EC_ProxyConsumer, "$Id$") -TAO_EC_ProxyPushConsumer::TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel* ec) - : event_channel_ (ec) +TAO_EC_ProxyPushConsumer:: + TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel* ec, + TAO_EC_SupplierFiltering* filtering) + : event_channel_ (ec), + supplier_filtering_ (filtering) { + this->supplier_filtering_->bind (this); } TAO_EC_ProxyPushConsumer::~TAO_EC_ProxyPushConsumer (void) @@ -32,6 +37,20 @@ TAO_EC_ProxyPushConsumer::_default_POA (CORBA::Environment&) } void +TAO_EC_ProxyPushConsumer::connected (TAO_EC_ProxyPushSupplier* supplier, + CORBA::Environment &ACE_TRY_ENV) +{ + this->supplier_filtering_->connected (supplier, ACE_TRY_ENV); +} + +void +TAO_EC_ProxyPushConsumer::disconnected (TAO_EC_ProxyPushSupplier* supplier, + CORBA::Environment &ACE_TRY_ENV) +{ + this->supplier_filtering_->disconnected (supplier, ACE_TRY_ENV); +} + +void TAO_EC_ProxyPushConsumer::connected (TAO_EC_ProxyPushConsumer*, CORBA::Environment &) { @@ -61,6 +80,13 @@ TAO_EC_ProxyPushConsumer::connect_push_supplier ( } void +TAO_EC_ProxyPushConsumer::push (const RtecEventComm::EventSet& event, + CORBA::Environment &ACE_TRY_ENV) +{ + this->supplier_filtering_->push (event, ACE_TRY_ENV); +} + +void TAO_EC_ProxyPushConsumer::disconnect_push_consumer ( CORBA::Environment &ACE_TRY_ENV) { @@ -78,4 +104,3 @@ TAO_EC_ProxyPushConsumer::disconnect_push_consumer ( this->event_channel_->destroy_proxy_push_consumer (this); } - diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h index e109cd4b0b8..a3ed1226dec 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h @@ -40,6 +40,7 @@ class TAO_EC_Event_Channel; class TAO_EC_ProxyPushSupplier; +class TAO_EC_SupplierFiltering; class TAO_EC_ProxyPushConsumer : public POA_RtecEventChannelAdmin::ProxyPushConsumer { @@ -53,6 +54,8 @@ class TAO_EC_ProxyPushConsumer : public POA_RtecEventChannelAdmin::ProxyPushCons // = MEMORY MANAGMENT // It makes a copy of the SupplierQOS and the supplier object // reference. + // It assumes ownership of the SupplierFiltering, but requests + // destruction through the Event Channel. // The object commits suicide when disconnect_push_consumer() is // called. // @@ -61,7 +64,8 @@ class TAO_EC_ProxyPushConsumer : public POA_RtecEventChannelAdmin::ProxyPushCons // externally. // public: - TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel* event_channel); + TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel* event_channel, + TAO_EC_SupplierFiltering* filtering); // constructor... virtual ~TAO_EC_ProxyPushConsumer (void); @@ -78,9 +82,9 @@ public: // The QoS (subscription) used to connect to the EC. virtual void connected (TAO_EC_ProxyPushSupplier* supplier, - CORBA::Environment &env) = 0; + CORBA::Environment &env); virtual void disconnected (TAO_EC_ProxyPushSupplier* supplier, - CORBA::Environment &env) = 0; + CORBA::Environment &env); // Concrete implementations can use this methods to keep track of // the consumers interested in this events. @@ -103,13 +107,16 @@ public: const RtecEventChannelAdmin::SupplierQOS& qos, CORBA::Environment &); virtual void push (const RtecEventComm::EventSet& event, - CORBA::Environment &) = 0; + CORBA::Environment &); virtual void disconnect_push_consumer (CORBA::Environment &); private: TAO_EC_Event_Channel* event_channel_; // The supplier admin, used for activation and memory managment. + TAO_EC_SupplierFiltering* supplier_filtering_; + // The strategy to do filtering close to the supplier + RtecEventComm::PushSupplier_var supplier_; // The supplier.... diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp index f2f24deb0f0..6eb51e573f3 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp @@ -33,6 +33,18 @@ TAO_EC_ProxyPushSupplier::_default_POA (CORBA::Environment&) } void +TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushConsumer*, + CORBA::Environment &) +{ +} + +void +TAO_EC_ProxyPushSupplier::disconnected (TAO_EC_ProxyPushConsumer*, + CORBA::Environment &) +{ +} + +void TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushSupplier*, CORBA::Environment &) { diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h index eb4f145fcc9..2a91d058cd7 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h @@ -86,9 +86,9 @@ public: // The QoS (subscription) used to connect to the EC. virtual void connected (TAO_EC_ProxyPushConsumer* consumer, - CORBA::Environment &env) = 0; + CORBA::Environment &env); virtual void disconnected (TAO_EC_ProxyPushConsumer* consumer, - CORBA::Environment &env) = 0; + CORBA::Environment &env); // Concrete implementations can use this methods to keep track of // the suppliers that publish its events. diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.cpp new file mode 100644 index 00000000000..a2c8154ff76 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.cpp @@ -0,0 +1,9 @@ +// $Id$ + +#include "EC_QOS_Info.h" + +#if ! defined (__ACE_INLINE__) +#include "EC_QOS_Info.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(Event, EC_QOS_Info, "$Id$") diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.h b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.h new file mode 100644 index 00000000000..d9c1ad87fc3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.h @@ -0,0 +1,56 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Real-time Event Channel +// +// = FILENAME +// EC_Event_Channel +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = DESCRIPTION +// Filters compute QOS information for real-time dispatching, this +// class encapsulates that information. +// +// = CREDITS +// Based on previous work by Tim Harrison (harrison@cs.wustl.edu) +// and other members of the DOC group. +// More details can be found in: +// http://www.cs.wustl.edu/~schmidt/oopsla.ps.gz +// http://www.cs.wustl.edu/~schmidt/JSAC-98.ps.gz +// +// ============================================================================ + +#ifndef TAO_EC_QOS_INFO_H +#define TAO_EC_QOS_INFO_H + +#include "ace/OS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class TAO_EC_QOS_Info +{ + // = TITLE + // A representation of QoS information for the event channel + // filters. + // + // = DESCRIPTION + // This first implementation is just a place-holder. + // +public: + TAO_EC_QOS_Info (void); + // constructor + +}; + +#if defined (__ACE_INLINE__) +#include "EC_QOS_Info.i" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_EC_EVENT_CHANNEL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.i b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.i new file mode 100644 index 00000000000..2e50c43a45f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_QOS_Info.i @@ -0,0 +1,6 @@ +// $Id$ + +ACE_INLINE +TAO_EC_QOS_Info::TAO_EC_QOS_Info (void) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp index f9ae7452d63..395a17319c3 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp @@ -86,3 +86,15 @@ TAO_EC_SupplierAdmin::obtain_push_consumer (CORBA::Environment &ACE_TRY_ENV) return consumer->_this (ACE_TRY_ENV); } + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Unbounded_Set<TAO_EC_ProxyPushConsumer*>; +template class ACE_Unbounded_Set_Iterator<TAO_EC_ProxyPushConsumer*>; + +#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Unbounded_Set<TAO_EC_ProxyPushConsumer*> +#pragma instantiate ACE_Unbounded_Set_Iterator<TAO_EC_ProxyPushConsumer*> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.cpp new file mode 100644 index 00000000000..16e42f018cf --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.cpp @@ -0,0 +1,64 @@ +// $Id$ + +#include "EC_SupplierFiltering.h" +#include "EC_Event_Channel.h" +#include "EC_ConsumerAdmin.h" +#include "EC_ProxySupplier.h" +#include "EC_QOS_Info.h" + +#if ! defined (__ACE_INLINE__) +#include "EC_SupplierFiltering.i" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(Event, EC_SupplierFiltering, "$Id$") + +TAO_EC_SupplierFiltering::~TAO_EC_SupplierFiltering (void) +{ +} + +// **************************************************************** + +TAO_EC_Null_SupplierFiltering:: + TAO_EC_Null_SupplierFiltering (TAO_EC_Event_Channel* ec) + : event_channel_ (ec) +{ +} + +void +TAO_EC_Null_SupplierFiltering::bind (TAO_EC_ProxyPushConsumer*) +{ +} + +void +TAO_EC_Null_SupplierFiltering::connected (TAO_EC_ProxyPushSupplier*, + CORBA::Environment &) +{ +} + +void +TAO_EC_Null_SupplierFiltering::disconnected (TAO_EC_ProxyPushSupplier*, + CORBA::Environment &) +{ +} + +void +TAO_EC_Null_SupplierFiltering::push (const RtecEventComm::EventSet& event, + CORBA::Environment &ACE_TRY_ENV) +{ + TAO_EC_ConsumerAdmin* consumer_admin = + this->event_channel_->consumer_admin (); + TAO_EC_ConsumerAdmin::SupplierSetIterator end = + consumer_admin->end (); + + TAO_EC_QOS_Info qos_info; + for (TAO_EC_ConsumerAdmin::SupplierSetIterator i = + consumer_admin->begin (); + i != end; + ++i) + { + (*i)->filter (event, qos_info, ACE_TRY_ENV); + ACE_CHECK; + } +} + + diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.h b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.h new file mode 100644 index 00000000000..eb10232171d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.h @@ -0,0 +1,137 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Real-time Event Channel +// +// = FILENAME +// EC_SupplierFiltering +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// = DESCRIPTION +// Define the TAO_EC_SupplierFiltering interface and some simple +// implementations. +// +// = CREDITS +// Based on previous work by Tim Harrison (harrison@cs.wustl.edu) +// and other members of the DOC group. +// More details can be found in: +// http://www.cs.wustl.edu/~schmidt/oopsla.ps.gz +// http://www.cs.wustl.edu/~schmidt/JSAC-98.ps.gz +// +// +// ============================================================================ + +#ifndef TAO_EC_SUPPLIERFILTERING_H +#define TAO_EC_SUPPLIERFILTERING_H + +#include "orbsvcs/RtecEventCommC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class TAO_EC_ProxyPushSupplier; +class TAO_EC_ProxyPushConsumer; +class TAO_EC_Event_Channel; + +class TAO_EC_SupplierFiltering +{ + // = TITLE + // The strategy to handle filtering close to the supplier. + // + // = DESCRIPTION + // After an event is received by the a ProxyPushConsumer it must + // be dispatched to the right set of ProxyPushSuppliers; + // determining this set is the task of this class. + // Notice that this is an implicit form of filtering, because the + // ProxyPushSuppliers outside the set will *not* receive the + // event. + // + // Several implementations are possible: + // + // - Each ProxyPushConsumer keeps a list of ProxyPushSuppliers, + // using the subscriptions and publications to find potential + // matches. + // - Each ProxyPushConsumer keeps several such lists, indexed by + // event type and/or source, this has the advantage of further + // minimizing the set of ProxyPushSuppliers invoked. + // - A single list of consumers is kept (global for the event + // channel), such a list results is faster updates and requires + // an smaller memory footprint. + // - Multiple global lists are kept, indexed by type and/or + // source, this is a tradeoff between the solutions above. + // - No list is kept, the events are sent to the consumers which + // must filter out what they want, this is good when no + // filtering is wanted or when the amount of filtering is coarse + // i.e. each event goes to a large subset of the + // ProxyPushSuppliers. + // + // Different applications will require to use different + // implementations of this class; as usual the EC_Factory will + // create the right instance. + // +public: + virtual ~TAO_EC_SupplierFiltering (void); + // Destructor + + virtual void bind (TAO_EC_ProxyPushConsumer* consumer) = 0; + // Whenever a ProxyPushConsumer is initialized it calls this method + // to inform the FilteringStrategy of its identity. + // Strategies that do not keep ProxyPushConsumer specific + // information, or that are shared between multiple + // ProxyPushConsumers can ignore this message. + + virtual void connected (TAO_EC_ProxyPushSupplier* supplier, + CORBA::Environment &env) = 0; + virtual void disconnected (TAO_EC_ProxyPushSupplier* supplier, + CORBA::Environment &env) = 0; + // Concrete implementations can use this methods to keep track of + // the consumers interested in this events. + + virtual void push (const RtecEventComm::EventSet& event, + CORBA::Environment &) = 0; + // The ProxyPushConsumer delegates on this class to actually send + // the event. +}; + +// **************************************************************** + +class TAO_EC_Null_SupplierFiltering : public TAO_EC_SupplierFiltering +{ + // = TITLE + // A null filtering strategy. + // + // = DESCRIPTION + // This strategy does no filtering, it is useful for backends of + // the CosEventChannel, testing and broadcasters; it uses the + // ConsumerAdmin to find all the consumers and pushes the event to + // all of them. + // +public: + TAO_EC_Null_SupplierFiltering (TAO_EC_Event_Channel* ec); + // Constructor + + // = The TAO_EC_SupplierFiltering methods. + virtual void bind (TAO_EC_ProxyPushConsumer* consumer); + virtual void connected (TAO_EC_ProxyPushSupplier* supplier, + CORBA::Environment &env); + virtual void disconnected (TAO_EC_ProxyPushSupplier* supplier, + CORBA::Environment &env); + virtual void push (const RtecEventComm::EventSet& event, + CORBA::Environment &); + +private: + TAO_EC_Event_Channel *event_channel_; + // The event channel, used to locate the set of consumers. +}; + +#if defined (__ACE_INLINE__) +#include "EC_SupplierFiltering.i" +#endif /* __ACE_INLINE__ */ + +#endif /* TAO_EC_SUPPLIERFILTERING_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.i b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierFiltering.i @@ -0,0 +1 @@ +// $Id$ |