TAO_EC_ProxyPushConsumer Class Reference

ProxyPushConsumer. More...

#include <EC_ProxyConsumer.h>

Inheritance diagram for TAO_EC_ProxyPushConsumer:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_ProxyPushConsumer:

Collaboration graph
[legend]
List of all members.

Public Types

typedef RtecEventChannelAdmin::ProxyPushConsumer Interface
typedef RtecEventChannelAdmin::ProxyPushConsumer_var _var_type
typedef RtecEventChannelAdmin::ProxyPushConsumer_ptr _ptr_type

Public Member Functions

 TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel_Base *event_channel)
 constructor...

virtual ~TAO_EC_ProxyPushConsumer (void)
 destructor...

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

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

RtecEventComm::PushSupplier_ptr supplier (void) const
const RtecEventChannelAdmin::SupplierQOSpublications (void) const
 The QoS (subscription) used to connect to the EC.

CORBA::Boolean supplier_non_existent (CORBA::Boolean_out disconnected 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 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 shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
 The event channel is shutting down.

const RtecEventChannelAdmin::SupplierQOSpublications_i (void) const
CORBA::ULong _incr_refcnt (void)
 Increment and decrement the reference count.

CORBA::ULong _decr_refcnt (void)

Public Attributes

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


Protected Member Functions

void supplier (RtecEventComm::PushSupplier_ptr supplier)
void supplier_i (RtecEventComm::PushSupplier_ptr supplier)
CORBA::Boolean is_connected_i (void) const
 The private version (without locking) of is_connected().

TAO_EC_Supplier_Filterfilter_i (void) const
 Return the current filter, assumes the locks are held.

void cleanup_i (void)
 Release the filter and the supplier.


Protected Attributes

TAO_EC_Event_Channel_Baseevent_channel_
 The supplier admin, used for activation and memory managment.

ACE_Locklock_
 The locking strategy.

CORBA::ULong refcount_
 The reference count.

RtecEventComm::PushSupplier_var supplier_
 The supplier....

int connected_
RtecEventChannelAdmin::SupplierQOS qos_
 The publication and QoS information...

PortableServer::POA_var default_POA_
 Store the default POA.

TAO_EC_Supplier_Filterfilter_
 The strategy to do filtering close to the supplier.


Private Member Functions

virtual void shutdown_hook (ACE_ENV_SINGLE_ARG_DECL)
 Template method hooks.

virtual void refcount_zero_hook (void)

Friends

class TAO_EC_ProxyPushConsumer_Guard

Detailed Description

ProxyPushConsumer.

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

Memory Management

It makes a copy of the SupplierQOS and the supplier object reference. It uses bind/unbind to control the lifetime of the Supplier_Filter object. The object commits suicide when disconnect_push_consumer() is called.

Locking

No provisions for locking, access must be serialized externally.

Definition at line 56 of file EC_ProxyConsumer.h.


Member Typedef Documentation

typedef RtecEventChannelAdmin::ProxyPushConsumer_ptr TAO_EC_ProxyPushConsumer::_ptr_type
 

Definition at line 61 of file EC_ProxyConsumer.h.

typedef RtecEventChannelAdmin::ProxyPushConsumer_var TAO_EC_ProxyPushConsumer::_var_type
 

Definition at line 60 of file EC_ProxyConsumer.h.

typedef RtecEventChannelAdmin::ProxyPushConsumer TAO_EC_ProxyPushConsumer::Interface
 

Definition at line 59 of file EC_ProxyConsumer.h.


Constructor & Destructor Documentation

TAO_EC_ProxyPushConsumer::TAO_EC_ProxyPushConsumer TAO_EC_Event_Channel_Base event_channel  ) 
 

constructor...

Definition at line 23 of file EC_ProxyConsumer.cpp.

References TAO_EC_Event_Channel_Base::consumer_poa(), TAO_EC_Event_Channel_Base::create_consumer_lock(), and RtecEventChannelAdmin::SupplierQOS::is_gateway.

00024   : event_channel_ (ec),
00025     refcount_ (1),
00026     connected_ (0),
00027     filter_ (0)
00028 {
00029   this->lock_ =
00030     this->event_channel_->create_consumer_lock ();
00031 
00032   this->default_POA_ =
00033     this->event_channel_->consumer_poa ();
00034 
00035   this->qos_.is_gateway = 0;
00036 }

TAO_EC_ProxyPushConsumer::~TAO_EC_ProxyPushConsumer void   )  [virtual]
 

destructor...

Definition at line 38 of file EC_ProxyConsumer.cpp.

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

00039 {
00040   this->event_channel_->destroy_consumer_lock (this->lock_);
00041   this->cleanup_i ();
00042 }


Member Function Documentation

CORBA::ULong TAO_EC_ProxyPushConsumer::_decr_refcnt void   ) 
 

