Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PointerTo< T > Class Template Reference

PointerTo is a template class which implements a smart pointer to an object derived from ReferenceCount. More...

#include <pointerTo.h>

Inheritance diagram for PointerTo< T >:

PointerToBase< T > List of all members.

Public Types

typedef TYPENAME PointerToBase<
T >::To 
To

Public Member Functions

 PointerTo (To *ptr=(To *) NULL)
 PointerTo (const PointerTo< T > &copy)
Tooperator * () const
Tooperator-> () const
 operator TYPENAME PointerToBase () const
 We also have the typecast operator to automatically convert PointerTo's to the required kind of actual pointer.

Top () const
 Returns an ordinary pointer instead of a PointerTo.

PointerTo< T > & operator= (To *ptr)
PointerTo< T > & operator= (const PointerTo< T > &copy)
bool is_null () const
 Returns true if the PointerTo is a NULL pointer, false otherwise.

void clear ()
 A convenient way to set the PointerTo object to NULL.

bool operator== (const To *other) const
bool operator== (To *other) const
bool operator== (const PointerToBase< To > &other) const
bool operator!= (const To *other) const
bool operator!= (To *other) const
bool operator!= (const PointerToBase< To > &other) const
bool operator> (const To *other) const
bool operator> (To *other) const
bool operator> (const PointerToBase< To > &other) const
bool operator<= (const To *other) const
bool operator<= (To *other) const
bool operator<= (const PointerToBase< To > &other) const
bool operator>= (const To *other) const
bool operator>= (To *other) const
bool operator>= (const PointerToBase< To > &other) const
bool operator< (const To *other) const
bool operator< (const PointerToBase< To > &other) const
void output (ostream &out) const
 A handy function to output PointerTo's as a hex pointer followed by a reference count.


Protected Member Functions

void reassign (To *ptr)
 This is the main work of the PointerTo family.

void reassign (const PointerToBase< To > &copy)

Protected Attributes

To_ptr

Detailed Description

template<class T>
class PointerTo< T >

PointerTo is a template class which implements a smart pointer to an object derived from ReferenceCount.

Definition at line 167 of file pointerTo.h.


Member Typedef Documentation

template<class T>
typedef TYPENAME PointerToBase<T>::To PointerTo< T >::To
 

Reimplemented from PointerToBase< T >.

Definition at line 169 of file pointerTo.h.

Referenced by operator<<().


Constructor & Destructor Documentation

template<class T>
PointerTo< T >::PointerTo To ptr = (To *)NULL  )  [inline]
 

Definition at line 416 of file pointerTo.I.

References INLINE, and PointerToBase< T >::reassign().

Referenced by operator<<().

template<class T>
PointerTo< T >::PointerTo const PointerTo< T > &  copy  )  [inline]
 

Definition at line 428 of file pointerTo.I.

References INLINE, and PointerToBase< T >::reassign().


Member Function Documentation

template<class T>
void PointerTo< T >::clear  )  [inline]
 

A convenient way to set the PointerTo object to NULL.

(Assignment to a NULL pointer also works, of course.)

Reimplemented from PointerToBase< T >.

Definition at line 203 of file pointerTo.h.

template<class T>
bool PointerTo< T >::is_null  )  const [inline]
 

Returns true if the PointerTo is a NULL pointer, false otherwise.

(Direct comparison to a NULL pointer also works.)

Reimplemented from PointerToBase< T >.

Definition at line 202 of file pointerTo.h.

template<class T>
TYPENAME PointerTo< T >::To & PointerTo< T >::operator *  )  const [inline]
 

Definition at line 442 of file pointerTo.I.

References INLINE.

Referenced by operator<<().

template<class T>
PointerTo< T >::operator TYPENAME PointerToBase< T >::To *  )  const [inline]
 

We also have the typecast operator to automatically convert PointerTo's to the required kind of actual pointer.

This introduces ambiguities which the compiler will resolve one way or the other, but we don't care which way it goes because either will be correct.

Definition at line 479 of file pointerTo.I.

References PointerToBase< T >::_ptr, INLINE, and TYPENAME.

template<class T>
bool PointerToBase< T >::operator!= const PointerToBase< To > &  other  )  const [inline, inherited]
 

Definition at line 279 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator!= To other  )  const [inline, inherited]
 

Definition at line 214 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator!= const To other  )  const [inline, inherited]
 

Definition at line 150 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
TYPENAME PointerTo< T >::To * PointerTo< T >::operator->  )  const [inline]
 

