Public Types | Public Member Functions | Protected Member Functions | Private Member Functions

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

Definition at line 40 of file Peer.h.


Constructor & Destructor Documentation

TAO_Notify_Peer::TAO_Notify_Peer ( void   ) 

Constructor.

Definition at line 13 of file Peer.cpp.

{
}

TAO_Notify_Peer::~TAO_Notify_Peer (  )  [virtual]

Destructor.

Definition at line 17 of file Peer.cpp.

{
}


Member Function Documentation

CORBA::ULong TAO_Notify_Peer::_decr_refcnt ( void   ) 

Definition at line 115 of file Peer.cpp.

{
  return this->proxy ()->_decr_refcnt ();
}

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.

{
  return this->proxy ()->_incr_refcnt ();
}

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.

{
  TAO_Notify_EventTypeSeq subscribed_types ;
  this->proxy ()->subscribed_types (subscribed_types);

  try
    {
      CosNotification::EventTypeSeq cos_added;
      CosNotification::EventTypeSeq cos_removed;

      const TAO_Notify_EventType& special = TAO_Notify_EventType::special ();

      // Don;t inform of types that we already know about.
      // E.g. if we're subscribed for {A,B,C,F}
      // and we receive an update with added list {A,B,G}
      // then, we should only send {G} because peer already knows about {A, B}
      // However if we're subscribed for everything, send all kinds of adds.

      // Don;t inform of removed types that we don;t care about.
      // e.g. if we're currently subscribed for {A,B,C,F}
      // and we receive an update with removed list {A, B, D}
      // then, we should only send {A,B} because the peer is not interested in D.
      // However if we're subscribed for everything, send all kinds of removes.

      TAO_Notify_EventTypeSeq added_result = added;
      TAO_Notify_EventTypeSeq removed_result;

      if (subscribed_types.find (special) != 0)
        {
          added_result.remove_seq (subscribed_types);
          removed_result.intersection (subscribed_types, removed);
        }
      else
        {
          removed_result = removed;
        }

      added_result.populate_no_special (cos_added);
      removed_result.populate_no_special (cos_removed);

      if (cos_added.length () != 0 || cos_removed.length () != 0)
        {
          // Protect this object from being destroyed in this scope.
          TAO_Notify_Proxy::Ptr proxy_guard(this->proxy ());

          this->dispatch_updates_i (cos_added, cos_removed);
        }
    }
  catch (const CORBA::OBJECT_NOT_EXIST&)
    {
      this->handle_dispatch_exception ();
    }
  catch (const CORBA::NO_IMPLEMENT&)
    {
      // The peer does not implement the offer/subscription_change method
      // Do nothing. Later, perhaps set a flag that helps us decide if we should dispatch_updates_i.
    }
  catch (const CORBA::SystemException&)
    {
      this->handle_dispatch_exception ();
    }
  catch (const CORBA::Exception&)
    {
      // Do nothing
    }
}

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_Supplier.

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

Handle dispatch exceptions.

Definition at line 34 of file Peer.cpp.

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

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

Access Proxy.

Implemented in TAO_Notify_Supplier.

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

QoS changed notification from the Peer.

Definition at line 22 of file Peer.cpp.

{
  // NOP.
}

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

Shutdown the peer.

Definition at line 28 of file Peer.cpp.

{
  // NOP.
}


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines