TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE > Class Template Reference

Implement common tasks in the Admin interfaces. More...

#include <ESF_Proxy_Admin.h>

Inheritance diagram for TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >:

Inheritance graph
[legend]
Collaboration diagram for TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_ESF_Proxy_Admin (EVENT_CHANNEL *ec)
 Constructor, allocate the internal collection.
virtual ~TAO_ESF_Proxy_Admin (void)
 Cleanup internal resources, destroy the internal collection.
void for_each (TAO_ESF_Worker< PROXY > *worker)
 Iterate over its internal collection.
virtual INTERFACE * obtain (void)
 Create a new PROXY and activate it.
virtual void shutdown (void)
virtual void connected (PROXY *proxy)
virtual void reconnected (PROXY *proxy)
virtual void disconnected (PROXY *proxy)

Protected Attributes

EVENT_CHANNEL * event_channel_
 The Event Channel we belong to.

Private Types

typedef TAO_ESF_Proxy_Collection<
PROXY > 
Collection
 Shorthand for the Proxy collection.

Private Attributes

Collectioncollection_
 The proxy collection object.

Detailed Description

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
class TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >

Implement common tasks in the Admin interfaces.

Requirements

The EVENT_CHANNEL interface must implement:

 * /// create a new proxy
 * void create_proxy (PROXY*&);
 *
 * /// destroy a proxy
 * void destroy_proxy (PROXY*);
 *
 * /// create a proxy collection
 * void create_proxy_collection (TAO_ESF_Proxy_Collection<PROXY>*&);
 *
 * /// destroy a proxy collection
 * void destroy_proxy_collection (TAO_ESF_Proxy_Collection<PROXY>*&);
 * 

In addition to the requirements imposed by TAO_ESF_Proxy_Collection<>, the PROXY interface must define:

 * /// The T_ptr for the IDL interface implemented by the PROXY.
 * typename .... _ptr_type;
 *
 * /// The T_var for the IDL interface implemented by the PROXY.
 * typename .... _var_type;
 *
 * /// activate the proxy and return the object reference
 * PROXY::_ptr_type
 * PROXY::activate (void) throw ();
 * 

Definition at line 65 of file ESF_Proxy_Admin.h.


Member Typedef Documentation

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
typedef TAO_ESF_Proxy_Collection<PROXY> TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::Collection [private]

Shorthand for the Proxy collection.

Definition at line 121 of file ESF_Proxy_Admin.h.


Constructor & Destructor Documentation

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::TAO_ESF_Proxy_Admin ( EVENT_CHANNEL *  ec  ) 

Constructor, allocate the internal collection.

Definition at line 16 of file ESF_Proxy_Admin.cpp.

References TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::event_channel_.

00017   : event_channel_ (ec)
00018 {
00019   this->event_channel_->create_proxy_collection (this->collection_);
00020 }

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::~TAO_ESF_Proxy_Admin ( void   )  [virtual]

Cleanup internal resources, destroy the internal collection.

Definition at line 24 of file ESF_Proxy_Admin.cpp.

References TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::event_channel_.

00025 {
00026   this->event_channel_->destroy_proxy_collection (this->collection_);
00027 }


Member Function Documentation

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
void TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::connected ( PROXY *  proxy  )  [virtual]

A <proxy> has connected, this is invoked when the proxy's client has invoked the connect_xxx_yyy() method. The default implementation is a no-op.

Definition at line 61 of file ESF_Proxy_Admin.cpp.

00062 {
00063 }

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
void TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::disconnected ( PROXY *  proxy  )  [virtual]

A <proxy> has been disconnected. The default implementation removes the object from the collection and deactivates the proxy.

Definition at line 74 of file ESF_Proxy_Admin.cpp.

References TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::collection_, and TAO_ESF_Proxy_Collection< PROXY >::disconnected().

