diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-01-26 03:00:32 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-01-26 03:00:32 +0000 |
commit | 956d36444a459de2726c9cba62cfd1a9807c65dc (patch) | |
tree | ade72a0fe596c3f672f85f5944ade3bf61a0a24d | |
parent | 75df533f2bfdfb5d5327e6e46089722c3dd4ac6d (diff) | |
download | ATCD-956d36444a459de2726c9cba62cfd1a9807c65dc.tar.gz |
ChangeLogTag:Mon Jan 25 17:24:50 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
21 files changed, 328 insertions, 100 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index b80066b4bfd..23b55e087be 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,5 +1,31 @@ Mon Jan 25 17:24:50 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + * orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp: + * orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h: + * orbsvcs/orbsvcs/Event/EC_Dispatching.h: + * orbsvcs/orbsvcs/Event/EC_Dispatching.i: + * orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp: + * orbsvcs/orbsvcs/Event/EC_Event_Channel.h: + * orbsvcs/orbsvcs/Event/EC_Event_Channel.i: + * orbsvcs/orbsvcs/Event/EC_Factory.h: + * orbsvcs/orbsvcs/Event/EC_Filter.h: + * orbsvcs/orbsvcs/Event/EC_Filter.i: + * orbsvcs/orbsvcs/Event/EC_Filter_Builder.h: + * orbsvcs/orbsvcs/Event/EC_Filter_Builder.i: + * orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp: + * orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h: + * orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i: + * orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp: + * orbsvcs/orbsvcs/Event/EC_ProxySupplier.h: + * orbsvcs/orbsvcs/Event/EC_ProxySupplier.i: + * orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp: + * orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h: + These files compile now, and are fairly complete, but I still + have to implement the TAO_EC_Filter hierarchy, the dispatching + strategies and a couple of example ProxySupplier/ProxyConsumer + classes. + We also need to implement the locking strategies. + * orbsvcs/orbsvcs/Makefile: Updated dependencies. diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp index 448933229fd..c65c674881f 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp @@ -1,6 +1,8 @@ // $Id$ +#include "orbsvcs/RtecEventChannelAdminC.h" #include "EC_ConsumerAdmin.h" +#include "EC_ProxySupplier.h" #include "EC_Event_Channel.h" #if ! defined (__ACE_INLINE__) @@ -64,17 +66,18 @@ TAO_EC_ConsumerAdmin::disconnected (TAO_EC_ProxyPushSupplier *supplier, CORBA::Environment &ACE_TRY_ENV) { if (this->all_suppliers_.remove (supplier) != 0) - ACE_THROW (RtecEventChannelAdmin::SUBSCRIPTION_ERROR ()); + ACE_THROW (RtecEventChannelAdmin::EventChannel::SUBSCRIPTION_ERROR ()); } RtecEventChannelAdmin::ProxyPushSupplier_ptr TAO_EC_ConsumerAdmin::obtain_push_supplier (CORBA::Environment &ACE_TRY_ENV) { TAO_EC_ProxyPushSupplier* supplier = - this->event_channel_->create_proxy_push_supplier (void); + this->event_channel_->create_proxy_push_supplier (); - supplier->set_default_POA ( - this->event_channel_->factory ()->supplier_POA ()); + PortableServer::POA_var poa = + this->event_channel_->supplier_poa (ACE_TRY_ENV); + supplier->set_default_POA (poa.in ()); return supplier->_this (ACE_TRY_ENV); } diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h index 6c0fb8332f6..3c2c2176f6f 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h @@ -27,10 +27,11 @@ // // ============================================================================ -#ifndef TAO_EC_PROXYSUPPLIER_H -#define TAO_EC_PROXYSUPPLIER_H +#ifndef TAO_EC_CONSUMERADMIN_H +#define TAO_EC_CONSUMERADMIN_H #include "ace/Containers.h" +#include "orbsvcs/RtecEventChannelAdminS.h" #include "orbsvcs/Event/EC_Filter.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -39,6 +40,7 @@ class TAO_EC_Event_Channel; class TAO_EC_ProxyPushSupplier; +class TAO_EC_ProxyPushConsumer; class TAO_EC_ConsumerAdmin : public POA_RtecEventChannelAdmin::ConsumerAdmin { @@ -109,4 +111,4 @@ private: #include "EC_ConsumerAdmin.i" #endif /* __ACE_INLINE__ */ -#endif /* TAO_EC_PROXYSUPPLIER_H */ +#endif /* TAO_EC_CONSUMERADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h index 0fecaa31896..126e478b0eb 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.h @@ -30,15 +30,17 @@ // // ============================================================================ -#ifndef TAO_EC_FILTER_H -#define TAO_EC_FILTER_H +#ifndef TAO_EC_DISPATCHING_H +#define TAO_EC_DISPATCHING_H -#include "orbsvcs/RtecEventComm.h" +#include "orbsvcs/RtecEventCommC.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +class TAO_EC_QOS_Info; + class TAO_EC_Dispatching { // = TITLE diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.i b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Dispatching.i @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp index a365a5325db..24dc5e9abd4 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp @@ -2,6 +2,10 @@ #include "EC_Event_Channel.h" #include "EC_Factory.h" +#include "EC_Dispatching.h" +#include "EC_ConsumerAdmin.h" +#include "EC_SupplierAdmin.h" +#include "Timer_Module.h" #if ! defined (__ACE_INLINE__) #include "EC_Event_Channel.i" @@ -49,12 +53,12 @@ TAO_EC_Event_Channel::activate (CORBA::Environment& ACE_TRY_ENV) PortableServer::POA_var supplier_poa = this->factory_->supplier_poa (ACE_TRY_ENV); ACE_CHECK; - this->supplier_admin_->set_default_poa (supplier_poa); + this->supplier_admin_->set_default_POA (supplier_poa.in ()); PortableServer::POA_var consumer_poa = this->factory_->consumer_poa (ACE_TRY_ENV); ACE_CHECK; - this->consumer_admin_->set_default_poa (consumer_poa); + this->consumer_admin_->set_default_POA (consumer_poa.in ()); } void diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h index 0be70b5e336..83462e1ffd5 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h @@ -33,14 +33,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "orbsvcs/RtecEventChannelAdminS.h" - -class TAO_EC_Dispatching; -class TAO_EC_Filter_Builder; -class TAO_EC_ConsumerAdmin; -class TAO_EC_SupplierAdmin; -class TAO_EC_Timer_Module; - -class TAO_EC_Factory; +#include "EC_Factory.h" class TAO_EC_Event_Channel : public POA_RtecEventChannelAdmin::EventChannel { @@ -85,6 +78,10 @@ public: void destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*); // Create and destroy a ProxyPushConsumer + PortableServer::POA_ptr supplier_poa (CORBA::Environment&); + PortableServer::POA_ptr consumer_poa (CORBA::Environment&); + // Access the supplier and consumer POAs from the factory. + virtual void connected (TAO_EC_ProxyPushConsumer*, CORBA::Environment&); virtual void disconnected (TAO_EC_ProxyPushConsumer*, @@ -138,7 +135,7 @@ private: TAO_EC_SupplierAdmin *supplier_admin_; // The SupplierAdmin implementation - TAO_EC_TimerModule *timer_module_; + TAO_EC_Timer_Module *timer_module_; // The timer module }; diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i index dd7c5aa4ae8..ccc0d58f161 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i @@ -3,31 +3,31 @@ ACE_INLINE TAO_EC_Dispatching* TAO_EC_Event_Channel::dispatching (void) const { - this->dispatching_; + return this->dispatching_; } ACE_INLINE TAO_EC_Filter_Builder* TAO_EC_Event_Channel::filter_builder (void) const { - this->filter_builder_; + return this->filter_builder_; } ACE_INLINE TAO_EC_ConsumerAdmin* TAO_EC_Event_Channel::consumer_admin (void) const { - this->consumer_admin_; + return this->consumer_admin_; } ACE_INLINE TAO_EC_SupplierAdmin* TAO_EC_Event_Channel::supplier_admin (void) const { - this->supplier_admin_; + return this->supplier_admin_; } ACE_INLINE TAO_EC_Timer_Module* TAO_EC_Event_Channel::timer_module (void) const { - this->timer_module_; + return this->timer_module_; } ACE_INLINE TAO_EC_ProxyPushSupplier* @@ -53,3 +53,15 @@ TAO_EC_Event_Channel::destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer* con { this->factory_->destroy_proxy_push_consumer (consumer); } + +ACE_INLINE PortableServer::POA_ptr +TAO_EC_Event_Channel::supplier_poa (CORBA::Environment &ACE_TRY_ENV) +{ + return this->factory_->supplier_poa (ACE_TRY_ENV); +} + +ACE_INLINE PortableServer::POA_ptr +TAO_EC_Event_Channel::consumer_poa (CORBA::Environment &ACE_TRY_ENV) +{ + return this->factory_->consumer_poa (ACE_TRY_ENV); +} diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h b/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h index 8199bc2c56f..21b92ed273f 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Factory.h @@ -60,37 +60,51 @@ public: virtual ~TAO_EC_Factory (void); // destructor... - TAO_EC_Dispatching* create_dispatching (TAO_EC_Event_Channel*) = 0; - void destroy_dispatching (TAO_EC_Dispatching*) = 0; + virtual TAO_EC_Dispatching* + create_dispatching (TAO_EC_Event_Channel*) = 0; + virtual void + destroy_dispatching (TAO_EC_Dispatching*) = 0; // Create and destroy the dispatching module. - TAO_EC_Filter_Builder* create_filter_builder (TAO_EC_Event_Channel*) = 0; - void destroy_filter_builder (TAO_EC_Filter_Builder*) = 0; + virtual TAO_EC_Filter_Builder* + create_filter_builder (TAO_EC_Event_Channel*) = 0; + virtual void + destroy_filter_builder (TAO_EC_Filter_Builder*) = 0; // Create and destroy the filter builder. - TAO_EC_ConsumerAdmin* create_consumer_admin (TAO_EC_Event_Channel*) = 0; - void destroy_consumer_admin (TAO_EC_ConsumerAdmin*) = 0; + virtual TAO_EC_ConsumerAdmin* + create_consumer_admin (TAO_EC_Event_Channel*) = 0; + virtual void + destroy_consumer_admin (TAO_EC_ConsumerAdmin*) = 0; // Create and destroy the consumer admin implementation. - TAO_EC_SupplierAdmin* create_supplier_admin (TAO_EC_Event_Channel*) = 0; - void destroy_supplier_admin (TAO_EC_SupplierAdmin*) = 0; + virtual TAO_EC_SupplierAdmin* + create_supplier_admin (TAO_EC_Event_Channel*) = 0; + virtual void + destroy_supplier_admin (TAO_EC_SupplierAdmin*) = 0; // Create and destroy the supplier admin implementation. - TAO_EC_ProxyPushSupplier* create_proxy_push_supplier (TAO_EC_Event_Channel*) = 0; - void destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*) = 0; + virtual TAO_EC_ProxyPushSupplier* + create_proxy_push_supplier (TAO_EC_Event_Channel*) = 0; + virtual void + destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*) = 0; // Create and destroy a ProxyPushSupplier - TAO_EC_ProxyPushConsumer* create_proxy_push_consumer (TAO_EC_Event_Channel*) = 0; - void destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*) = 0; + virtual TAO_EC_ProxyPushConsumer* + create_proxy_push_consumer (TAO_EC_Event_Channel*) = 0; + virtual void + destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*) = 0; // Create and destroy a ProxyPushConsumer - TAO_EC_Timer_Module* create_timer_module (TAO_EC_Event_Channel*) = 0; - void destroy_timer_module (TAO_EC_Timer_Module*) = 0; + virtual TAO_EC_Timer_Module* + create_timer_module (TAO_EC_Event_Channel*) = 0; + virtual void + destroy_timer_module (TAO_EC_Timer_Module*) = 0; // Create and destroy the timer module. - virtual void PortableServer::POA_ptr + virtual PortableServer::POA_ptr consumer_poa (CORBA::Environment& env) = 0; - virtual void PortableServer::POA_ptr + virtual PortableServer::POA_ptr supplier_poa (CORBA::Environment& env) = 0; // The Event Channel uses this methods to control the activation of // the run-time servants. diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.h b/TAO/orbsvcs/orbsvcs/Event/EC_Filter.h index ce6e256674b..76349661932 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Filter.h @@ -38,6 +38,7 @@ #ifndef TAO_EC_FILTER_H #define TAO_EC_FILTER_H +#include "ace/Containers.h" #include "orbsvcs/RtecEventCommC.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -64,7 +65,7 @@ public: virtual ~TAO_EC_Filter (void); // destructor... - TAO_EC_Filter* parent (void) const; + const TAO_EC_Filter* parent (void) const; // Obtain the parent of this filter. void adopt_child (TAO_EC_Filter* child); @@ -73,7 +74,7 @@ public: static int matches (const RtecEventComm::EventHeader& rhs, const RtecEventComm::EventHeader& lhs); // matches two event headers. - // @@ TODO: stragize this... + // @@ TODO: strategize this... virtual int filter (const RtecEventComm::EventSet& event, const TAO_EC_QOS_Info& qos_info, @@ -94,7 +95,9 @@ public: virtual CORBA::ULong max_event_size (void) const = 0; // Returns the maximum size of the events pushed by this filter. - virtual void event_ids (RtecEventComm::EventHeaderSet& headerset) = 0; + typedef ACE_Array<RtecEventComm::EventHeader> Headers; + + virtual void event_ids (Headers& headerset) = 0; // Compute the disjunction of all the event types that could be of // interest for this filter (and its children). @@ -105,7 +108,7 @@ private: // **************************************************************** -class TAO_EC_Trivial_Filter : public TAO_EC_Filter +class TAO_EC_Null_Filter : public TAO_EC_Filter { // = TITLE // @@ -114,7 +117,7 @@ class TAO_EC_Trivial_Filter : public TAO_EC_Filter // = MEMORY MANAGMENT // public: - TAO_EC_Trivial_Filter (void); + TAO_EC_Null_Filter (void); // constructor. // = The TAO_EC_Filter methods, please check the documentation in @@ -127,7 +130,7 @@ public: CORBA::Environment& env); virtual void clear (void); virtual CORBA::ULong max_event_size (void) const; - virtual void event_ids (RtecEventComm::EventHeaderSet& headerset); + virtual void event_ids (TAO_EC_Filter::Headers& headerset); }; // **************************************************************** @@ -152,7 +155,7 @@ public: CORBA::Environment& env); virtual void clear (void); virtual CORBA::ULong max_event_size (void) const; - virtual void event_ids (RtecEventComm::EventHeaderSet& headerset); + virtual void event_ids (TAO_EC_Filter::Headers& headerset); }; // **************************************************************** @@ -177,7 +180,7 @@ public: CORBA::Environment& env); virtual void clear (void); virtual CORBA::ULong max_event_size (void) const; - virtual void event_ids (RtecEventComm::EventHeaderSet& headerset); + virtual void event_ids (TAO_EC_Filter::Headers& headerset); }; // **************************************************************** @@ -202,7 +205,7 @@ public: CORBA::Environment& env); virtual void clear (void); virtual CORBA::ULong max_event_size (void) const; - virtual void event_ids (RtecEventComm::EventHeaderSet& headerset); + virtual void event_ids (TAO_EC_Filter::Headers& headerset); }; // **************************************************************** diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.i b/TAO/orbsvcs/orbsvcs/Event/EC_Filter.i index cfa1da318d3..367356df657 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter.i +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Filter.i @@ -1 +1,39 @@ // $Id$ + +ACE_INLINE +TAO_EC_Filter::TAO_EC_Filter (void) + : parent_ (0) +{ +} + +ACE_INLINE const TAO_EC_Filter* +TAO_EC_Filter::parent (void) const +{ + return this->parent_; +} + +ACE_INLINE int +TAO_EC_Filter::matches (const RtecEventComm::EventHeader& rhs, + const RtecEventComm::EventHeader& lhs) +{ + if ((rhs.source == 0 && rhs.type == 0) + || (lhs.source == 0 && lhs.type == 0)) + return 1; + + if (rhs.source == 0 || lhs.source == 0) + return rhs.type == lhs.type; + + if (rhs.type == 0 || lhs.type == 0) + return rhs.source == lhs.source; + + return (rhs.type == lhs.type && rhs.source == lhs.type); +} + +// **************************************************************** + +ACE_INLINE +TAO_EC_Null_Filter::TAO_EC_Null_Filter (void) +{ +} + +// **************************************************************** diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h index d208e59db41..1dc92b28c1a 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.h @@ -31,7 +31,7 @@ #ifndef TAO_EC_FILTER_BUILDER_H #define TAO_EC_FILTER_BUILDER_H -#include "orbsvcs/RtecEventChannelAdmin.h" +#include "orbsvcs/RtecEventChannelAdminC.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -49,8 +49,8 @@ public: virtual ~TAO_EC_Filter_Builder (void); // destructor... - TAO_EC_Filter* build (RtecEventChannelAdmin::ConsumerQOS& qos) const - = 0; + virtual TAO_EC_Filter* + build (RtecEventChannelAdmin::ConsumerQOS& qos) const = 0; // Create the filter, the caller must assume ownership of the filter // returned. diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.i b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Filter_Builder.i @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp new file mode 100644 index 00000000000..a5fd3ccf946 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp @@ -0,0 +1,81 @@ +// $Id$ + +#include "EC_ProxyConsumer.h" +#include "EC_Event_Channel.h" + +#if ! defined (__ACE_INLINE__) +#include "EC_ProxyConsumer.i" +#endif /* __ACE_INLINE__ */ + +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 (void) +{ +} + +void +TAO_EC_ProxyPushConsumer::set_default_POA (PortableServer::POA_ptr poa) +{ + this->default_POA_ = + PortableServer::POA::_duplicate (poa); +} + +PortableServer::POA_ptr +TAO_EC_ProxyPushConsumer::_default_POA (CORBA::Environment&) +{ + return PortableServer::POA::_duplicate (this->default_POA_); +} + +void +TAO_EC_ProxyPushConsumer::connected (TAO_EC_ProxyPushConsumer*, + CORBA::Environment &) +{ +} + +void +TAO_EC_ProxyPushConsumer::disconnected (TAO_EC_ProxyPushConsumer*, + CORBA::Environment &) +{ +} + +void +TAO_EC_ProxyPushConsumer::connect_push_supplier ( + RtecEventComm::PushSupplier_ptr push_supplier, + const RtecEventChannelAdmin::SupplierQOS& qos, + CORBA::Environment &ACE_TRY_ENV) +{ + if (this->is_connected ()) + ACE_THROW (RtecEventChannelAdmin::AlreadyConnected ()); + + this->supplier_ = + RtecEventComm::PushSupplier::_duplicate (push_supplier); + this->qos_ = qos; + + // Notify the event channel... + this->event_channel_->connected (this, ACE_TRY_ENV); +} + +void +TAO_EC_ProxyPushConsumer::disconnect_push_consumer ( + CORBA::Environment &ACE_TRY_ENV) +{ + this->supplier_ = + RtecEventComm::PushSupplier::_nil (); + + PortableServer::POA_var poa = + this->_default_POA (ACE_TRY_ENV); + ACE_CHECK; + PortableServer::ObjectId_var id = + poa->servant_to_id (this, ACE_TRY_ENV); + ACE_CHECK; + poa->deactivate_object (id.in (), ACE_TRY_ENV); + ACE_CHECK; + + 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 1fd9463178c..e109cd4b0b8 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h @@ -31,14 +31,15 @@ #ifndef TAO_EC_PROXYCONSUMER_H #define TAO_EC_PROXYCONSUMER_H +#include "orbsvcs/RtecEventChannelAdminS.h" #include "orbsvcs/Event/EC_Filter.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -class TAO_EC_Dispatching; -class TAO_EC_Filter_Builder; +class TAO_EC_Event_Channel; +class TAO_EC_ProxyPushSupplier; class TAO_EC_ProxyPushConsumer : public POA_RtecEventChannelAdmin::ProxyPushConsumer { @@ -60,7 +61,7 @@ class TAO_EC_ProxyPushConsumer : public POA_RtecEventChannelAdmin::ProxyPushCons // externally. // public: - TAO_EC_ProxyPushConsumer (TAO_EC_SupplierAdmin* supplier_admin); + TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel* event_channel); // constructor... virtual ~TAO_EC_ProxyPushConsumer (void); @@ -90,23 +91,23 @@ public: // Usually implemented as no-ops, but some configurations may // require this methods. - void set_default_poa (PortableServer::POA_ptr poa); + void set_default_POA (PortableServer::POA_ptr poa); // Set this servant's default POA + virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env); + // Override the ServantBase method. + // = The RtecEventChannelAdmin::ProxyPushConsumer methods... virtual void connect_push_supplier ( - RtecEventComm::PushConsumer_ptr push_consumer, - const RtecEventChannelAdmin::ConsumerQOS& qos, + RtecEventComm::PushSupplier_ptr push_supplier, + const RtecEventChannelAdmin::SupplierQOS& qos, CORBA::Environment &); virtual void push (const RtecEventComm::EventSet& event, - CORBA::Environment &); + CORBA::Environment &) = 0; virtual void disconnect_push_consumer (CORBA::Environment &); - virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env); - // Override the ServantBase method. - private: - TAO_EC_SupplierAdmin* supplier_admin_; + TAO_EC_Event_Channel* event_channel_; // The supplier admin, used for activation and memory managment. RtecEventComm::PushSupplier_var supplier_; diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i new file mode 100644 index 00000000000..bd596291b5b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i @@ -0,0 +1,19 @@ +// $Id$ + +ACE_INLINE CORBA::Boolean +TAO_EC_ProxyPushConsumer::is_connected (void) const +{ + return !CORBA::is_nil (this->supplier_.in ()); +} + +ACE_INLINE RtecEventComm::PushSupplier_ptr +TAO_EC_ProxyPushConsumer::supplier (void) const +{ + return RtecEventComm::PushSupplier::_duplicate (this->supplier_); +} + +ACE_INLINE const RtecEventChannelAdmin::SupplierQOS& +TAO_EC_ProxyPushConsumer::publications (void) const +{ + return this->qos_; +} diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp index 4d79dd12731..96e0ecd251b 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp @@ -1,6 +1,8 @@ // $Id$ #include "EC_ProxySupplier.h" +#include "EC_Dispatching.h" +#include "EC_Filter_Builder.h" #include "EC_Event_Channel.h" #if ! defined (__ACE_INLINE__) @@ -19,15 +21,27 @@ TAO_EC_ProxyPushSupplier::~TAO_EC_ProxyPushSupplier (void) } void -TAO_EC_ProxyPushSupplier::set_default_poa (PortableServer::POA_ptr poa) +TAO_EC_ProxyPushSupplier::set_default_POA (PortableServer::POA_ptr poa) { - this->default_POA_ = PortableServier::POA::_duplicate (poa); + this->default_POA_ = PortableServer::POA::_duplicate (poa); } PortableServer::POA_ptr TAO_EC_ProxyPushSupplier::_default_POA (CORBA::Environment&) { - return PortableServier::POA::_duplicate (this->default_POA_); + return PortableServer::POA::_duplicate (this->default_POA_); +} + +void +TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushSupplier*, + CORBA::Environment &) +{ +} + +void +TAO_EC_ProxyPushSupplier::disconnected (TAO_EC_ProxyPushSupplier*, + CORBA::Environment &) +{ } void @@ -36,18 +50,19 @@ TAO_EC_ProxyPushSupplier::connect_push_consumer ( const RtecEventChannelAdmin::ConsumerQOS& qos, CORBA::Environment &ACE_TRY_ENV) { - if (this->connected ()) + if (this->is_connected ()) ACE_THROW (RtecEventChannelAdmin::AlreadyConnected ()); this->consumer_ = RtecEventComm::PushConsumer::_duplicate (push_consumer); this->qos_ = qos; - this->adopt_child ( - this->event_channel_->filter_builder_->build (this->qos_)); + this->child_ = + this->event_channel_->filter_builder ()->build (this->qos_); + this->adopt_child (this->child_); - // @@ Notify the event channel... - // this->event_channel_->connected (this); + // Notify the event channel... + this->event_channel_->connected (this, ACE_TRY_ENV); } void @@ -94,10 +109,10 @@ TAO_EC_ProxyPushSupplier::push (const RtecEventComm::EventSet& event, const TAO_EC_QOS_Info& qos_info, CORBA::Environment& ACE_TRY_ENV) { - this->event_channel_->dispatching_module ()->push (this, - event, - qos_info, - ACE_TRY_ENV); + this->event_channel_->dispatching ()->push (this, + event, + qos_info, + ACE_TRY_ENV); this->child_->clear (); } @@ -114,7 +129,7 @@ TAO_EC_ProxyPushSupplier::max_event_size (void) const } void -TAO_EC_ProxyPushSupplier::event_ids (RtecEventComm::EventHeaderSet& headerset) +TAO_EC_ProxyPushSupplier::event_ids (TAO_EC_Filter::Headers& headerset) { - return this->child_->event_ids (headerset); + this->child_->event_ids (headerset); } diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h index ce652106ad0..ab81be2f4c6 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h @@ -31,14 +31,15 @@ #ifndef TAO_EC_PROXYSUPPLIER_H #define TAO_EC_PROXYSUPPLIER_H +#include "orbsvcs/RtecEventChannelAdminS.h" #include "orbsvcs/Event/EC_Filter.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -class TAO_EC_Dispatching; -class TAO_EC_Filter_Builder; +class TAO_EC_Event_Channel; +class TAO_EC_ProxyPushConsumer; class TAO_EC_ProxyPushSupplier : public POA_RtecEventChannelAdmin::ProxyPushSupplier, public TAO_EC_Filter { @@ -85,20 +86,20 @@ public: // The QoS (subscription) used to connect to the EC. virtual void connected (TAO_EC_ProxyPushConsumer* consumer, - CORBA::Environment &env); + CORBA::Environment &env) = 0; virtual void disconnected (TAO_EC_ProxyPushConsumer* consumer, - CORBA::Environment &env); + CORBA::Environment &env) = 0; // Concrete implementations can use this methods to keep track of // the suppliers that publish its events. 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); // Usually implemented as no-ops, but some configurations may // require this methods. - void set_default_poa (PortableServer::POA_ptr poa); + void set_default_POA (PortableServer::POA_ptr poa); // Set this servant's default POA virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env); @@ -122,7 +123,7 @@ public: CORBA::Environment& env); virtual void clear (void); virtual CORBA::ULong max_event_size (void) const; - virtual void event_ids (RtecEventComm::EventHeaderSet& headerset); + virtual void event_ids (TAO_EC_Filter::Headers& headerset); private: TAO_EC_Event_Channel* event_channel_; @@ -139,6 +140,9 @@ private: PortableServer::POA_var default_POA_; // Store the default POA. + +private: + TAO_EC_Filter* child_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.i b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.i index e5911839c99..3e559db825e 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.i +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.i @@ -15,7 +15,7 @@ TAO_EC_ProxyPushSupplier::is_suspended (void) const ACE_INLINE RtecEventComm::PushConsumer_ptr TAO_EC_ProxyPushSupplier::consumer (void) const { - return RtecEventComm::PushConsumer:_duplicate (this->consumer_); + return RtecEventComm::PushConsumer::_duplicate (this->consumer_); } ACE_INLINE const RtecEventChannelAdmin::ConsumerQOS& diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp index 1ab0d31c9d1..f9ae7452d63 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp @@ -1,6 +1,7 @@ // $Id$ #include "EC_SupplierAdmin.h" +#include "EC_ProxyConsumer.h" #include "EC_Event_Channel.h" #if ! defined (__ACE_INLINE__) @@ -70,17 +71,18 @@ TAO_EC_SupplierAdmin::disconnected (TAO_EC_ProxyPushConsumer *consumer, CORBA::Environment &ACE_TRY_ENV) { if (this->all_consumers_.remove (consumer) != 0) - ACE_THROW (RtecEventChannelAdmin::SUBSCRIPTION_ERROR ()); + ACE_THROW (RtecEventChannelAdmin::EventChannel::SUBSCRIPTION_ERROR ()); } -RtecEventChannelAdmin::ProxyPushSupplier_ptr -TAO_EC_SupplierAdmin::obtain_push_supplier (CORBA::Environment &ACE_TRY_ENV) +RtecEventChannelAdmin::ProxyPushConsumer_ptr +TAO_EC_SupplierAdmin::obtain_push_consumer (CORBA::Environment &ACE_TRY_ENV) { - TAO_EC_ProxyPushSupplier* supplier = - this->event_channel_->factory ()->create_proxy_push_consumer (this->event_channel_); + TAO_EC_ProxyPushConsumer* consumer = + this->event_channel_->create_proxy_push_consumer (); - supplier->set_default_POA ( - this->event_channel_->factory ()->consumer_POA ()); + PortableServer::POA_var poa = + this->event_channel_->consumer_poa (ACE_TRY_ENV); + consumer->set_default_POA (poa.in ()); - return supplier->_this (ACE_TRY_ENV); + return consumer->_this (ACE_TRY_ENV); } diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h index 950595a82a0..6245c2cd9e2 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h @@ -27,9 +27,10 @@ // // ============================================================================ -#ifndef TAO_EC_PROXYSUPPLIER_H -#define TAO_EC_PROXYSUPPLIER_H +#ifndef TAO_EC_SUPPLIERADMIN_H +#define TAO_EC_SUPPLIERADMIN_H +#include "orbsvcs/RtecEventChannelAdminS.h" #include "orbsvcs/Event/EC_Filter.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -37,6 +38,8 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ class TAO_EC_Event_Channel; +class TAO_EC_ProxyPushSupplier; +class TAO_EC_ProxyPushConsumer; class TAO_EC_SupplierAdmin : public POA_RtecEventChannelAdmin::SupplierAdmin { @@ -63,7 +66,7 @@ public: virtual ~TAO_EC_SupplierAdmin (void); // destructor... - void set_default_poa (PortableServer::POA_ptr poa); + void set_default_POA (PortableServer::POA_ptr poa); // Set this servant's default POA virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env); @@ -103,4 +106,4 @@ private: #include "EC_SupplierAdmin.i" #endif /* __ACE_INLINE__ */ -#endif /* TAO_EC_PROXYSUPPLIER_H */ +#endif /* TAO_EC_SUPPLIERADMIN_H */ |