TAO_EC_ProxyPushSupplier Class Reference

ProxyPushSupplier. More...

#include <EC_ProxySupplier.h>

Inheritance diagram for TAO_EC_ProxyPushSupplier:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_ProxyPushSupplier:

Collaboration graph
[legend]
List of all members.

Public Types

typedef RtecEventChannelAdmin::ProxyPushSupplier Interface
typedef RtecEventChannelAdmin::ProxyPushSupplier_var _var_type
typedef RtecEventChannelAdmin::ProxyPushSupplier_ptr _ptr_type

Public Member Functions

 TAO_EC_ProxyPushSupplier (TAO_EC_Event_Channel_Base *event_channel, int validate_connection)
 Constructor...

virtual ~TAO_EC_ProxyPushSupplier (void)
 Destructor...

virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL)=0
 Disconnect this from.

CORBA::Boolean is_connected (void) const
 Return 0 if no consumer is connected...

CORBA::Boolean is_suspended (void) const
 Return 1 if it is suspended.

RtecEventComm::PushConsumer_ptr consumer (void) const
const RtecEventChannelAdmin::ConsumerQOSsubscriptions (void) const
 The QoS (subscription) used to connect to the EC.

virtual void connected (TAO_EC_ProxyPushConsumer *consumer ACE_ENV_ARG_DECL)
virtual void reconnected (TAO_EC_ProxyPushConsumer *consumer ACE_ENV_ARG_DECL)
virtual void disconnected (TAO_EC_ProxyPushConsumer *consumer ACE_ENV_ARG_DECL)
virtual void connected (TAO_EC_ProxyPushSupplier *supplier ACE_ENV_ARG_DECL)
virtual void reconnected (TAO_EC_ProxyPushSupplier *supplier ACE_ENV_ARG_DECL)
virtual void disconnected (TAO_EC_ProxyPushSupplier *supplier ACE_ENV_ARG_DECL)
virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL)
 The event channel is shutting down.

void push_to_consumer (RtecEventComm::PushConsumer_ptr consumer, const RtecEventComm::EventSet &event ACE_ENV_ARG_DECL)
void reactive_push_to_consumer (RtecEventComm::PushConsumer_ptr consumer, const RtecEventComm::EventSet &event ACE_ENV_ARG_DECL)
CORBA::Boolean consumer_non_existent (CORBA::Boolean_out disconnected ACE_ENV_ARG_DECL)
CORBA::ULong _incr_refcnt (void)
 Increment and decrement the reference count.

CORBA::ULong _decr_refcnt (void)
virtual int filter (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info ACE_ENV_ARG_DECL)
virtual int filter_nocopy (RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info ACE_ENV_ARG_DECL)
virtual void push (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info ACE_ENV_ARG_DECL)
virtual void push_nocopy (RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info ACE_ENV_ARG_DECL)
virtual void clear (void)
virtual CORBA::ULong max_event_size (void) const
 Returns the maximum size of the events pushed by this filter.

virtual int can_match (const RtecEventComm::EventHeader &header) const
virtual int add_dependencies (const RtecEventComm::EventHeader &header, const TAO_EC_QOS_Info &qos_info ACE_ENV_ARG_DECL)

Public Attributes

