TAO_CEC_ProxyPushConsumer Class Reference

ProxyPushConsumer. More...

#include <CEC_ProxyPushConsumer.h>

Collaboration diagram for TAO_CEC_ProxyPushConsumer:

Collaboration graph
[legend]
List of all members.

Public Types

typedef CosEventChannelAdmin::ProxyPushConsumer_ptr _ptr_type
typedef CosEventChannelAdmin::ProxyPushConsumer_var _var_type

Public Member Functions

 TAO_CEC_ProxyPushConsumer (TAO_CEC_EventChannel *event_channel)
 constructor...

virtual ~TAO_CEC_ProxyPushConsumer (void)
 destructor...

CosEventComm::PushSupplier_ptr supplier (void) const
CORBA::Boolean supplier_non_existent (CORBA::Boolean_out disconnected)
virtual void shutdown ()
 The event channel is shutting down.

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

CORBA::ULong _decr_refcnt (void)
virtual void _add_ref ()
virtual void _remove_ref ()

Public Attributes

virtual void virtual activate(CosEventChannelAdmin::ProxyPushConsumer_ptr
&activated_proxy) ACE_THROW_SPEC((CORBA void deactivate()
ACE_THROW_SPEC((CORBA CORBA::Boolea 
is_connected )(void) const
 Return false if no supplier is connected...

virtual void virtual connect_push_supplier(CosEventComm::PushSupplier_ptr
push_supplier) ACE_THROW_SPEC((CORBA void virtual push(const CORBA::Any &event)
ACE_THROW_SPEC((CORBA void
virtual disconnect_push_consumer()
ACE_THROW_SPEC((CORBA PortableServer::POA_pt 
_default_POA )()

Protected Member Functions

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

void cleanup_i (void)
 Release the supplier.


Private Attributes

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

ACE_Locklock_
 The locking strategy.

CORBA::ULong refcount_
 The reference count.

CosEventComm::PushSupplier_var supplier_
 The supplier....

bool connected_
PortableServer::POA_var default_POA_
 Store the default POA.


Friends

class TAO_CEC_ProxyPushConsumer_Guard

Detailed Description

ProxyPushConsumer.

Implement the CosEventChannelAdmin::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 MANAGMENT The object commits suicide when disconnect_push_consumer() is called.

Definition at line 47 of file CEC_ProxyPushConsumer.h.


Member Typedef Documentation

typedef CosEventChannelAdmin::ProxyPushConsumer_ptr TAO_CEC_ProxyPushConsumer::_ptr_type
 

Definition at line 51 of file CEC_ProxyPushConsumer.h.

typedef CosEventChannelAdmin::ProxyPushConsumer_var TAO_CEC_ProxyPushConsumer::_var_type
 

Definition at line 52 of file CEC_ProxyPushConsumer.h.


Constructor & Destructor Documentation

TAO_CEC_ProxyPushConsumer::TAO_CEC_ProxyPushConsumer TAO_CEC_EventChannel event_channel  ) 
 

constructor...

Definition at line 23 of file CEC_ProxyPushConsumer.cpp.

References TAO_CEC_EventChannel::consumer_poa(), TAO_CEC_EventChannel::create_consumer_lock(), and TAO_CEC_EventChannel::get_servant_retry_map().

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

TAO_CEC_ProxyPushConsumer::~TAO_CEC_ProxyPushConsumer void   )  [virtual]
 

destructor...

Definition at line 37 of file CEC_ProxyPushConsumer.cpp.

References TAO_CEC_EventChannel::destroy_consumer_lock(), and TAO_CEC_EventChannel::get_servant_retry_map().

00038 {
00039   this->event_channel_->get_servant_retry_map ().unbind (this);
00040   this->event_channel_->destroy_consumer_lock (this->lock_);
00041 }


Member Function Documentation

void TAO_CEC_ProxyPushConsumer::_add_ref  )  [virtual]
 

Definition at line 305 of file CEC_ProxyPushConsumer.cpp.

References _incr_refcnt().

00306 {
00307   this->_incr_refcnt ();
00308 }

CORBA::ULong TAO_CEC_ProxyPushConsumer::_decr_refcnt void   ) 
 

Definition at line 171 of file CEC_ProxyPushConsumer.cpp.

References ACE_GUARD_RETURN, and TAO_CEC_EventChannel::destroy_proxy().

Referenced by _remove_ref().

00172 {
00173   {
00174     ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00175     --this->refcount_;
00176     if (this->refcount_ != 0)
00177       return this->refcount_;
00178   }
00179 
00180   // Notify the event channel
00181   this->event_channel_->destroy_proxy (this);
00182   return 0;
00183 }

CORBA::ULong TAO_CEC_ProxyPushConsumer::_incr_refcnt void   ) 
 

Increment and decrement the reference count.

Definition at line 164 of file CEC_ProxyPushConsumer.cpp.

References ACE_GUARD_RETURN.

Referenced by _add_ref().

00165 {
00166   ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
00167   return this->refcount_++;
00168 }

void TAO_CEC_ProxyPushConsumer::_remove_ref  )  [virtual]
 

Definition at line 311 of file CEC_ProxyPushConsumer.cpp.

References _decr_refcnt().

00312 {
00313   this->_decr_refcnt ();
00314 }

void TAO_CEC_ProxyPushConsumer::cleanup_i void   )  [protected]
 

Release the supplier.

Definition at line 156 of file CEC_ProxyPushConsumer.cpp.

00157 {
00158   this->supplier_ =
00159     CosEventComm::PushSupplier::_nil ();
00160   this->connected_ = false;
00161 }

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

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

Definition at line 8 of file CEC_ProxyPushConsumer.i.

Referenced by supplier_non_existent(), and TAO_CEC_ProxyPushConsumer_Guard::TAO_CEC_ProxyPushConsumer_Guard().

00009 {
00010   return this->connected_;
00011 }

void TAO_CEC_ProxyPushConsumer::shutdown  )  [virtual]
 

