TAO_EC_Servant_Var< T > Class Template Reference

#include <EC_Lifetime_Utils_T.h>

Collaboration diagram for TAO_EC_Servant_Var< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_EC_Servant_Var (T *p=0)
 Constructor. Assumes ownership of p.

 TAO_EC_Servant_Var (TAO_EC_Servant_Var< T > const &rhs)
 Copy constructor. Adds reference to rhs.

TAO_EC_Servant_Var< T > & operator= (TAO_EC_Servant_Var< T > const &rhs)
 Assignment operator. Adds reference to rhs.

 ~TAO_EC_Servant_Var ()
TAO_EC_Servant_Var< T > & operator= (T *p)
 Assignment operator. Assumes ownership of p.

template<class Y>  TAO_EC_Servant_Var (Y *p)
template<class Y>  TAO_EC_Servant_Var (TAO_EC_Servant_Var< Y > const &rhs)
template<class Y> TAO_EC_Servant_Var< T > & operator= (TAO_EC_Servant_Var< Y > const &rhs)
template<class Y> TAO_EC_Servant_Var< T > & operator= (Y *p)
T const * operator-> () const
 Smart pointer operator-> provides access to the underlying object.

T * operator-> ()
 Smart pointer operator-> provides access to the underlying object.

T const & operator * () const
 Dereference the underlying object.

T & operator * ()
 Dereference the underlying object.

 operator void const * () const
T * in () const
 As an IN parameter.

T *& inout ()
 As an INOUT parameter.

T *& out ()
 As an OUT parameter.

T * _retn ()

Private Attributes

T * ptr_

template<class T>
class TAO_EC_Servant_Var< T >


Constructor & Destructor Documentation

template<class T>
TAO_END_VERSIONED_NAMESPACE_DECL TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_EC_Servant_Var< T >::TAO_EC_Servant_Var T *  p = 0  ) 
 

Constructor. Assumes ownership of p.

Definition at line 124 of file EC_Lifetime_Utils_T.inl.

00125   : ptr_(p)
00126 {
00127 }

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

Copy constructor. Adds reference to rhs.

Definition at line 133 of file EC_Lifetime_Utils_T.inl.

00134   : ptr_(rhs.ptr_)
00135 {
00136   if (ptr_)
00137     {
00138       try
00139         {
00140           ptr_->_add_ref ();
00141         }
00142       catch (...)
00143         {
00144           throw;
00145         }
00146     }
00147 }

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

Destructor. Removes a reference from the underlying object, possibly destroying it.

Definition at line 179 of file EC_Lifetime_Utils_T.inl.

00180 {
00181   // Unfortunately, there is no throw spec on _remove_ref, so we
00182   // can't assume that it will not throw.  If it does, then we are in
00183   // trouble.  In any event, we can't let the exception escape our
00184   // destructor.
00185   if (ptr_ != 0)
00186   {
00187     try
00188     {
00189       ptr_->_remove_ref ();
00190     }
00191     catch (...)
00192     {
00193     }
00194   }
00195 }

template<class T>
template<class Y>
ACE_INLINE TAO_EC_Servant_Var< T >::TAO_EC_Servant_Var Y *  p  ) 
 

Template member constructor from a pointer that will implicitly cast to type T. Assumes ownership of p. This constructor allows constructs such as: Servant_Base<Base> p(new Derived);

Definition at line 200 of file EC_Lifetime_Utils_T.inl.

00201   : ptr_(p)
00202 {
00203 }

template<class T>
template<class Y>
ACE_INLINE TAO_EC_Servant_Var< T >::TAO_EC_Servant_Var TAO_EC_Servant_Var< Y > const &  rhs  ) 
 

Template member copy constructor from a TAO_EC_Servant_Var<Y>, where Y can be implicitly cast to type T.

Definition at line 207 of file EC_Lifetime_Utils_T.inl.

00208   : ptr_(rhs.in())
00209 {
00210   if (ptr_)
00211   {
00212     ptr_->_add_ref();
00213   }
00214 }


Member Function Documentation

template<class T>
ACE_INLINE T * TAO_EC_Servant_Var< T >::_retn  ) 
 

Definition at line 310 of file EC_Lifetime_Utils_T.inl.

Referenced by TAO_ECG_Mcast_Gateway::init_address_server().

00311 {
00312   T * rval = ptr_;
00313   ptr_ = 0;
00314   return rval;
00315 }

template<class T>
ACE_INLINE T * TAO_EC_Servant_Var< T >::in  )  const
 

As an IN parameter.

Definition at line 282 of file EC_Lifetime_Utils_T.inl.

Referenced by TAO_ECG_Mcast_Gateway::init_address_server(), TAO_ECG_Mcast_Gateway::init_receiver(), TAO_ECG_Mcast_Gateway::init_sender(), operator!=(), operator==(), and TAO_ECG_Mcast_Gateway::run().