virtual void virtual activate(RtecEventChannelAdmin::ProxyPushSupplier_ptr
&proxy ACE_ENV_ARG_DECL) ACE_THROW_SPEC((CORBA voi 
deactivate )(ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC(())
 Deactivate from the POA.


Protected Member Functions

void consumer (RtecEventComm::PushConsumer_ptr consumer)
void consumer_i (RtecEventComm::PushConsumer_ptr consumer)
void cleanup_i (void)
 Release the child and the consumer.


Protected Attributes

void suspend_connection_i(ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC((CORBA void
resume_connection_i(ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC((CORBA void
suspend_connection_locked(ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC((CORBA void
resume_connection_locked(ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC((CORBA CORBA::Boolea 
is_connected_i )(void) const
 The private version (without locking) of is_connected().

TAO_EC_Event_Channel_Baseevent_channel_
 The Event Channel that owns this object.

ACE_Locklock_
 The locking strategy.

CORBA::ULong refcount_
 The reference count.

RtecEventComm::PushConsumer_var consumer_
 The consumer....

CORBA::Boolean suspended_
 Is this consumer suspended?

RtecEventChannelAdmin::ConsumerQOS qos_
 The subscription and QoS information...

PortableServer::POA_var default_POA_
 Store the default POA.

TAO_EC_Filterchild_
 The filter object.

int consumer_validate_connection_
 Validate the connection to consumer on connect.


Private Member Functions

virtual void refcount_zero_hook (void)
 Template method hooks.

virtual void pre_dispatch_hook (RtecEventComm::EventSet &ACE_ENV_ARG_DECL)

Detailed Description

ProxyPushSupplier.

Implement the RtecEventChannelAdmin::ProxyPushSupplier interface, remember that this class is used to communicate with a PushConsumer, so, in effect, this is the ambassador for a consumer inside the event channel.

Memory Management

It does not assume ownership of the TAO_EC_Dispatching object. It makes a copy of the ConsumerQOS and the consumer object reference.

Locking

Locking is strategized, the event channel acts as a factory for the locking strategies.

Todo:
We don't need to provide a trivial filter, the object itself could short-circuit the filter() ---> push() cycle when the EC is properly configured, we need to explore this...

Definition at line 56 of file EC_ProxySupplier.h.


Member Typedef Documentation

typedef RtecEventChannelAdmin::ProxyPushSupplier_ptr TAO_EC_ProxyPushSupplier::_ptr_type
 

Definition at line 61 of file EC_ProxySupplier.h.

typedef RtecEventChannelAdmin::ProxyPushSupplier_var TAO_EC_ProxyPushSupplier::_var_type
 

Definition at line 60 of file EC_ProxySupplier.h.

typedef RtecEventChannelAdmin::ProxyPushSupplier TAO_EC_ProxyPushSupplier::Interface
 

Definition at line 59 of file EC_ProxySupplier.h.


Constructor & Destructor Documentation

TAO_EC_ProxyPushSupplier::TAO_EC_ProxyPushSupplier TAO_EC_Event_Channel_Base event_channel,
int  validate_connection
 

Constructor...

Definition at line 28 of file EC_ProxySupplier.cpp.

References TAO_EC_Event_Channel_Base::create_supplier_lock(), and TAO_EC_Event_Channel_Base::supplier_poa().

00029   : event_channel_ (ec),
00030     refcount_ (1),
00031     suspended_ (0),
00032     child_ (0),
00033     consumer_validate_connection_(validate_connection)
00034 {
00035   this->lock_ =
00036     this->event_channel_->create_supplier_lock ();
00037 
00038   this->default_POA_ =
00039     this->event_channel_->supplier_poa ();
00040 }

TAO_EC_ProxyPushSupplier::~TAO_EC_ProxyPushSupplier void   )  [virtual]
 

Destructor...

Definition at line 42 of file EC_ProxySupplier.cpp.

References cleanup_i(), and TAO_EC_Event_Channel_Base::destroy_supplier_lock().

00043 {
00044   this->event_channel_->destroy_supplier_lock (this->lock_);
00045   this->cleanup_i ();
00046 }


Member Function Documentation

CORBA::ULong TAO_EC_ProxyPushSupplier::_decr_refcnt void   ) 
 

Definition at line 184 of file EC_ProxySupplier.cpp.

References ACE_GUARD_RETURN, and refcount_zero_hook().

Referenced by TAO_EC_Default_ProxyPushSupplier::_remove_ref(), TAO_EC_Kokyu_Push_Command::~TAO_EC_Kokyu_Push_Command(), and TAO_EC_Push_Command::~TAO_EC_Push_Command().

00185 {
00186   {
00187     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00188     this->refcount_--;
00189     if (this->refcount_ != 0)
00190       return this->refcount_;
00191   }
00192 
00193   this->refcount_zero_hook ();
00194   return 0;
00195 }

CORBA::ULong TAO_EC_ProxyPushSupplier::_incr_refcnt void   ) 
 

Increment and decrement the reference count.

Definition at line 170 of file EC_ProxySupplier.cpp.

References ACE_GUARD_RETURN.

Referenced by TAO_EC_Default_ProxyPushSupplier::_add_ref(), TAO_EC_Kokyu_Push_Command::TAO_EC_Kokyu_Push_Command(), and TAO_EC_Push_Command::TAO_EC_Push_Command().

00171 {
00172   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00173   return this->refcount_++;
00174 }

virtual int TAO_EC_ProxyPushSupplier::add_dependencies const RtecEventComm::EventHeader header,
const TAO_EC_QOS_Info &qos_info  ACE_ENV_ARG_DECL
[virtual]
 

This is used for computing the scheduling dependencies:

Leaf filters check if the header could be matched, similar to the can_match() method; if it does they return 1, and 0 otherwise. Intermediate nodes always return 0.

This is used to build precise dependencies between the suppliers and the leaf of the filters that accept that event. Notice that only the nodes doing scheduling recurse through the list, so in configurations that do no require scheduling the recursion stops fairly soon.

Implements TAO_EC_Filter.

int TAO_EC_ProxyPushSupplier::can_match const RtecEventComm::EventHeader header  )  const [virtual]
 

Returns 0 if an event with that header could never be accepted. This can used by the suppliers to filter out consumers that couldn't possibly be interested in their events. The rt_info and

Implements TAO_EC_Filter.

Definition at line 508 of file EC_ProxySupplier.cpp.

References ACE_GUARD_RETURN, TAO_EC_Filter::can_match(), and is_connected_i.

00510 {
00511   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00512 
00513   if (this->is_connected_i () == 0)
00514     return 0;
00515 
00516   return this->child_->can_match (header);
00517 }

void TAO_EC_ProxyPushSupplier::cleanup_i void   )  [protected]
 

Release the child and the consumer.

Definition at line 137 of file EC_ProxySupplier.cpp.

Referenced by ~TAO_EC_ProxyPushSupplier().

00138 {
00139   this->consumer_ =
00140     RtecEventComm::PushConsumer::_nil ();
00141 
00142   // @@ Why don't we have a destroy() method in the
00143   // filter_builder?
00144   delete this->child_;
00145   this->child_ = 0;
00146 }

void TAO_EC_ProxyPushSupplier::clear void   )  [virtual]
 

Clear any saved state, must reset and assume no events have been received.

Implements TAO_EC_Filter.

Definition at line 492 of file EC_ProxySupplier.cpp.

References ACE_GUARD, and TAO_EC_Filter::clear().

00493 {
00494   ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00495 
00496   this->child_->clear ();
00497 }

virtual void TAO_EC_ProxyPushSupplier::connected TAO_EC_ProxyPushSupplier *supplier  ACE_ENV_ARG_DECL  )  [virtual]
 

Usually implemented as no-ops, but some configurations may require this methods.

virtual void TAO_EC_ProxyPushSupplier::connected TAO_EC_ProxyPushConsumer *consumer  ACE_ENV_ARG_DECL  )  [virtual]
 

Concrete implementations can use this methods to keep track of the suppliers that publish its events.

ACE_INLINE void TAO_EC_ProxyPushSupplier::consumer RtecEventComm::PushConsumer_ptr  consumer  )  [protected]
 

Set the consumer, used by some implementations to change the policies used when invoking operations on the consumer.

Definition at line 83 of file EC_ProxySupplier.i.

References ACE_GUARD, and consumer_i().

00084 {
00085   ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00086 
00087   this->consumer_i (consumer);
00088 }

ACE_INLINE RtecEventComm::PushConsumer_ptr TAO_EC_ProxyPushSupplier::consumer void   )  const
 

Return the consumer object reference. It returns nil() if it has not connected yet.

Definition at line 70 of file EC_ProxySupplier.i.

References ACE_GUARD_RETURN.

00071 {
00072   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00073   return RtecEventComm::PushConsumer::_duplicate (this->consumer_.in ());
00074 }

ACE_INLINE void TAO_EC_ProxyPushSupplier::consumer_i RtecEventComm::PushConsumer_ptr  consumer  )  [protected]
 

Definition at line 77 of file EC_ProxySupplier.i.

Referenced by consumer().

00078 {
00079   this->consumer_ = consumer;
00080 }

CORBA::Boolean TAO_EC_ProxyPushSupplier::consumer_non_existent CORBA::Boolean_out disconnected  ACE_ENV_ARG_DECL  ) 
 

Invoke the _non_existent() pseudo-operation on the consumer. If it is disconnected then it returns true and sets the flag.

Definition at line 463 of file EC_ProxySupplier.cpp.

References CORBA::Object::_duplicate(), ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_THROW_EX, and is_connected_i.

00466 {
00467   CORBA::Object_var consumer;
00468   {
00469     ACE_GUARD_THROW_EX (
00470         ACE_Lock, ace_mon, *this->lock_,
00471         CORBA::INTERNAL ());
00472     ACE_CHECK_RETURN (0);
00473 
00474     disconnected = 0;
00475     if (this->is_connected_i () == 0)
00476       {
00477         disconnected = 1;
00478         return 0;
00479       }
00480 
00481     consumer = CORBA::Object::_duplicate (this->consumer_.in ());
00482   }
00483 
00484 #if (TAO_HAS_MINIMUM_CORBA == 0)
00485   return consumer->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);
00486 #else
00487   return 0;
00488 #endif /* TAO_HAS_MINIMUM_CORBA */
00489 }

