TAO_Notify_Peer Class Reference

Base class for Supplier and Consumer classes. This object delegates its reference count to its creator proxy object. More...

#include <Peer.h>

Inheritance diagram for TAO_Notify_Peer:

Inheritance graph
[legend]
List of all members.

Public Types

typedef TAO_Notify_Refcountable_Guard_T<
TAO_Notify_Peer
Ptr

Public Member Functions

 TAO_Notify_Peer (void)
 Constructor.
virtual ~TAO_Notify_Peer ()
 Destructor.
CORBA::ULong _incr_refcnt (void)
CORBA::ULong _decr_refcnt (void)
virtual void shutdown (void)
 Shutdown the peer.
virtual TAO_Notify_Proxyproxy (void)=0
 Access Proxy.
virtual void dispatch_updates (const TAO_Notify_EventTypeSeq &added, const TAO_Notify_EventTypeSeq &removed)
virtual void qos_changed (const TAO_Notify_QoSProperties &qos_properties)
 QoS changed notification from the Peer.
void handle_dispatch_exception (void)
 Handle dispatch exceptions.
virtual ACE_CString get_ior (void) const =0
 Retrieve the ior of this peer.

Protected Member Functions

virtual void dispatch_updates_i (const CosNotification::EventTypeSeq &added, const CosNotification::EventTypeSeq &removed)=0
 Implementation of Peer specific dispatch_updates.

Private Member Functions

virtual void release (void)=0
 Release.

Detailed Description

Base class for Supplier and Consumer classes. This object delegates its reference count to its creator proxy object.

Definition at line 37 of file Peer.h.


Member Typedef Documentation

typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_Peer > TAO_Notify_Peer::Ptr

Definition at line 40 of file Peer.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_Peer::TAO_Notify_Peer ( void   ) 

Constructor.

Definition at line 13 of file Peer.cpp.

00014 {
00015 }

TAO_Notify_Peer::~TAO_Notify_Peer (  )  [virtual]

Destructor.

Definition at line 17 of file Peer.cpp.

00018 {
00019 }


Member Function Documentation

CORBA::ULong TAO_Notify_Peer::_decr_refcnt ( void   ) 

Definition at line 115 of file Peer.cpp.

References TAO_Notify_Refcountable::_decr_refcnt(), and proxy().

00116 {
00117   return this->proxy ()->_decr_refcnt ();
00118 }

CORBA::ULong TAO_Notify_Peer::_incr_refcnt ( void   ) 

This method sigantures deliberately match the RefCounting methods required for ESF Proxy

Definition at line 109 of file Peer.cpp.

References TAO_Notify_Refcountable::_incr_refcnt(), and proxy().

00110 {
00111   return this->proxy ()->_incr_refcnt ();
00112 }

void TAO_Notify_Peer::dispatch_updates ( const TAO_Notify_EventTypeSeq added,
const TAO_Notify_EventTypeSeq removed 
) [virtual]

Definition at line 41 of file Peer.cpp.

References dispatch_updates_i(), ACE_Unbounded_Set_Ex< T, C >::find(), handle_dispatch_exception(), TAO_Notify_EventTypeSeq::intersection(), TAO_Notify_EventTypeSeq::populate_no_special(), proxy(), TAO_Notify_EventTypeSeq::remove_seq(), TAO_Notify_EventType::special(), and TAO_Notify_Proxy::subscribed_types().

Referenced by TAO_Notify_Method_Request_Updates_T< SEQ, PROXY, SEQ_PARAM, PROXY_PARAM >::execute_i().

