Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

TAO::Cache_IntId_T< TRANSPORT_TYPE > Class Template Reference

Helper class for TAO_Transport_Cache_Manager. More...

#include <Cache_Entries_T.h>

List of all members.

Public Types

typedef TRANSPORT_TYPE transport_type

Public Member Functions

 Cache_IntId_T (void)
 Constructor.
 Cache_IntId_T (transport_type *transport)
 Constructor.
 Cache_IntId_T (const Cache_IntId_T &rhs)
 Copy constructor.
 ~Cache_IntId_T (void)
 Destructor.
Cache_IntId_Toperator= (const Cache_IntId_T &rhs)
 Assignment operator (does copy memory).
bool operator== (const Cache_IntId_T &rhs) const
 Equality comparison operator (must match both id_ and kind_).
bool operator!= (const Cache_IntId_T &rhs) const
 Inequality comparison operator.
transport_type * transport (void)
 Return the underlying transport.
const transport_type * transport (void) const
 Return the underlying transport.
void recycle_state (Cache_Entries_State new_state)
 Set recycle_state.
Cache_Entries_State recycle_state (void) const
 Get recycle_state.
transport_type * relinquish_transport (void)
bool is_connected (void) const
 Get the connected flag.
void is_connected (bool connected)
 Set the connected flag.

Static Public Member Functions

static const char * state_name (Cache_Entries_State st)

Private Attributes

transport_type * transport_
 The transport that needs to be cached.
Cache_Entries_State recycle_state_
 The state of the handle.
bool is_connected_

Detailed Description

template<typename TRANSPORT_TYPE>
class TAO::Cache_IntId_T< TRANSPORT_TYPE >

Helper class for TAO_Transport_Cache_Manager.

Helper class that wraps the

part of the Map or table holding the Transport state.: unifies data items, so they can be stored together as a

for a <key> in a table holding the state of the Transport Cache.

Definition at line 65 of file Cache_Entries_T.h.


Member Typedef Documentation

template<typename TRANSPORT_TYPE>
typedef TRANSPORT_TYPE TAO::Cache_IntId_T< TRANSPORT_TYPE >::transport_type

Definition at line 68 of file Cache_Entries_T.h.


Constructor & Destructor Documentation

template<typename TRANSPORT_TYPE >
TAO::Cache_IntId_T< TRANSPORT_TYPE >::Cache_IntId_T ( void   ) 

Constructor.

Definition at line 13 of file Cache_Entries_T.inl.

template<typename TRANSPORT_TYPE >
TAO::Cache_IntId_T< TRANSPORT_TYPE >::Cache_IntId_T ( transport_type *  transport  ) 

Constructor.

Definition at line 18 of file Cache_Entries_T.cpp.

    : transport_ (transport)
    , recycle_state_ (ENTRY_UNKNOWN)
    , is_connected_ (false)
  {
    this->is_connected_ = transport->is_connected();
    transport->add_reference ();
    if (TAO_debug_level > 9)
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("TAO (%P|%t) - Cache_IntId_T::Cache_IntId_T, ")
                  ACE_TEXT ("this=%@ Transport[%d] is%Cconnected\n"),
                  this, transport->id (), (is_connected_ ? " " : " not ")));
  }

template<typename TRANSPORT_TYPE >
TAO::Cache_IntId_T< TRANSPORT_TYPE >::Cache_IntId_T ( const Cache_IntId_T< TRANSPORT_TYPE > &  rhs  ) 

Copy constructor.

Definition at line 21 of file Cache_Entries_T.inl.

    : transport_ (0),
      recycle_state_ (ENTRY_UNKNOWN),
      is_connected_ (false)
  {
    *this = rhs;
  }

template<typename TRANSPORT_TYPE >
TAO::Cache_IntId_T< TRANSPORT_TYPE >::~Cache_IntId_T ( void   ) 

Destructor.

Definition at line 33 of file Cache_Entries_T.cpp.

  {
    if (this->transport_)
      this->transport_->remove_reference ();
  }


Member Function Documentation

template<typename TRANSPORT_TYPE >
bool TAO::Cache_IntId_T< TRANSPORT_TYPE >::is_connected ( void   )  const

Get the connected flag.

Definition at line 57 of file Cache_Entries_T.inl.

  {
    return this->is_connected_;
  }

template<typename TRANSPORT_TYPE >
void TAO::Cache_IntId_T< TRANSPORT_TYPE >::is_connected ( bool  connected  ) 

Set the connected flag.

Definition at line 64 of file Cache_Entries_T.inl.

  {
    this->is_connected_ = connected;
  }

template<typename TRANSPORT_TYPE >
bool TAO::Cache_IntId_T< TRANSPORT_TYPE >::operator!= ( const Cache_IntId_T< TRANSPORT_TYPE > &  rhs  )  const

Inequality comparison operator.

Definition at line 36 of file Cache_Entries_T.inl.

  {
    return (this->transport_ != rhs.transport_);
  }

template<typename TRANSPORT_TYPE >
Cache_IntId_T< TRANSPORT_TYPE > & TAO::Cache_IntId_T< TRANSPORT_TYPE >::operator= ( const Cache_IntId_T< TRANSPORT_TYPE > &  rhs  ) 