virtual void TAO_EC_ProxyPushSupplier::disconnect_push_supplier ACE_ENV_SINGLE_ARG_DECL   )  [pure virtual]
 

Disconnect this from.

Referenced by TAO_EC_Reactive_ConsumerControl::system_exception().

virtual void TAO_EC_ProxyPushSupplier::disconnected TAO_EC_ProxyPushSupplier *supplier  ACE_ENV_ARG_DECL  )  [virtual]
 

virtual void TAO_EC_ProxyPushSupplier::disconnected TAO_EC_ProxyPushConsumer *consumer  ACE_ENV_ARG_DECL  )  [virtual]
 

virtual int TAO_EC_ProxyPushSupplier::filter const RtecEventComm::EventSet event,
TAO_EC_QOS_Info &qos_info  ACE_ENV_ARG_DECL
[virtual]
 

Filter this event, returns 1 if the event is accepted, 0 otherwise. Notice that there are two versions of the method, if the event is not const then filter can take ownership of the event.

Attention:
There seems to be a disparity in interfaces: Supplier always push event sets of size 1 to the EC_ProxyPushSupplier, and EC_Filters do not implement handling of sets of more than 1 event. Then, why is this not enforced by the interface by having EC_ProxyPushSupplier take an event rather than a set?

Implements TAO_EC_Filter.