The event channel is shutting down.

Definition at line 121 of file CEC_ProxyPushConsumer.cpp.

References ACE_CATCHANY, ACE_CHECK, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_TRY, ACE_TRY_CHECK, and CORBA::is_nil().

00122 {
00123   CosEventComm::PushSupplier_var supplier;
00124 
00125   {
00126     ACE_GUARD_THROW_EX (
00127         ACE_Lock, ace_mon, *this->lock_,
00128         CORBA::INTERNAL ());
00129     // @@ CosEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
00130     ACE_CHECK;
00131 
00132     supplier = this->supplier_._retn ();
00133     this->connected_ = false;
00134   }
00135 
00136   this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER);
00137   ACE_CHECK;
00138 
00139   if (CORBA::is_nil (supplier.in ()))
00140     return;
00141 
00142   ACE_TRY
00143     {
00144       supplier->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER);
00145       ACE_TRY_CHECK;
00146     }
00147   ACE_CATCHANY
00148     {
00149       // Ignore exceptions, we must isolate other clients from
00150       // failures on this one.
00151     }
00152   ACE_ENDTRY;
00153 }

ACE_INLINE void TAO_CEC_ProxyPushConsumer::supplier CosEventComm::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 CEC_ProxyPushConsumer.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 CosEventComm::PushSupplier_ptr TAO_CEC_ProxyPushConsumer::supplier void   )  const
 

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

Definition at line 22 of file CEC_ProxyPushConsumer.i.

References ACE_GUARD_RETURN.

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

ACE_INLINE void TAO_CEC_ProxyPushConsumer::supplier_i CosEventComm::PushSupplier_ptr  supplier  )  [protected]
 

Definition at line 29 of file CEC_ProxyPushConsumer.i.

Referenced by supplier().

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

CORBA::Boolean TAO_CEC_ProxyPushConsumer::supplier_non_existent CORBA::Boolean_out  disconnected  ) 
 

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

Definition at line 89 of file CEC_ProxyPushConsumer.cpp.

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

00092 {
00093   CORBA::Object_var supplier;
00094   {
00095     ACE_GUARD_THROW_EX (
00096         ACE_Lock, ace_mon, *this->lock_,
00097         CORBA::INTERNAL ());
00098     ACE_CHECK_RETURN (0);
00099 
00100     disconnected = false;
00101     if (!this->is_connected_i ())
00102       {
00103         disconnected = true;
00104         return false;
00105       }
00106     if (CORBA::is_nil (this->supplier_.in ()))
00107       {
00108         return false;
00109       }
00110     supplier = CORBA::Object::_duplicate (this->supplier_.in ());
00111   }
00112 
00113 #if (TAO_HAS_MINIMUM_CORBA == 0)
00114   return supplier->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);
00115 #else
00116   return false;
00117 #endif /* TAO_HAS_MINIMUM_CORBA */
00118 }


Friends And Related Function Documentation

friend class TAO_CEC_ProxyPushConsumer_Guard [friend]
 

Definition at line 115 of file CEC_ProxyPushConsumer.h.


Member Data Documentation

PortableServer::POA_ptr TAO_CEC_ProxyPushConsumer::_default_POA
 

Definition at line 299 of file CEC_ProxyPushConsumer.cpp.

00300 {
00301   return PortableServer::POA::_duplicate (this->default_POA_.in ());
00302 }

bool TAO_CEC_ProxyPushConsumer::connected_ [private]
 

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

Definition at line 139 of file CEC_ProxyPushConsumer.h.

PortableServer::POA_var TAO_CEC_ProxyPushConsumer::default_POA_ [private]
 

Store the default POA.

Definition at line 142 of file CEC_ProxyPushConsumer.h.

TAO_CEC_EventChannel* TAO_CEC_ProxyPushConsumer::event_channel_ [private]
 

The supplier admin, used for activation and memory managment.

Definition at line 126 of file CEC_ProxyPushConsumer.h.

ACE_INLINE CORBA::Boolean TAO_CEC_ProxyPushConsumer::is_connected
 

Return false if no supplier is connected...

Definition at line 14 of file CEC_ProxyPushConsumer.i.

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

ACE_Lock* TAO_CEC_ProxyPushConsumer::lock_ [private]
 

The locking strategy.

Definition at line 129 of file CEC_ProxyPushConsumer.h.

CORBA::ULong TAO_CEC_ProxyPushConsumer::refcount_ [private]
 

The reference count.

Definition at line 132 of file CEC_ProxyPushConsumer.h.

CosEventComm::PushSupplier_var TAO_CEC_ProxyPushConsumer::supplier_ [private]
 

The supplier....

Definition at line 135 of file CEC_ProxyPushConsumer.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:19:39 2006 for TAO_CosEvent by doxygen 1.3.6