TAO_Notify_ProxySupplier Class Reference

Base class for all the ProxySuppliers. More...

#include <ProxySupplier.h>

Inheritance diagram for TAO_Notify_ProxySupplier:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_ProxySupplier:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_Notify_Refcountable_Guard_T<
TAO_Notify_ProxySupplier
Ptr

Public Member Functions

 TAO_Notify_ProxySupplier (void)
 Constuctor.

virtual ~TAO_Notify_ProxySupplier ()
 Destructor.

virtual void init (TAO_Notify_ConsumerAdmin *consumer_admin)
 Init.

void connect (TAO_Notify_Consumer *consumer) throw ( CORBA::SystemException , CosEventChannelAdmin::AlreadyConnected )
 Connect.

void disconnect ()
 Disconnect.

virtual void deliver (TAO_Notify_Method_Request_Dispatch_No_Copy &request)
 Dispatch Event to consumer.

virtual int shutdown ()
 Override TAO_Notify_Container_T::shutdown method.

virtual void destroy ()
 Destroy this object.

virtual void qos_changed (const TAO_Notify_QoSProperties &qos_properties)
 Override, TAO_Notify_Proxy::qos_changed to apply MaxEventssPerConsumer QoS.

bool is_connected (void) const
 Returns true if connected.

TAO_Notify_Consumerconsumer (void)
 Access the Consumer.

TAO_Notify_ConsumerAdminconsumer_admin (void)
 The CA parent.


Private Member Functions

virtual TAO_Notify_Peerpeer (void)
 Access our Peer.


Private Attributes

TAO_Notify_ConsumerAdmin::Ptr consumer_admin_
ACE_Auto_Ptr< TAO_Notify_Consumerconsumer_
 The Consumer that we're connect to.


Friends

class TAO_Notify_Consumer

Detailed Description

Base class for all the ProxySuppliers.

Definition at line 37 of file ProxySupplier.h.


Member Typedef Documentation

typedef TAO_Notify_Refcountable_Guard_T<TAO_Notify_ProxySupplier> TAO_Notify_ProxySupplier::Ptr
 

Reimplemented from TAO_Notify_Proxy.

Definition at line 42 of file ProxySupplier.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_ProxySupplier::TAO_Notify_ProxySupplier void   ) 
 

Constuctor.

Definition at line 22 of file ProxySupplier.cpp.

00023   : consumer_admin_ (0)
00024 {
00025 }

TAO_Notify_ProxySupplier::~TAO_Notify_ProxySupplier  )  [virtual]
 

Destructor.

Definition at line 27 of file ProxySupplier.cpp.

00028 {
00029 }


Member Function Documentation

void TAO_Notify_ProxySupplier::connect TAO_Notify_Consumer consumer  )  throw ( CORBA::SystemException , CosEventChannelAdmin::AlreadyConnected )
 

Connect.

Definition at line 55 of file ProxySupplier.cpp.

References ACE_ASSERT, ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_GUARD_THROW_EX, ACE_THROW, TAO_Singleton< TYPE, ACE_LOCK >::instance(), TAO_Notify_Atomic_Property_Long, TAO_Notify_Property_Long, TAO_SYNCH_MUTEX, and TAO_Notify_PropertyBase_T< TYPE >::value().