Referenced by TAO_EC_Timeout_Filter::push_to_proxy().

virtual int TAO_EC_ProxyPushSupplier::filter_nocopy RtecEventComm::EventSet event,
TAO_EC_QOS_Info &qos_info  ACE_ENV_ARG_DECL
[virtual]
 

Implements TAO_EC_Filter.

ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushSupplier::is_connected void   )  const
 

Return 0 if no consumer is connected...

Definition at line 54 of file EC_ProxySupplier.i.

References ACE_GUARD_RETURN, and is_connected_i.

00055 {
00056   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00057 
00058   return this->is_connected_i ();
00059 }

ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushSupplier::is_suspended void   )  const
 

Return 1 if it is suspended.

Definition at line 62 of file EC_ProxySupplier.i.

References ACE_GUARD_RETURN, and suspended_.

00063 {
00064   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00065 
00066   return this->suspended_;
00067 }

CORBA::ULong TAO_EC_ProxyPushSupplier::max_event_size void   )  const [virtual]
 

Returns the maximum size of the events pushed by this filter.

Implements TAO_EC_Filter.

Definition at line 500 of file EC_ProxySupplier.cpp.

References ACE_GUARD_RETURN, and TAO_EC_Filter::max_event_size().

00501 {
00502   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00503 
00504   return this->child_->max_event_size ();
00505 }

void TAO_EC_ProxyPushSupplier::pre_dispatch_hook RtecEventComm::EventSet ACE_ENV_ARG_DECL  )  [private, virtual]
 

Definition at line 303 of file EC_ProxySupplier.cpp.

References RtecEventComm::EventSet.

00305 {
00306 }

virtual void TAO_EC_ProxyPushSupplier::push const RtecEventComm::EventSet event,
TAO_EC_QOS_Info &qos_info  ACE_ENV_ARG_DECL
[virtual]
 

This is called by the children when they accept an event and which to pass it up. Notice that there are two versions of the method, if the event is not const then filter can take ownership of the event.

Implements TAO_EC_Filter.

virtual void TAO_EC_ProxyPushSupplier::push_nocopy RtecEventComm::EventSet event,
TAO_EC_QOS_Info &qos_info  ACE_ENV_ARG_DECL
[virtual]
 

Implements TAO_EC_Filter.

void TAO_EC_ProxyPushSupplier::push_to_consumer RtecEventComm::PushConsumer_ptr  consumer,
const RtecEventComm::EventSet &event  ACE_ENV_ARG_DECL
 

These methods take consumer argument because during the time the filters have been processing the event, this proxy's consumer may have changed.

Referenced by TAO_EC_Kokyu_Push_Command::execute(), and TAO_EC_Push_Command::execute().

void TAO_EC_ProxyPushSupplier::reactive_push_to_consumer RtecEventComm::PushConsumer_ptr  consumer,
const RtecEventComm::EventSet &event  ACE_ENV_ARG_DECL
 

