Provides a type safe counted reference to servants. More...
#include <Servant_Var.h>
Public Types | |
| typedef T | Servant_Type |
Public Member Functions | |
| Servant_Var (T *p=0) | |
Constructor. Assumes ownership of p. | |
| Servant_Var (Servant_Var< T > const &rhs) | |
Copy constructor. Adds reference to rhs. | |
| Servant_Var< T > & | operator= (Servant_Var< T > const &rhs) |
Assignment operator. Adds reference to rhs. | |
| ~Servant_Var () throw () | |
| Servant_Var< T > & | operator= (T *p) |
Assignment operator. Assumes ownership of p. | |
| template<class Y > | |
| Servant_Var (Y *p) | |
| template<class Y > | |
| Servant_Var (Servant_Var< Y > const &rhs) | |
| template<class Y > | |
| Servant_Var< T > & | operator= (Servant_Var< Y > const &rhs) |
| template<class Y > | |
| 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 () |
| void | swap (Servant_Var< T > &rhs) throw () |
Static Public Member Functions | |
| static T * | _duplicate (T *) |
| Increment the reference count and return the servant. | |
Private Attributes | |
| T * | ptr_ |
Provides a type safe counted reference to servants.
Definition at line 46 of file Servant_Var.h.
| typedef T TAO::Utils::Servant_Var< T >::Servant_Type |
Definition at line 49 of file Servant_Var.h.
| TAO::Utils::Servant_Var< T >::Servant_Var | ( | T * | p = 0 |
) |
| TAO::Utils::Servant_Var< T >::Servant_Var | ( | Servant_Var< T > const & | rhs | ) |
Copy constructor. Adds reference to rhs.
Definition at line 37 of file Servant_Var.inl.
: ptr_ (Servant_Var<T>::_duplicate(rhs.ptr_)) { }
| TAO::Utils::Servant_Var< T >::~Servant_Var | ( | void | ) | throw () |
Destructor. Removes a reference from the underlying object, possibly destroying it.
Definition at line 69 of file Servant_Var.inl.
{
if (ptr_ != 0)
{
ptr_->_remove_ref ();
}
}
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 79 of file Servant_Var.inl.
: ptr_ (p) { }
| TAO::Utils::Servant_Var< T >::Servant_Var | ( | Servant_Var< Y > const & | rhs | ) |
Template member copy constructor from a Servant_Var<Y>, where Y can be implicitly cast to type T.
Definition at line 85 of file Servant_Var.inl.
: ptr_ (Servant_Var<T>::_duplicate (rhs.in ())) { }
| T * TAO::Utils::Servant_Var< T >::_duplicate | ( | T * | p | ) | [static] |
Increment the reference count and return the servant.
It is safe to pass in a null pointer, the pointer is simply returned in that case.
Definition at line 11 of file Servant_Var.inl.
{
if (p != 0)
{
p->_add_ref ();
}
return p;
}
| T * TAO::Utils::Servant_Var< T >::_retn | ( | void | ) |
Definition at line 175 of file Servant_Var.inl.
| T * TAO::Utils::Servant_Var< T >::in | ( | void | ) | const |
| T *& TAO::Utils::Servant_Var< T >::inout | ( | void | ) |
| TAO::Utils::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 145 of file Servant_Var.inl.
{
return ptr_;
}
| T & TAO::Utils::Servant_Var< T >::operator* | ( | void | ) |
Dereference the underlying object.
Definition at line 139 of file Servant_Var.inl.
{
return *ptr_;
}
| T const & TAO::Utils::Servant_Var< T >::operator* | ( | void | ) | const |
Dereference the underlying object.
Definition at line 133 of file Servant_Var.inl.
{
return *ptr_;
}
| T const * TAO::Utils::Servant_Var< T >::operator-> | ( | void | ) | const |
Smart pointer operator-> provides access to the underlying object.
Definition at line 120 of file Servant_Var.inl.
{
return ptr_;
}
| T * TAO::Utils::Servant_Var< T >::operator-> | ( | void | ) |
Smart pointer operator-> provides access to the underlying object.
Definition at line 127 of file Servant_Var.inl.
{
return ptr_;
}
| TAO::Utils::Servant_Var< T > & TAO::Utils::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 102 of file Servant_Var.inl.
{
if (this->ptr_ != p)
{
// This constructor doesn't increase the reference count so we
// we must check for self-assignment. Otherwise the reference
// count would be prematurely decremented upon exiting this
// scope.
TAO::Utils::Servant_Var<T> tmp (p);
this->swap (tmp);
}
return *this;
}
| TAO::Utils::Servant_Var< T > & TAO::Utils::Servant_Var< T >::operator= | ( | Servant_Var< T > const & | rhs | ) |
Assignment operator. Adds reference to rhs.
Definition at line 44 of file Servant_Var.inl.
{
TAO::Utils::Servant_Var<T> tmp (rhs);
this->swap (tmp);
return *this;
}
| TAO::Utils::Servant_Var< T > & TAO::Utils::Servant_Var< T >::operator= | ( | T * | p | ) |
Assignment operator. Assumes ownership of p.
Definition at line 53 of file Servant_Var.inl.
{
if (this->ptr_ != p)
{
// This constructor doesn't increase the reference count so we
// we must check for self-assignment. Otherwise the reference
// count would be prematurely decremented upon exiting this
// scope.
TAO::Utils::Servant_Var<T> tmp (p);
this->swap (tmp);
}
return *this;
}
| TAO::Utils::Servant_Var< T > & TAO::Utils::Servant_Var< T >::operator= | ( | Servant_Var< Y > const & | rhs | ) |
Template member assignment operator from a Servant_Var<Y>, where Y can be implicitly cast to type T.
Definition at line 93 of file Servant_Var.inl.
{
TAO::Utils::Servant_Var<T> tmp (rhs);
this->swap (tmp);
return *this;
}
| T *& TAO::Utils::Servant_Var< T >::out | ( | void | ) |
As an OUT parameter.
Definition at line 166 of file Servant_Var.inl.
| void TAO::Utils::Servant_Var< T >::swap | ( | Servant_Var< T > & | rhs | ) | throw () |
Swap the contents of a Servant_Var<T> with another Servant_Var<T> Often used to implement strong exception safety.
Definition at line 23 of file Servant_Var.inl.
{
std::swap (this->ptr_, rhs.ptr_);
}
T* TAO::Utils::Servant_Var< T >::ptr_ [private] |
Definition at line 141 of file Servant_Var.h.
1.7.0