Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes

DGtal::CountedPtr< T > Class Template Reference

Aim: Smart pointer based on reference counts. More...

#include <CountedPtr.h>

Inheritance diagram for DGtal::CountedPtr< T >:
Inheritance graph
[legend]
Collaboration diagram for DGtal::CountedPtr< T >:
Collaboration graph
[legend]

Data Structures

struct  counter

Public Types

typedef T element_type

Public Member Functions

 CountedPtr (T *p=0)
 ~CountedPtr ()
 CountedPtr (const CountedPtr &r) throw ()
CountedPtroperator= (const CountedPtr &r)
T & operator* () const throw ()
T * operator-> () const throw ()
T * get () const throw ()
bool unique () const throw ()
unsigned int count () const
void selfDisplay (std::ostream &out) const
bool isValid () const

Private Member Functions

void acquire (counter *c) throw ()
void release ()

Private Attributes

struct DGtal::CountedPtr::countermyCounter

Detailed Description

template<typename T>
class DGtal::CountedPtr< T >

Aim: Smart pointer based on reference counts.

Description of template class 'CountedPtr'

Taken from http://ootips.org/yonat/4dev/smart-pointers.html


Member Typedef Documentation

template<typename T>
typedef T DGtal::CountedPtr< T >::element_type

Constructor & Destructor Documentation

template<typename T>
DGtal::CountedPtr< T >::CountedPtr ( T *  p = 0  )  [inline, explicit]
template<typename T>
DGtal::CountedPtr< T >::~CountedPtr (  )  [inline]
template<typename T>
DGtal::CountedPtr< T >::CountedPtr ( const CountedPtr< T > &  r  )  throw () [inline]

Member Function Documentation

template<typename T>
void DGtal::CountedPtr< T >::acquire ( counter c  )  throw () [inline, private]
template<typename T>
unsigned int DGtal::CountedPtr< T >::count (  )  const [inline]

For debug.

template<typename T>
T* DGtal::CountedPtr< T >::get (  )  const throw () [inline]
template<typename T>
bool DGtal::CountedPtr< T >::isValid (  )  const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
template<typename T>
T& DGtal::CountedPtr< T >::operator* (  )  const throw () [inline]
template<typename T>
T* DGtal::CountedPtr< T >::operator-> (  )  const throw () [inline]
template<typename T>
CountedPtr& DGtal::CountedPtr< T >::operator= ( const CountedPtr< T > &  r  )  [inline]
template<typename T>
void DGtal::CountedPtr< T >::release (  )  [inline, private]
template<typename T>
void DGtal::CountedPtr< T >::selfDisplay ( std::ostream &  out  )  const

Writes/Displays the object on an output stream.

Parameters:
out the output stream where the object is written.
template<typename T>
bool DGtal::CountedPtr< T >::unique (  )  const throw () [inline]

Field Documentation

template<typename T>
struct DGtal::CountedPtr::counter* DGtal::CountedPtr< T >::myCounter [private]

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