00060 {
00061   // Adopt the consumer
00062   ACE_Auto_Ptr< TAO_Notify_Consumer > auto_consumer (consumer);
00063 
00064   TAO_Notify_Atomic_Property_Long& consumer_count = this->admin_properties().consumers ();
00065   const TAO_Notify_Property_Long& max_consumers = this->admin_properties().max_consumers ();
00066 
00067   if (max_consumers != 0 && consumer_count >= max_consumers.value ())
00068   {
00069     ACE_THROW (CORBA::IMP_LIMIT ()); // we've reached the limit of consumers connected.
00070   }
00071 
00072   {
00073     ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
00074                         CORBA::INTERNAL ());
00075     ACE_CHECK;
00076 
00077     // if consumer is set and reconnect not allowed we get out.
00078     if (this->is_connected () && TAO_Notify_PROPERTIES::instance()->allow_reconnect() == false)
00079       {
00080           ACE_THROW (CosEventChannelAdmin::AlreadyConnected ());
00081       }
00082 
00083     // Adopt the consumer
00084     this->consumer_ = auto_consumer;
00085 
00086     this->consumer_admin_->subscribed_types (this->subscribed_types_ ACE_ENV_ARG_PARAMETER); // get the parents subscribed types.
00087     ACE_CHECK;
00088   }
00089 
00090   // Inform QoS values.
00091   ACE_ASSERT (this->consumer_.get() != 0);
00092   this->consumer_->qos_changed (this->qos_properties_);
00093 
00094   TAO_Notify_EventTypeSeq removed;
00095 
00096   this->event_manager().subscription_change (this, this->subscribed_types_, removed ACE_ENV_ARG_PARAMETER);
00097   ACE_CHECK;
00098 
00099   this->event_manager().connect (this ACE_ENV_ARG_PARAMETER);
00100   ACE_CHECK;
00101 
00102   // Increment the global consumer count
00103   ++consumer_count;
00104 }

ACE_INLINE TAO_Notify_Consumer * TAO_Notify_ProxySupplier::consumer void   ) 
 

Access the Consumer.

Definition at line 14 of file ProxySupplier.inl.

References ACE_Auto_Basic_Ptr< X >::get().

Referenced by peer().

00015 {
00016   return this->consumer_.get();
00017 }

ACE_INLINE TAO_Notify_ConsumerAdmin & TAO_Notify_ProxySupplier::consumer_admin void   ) 
 

The CA parent.

Definition at line 20 of file ProxySupplier.inl.

References ACE_ASSERT.

00021 {
00022   ACE_ASSERT( this->consumer_admin_.get() != 0 );
00023   return *this->consumer_admin_;
00024 }

void TAO_Notify_ProxySupplier::deliver TAO_Notify_Method_Request_Dispatch_No_Copy request  )  [virtual]
 

Dispatch Event to consumer.

Reimplemented in TAO_Notify_RT_StructuredProxyPushSupplier.

Definition at line 155 of file ProxySupplier.cpp.

References ACE_ENV_ARG_PARAMETER, and TAO_Notify_Object::execute_task().

00156 {
00157   this->execute_task (request ACE_ENV_ARG_PARAMETER);
00158 }

void TAO_Notify_ProxySupplier::destroy  )  [virtual]
 

Destroy this object.

Implements TAO_Notify_Proxy.

Definition at line 140 of file ProxySupplier.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, and shutdown().

Referenced by TAO_Notify_Consumer::deliver(), TAO_Notify_SequencePushConsumer::dispatch_from_queue(), and TAO_Notify_Consumer::dispatch_from_queue().

00141 {
00142   int result = this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00143   ACE_CHECK;
00144   if ( result == 1)
00145     return;
00146 
00147   this->consumer_admin_->remove (this ACE_ENV_ARG_PARAMETER);
00148   ACE_CHECK;
00149 
00150   // Do not reset this->consumer_.
00151   // It is not safe to delete the non-refcounted consumer here.
00152 }

void TAO_Notify_ProxySupplier::disconnect  ) 
 

Disconnect.

Definition at line 107 of file ProxySupplier.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify_Object::admin_properties(), TAO_Notify_AdminProperties::consumers(), TAO_Notify_Event_Manager::disconnect(), TAO_Notify_Object::event_manager(), and TAO_Notify_Event_Manager::subscription_change().

Referenced by shutdown().

