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 127 of file EC_Lifetime_Utils_T.i.

00128   : ptr_(p)
00129 {
00130 }

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 136 of file EC_Lifetime_Utils_T.i.

References ACE_CATCHALL, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_RE_THROW, ACE_TRY_CHECK, and ACE_TRY_NEW_ENV.

00137   : ptr_(rhs.ptr_)
00138 {
00139   if (ptr_)
00140     {
00141       ACE_TRY_NEW_ENV
00142         {
00143           ptr_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00144           ACE_TRY_CHECK;
00145         }
00146       ACE_CATCHALL
00147         {
00148           ACE_RE_THROW;
00149         }
00150         ACE_ENDTRY;
00151     }
00152 }

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 184 of file EC_Lifetime_Utils_T.i.

References ACE_CATCHALL, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY_CHECK, and ACE_TRY_NEW_ENV.

00185 {
00186   // Unfortunately, there is no throw spec on _remove_ref, so we
00187   // can't assume that it will not throw.  If it does, then we are in
00188   // trouble.  In any event, we can't let the exception escape our
00189   // destructor.
00190   if (ptr_ != 0)
00191   {
00192     ACE_TRY_NEW_ENV
00193     {
00194       ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
00195       ACE_TRY_CHECK;
00196     }
00197     ACE_CATCHALL
00198     {
00199     }
00200     ACE_ENDTRY;
00201   }
00202 }

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 207 of file EC_Lifetime_Utils_T.i.

00208   : ptr_(p)
00209 {
00210 }

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 214 of file EC_Lifetime_Utils_T.i.

00215   : ptr_(rhs.in())
00216 {
00217   if (ptr_)
00218   {
00219     ptr_->_add_ref();
00220   }
00221 }


Member Function Documentation

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

Definition at line 317 of file EC_Lifetime_Utils_T.i.

Referenced by TAO_ECG_Mcast_Gateway::init_address_server().

00318 {
00319   T * rval = ptr_;
00320   ptr_ = 0;
00321   return rval;
00322 }

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

As an IN parameter.

Definition at line 289 of file EC_Lifetime_Utils_T.i.

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().

00290 {
00291   return ptr_;
00292 }

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

As an INOUT parameter.

Definition at line 296 of file EC_Lifetime_Utils_T.i.

00297 {
00298   return ptr_;
00299 }

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

Dereference the underlying object.

Definition at line 275 of file EC_Lifetime_Utils_T.i.

00276 {
00277   return *ptr_;
00278 }

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

Dereference the underlying object.

Definition at line 268 of file EC_Lifetime_Utils_T.i.

00269 {
00270   return *ptr_;
00271 }

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 282 of file EC_Lifetime_Utils_T.i.

00283 {
00284   return ptr_;
00285 }

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

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

Definition at line 261 of file EC_Lifetime_Utils_T.i.

00262 {
00263   return ptr_;
00264 }

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 254 of file EC_Lifetime_Utils_T.i.

00255 {
00256   return ptr_;
00257 }

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 239 of file EC_Lifetime_Utils_T.i.

References TAO_EC_Servant_Var< T >::ptr_.

00240 {
00241   TAO_EC_Servant_Var<T> tmp(p);
00242 
00243   // std::swap(tmp.ptr_, ptr_);
00244   T * swap_temp = tmp.ptr_;
00245   tmp.ptr_ = ptr_;
00246   ptr_ = swap_temp;
00247 
00248   return *this;
00249 }

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 225 of file EC_Lifetime_Utils_T.i.

References TAO_EC_Servant_Var< T >::ptr_.

00226 {
00227   TAO_EC_Servant_Var<T> tmp(rhs);
00228 
00229   // std::swap(tmp.ptr_, ptr_);
00230   T * swap_temp = tmp.ptr_;
00231   tmp.ptr_ = ptr_;
00232   ptr_ = swap_temp;
00233 
00234   return *this;
00235 }

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 170 of file EC_Lifetime_Utils_T.i.

References TAO_EC_Servant_Var< T >::ptr_.

00171 {
00172   TAO_EC_Servant_Var<T> tmp(p);
00173 
00174   // std::swap(tmp.ptr_, ptr_);
00175   T * swap_temp = tmp.ptr_;
00176   tmp.ptr_ = ptr_;
00177   ptr_ = swap_temp;
00178 
00179   return *this;
00180 }

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 156 of file EC_Lifetime_Utils_T.i.

References TAO_EC_Servant_Var< T >::ptr_.

00157 {
00158   TAO_EC_Servant_Var<T> tmp(rhs);
00159 
00160   // std::swap(tmp.ptr_, ptr_);
00161   T * swap_temp = tmp.ptr_;
00162   tmp.ptr_ = ptr_;
00163   ptr_ = swap_temp;
00164 
00165   return *this;
00166 }

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

As an OUT parameter.

Definition at line 303 of file EC_Lifetime_Utils_T.i.

References TAO_EC_Servant_Var< T >::ptr_.

00304 {
00305   TAO_EC_Servant_Var<T> tmp;
00306 
00307   // std::swap(tmp.ptr_, ptr_);
00308   T * swap_temp = tmp.ptr_;
00309   tmp.ptr_ = ptr_;
00310   ptr_ = swap_temp;
00311 
00312   return ptr_;
00313 }


Member Data Documentation

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

Definition at line 175 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 Thu Nov 9 13:15:42 2006 for TAO_RTEvent by doxygen 1.3.6