TAO_Notify_Refcountable_Guard_T< T > Class Template Reference

Increments the reference count in the constructor, the count is decremented in the destructor. See Refcountable.h for further notes on usage. More...

#include <Refcountable_Guard_T.h>

Collaboration diagram for TAO_Notify_Refcountable_Guard_T< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Notify_Refcountable_Guard_T (T *t=0)
 Constuctor.

 TAO_Notify_Refcountable_Guard_T (const TAO_Notify_Refcountable_Guard_T< T > &rhs)
 Copy constructor.

 ~TAO_Notify_Refcountable_Guard_T ()
 Destructor.

T * get (void) const
 Redirection operator.

bool isSet (void) const
 Boolean test.

T * operator-> (void) const
 Redirection operator.

T & operator * () const
 Dereference operator.

void reset (T *t=0)
 Reassignment.

TAO_Notify_Refcountable_Guard_T<
T > & 
operator= (const TAO_Notify_Refcountable_Guard_T< T > &rhs)
 Assignment.


Private Member Functions

void swap (TAO_Notify_Refcountable_Guard_T< T > &rhs)

Private Attributes

T * t_

Detailed Description

template<class T>
class TAO_Notify_Refcountable_Guard_T< T >

Increments the reference count in the constructor, the count is decremented in the destructor. See Refcountable.h for further notes on usage.

Definition at line 34 of file Refcountable_Guard_T.h.


Constructor & Destructor Documentation

template<class T>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_Notify_Refcountable_Guard_T< T >::TAO_Notify_Refcountable_Guard_T T *  t = 0  )  [explicit]
 

Constuctor.

Definition at line 10 of file Refcountable_Guard_T.inl.

00011   : t_ (t)
00012 {
00013   if ( this->t_ != static_cast< T* >( 0 ) ) this->t_->_incr_refcnt();
00014 }

template<class T>
ACE_INLINE TAO_Notify_Refcountable_Guard_T< T >::TAO_Notify_Refcountable_Guard_T const TAO_Notify_Refcountable_Guard_T< T > &  rhs  ) 
 

Copy constructor.

Definition at line 17 of file Refcountable_Guard_T.inl.

00018   : t_ (rhs.t_)
00019 {
00020   if ( this->t_ != static_cast< T* >( 0 ) ) this->t_->_incr_refcnt();
00021 }

template<class T>
ACE_INLINE TAO_Notify_Refcountable_Guard_T< T >::~TAO_Notify_Refcountable_Guard_T  ) 
 

Destructor.

Definition at line 24 of file Refcountable_Guard_T.inl.

00025 {
00026   if ( this->t_ != static_cast< T* >( 0 ) ) this->t_->_decr_refcnt();
00027 }


Member Function Documentation

template<class T>
ACE_INLINE T * TAO_Notify_Refcountable_Guard_T< T >::get void   )  const
 

Redirection operator.

Definition at line 31 of file Refcountable_Guard_T.inl.

00032 {
00033   return this->t_;
00034 }

template<class T>
ACE_INLINE bool TAO_Notify_Refcountable_Guard_T< T >::isSet void   )  const
 

Boolean test.

Definition at line 38 of file Refcountable_Guard_T.inl.

00039 {
00040   return ( this->t_ != static_cast< T* >( 0 ) );
00041 }

template<class T>
ACE_INLINE T & TAO_Notify_Refcountable_Guard_T< T >::operator *  )  const
 

Dereference operator.

Definition at line 54 of file Refcountable_Guard_T.inl.

References ACE_ASSERT.

00055 {
00056   ACE_ASSERT ( this->t_ != static_cast< T* >( 0 ) );
00057   return *this->t_;
00058 }

template<class T>
ACE_INLINE T * TAO_Notify_Refcountable_Guard_T< T >::operator-> void   )  const
 

Redirection operator.

Definition at line 46 of file Refcountable_Guard_T.inl.

References ACE_ASSERT.

00047 {
00048   ACE_ASSERT ( this->t_ != static_cast< T* >( 0 ) );
00049   return this->t_;
00050 }

template<class T>
ACE_INLINE TAO_Notify_Refcountable_Guard_T< T > & TAO_Notify_Refcountable_Guard_T< T >::operator= const TAO_Notify_Refcountable_Guard_T< T > &  rhs  ) 
 

Assignment.

Definition at line 62 of file Refcountable_Guard_T.inl.

References TAO_Notify_Refcountable_Guard_T< T >::reset(), and TAO_Notify_Refcountable_Guard_T< T >::t_.

00064 {
00065   reset( rhs.t_ );
00066   return *this;
00067 }

template<class T>
ACE_INLINE void TAO_Notify_Refcountable_Guard_T< T >::reset T *  t = 0  ) 
 

Reassignment.

Definition at line 72 of file Refcountable_Guard_T.inl.

References TAO_Notify_Refcountable_Guard_T< T >::swap().

Referenced by TAO_Notify_Refcountable_Guard_T< T >::operator=().

00073 {
00074   if (this->t_ != t)
00075   {
00076     TAO_Notify_Refcountable_Guard_T<T> temp( t );
00077     swap( temp );
00078   }
00079 }

template<class T>
ACE_INLINE void TAO_Notify_Refcountable_Guard_T< T >::swap TAO_Notify_Refcountable_Guard_T< T > &  rhs  )  [private]
 

Definition at line 83 of file Refcountable_Guard_T.inl.

References TAO_Notify_Refcountable_Guard_T< T >::t_.

Referenced by TAO_Notify_Refcountable_Guard_T< T >::reset().

00085 {
00086   T* temp = this->t_;
00087   this->t_ = rhs.t_;
00088   rhs.t_ = temp;
00089 }


Member Data Documentation

template<class T>
T* TAO_Notify_Refcountable_Guard_T< T >::t_ [private]
 

Definition at line 70 of file Refcountable_Guard_T.h.

Referenced by TAO_Notify_Refcountable_Guard_T< T >::operator=(), and TAO_Notify_Refcountable_Guard_T< T >::swap().


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