Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

at::PtrView< w_ClassRef, w_RefTraits > Class Template Reference
[Smart Pointer Support]

#include <at_lifetime.h>

Collaboration diagram for at::PtrView< w_ClassRef, w_RefTraits >:

Collaboration graph
[legend]
List of all members.

Public Methods

 PtrView (w_ClassRef i_ptr=0)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>  PtrView (const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
 PtrView (const PtrView &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>  PtrView (const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>  PtrView (const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
PtrView< w_ClassRef, w_RefTraits > & operator= (const w_ClassRef i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> PtrView & operator= (const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
PtrView & operator= (const PtrView &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> PtrView & operator= (const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> PtrView & operator= (const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
PointerTo< w_ClassRef >::value_type * operator-> () const
PointerTo< w_ClassRef >::value_type & operator * () const
w_ClassRef Get () const
PtrView< w_ClassRef > LifeView () const
 operator bool () const
bool operator! () const
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator== (const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator== (const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator== (const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator!= (const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator!= (const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator!= (const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator< (const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator< (const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator< (const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator> (const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator> (const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator> (const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator<= (const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator<= (const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator<= (const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator>= (const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator>= (const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)
template<typename w_ClassRefRhs, typename w_RefTraitsRhs> bool operator>= (const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &i_ptr)

Detailed Description

template<typename w_ClassRef, typename w_RefTraits>
class at::PtrView< w_ClassRef, w_RefTraits >

PtrView is a member of the set of co-operative "smart" pointers Ptr, PtrDelegate and PtrView. PtrDelegate and PtrView are intended to be used to specify pointer passing policy while Ptr is intended to be instantiated as a member or automatic variable to maintain the reference to the object being managed.

The PtrView smart pointer is intended to specify a policy of passing a pointer without any obligation to decrement the reference count. If your pointer is currently stored within an Ptr and will remain available for the life of the call (or the return) you may safely pass an PtrView. This will eliminate any unneccessary increments and decrements of the reference count and hence is the preferred mechanism for passing pointers.

A Life-"View" is intended to indicate that a "view" into the pointer is being transferred with no other obligation on the recepient.

The policy demands however that if the recepient requires to maintain the pointer active for more than the period terminated at the end of the call or more than immediatly after the return from the function the recepient will require to increment the reference count. This may be done by assinging the PtrView object passed into a Ptr object will will cause an increment of the reference count to occur.

Hence assignment of an PtrView to an Ptr or PtrDelegate will increment the reference count while assignment of a Ptr or a PtrDelegate to a PtrView will not increment the reference count.

See also:
at_lifetime.h , PtrDelegate , Ptr


Constructor & Destructor Documentation

template<typename w_ClassRef, typename w_RefTraits>
at::PtrView< w_ClassRef, w_RefTraits >::PtrView w_ClassRef    i_ptr = 0 [inline]
 

Contruct an PtrView smart pointer from a regular pointer.

Parameters:
i_ptr  The regular pointer (optional).

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
at::PtrView< w_ClassRef, w_RefTraits >::PtrView const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

Constructs an PtrView from another PtrView which may be based on a different managed pointer type.

Parameters:
i_ptr  A reference to the PtrView from which this one is being constructed.

template<typename w_ClassRef, typename w_RefTraits>
at::PtrView< w_ClassRef, w_RefTraits >::PtrView const PtrView< w_ClassRef, w_RefTraits > &    i_ptr [inline]
 

Copy constructor for PtrView. Apparently, without such a constructor, the compiler is unable (or unwilling) to use the above templated constructor, and instead generates its own code that does the wrong thing.

Parameters:
i_ptr  A reference to the PtrView pointer being copied.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
at::PtrView< w_ClassRef, w_RefTraits >::PtrView const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

Constructs an PtrView from an Ptr.

Parameters:
i_ptr  A reference to the Ptr that is to be copied.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
at::PtrView< w_ClassRef, w_RefTraits >::PtrView const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

Constructs an PtrView from an PtrDelegate.

Parameters:
i_ptr  A reference to the PtrDelegate that is to be copied.


Member Function Documentation

template<typename w_ClassRef, typename w_RefTraits>
w_ClassRef at::PtrView< w_ClassRef, w_RefTraits >::Get   const [inline]
 

Get() allows access to the inner pointer.

Returns:
The address of the pointed-to object.

template<typename w_ClassRef, typename w_RefTraits>
PtrView< w_ClassRef > at::PtrView< w_ClassRef, w_RefTraits >::LifeView   const [inline]
 

This method returns an PtrView version of this pointer.

Returns:
An PtrView version of this pointer.

template<typename w_ClassRef, typename w_RefTraits>
PointerTo<w_ClassRef>::value_type& at::PtrView< w_ClassRef, w_RefTraits >::operator *   const [inline]
 

This method overloads the dereference operator-*(ptr)

Returns:
The object being pointed to.

template<typename w_ClassRef, typename w_RefTraits>
at::PtrView< w_ClassRef, w_RefTraits >::operator bool   const [inline]
 

Conversion from PtrView to bool returns true if the managed pointer is not null.

Returns:
A boolean indicating whether (true) or not (false) the managed pointer's address is non-zero.

template<typename w_ClassRef, typename w_RefTraits>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator!   const [inline]
 

This method overloads the ! operator- returns true if managed pointer is null.

Returns:
A boolean indicating whether (true) or not (false) the managed pointer's address is zero.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator!= const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator!= const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator!= const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

These methods overload the '!=' operator for the cases where an PtrView is being tested for inequality to an PtrDelegate, an Ptr, or an PtrView.

Parameters:
i_ptr  A reference to the smart pointer on the right-hand side of the '!=' operator.
Returns:
A boolean indicating whether (true) or not (false) the two pointers on each side of the '!=' sign are unequal, i.e. point to different objects.

template<typename w_ClassRef, typename w_RefTraits>
PointerTo<w_ClassRef>::value_type* at::PtrView< w_ClassRef, w_RefTraits >::operator->   const [inline]
 

dereference operator, allows use of "->" against the underlying type.

Returns:
The address of the pointed-to object.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator< const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator< const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator< const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

These methods overload the < operator for the cases where an PtrView is being tested to see if it is less than an PtrDelegate, an Ptr, or an PtrView.

Parameters:
i_ptr  A reference to the smart pointer on the right-hand side of the '<' operator.
Returns:
A boolean indicating whether (true) or not (false) the left-hand pointer is less than the right-hand pointer, i.e. whether the address of the left-hand managed pointer is less than the address of the right-hand managed pointer.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator<= const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator<= const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator<= const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

These methods overload the <= operator for the cases where an PtrView is being tested to see if it is less than or equal to an PtrDelegate, an Ptr, or an PtrView.

Parameters:
i_ptr  A reference to the smart pointer on the right-hand side of the '<=' operator.
Returns:
A boolean indicating whether (true) or not (false) the left-hand pointer is less than or equal to the right-hand pointer, i.e. whether the address of the left-hand managed pointer is less than or equal to the address of the right-hand managed pointer.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
PtrView& at::PtrView< w_ClassRef, w_RefTraits >::operator= const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This method overloads the assignment operator for the case where an PtrView is being set equal to an PtrDelegate.

Parameters:
i_ptr  The PtrDelegate on the right-hand side of the '=' sign.
Returns:
A reference to the PtrView on the left-hand side of the '=' sign.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
PtrView& at::PtrView< w_ClassRef, w_RefTraits >::operator= const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

Assignment operator for the case where an Ptr is being assigned to an PtrView.

Parameters:
i_ptr  A reference to the Ptr on the right-hand side of the '=' sign.
Returns:
A reference to the PtrView on the left-hand side of the '=' sign.

template<typename w_ClassRef, typename w_RefTraits>
PtrView& at::PtrView< w_ClassRef, w_RefTraits >::operator= const PtrView< w_ClassRef, w_RefTraits > &    i_ptr [inline]
 

Copy assignment.

Parameters:
i_ptr  The PtrView on the right-hand side of the '=' sign.
Returns:
A reference to the PtrView on the left-hand side of the '=' sign.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
PtrView& at::PtrView< w_ClassRef, w_RefTraits >::operator= const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

Assignment operator for the case where an PtrView is being set equal to another PtrView.

Parameters:
i_ptr  The PtrView on the right-hand side of the '=' sign.
Returns:
A reference to the PtrView on the left-hand side of the '=' sign.

template<typename w_ClassRef, typename w_RefTraits>
PtrView< w_ClassRef, w_RefTraits >& at::PtrView< w_ClassRef, w_RefTraits >::operator= const w_ClassRef    i_ptr [inline]
 

Assignment operator for the case where an PtrView is being set equal to a regular pointer.

Parameters:
i_ptr  The regular pointer on the right-hand side of the '=' sign.
Returns:
A reference to the PtrView pointer on the left-hand side of the '=' sign.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator== const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator== const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator== const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

These methods overload the '==' operator for the cases where an PtrView is being tested for equality to an PtrDelegate, an Ptr, or an PtrView.

Parameters:
i_ptr  A reference to the smart pointer on the right-hand side of the '==' operator.
Returns:
A boolean indicating whether (true) or not (false) the two pointers on each side of the '==' sign are equal, i.e. point to the same object.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator> const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator> const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator> const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

These methods overload the > operator for the cases where an PtrView is being tested to see if it is greater than an PtrDelegate, an Ptr, or an PtrView.

Parameters:
i_ptr  A reference to the smart pointer on the right-hand side of the '>' operator.
Returns:
A boolean indicating whether (true) or not (false) the left-hand pointer is greater than the right-hand pointer, i.e. whether the address of the lefthand managed pointer is greater than the address of the right-hand managed pointer.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator>= const PtrView< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator>= const Ptr< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<typename w_ClassRef, typename w_RefTraits>
template<typename w_ClassRefRhs, typename w_RefTraitsRhs>
bool at::PtrView< w_ClassRef, w_RefTraits >::operator>= const PtrDelegate< w_ClassRefRhs, w_RefTraitsRhs > &    i_ptr [inline]
 

These methods overload the >= operator for the cases where an PtrView is being tested to see if it is greater than or equal to an PtrDelegate, an Ptr, or an PtrView.

Parameters:
i_ptr  A reference to the smart pointer on the right-hand side of the '>=' operator.
Returns:
A boolean indicating whether (true) or not (false) the left-hand pointer is greater than or equal to the right- hand pointer, i.e. whether the address of the left-hand managed pointer is greater than or equal to the address of the right-hand managed pointer.


The documentation for this class was generated from the following file:

Generated for Austria by doxygen and MakeXS at Sun Oct 24 17:35:34 PDT 2004