00075 {
00076   proxy->deactivate ();
00077 // Cannot happen, just following the discipline.
00078 
00079   try
00080     {
00081       this->collection_->disconnected (proxy);
00082     }
00083   catch (const CORBA::Exception&)
00084     {
00085       // @@ In the future the collections may raise exceptions to
00086       // report errors (such as out of memory or things like that).
00087       // We must decide how is that info going to be used, and how
00088       // would we propagate the exception to the application.
00089       // For example: the CosEC has no exceptions for "out of
00090       // resources" or something similar, and i've never seen a spec
00091       // that has an exception for "could not acquire a mutex".
00092     }
00093 }

template<class EC, class P, class I>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void TAO_ESF_Proxy_Admin< EC, P, I >::for_each ( TAO_ESF_Worker< PROXY > *  worker  ) 

Iterate over its internal collection.

Definition at line 9 of file ESF_Proxy_Admin.inl.

References TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::collection_, and TAO_ESF_Proxy_Collection< PROXY >::for_each().

Referenced by TAO_ESF_Peer_Admin< EVENT_CHANNEL, PROXY, INTERFACE, PEER >::peer_connected(), TAO_ESF_Peer_Admin< EVENT_CHANNEL, PROXY, INTERFACE, PEER >::peer_disconnected(), and TAO_ESF_Peer_Admin< EVENT_CHANNEL, PROXY, INTERFACE, PEER >::peer_reconnected().

00010 {
00011   this->collection_->for_each (worker);
00012 }

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
INTERFACE * TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::obtain ( void   )  [virtual]

Create a new PROXY and activate it.

Definition at line 31 of file ESF_Proxy_Admin.cpp.

References TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::collection_, TAO_ESF_Proxy_Collection< PROXY >::connected(), and TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::event_channel_.

00032 {
00033   PROXY* proxy;
00034   this->event_channel_->create_proxy (proxy);
00035 
00036   TAO_ESF_RefCountedRef<PROXY> holder (proxy);
00037 
00038   typename PROXY::_ptr_type r;
00039   proxy->activate (r);
00040 
00041   typename PROXY::_var_type result = r;
00042 
00043   this->collection_->connected (proxy);
00044 
00045   return result._retn ();
00046 }

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
void TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::reconnected ( PROXY *  proxy  )  [virtual]

A <proxy> has reconnected, i.e. its client has invoked the connect_xxx_yyy() method, but the proxy was connected already. The default implementation delegates on the collection <reconnected> method

Definition at line 67 of file ESF_Proxy_Admin.cpp.

References TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::collection_, and TAO_ESF_Proxy_Collection< PROXY >::reconnected().

00068 {
00069   this->collection_->reconnected (proxy);
00070 }

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
void TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::shutdown ( void   )  [virtual]

The Event Channel that owns this Admin object is going down. Invoke <shutdown> on all the proxies, cleanup the collection and prepare to terminate.

Definition at line 49 of file ESF_Proxy_Admin.cpp.

References TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::collection_, TAO_ESF_Proxy_Collection< PROXY >::for_each(), and TAO_ESF_Proxy_Collection< PROXY >::shutdown().

00050 {
00051   TAO_ESF_Shutdown_Proxy<PROXY> worker;
00052 
00053   this->collection_->for_each (&worker);
00054 // Cannot happen, just following the discipline.
00055 
00056   this->collection_->shutdown ();
00057 }


Member Data Documentation

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
Collection* TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::collection_ [private]

The proxy collection object.

Definition at line 124 of file ESF_Proxy_Admin.h.

Referenced by TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::disconnected(), TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::for_each(), TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::obtain(), TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::reconnected(), and TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::shutdown().

template<class EVENT_CHANNEL, class PROXY, class INTERFACE>
EVENT_CHANNEL* TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::event_channel_ [protected]

The Event Channel we belong to.

Definition at line 117 of file ESF_Proxy_Admin.h.

Referenced by TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::obtain(), TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::TAO_ESF_Proxy_Admin(), and TAO_ESF_Proxy_Admin< EVENT_CHANNEL, PROXY, INTERFACE >::~TAO_ESF_Proxy_Admin().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:43:51 2010 for TAO_ESF by  doxygen 1.4.7