Definition at line 455 of file pointerTo.I.

References INLINE.

Referenced by operator<<().

template<class T>
bool PointerToBase< T >::operator< const PointerToBase< To > &  other  )  const [inline, inherited]
 

Definition at line 345 of file pointerTo.I.

References INLINE.

template<class T>
bool PointerToBase< T >::operator< const To other  )  const [inline, inherited]
 

Definition at line 332 of file pointerTo.I.

References PointerToBase< T >::_ptr, INLINE, NULL, and PointerToBase< T >::To.

template<class T>
bool PointerToBase< T >::operator<= const PointerToBase< To > &  other  )  const [inline, inherited]
 

Definition at line 305 of file pointerTo.I.

References PointerToBase< T >::_ptr, INLINE, and NULL.

template<class T>
bool PointerToBase< T >::operator<= To other  )  const [inline, inherited]
 

Definition at line 240 of file pointerTo.I.

References PointerToBase< T >::_ptr.

template<class T>
bool PointerToBase< T >::operator<= const To other  )  const [inline, inherited]
 

Definition at line 176 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
PointerTo< T > & PointerTo< T >::operator= const PointerTo< T > &  copy  )  [inline]
 

Definition at line 524 of file pointerTo.I.

References PointerToBase< T >::_ptr, INLINE, and TYPENAME.

template<class T>
PointerTo< T > & PointerTo< T >::operator= To ptr  )  [inline]
 

Definition at line 510 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator== const PointerToBase< To > &  other  )  const [inline, inherited]
 

Definition at line 266 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator== To other  )  const [inline, inherited]
 

Definition at line 201 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator== const To other  )  const [inline, inherited]
 

Definition at line 137 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator> const PointerToBase< To > &  other  )  const [inline, inherited]
 

Definition at line 292 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator> To other  )  const [inline, inherited]
 

Definition at line 227 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator> const To other  )  const [inline, inherited]
 

Definition at line 163 of file pointerTo.I.

References PointerToBase< T >::_ptr.

template<class T>
bool PointerToBase< T >::operator>= const PointerToBase< To > &  other  )  const [inline, inherited]
 

Definition at line 318 of file pointerTo.I.

References INLINE, NULL, PointerToBase< T >::reassign(), and PointerToBase< T >::To.

template<class T>
bool PointerToBase< T >::operator>= To other  )  const [inline, inherited]
 

Definition at line 253 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
bool PointerToBase< T >::operator>= const To other  )  const [inline, inherited]
 

Definition at line 189 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
void PointerToBase< T >::output ostream &  out  )  const [inline, inherited]
 

A handy function to output PointerTo's as a hex pointer followed by a reference count.

Definition at line 399 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
TYPENAME PointerTo< T >::To * PointerTo< T >::p  )  const [inline]
 

Returns an ordinary pointer instead of a PointerTo.

Useful to work around compiler problems, particularly for implicit upcasts.

Definition at line 497 of file pointerTo.I.

template<class T>
void PointerToBase< T >::reassign const PointerToBase< To > &  copy  )  [inline, protected, inherited]
 

Definition at line 122 of file pointerTo.I.

References PointerToBase< T >::_ptr, and INLINE.

template<class T>
void PointerToBase< T >::reassign To ptr  )  [protected, inherited]
 

This is the main work of the PointerTo family.

When the pointer is reassigned, decrement the old reference count and increment the new one.

Definition at line 78 of file pointerTo.I.

Referenced by ConstPointerTo< T >::ConstPointerTo(), PointerToBase< T >::operator>=(), PointerTo< T >::PointerTo(), and PointerToBase< T >::PointerToBase().


Member Data Documentation

template<class T>
To* PointerToBase< T >::_ptr [protected, inherited]
 

Definition at line 110 of file pointerTo.h.

Referenced by PointerToBase< T >::clear(), PointerToBase< T >::is_null(), PointerTo< T >::operator TYPENAME PointerToBase(), PointerToBase< T >::operator!=(), PointerToBase< T >::operator<(), PointerToBase< T >::operator<=(), PointerTo< T >::operator=(), PointerToBase< T >::operator==(), PointerToBase< T >::operator>(), PointerToBase< T >::operator>=(), PointerToBase< T >::output(), PointerToBase< T >::PointerToBase(), PointerToBase< T >::reassign(), and PointerToBase< T >::~PointerToBase().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:54:11 2003 for Panda by doxygen1.3