counted_ptr< _Tp > Class Template Reference
[Classes and types for basic data management]

#include <counted_ptr.h>

Inheritance diagram for counted_ptr< _Tp >:

Inheritance graph
[legend]
Collaboration diagram for counted_ptr< _Tp >:

Collaboration graph
[legend]

List of all members.

Classes

class  counter

Public Types

typedef _Tp element_type

Public Member Functions

 counted_ptr (_Tp *p=0)
 ~counted_ptr ()
 counted_ptr (const counted_ptr &r) throw ()
counted_ptroperator= (const counted_ptr &r)
counted_ptroperator= (element_type *r)
template<typename _Tq >
 counted_ptr (const counted_ptr< _Tq > &r) throw ()
template<typename _Tq >
counted_ptroperator= (const counted_ptr< _Tq > &r)
_Tp & operator* () const throw ()
_Tp * operator-> () const throw ()
_Tp * get () const throw ()
bool is_unique () const throw ()


Detailed Description

template<typename _Tp>
class counted_ptr< _Tp >

This class provides a simple reference counted pointer. The implementation is non-intrusive; it allocates an additional int and pointer for every counted object.

Definition at line 39 of file counted_ptr.h.


Member Typedef Documentation

template<typename _Tp>
typedef _Tp counted_ptr< _Tp >::element_type

The element type of the counted pointer

Definition at line 63 of file counted_ptr.h.


Constructor & Destructor Documentation

template<typename _Tp>
counted_ptr< _Tp >::counted_ptr ( _Tp *  p = 0  )  [inline, explicit]

The constructor allocates a new counter object, at least if is non-NULL.

Definition at line 68 of file counted_ptr.h.

template<typename _Tp>
counted_ptr< _Tp >::~counted_ptr (  )  [inline]

The Standard Destructor just deletes this reference to the counted object.

Definition at line 72 of file counted_ptr.h.

template<typename _Tp>
counted_ptr< _Tp >::counted_ptr ( const counted_ptr< _Tp > &  r  )  throw () [inline]

The Copy Constructor gets a new reference to the counted object.

Definition at line 75 of file counted_ptr.h.

template<typename _Tp>
template<typename _Tq >
counted_ptr< _Tp >::counted_ptr ( const counted_ptr< _Tq > &  r  )  throw () [inline]

The constructor allocates a new counter object.

Definition at line 105 of file counted_ptr.h.


Member Function Documentation

template<typename _Tp>
_Tp* counted_ptr< _Tp >::get (  )  const throw () [inline]

This is a safeguarded pointer operator

Definition at line 135 of file counted_ptr.h.

template<typename _Tp>
bool counted_ptr< _Tp >::is_unique (  )  const throw () [inline]

This checks whether the object has only this (unique) reference.

Definition at line 138 of file counted_ptr.h.

template<typename _Tp>
_Tp& counted_ptr< _Tp >::operator* (  )  const throw () [inline]

This is the dereferentiation operator

Definition at line 129 of file counted_ptr.h.

template<typename _Tp>
_Tp* counted_ptr< _Tp >::operator-> (  )  const throw () [inline]

This is the pointer operator

Definition at line 132 of file counted_ptr.h.

template<typename _Tp>
template<typename _Tq >
counted_ptr& counted_ptr< _Tp >::operator= ( const counted_ptr< _Tq > &  r  )  [inline]

The Assignment Operator first deletes the reference for the object this counted_ptr points at and then gets a new reference for the assigned object.

Definition at line 112 of file counted_ptr.h.

template<typename _Tp>
counted_ptr& counted_ptr< _Tp >::operator= ( element_type r  )  [inline]

This Assignment Operator explicitly sets a new element_type pointer.

Definition at line 92 of file counted_ptr.h.

template<typename _Tp>
counted_ptr& counted_ptr< _Tp >::operator= ( const counted_ptr< _Tp > &  r  )  [inline]

The Assignment Operator first deletes the reference for the object this counted_ptr points at and then gets a new reference for the assigned object.

Definition at line 81 of file counted_ptr.h.


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

Generated on Tue Feb 9 14:47:17 2010 for COCONUT API by  doxygen 1.5.8