00108 {
00109   TAO_Notify_EventTypeSeq added;
00110 
00111   this->event_manager().subscription_change (this, added, this->subscribed_types_ ACE_ENV_ARG_PARAMETER);
00112   ACE_CHECK;
00113 
00114   this->event_manager().disconnect (this ACE_ENV_ARG_PARAMETER);
00115   ACE_CHECK;
00116 
00117   // Decrement the global consumer count
00118   this->admin_properties().consumers ()--;
00119 }

void TAO_Notify_ProxySupplier::init TAO_Notify_ConsumerAdmin consumer_admin  )  [virtual]
 

Init.

Definition at line 32 of file ProxySupplier.cpp.

References ACE_ASSERT, ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify::Topology_Object::initialize(), TAO_Singleton< TYPE, ACE_LOCK >::instance(), CosNotification::QoSProperties, and TAO_Notify_Object::set_qos().

00033 {
00034   ACE_ASSERT (consumer_admin != 0 && this->consumer_admin_.get() == 0);
00035 
00036   TAO_Notify_Proxy::initialize (consumer_admin ACE_ENV_ARG_PARAMETER);
00037   ACE_CHECK;
00038 
00039   this->consumer_admin_.reset (consumer_admin);
00040 
00041   const CosNotification::QoSProperties &default_ps_qos =
00042     TAO_Notify_PROPERTIES::instance ()->default_proxy_supplier_qos_properties ();
00043 
00044   this->set_qos (default_ps_qos ACE_ENV_ARG_PARAMETER);
00045   ACE_CHECK;
00046 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE bool TAO_Notify_ProxySupplier::is_connected void   )  const
 

Returns true if connected.

Definition at line 8 of file ProxySupplier.inl.

References ACE_Auto_Basic_Ptr< X >::get().

00009 {
00010   return ( this->consumer_.get() != 0 );
00011 }

TAO_Notify_Peer * TAO_Notify_ProxySupplier::peer void   )  [private, virtual]
 

Access our Peer.

Implements TAO_Notify_Proxy.

Definition at line 49 of file ProxySupplier.cpp.

References consumer().

00050 {
00051   return this->consumer ();
00052 }

void TAO_Notify_ProxySupplier::qos_changed const TAO_Notify_QoSProperties qos_properties  )  [virtual]
 

Override, TAO_Notify_Proxy::qos_changed to apply MaxEventssPerConsumer QoS.

Reimplemented from TAO_Notify_Proxy.

Definition at line 161 of file ProxySupplier.cpp.

References TAO_Notify_Proxy::qos_changed().

00162 {
00163   TAO_Notify_Proxy::qos_changed (qos_properties);
00164 }

int TAO_Notify_ProxySupplier::shutdown  )  [virtual]
 

Override TAO_Notify_Container_T::shutdown method.

Reimplemented from TAO_Notify_Object.

Definition at line 122 of file ProxySupplier.cpp.

References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, disconnect(), ACE_Auto_Basic_Ptr< X >::get(), and TAO_Notify_Object::shutdown().

Referenced by destroy().

00123 {
00124   if (this->TAO_Notify_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1)
00125     return 1;
00126 
00127   ACE_CHECK_RETURN (1);
00128 
00129   this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER);
00130   ACE_CHECK_RETURN (1);
00131 
00132   if (this->consumer_.get() != 0)
00133   {
00134     this->consumer_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
00135   }
00136   return 0;
00137 }


Friends And Related Function Documentation

friend class TAO_Notify_Consumer [friend]
 

Definition at line 39 of file ProxySupplier.h.


Member Data Documentation

ACE_Auto_Ptr<TAO_Notify_Consumer> TAO_Notify_ProxySupplier::consumer_ [private]
 

The Consumer that we're connect to.

Definition at line 88 of file ProxySupplier.h.

TAO_Notify_ConsumerAdmin::Ptr TAO_Notify_ProxySupplier::consumer_admin_ [private]
 

= Data Members. The CA parent.

Definition at line 85 of file ProxySupplier.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:32:52 2006 for TAO_CosNotification by doxygen 1.3.6