00283 {
00284   return ptr_;
00285 }

template<class T>
ACE_INLINE T *& TAO_EC_Servant_Var< T >::inout  ) 
 

As an INOUT parameter.

Definition at line 289 of file EC_Lifetime_Utils_T.inl.

00290 {
00291   return ptr_;
00292 }

template<class T>
ACE_INLINE T & TAO_EC_Servant_Var< T >::operator *  ) 
 

Dereference the underlying object.

Definition at line 268 of file EC_Lifetime_Utils_T.inl.

00269 {
00270   return *ptr_;
00271 }

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

Dereference the underlying object.

Definition at line 261 of file EC_Lifetime_Utils_T.inl.

00262 {
00263   return *ptr_;
00264 }

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

Return a void pointer to the underlying object. This allows it to be used in conditional code and tested against 0.

Definition at line 275 of file EC_Lifetime_Utils_T.inl.

00276 {
00277   return ptr_;
00278 }

template<class T>
ACE_INLINE T * TAO_EC_Servant_Var< T >::operator->  ) 
 

Smart pointer operator-> provides access to the underlying object.

Definition at line 254 of file EC_Lifetime_Utils_T.inl.

00255 {
00256   return ptr_;
00257 }

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

Smart pointer operator-> provides access to the underlying object.

Definition at line 247 of file EC_Lifetime_Utils_T.inl.

00248 {
00249   return ptr_;
00250 }

template<class T>
template<class Y>
ACE_INLINE TAO_EC_Servant_Var< T > & TAO_EC_Servant_Var< T >::operator= Y *  p  ) 
 

Template member assignment operator from a pointer to Y, where Y can be implicitly cast to type T.

Definition at line 232 of file EC_Lifetime_Utils_T.inl.

References TAO_EC_Servant_Var< T >::ptr_.

00233 {
00234   TAO_EC_Servant_Var<T> tmp(p);
00235 
00236   // std::swap(tmp.ptr_, ptr_);
00237   T * swap_temp = tmp.ptr_;
00238   tmp.ptr_ = ptr_;
00239   ptr_ = swap_temp;
00240 
00241   return *this;
00242 }

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

Template member assignment operator from a TAO_EC_Servant_Var<Y>, where Y can be implicitly cast to type T.

Definition at line 218 of file EC_Lifetime_Utils_T.inl.

References TAO_EC_Servant_Var< T >::ptr_.

00219 {
00220   TAO_EC_Servant_Var<T> tmp(rhs);
00221 
00222   // std::swap(tmp.ptr_, ptr_);
00223   T * swap_temp = tmp.ptr_;
00224   tmp.ptr_ = ptr_;
00225   ptr_ = swap_temp;
00226 
00227   return *this;
00228 }

template<class T>
ACE_INLINE TAO_EC_Servant_Var< T > & TAO_EC_Servant_Var< T >::operator= T *  p  ) 
 

Assignment operator. Assumes ownership of p.

Definition at line 165 of file EC_Lifetime_Utils_T.inl.

References TAO_EC_Servant_Var< T >::ptr_.

00166 {
00167   TAO_EC_Servant_Var<T> tmp(p);
00168 
00169   // std::swap(tmp.ptr_, ptr_);
00170   T * swap_temp = tmp.ptr_;
00171   tmp.ptr_ = ptr_;
00172   ptr_ = swap_temp;
00173 
00174   return *this;
00175 }

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

Assignment operator. Adds reference to rhs.

Definition at line 151 of file EC_Lifetime_Utils_T.inl.

References TAO_EC_Servant_Var< T >::ptr_.

00152 {
00153   TAO_EC_Servant_Var<T> tmp(rhs);
00154 
00155   // std::swap(tmp.ptr_, ptr_);
00156   T * swap_temp = tmp.ptr_;
00157   tmp.ptr_ = ptr_;
00158   ptr_ = swap_temp;
00159 
00160   return *this;
00161 }

template<class T>
ACE_INLINE T *& TAO_EC_Servant_Var< T >::out  ) 
 

As an OUT parameter.

Definition at line 296 of file EC_Lifetime_Utils_T.inl.

References TAO_EC_Servant_Var< T >::ptr_.

00297 {
00298   TAO_EC_Servant_Var<T> tmp;
00299 
00300   // std::swap(tmp.ptr_, ptr_);
00301   T * swap_temp = tmp.ptr_;
00302   tmp.ptr_ = ptr_;
00303   ptr_ = swap_temp;
00304 
00305   return ptr_;
00306 }


Member Data Documentation

template<class T>
T* TAO_EC_Servant_Var< T >::ptr_ [private]
 

Definition at line 174 of file EC_Lifetime_Utils_T.h.

Referenced by TAO_EC_Servant_Var< T >::operator=(), and TAO_EC_Servant_Var< T >::out().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:43:03 2008 for TAO_RTEvent by doxygen 1.3.6