Assignment operator (does copy memory).

Definition at line 41 of file Cache_Entries_T.cpp.

  {
    if (this != &rhs)
      {
        this->recycle_state_ = rhs.recycle_state_;
        this->is_connected_ = rhs.is_connected_;
        transport_type *old_transport = this->transport_;
        this->transport_ = rhs.transport_;
        if (this->transport_)
          this->transport_->add_reference ();
        if (old_transport)
          old_transport->remove_reference ();
      }

    return *this;
  }

template<typename TRANSPORT_TYPE >
bool TAO::Cache_IntId_T< TRANSPORT_TYPE >::operator== ( const Cache_IntId_T< TRANSPORT_TYPE > &  rhs  )  const

Equality comparison operator (must match both id_ and kind_).

Definition at line 30 of file Cache_Entries_T.inl.

  {
    return (this->transport_ == rhs.transport_);
  }

template<typename TRANSPORT_TYPE >
Cache_Entries_State TAO::Cache_IntId_T< TRANSPORT_TYPE >::recycle_state ( void   )  const

Get recycle_state.

Definition at line 70 of file Cache_Entries_T.inl.

  {
    return this->recycle_state_;
  }

template<typename TRANSPORT_TYPE >
void TAO::Cache_IntId_T< TRANSPORT_TYPE >::recycle_state ( Cache_Entries_State  new_state  ) 

Set recycle_state.

Definition at line 61 of file Cache_Entries_T.cpp.

  {
    if (TAO_debug_level > 9)
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Cache_IntId_T::")
                  ACE_TEXT ("recycle_state, %C->%C Transport[%d] IntId=%@\n"),
                  state_name (recycle_state_), state_name (st),
                  transport_ ? transport_->id() : 0, this));
    this->recycle_state_ = st;
  }

template<typename TRANSPORT_TYPE >
Cache_IntId_T< TRANSPORT_TYPE >::transport_type * TAO::Cache_IntId_T< TRANSPORT_TYPE >::relinquish_transport ( void   ) 

Relinquish ownership of the TAO_Transport object associated with this Cache_IntId_T.

Note:
This method should go away once the Transport_Cache_Map_Manager is improved so that it returns TAO_Transport objects when performing a find() operation. This method really only exists to get around inadequacies in the Transport_Cache_Map_Manager interface.

Definition at line 77 of file Cache_Entries_T.inl.

  {
    // Yield ownership of the TAO_Transport object.
    transport_type *val = this->transport_;
    this->transport_ = 0;
    return val;
  }

template<typename TRANSPORT_TYPE >
const char * TAO::Cache_IntId_T< TRANSPORT_TYPE >::state_name ( Cache_Entries_State  st  )  [static]

Definition at line 86 of file Cache_Entries_T.inl.

  {
#define TAO_CACHE_INTID_ENTRY(X) case X: return #X
    switch (st)
      {
        TAO_CACHE_INTID_ENTRY (ENTRY_IDLE_AND_PURGABLE);
        TAO_CACHE_INTID_ENTRY (ENTRY_PURGABLE_BUT_NOT_IDLE);
        TAO_CACHE_INTID_ENTRY (ENTRY_BUSY);
        TAO_CACHE_INTID_ENTRY (ENTRY_CLOSED);
        TAO_CACHE_INTID_ENTRY (ENTRY_CONNECTING);
        TAO_CACHE_INTID_ENTRY (ENTRY_UNKNOWN);
      }
    return "***Unknown enum value, update Cache_IntId_T::state_name()";
#undef TAO_CACHE_INTID_ENTRY
  }

template<typename TRANSPORT_TYPE >
const Cache_IntId_T< TRANSPORT_TYPE >::transport_type * TAO::Cache_IntId_T< TRANSPORT_TYPE >::transport ( void   )  const

Return the underlying transport.

Definition at line 50 of file Cache_Entries_T.inl.

  {
    return this->transport_;
  }

template<typename TRANSPORT_TYPE >
Cache_IntId_T< TRANSPORT_TYPE >::transport_type * TAO::Cache_IntId_T< TRANSPORT_TYPE >::transport ( void   ) 

Return the underlying transport.

Definition at line 43 of file Cache_Entries_T.inl.

  {
    return this->transport_;
  }


Member Data Documentation

template<typename TRANSPORT_TYPE>
bool TAO::Cache_IntId_T< TRANSPORT_TYPE >::is_connected_ [private]

This is an analog for the transport::is_connected(), which is guarded by a mutex.

Definition at line 131 of file Cache_Entries_T.h.

template<typename TRANSPORT_TYPE>
Cache_Entries_State TAO::Cache_IntId_T< TRANSPORT_TYPE >::recycle_state_ [private]

The state of the handle.

Definition at line 127 of file Cache_Entries_T.h.

template<typename TRANSPORT_TYPE>
transport_type* TAO::Cache_IntId_T< TRANSPORT_TYPE >::transport_ [private]

The transport that needs to be cached.

Definition at line 124 of file Cache_Entries_T.h.


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