virtual void TAO_EC_ProxyPushSupplier::reconnected TAO_EC_ProxyPushSupplier *supplier  ACE_ENV_ARG_DECL  )  [virtual]
 

virtual void TAO_EC_ProxyPushSupplier::reconnected TAO_EC_ProxyPushConsumer *consumer  ACE_ENV_ARG_DECL  )  [virtual]
 

void TAO_EC_ProxyPushSupplier::refcount_zero_hook void   )  [private, virtual]
 

Template method hooks.

Definition at line 177 of file EC_ProxySupplier.cpp.

References TAO_EC_Event_Channel_Base::destroy_proxy().

Referenced by _decr_refcnt().

00178 {
00179   // Use the event channel
00180   this->event_channel_->destroy_proxy (this);
00181 }

virtual void TAO_EC_ProxyPushSupplier::shutdown ACE_ENV_SINGLE_ARG_DECL   )  [virtual]
 

The event channel is shutting down.

ACE_INLINE const RtecEventChannelAdmin::ConsumerQOS & TAO_EC_ProxyPushSupplier::subscriptions void   )  const
 

The QoS (subscription) used to connect to the EC.

Definition at line 91 of file EC_ProxySupplier.i.

References ACE_GUARD_RETURN.

00092 {
00093   // @@ TODO There should be a better way to signal errors here.
00094   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, this->qos_);
00095 
00096   return this->qos_;
00097 }


Member Data Documentation

TAO_EC_Filter* TAO_EC_ProxyPushSupplier::child_ [protected]
 

The filter object.

Definition at line 208 of file EC_ProxySupplier.h.

RtecEventComm::PushConsumer_var TAO_EC_ProxyPushSupplier::consumer_ [protected]
 

The consumer....

Definition at line 196 of file EC_ProxySupplier.h.

int TAO_EC_ProxyPushSupplier::consumer_validate_connection_ [protected]
 

Validate the connection to consumer on connect.

Definition at line 211 of file EC_ProxySupplier.h.

void TAO_EC_ProxyPushSupplier::deactivate
 

Deactivate from the POA.

Definition at line 149 of file EC_ProxySupplier.cpp.

00150 {
00151   ACE_TRY
00152     {
00153       PortableServer::ObjectId id =
00154         this->object_id (ACE_ENV_SINGLE_ARG_PARAMETER);
00155       ACE_TRY_CHECK;
00156       this->default_POA_->deactivate_object (id ACE_ENV_ARG_PARAMETER);
00157       ACE_TRY_CHECK;
00158     }
00159   ACE_CATCHANY
00160     {
00161       // Exceptions here should not be propagated.  They usually
00162       // indicate that an object is beign disconnected twice, or some
00163       // race condition, but not a fault that the user needs to know
00164       // about.
00165     }
00166   ACE_ENDTRY;
00167 }

PortableServer::POA_var TAO_EC_ProxyPushSupplier::default_POA_ [protected]
 

Store the default POA.

Definition at line 205 of file EC_ProxySupplier.h.

TAO_EC_Event_Channel_Base* TAO_EC_ProxyPushSupplier::event_channel_ [protected]
 

The Event Channel that owns this object.

Definition at line 187 of file EC_ProxySupplier.h.

ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushSupplier::is_connected_i [protected]
 

The private version (without locking) of is_connected().

Definition at line 48 of file EC_ProxySupplier.i.

Referenced by can_match(), consumer_non_existent(), and is_connected().

00049 {
00050   return !CORBA::is_nil (this->consumer_.in ());
00051 }

ACE_Lock* TAO_EC_ProxyPushSupplier::lock_ [protected]
 

The locking strategy.

Definition at line 190 of file EC_ProxySupplier.h.

RtecEventChannelAdmin::ConsumerQOS TAO_EC_ProxyPushSupplier::qos_ [protected]
 

The subscription and QoS information...

Definition at line 202 of file EC_ProxySupplier.h.

CORBA::ULong TAO_EC_ProxyPushSupplier::refcount_ [protected]
 

The reference count.

Definition at line 193 of file EC_ProxySupplier.h.

CORBA::Boolean TAO_EC_ProxyPushSupplier::suspended_ [protected]
 

Is this consumer suspended?

Definition at line 199 of file EC_ProxySupplier.h.

Referenced by is_suspended().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:15:21 2006 for TAO_RTEvent by doxygen 1.3.6