00042 {
00043   TAO_Notify_EventTypeSeq subscribed_types ;
00044   this->proxy ()->subscribed_types (subscribed_types);
00045 
00046   try
00047     {
00048       CosNotification::EventTypeSeq cos_added;
00049       CosNotification::EventTypeSeq cos_removed;
00050 
00051       const TAO_Notify_EventType& special = TAO_Notify_EventType::special ();
00052 
00053       // Don;t inform of types that we already know about.
00054       // E.g. if we're subscribed for {A,B,C,F}
00055       // and we receive an update with added list {A,B,G}
00056       // then, we should only send {G} because peer already knows about {A, B}
00057       // However if we're subscribed for everything, send all kinds of adds.
00058 
00059       // Don;t inform of removed types that we don;t care about.
00060       // e.g. if we're currently subscribed for {A,B,C,F}
00061       // and we receive an update with removed list {A, B, D}
00062       // then, we should only send {A,B} because the peer is not interested in D.
00063       // However if we're subscribed for everything, send all kinds of removes.
00064 
00065       TAO_Notify_EventTypeSeq added_result = added;
00066       TAO_Notify_EventTypeSeq removed_result;
00067 
00068       if (subscribed_types.find (special) != 0)
00069         {
00070           added_result.remove_seq (subscribed_types);
00071           removed_result.intersection (subscribed_types, removed);
00072         }
00073       else
00074         {
00075           removed_result = removed;
00076         }
00077 
00078       added_result.populate_no_special (cos_added);
00079       removed_result.populate_no_special (cos_removed);
00080 
00081       if (cos_added.length () != 0 || cos_removed.length () != 0)
00082         {
00083           // Protect this object from being destroyed in this scope.
00084           TAO_Notify_Proxy::Ptr proxy_guard(this->proxy ());
00085 
00086           this->dispatch_updates_i (cos_added, cos_removed);
00087         }
00088     }
00089   catch (const CORBA::OBJECT_NOT_EXIST&)
00090     {
00091       this->handle_dispatch_exception ();
00092     }
00093   catch (const CORBA::NO_IMPLEMENT&)
00094     {
00095       // The peer does not implement the offer/subscription_change method
00096       // Do nothing. Later, perhaps set a flag that helps us decide if we should dispatch_updates_i.
00097     }
00098   catch (const CORBA::SystemException&)
00099     {
00100       this->handle_dispatch_exception ();
00101     }
00102   catch (const CORBA::Exception&)
00103     {
00104       // Do nothing
00105     }
00106 }

virtual void TAO_Notify_Peer::dispatch_updates_i ( const CosNotification::EventTypeSeq added,
const CosNotification::EventTypeSeq removed 
) [protected, pure virtual]

Implementation of Peer specific dispatch_updates.

Implemented in TAO_Notify_Consumer, and TAO_Notify_Supplier.

Referenced by dispatch_updates().

virtual ACE_CString TAO_Notify_Peer::get_ior ( void   )  const [pure virtual]

Retrieve the ior of this peer.

Implemented in TAO_Notify_PushConsumer, TAO_Notify_PushSupplier, TAO_Notify_SequencePushConsumer, TAO_Notify_SequencePushSupplier, TAO_Notify_StructuredPushConsumer, and TAO_Notify_StructuredPushSupplier.

Referenced by TAO_Notify_Proxy::save_attrs().

void TAO_Notify_Peer::handle_dispatch_exception ( void   ) 

Handle dispatch exceptions.

Definition at line 34 of file Peer.cpp.

References TAO_Notify_Proxy::destroy(), and proxy().

Referenced by dispatch_updates().

00035 {
00036   // Sever all association when a remote client misbehaves. Other strategies like reties are possible but not implemented.
00037   this->proxy ()->destroy ();
00038 }

virtual TAO_Notify_Proxy* TAO_Notify_Peer::proxy ( void   )  [pure virtual]

Access Proxy.

Implemented in TAO_Notify_Consumer, and TAO_Notify_Supplier.

Referenced by _decr_refcnt(), _incr_refcnt(), dispatch_updates(), and handle_dispatch_exception().

void TAO_Notify_Peer::qos_changed ( const TAO_Notify_QoSProperties qos_properties  )  [virtual]

QoS changed notification from the Peer.

Reimplemented in TAO_Notify_Consumer.

Definition at line 22 of file Peer.cpp.

Referenced by TAO_Notify_Proxy::qos_changed().

00023 {
00024   // NOP.
00025 }

virtual void TAO_Notify_Peer::release ( void   )  [private, pure virtual]

Release.

Implemented in TAO_Notify_PushConsumer, TAO_Notify_PushSupplier, TAO_Notify_SequencePushConsumer, TAO_Notify_SequencePushSupplier, TAO_Notify_StructuredPushConsumer, and TAO_Notify_StructuredPushSupplier.

void TAO_Notify_Peer::shutdown ( void   )  [virtual]

Shutdown the peer.

Reimplemented in TAO_Notify_Consumer.

Definition at line 28 of file Peer.cpp.

00029 {
00030   // NOP.
00031 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:46:24 2010 for TAO_CosNotification by  doxygen 1.4.7