Definition at line 238 of file EC_ProxyConsumer.cpp.

References ACE_GUARD_RETURN, and refcount_zero_hook().

00239 {
00240   {
00241     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00242     this->refcount_--;
00243     if (this->refcount_ != 0)
00244       return this->refcount_;
00245   }
00246 
00247   this->refcount_zero_hook ();
00248   return 0;
00249 }

CORBA::ULong TAO_EC_ProxyPushConsumer::_incr_refcnt void   ) 
 

Increment and decrement the reference count.

Definition at line 224 of file EC_ProxyConsumer.cpp.

References ACE_GUARD_RETURN.

00225 {
00226   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00227   return this->refcount_++;
00228 }

void TAO_EC_ProxyPushConsumer::cleanup_i void   )  [protected]
 

Release the filter and the supplier.

Definition at line 188 of file EC_ProxyConsumer.cpp.

References TAO_EC_Supplier_Filter::_decr_refcnt(), connected_, filter_, and TAO_EC_Supplier_Filter::unbind().

Referenced by ~TAO_EC_ProxyPushConsumer().

00189 {
00190   this->supplier_ =
00191     RtecEventComm::PushSupplier::_nil ();
00192   this->connected_ = 0;
00193 
00194   if (this->filter_ != 0)
00195     {
00196       this->filter_->unbind (this);
00197       this->filter_->_decr_refcnt ();
00198       this->filter_ = 0;
00199     }
00200 }

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

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

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

Concrete implementations can use this methods to keep track of the consumers interested in this events.

virtual void TAO_EC_ProxyPushConsumer::disconnect_push_consumer ACE_ENV_SINGLE_ARG_DECL   )  [pure virtual]
 

Disconnect this from.

Referenced by TAO_EC_Reactive_SupplierControl::system_exception().

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

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

ACE_INLINE TAO_EC_Supplier_Filter * TAO_EC_ProxyPushConsumer::filter_i void   )  const [protected]
 

Return the current filter, assumes the locks are held.

Definition at line 58 of file EC_ProxyConsumer.i.

References filter_.

Referenced by TAO_EC_ProxyPushConsumer_Guard::TAO_EC_ProxyPushConsumer_Guard().

00059 {
00060   return this->filter_;
00061 }

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

Return 0 if no supplier is connected...

Definition at line 14 of file EC_ProxyConsumer.i.

References ACE_GUARD_RETURN, and is_connected_i().

00015 {
00016   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00017 
00018   return this->is_connected_i ();
00019 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE CORBA::Boolean TAO_EC_ProxyPushConsumer::is_connected_i void   )  const [protected]
 

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

Definition at line 8 of file EC_ProxyConsumer.i.

References connected_.

Referenced by is_connected(), supplier_non_existent(), and TAO_EC_ProxyPushConsumer_Guard::TAO_EC_ProxyPushConsumer_Guard().

00009 {
00010   return this->connected_;
00011 }

ACE_INLINE const RtecEventChannelAdmin::SupplierQOS & TAO_EC_ProxyPushConsumer::publications void   )  const
 

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

Definition at line 43 of file EC_ProxyConsumer.i.

References ACE_GUARD_RETURN.

00044 {
00045   // @@ TODO There should some way to signal errors here.
00046   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, this->qos_);
00047 
00048   return this->qos_;
00049 }

ACE_INLINE const RtecEventChannelAdmin::SupplierQOS & TAO_EC_ProxyPushConsumer::publications_i void   )  const
 

The QoS (subscription) used to connect to the EC, assumes the locks are held, use with care!

Definition at line 52 of file EC_ProxyConsumer.i.

Referenced by TAO_EC_Per_Supplier_Filter::connected(), and TAO_EC_Per_Supplier_Filter::reconnected().

00053 {
00054   return this->qos_;
00055 }

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

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

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

Definition at line 231 of file EC_ProxyConsumer.cpp.

References TAO_EC_Event_Channel_Base::destroy_proxy().

Referenced by _decr_refcnt(), and TAO_EC_ProxyPushConsumer_Guard::~TAO_EC_ProxyPushConsumer_Guard().

00232 {
00233   // Use the event channel
00234   this->event_channel_->destroy_proxy (this);
00235 }

virtual void TAO_EC_ProxyPushConsumer::shutdown ACE_ENV_SINGLE_ARG_DECL_NOT_USED   )  [virtual]
 

The event channel is shutting down.

virtual void TAO_EC_ProxyPushConsumer::shutdown_hook ACE_ENV_SINGLE_ARG_DECL   )  [private, virtual]
 

Template method hooks.

ACE_INLINE void TAO_EC_ProxyPushConsumer::supplier RtecEventComm::PushSupplier_ptr  supplier  )  [protected]
 

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

