Servant_var.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: Servant_var.inl 77590 2007-03-07 14:07:57Z johnnyw $
00004 
00005 #include <algorithm>
00006 
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008 
00009 template <class T>
00010 ACE_INLINE void
00011 PortableServer::Servant_var<T>::swap (Servant_var<T> & rhs) /* throw () */
00012 {
00013   std::swap (this->ptr_, rhs.ptr_);
00014 }
00015 
00016 template <class T>
00017 ACE_INLINE
00018 PortableServer::Servant_var<T>::Servant_var (T * p)
00019   : ptr_ (p)
00020 {
00021 }
00022 
00023 // If _add_ref throws, this object will not be completely constructed
00024 // so the destructor will not be called.
00025 template <class T>
00026 ACE_INLINE
00027 PortableServer::Servant_var<T>::Servant_var (Servant_var<T> const & rhs)
00028   : ptr_ (Servant_var<T>::_duplicate(rhs.ptr_))
00029 {
00030 }
00031 
00032 template <class T>
00033 ACE_INLINE PortableServer::Servant_var<T> &
00034 PortableServer::Servant_var<T>::operator= (Servant_var<T> const & rhs)
00035 {
00036   PortableServer::Servant_var<T> tmp (rhs);
00037   this->swap (tmp);
00038   return *this;
00039 }
00040 
00041 template <class T>
00042 ACE_INLINE typename PortableServer::Servant_var<T> &
00043 PortableServer::Servant_var<T>::operator= (T * p)
00044 {
00045   if (this->ptr_ != p)
00046     {
00047       // This constructor doesn't increase the reference count, nor is
00048       // it a copy constructor, so we must check for self-assignment.
00049       // Otherwise the reference count would be prematurely
00050       // decremented upon exiting this scope.
00051       PortableServer::Servant_var<T> tmp (p);
00052       this->swap (tmp);
00053     }
00054 
00055   return *this;
00056 }
00057 
00058 /*
00059   #if !defined(ACE_LACKS_MEMBER_TEMPLATES)
00060   template <class T> template <class Y>
00061   ACE_INLINE
00062   PortableServer::Servant_var<T>::Servant_var (Y * p)
00063   : ptr_ (p)
00064   {
00065   }
00066 
00067   template <class T> template <class Y>
00068   ACE_INLINE
00069   PortableServer::Servant_var<T>::Servant_var (Servant_var<Y> const & rhs)
00070   : ptr_ (Servant_var<T>::_duplicate (rhs.in ()))
00071   {
00072   }
00073 
00074   template <class T> template <class Y>
00075   ACE_INLINE typename PortableServer::Servant_var<T> &
00076   PortableServer::Servant_var<T>::operator=(Servant_var<Y> const & rhs)
00077   {
00078   PortableServer::Servant_var<T> tmp (rhs);
00079   this->swap (tmp);
00080   return *this;
00081   }
00082 
00083   template <class T> template <class Y>
00084   ACE_INLINE typename PortableServer::Servant_var<T> &
00085   PortableServer::Servant_var<T>::operator= (Y * p)
00086   {
00087   if (this->ptr_ != p)
00088   {
00089   // This constructor doesn't increase the reference count, nor is
00090   // it a copy constructor, so we must check for self-assignment.
00091   // Otherwise the reference count would be prematurely
00092   // decremented upon exiting this scope.
00093   PortableServer::Servant_var<T> tmp (p);
00094   this->swap (tmp);
00095   }
00096 
00097   return *this;
00098   }
00099   #endif / * ACE_LACKS_MEMBER_TEMPLATES * /
00100 */
00101 
00102 template <class T>
00103 ACE_INLINE T *
00104 PortableServer::Servant_var<T>::operator->() const
00105 {
00106   return this->ptr_;
00107 }
00108 
00109 template <class T>
00110 ACE_INLINE T const &
00111 PortableServer::Servant_var<T>::operator*() const
00112 {
00113   return *this->ptr_;
00114 }
00115 
00116 template <class T>
00117 ACE_INLINE T &
00118 PortableServer::Servant_var<T>::operator*()
00119 {
00120   return *this->ptr_;
00121 }
00122 
00123 template <class T>
00124 ACE_INLINE PortableServer::Servant_var<T>::operator void const * () const
00125 {
00126   return this->ptr_;
00127 }
00128 
00129 template <class T>
00130 ACE_INLINE T *
00131 PortableServer::Servant_var<T>::in (void) const
00132 {
00133   return this->ptr_;
00134 }
00135 
00136 template <class T>
00137 ACE_INLINE T *&
00138 PortableServer::Servant_var<T>::inout (void)
00139 {
00140   return this->ptr_;
00141 }
00142 
00143 template <class T>
00144 ACE_INLINE T *&
00145 PortableServer::Servant_var<T>::out (void)
00146 {
00147   PortableServer::Servant_var<T> tmp;
00148   this->swap (tmp);
00149   return this->ptr_;
00150 }
00151 
00152 template <class T>
00153 ACE_INLINE T *
00154 PortableServer::Servant_var<T>::_retn (void)
00155 {
00156   T * const rval = ptr_;
00157   this->ptr_ = 0;
00158   return rval;
00159 }
00160 
00161 template <class X, class Y>
00162 ACE_INLINE bool
00163 operator== (typename PortableServer::Servant_var<X> const & x,
00164             typename PortableServer::Servant_var<Y> const & y)
00165 {
00166   return x.in () == y.in ();
00167 }
00168 
00169 template <class X, class Y>
00170 ACE_INLINE bool
00171 operator!= (typename PortableServer::Servant_var<X> const & x,
00172             typename PortableServer::Servant_var<Y> const & y)
00173 {
00174   return x.in () != y.in ();
00175 }
00176 
00177 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:40:54 2010 for TAO_PortableServer by  doxygen 1.4.7