Definition at line 35 of file EC_ProxyConsumer.i.

References ACE_GUARD, and supplier_i().

00036 {
00037   ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
00038 
00039   this->supplier_i (supplier);
00040 }

ACE_INLINE RtecEventComm::PushSupplier_ptr TAO_EC_ProxyPushConsumer::supplier void   )  const
 

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

Definition at line 22 of file EC_ProxyConsumer.i.

References ACE_GUARD_RETURN.

Referenced by supplier_non_existent().

00023 {
00024   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00025   return RtecEventComm::PushSupplier::_duplicate (this->supplier_.in ());
00026 }

ACE_INLINE void TAO_EC_ProxyPushConsumer::supplier_i RtecEventComm::PushSupplier_ptr  supplier  )  [protected]
 

Definition at line 29 of file EC_ProxyConsumer.i.

Referenced by supplier().

00030 {
00031   this->supplier_ = supplier;
00032 }

CORBA::Boolean TAO_EC_ProxyPushConsumer::supplier_non_existent CORBA::Boolean_out disconnected  ACE_ENV_ARG_DECL  ) 
 

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

Definition at line 46 of file EC_ProxyConsumer.cpp.

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

00049 {
00050   CORBA::Object_var supplier;
00051   {
00052     ACE_GUARD_THROW_EX (
00053         ACE_Lock, ace_mon, *this->lock_,
00054         CORBA::INTERNAL ());
00055     ACE_CHECK_RETURN (0);
00056 
00057     disconnected = 0;
00058     if (this->is_connected_i () == 0)
00059       {
00060         disconnected = 1;
00061         return 0;
00062       }
00063     if (CORBA::is_nil (this->supplier_.in ()))
00064       {
00065         return 0;
00066       }
00067     supplier = CORBA::Object::_duplicate (this->supplier_.in ());
00068   }
00069 
00070 #if (TAO_HAS_MINIMUM_CORBA == 0)
00071   return supplier->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);
00072 #else
00073   return 0;
00074 #endif /* TAO_HAS_MINIMUM_CORBA */
00075 }


Friends And Related Function Documentation

friend class TAO_EC_ProxyPushConsumer_Guard [friend]
 

Definition at line 136 of file EC_ProxyConsumer.h.


Member Data Documentation

int TAO_EC_ProxyPushConsumer::connected_ [protected]
 

If the flag is not zero then we are connected, notice that the supplier can be nil.

Definition at line 162 of file EC_ProxyConsumer.h.

Referenced by cleanup_i(), and is_connected_i().

void TAO_EC_ProxyPushConsumer::deactivate
 

Deactivate from the POA.

Definition at line 203 of file EC_ProxyConsumer.cpp.

00204 {
00205   ACE_TRY
00206     {
00207       PortableServer::ObjectId id =
00208           this->object_id (ACE_ENV_SINGLE_ARG_PARAMETER);
00209       ACE_TRY_CHECK;
00210       this->default_POA_->deactivate_object (id ACE_ENV_ARG_PARAMETER);
00211       ACE_TRY_CHECK;
00212     }
00213   ACE_CATCHANY
00214     {
00215       // Exceptions here should not be propagated.  They usually
00216       // indicate that an object is beign disconnected twice, or some
00217       // race condition, but not a fault that the user needs to know
00218       // about.
00219     }
00220   ACE_ENDTRY;
00221 }

PortableServer::POA_var TAO_EC_ProxyPushConsumer::default_POA_ [protected]
 

Store the default POA.

Definition at line 168 of file EC_ProxyConsumer.h.

TAO_EC_Event_Channel_Base* TAO_EC_ProxyPushConsumer::event_channel_ [protected]
 

The supplier admin, used for activation and memory managment.

Definition at line 149 of file EC_ProxyConsumer.h.

TAO_EC_Supplier_Filter* TAO_EC_ProxyPushConsumer::filter_ [protected]
 

The strategy to do filtering close to the supplier.

Definition at line 171 of file EC_ProxyConsumer.h.

Referenced by cleanup_i(), and filter_i().

ACE_Lock* TAO_EC_ProxyPushConsumer::lock_ [protected]
 

The locking strategy.

Definition at line 152 of file EC_ProxyConsumer.h.

RtecEventChannelAdmin::SupplierQOS TAO_EC_ProxyPushConsumer::qos_ [protected]
 

The publication and QoS information...

Definition at line 165 of file EC_ProxyConsumer.h.

CORBA::ULong TAO_EC_ProxyPushConsumer::refcount_ [protected]
 

The reference count.

Definition at line 155 of file EC_ProxyConsumer.h.

RtecEventComm::PushSupplier_var TAO_EC_ProxyPushConsumer::supplier_ [protected]
 

The supplier....

Definition at line 158 of file EC_ProxyConsumer.h.


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