RefCountedBlockPtr< T, BoundsChecked, Controller > Class Template Reference

RefCountedBlockPtr<T> is a smart-pointer class that provides reference counting for arrays of objects of type T. More...

#include <RefCountedBlockPtr.h>

Inheritance diagram for RefCountedBlockPtr< T, BoundsChecked, Controller >:

Inheritance graph
[legend]
Collaboration diagram for RefCountedBlockPtr< T, BoundsChecked, Controller >:

Collaboration graph
[legend]

List of all members.

Classes

struct  NoInitTag

Public Types

typedef
std::random_access_iterator_tag 
iterator_category
typedef T value_type
typedef ptrdiff_t difference_type
typedef T * pointer
typedef T & reference
typedef T Element_t
typedef T Pointee_t
typedef ptrdiff_t Offset_t
typedef RefCountedBlockPtr< T,
BoundsChecked, Controller > 
This_t
typedef RefCountedBlockPtr< T,!BoundsChecked,
Controller > 
That_t

Public Member Functions

 RefCountedBlockPtr ()
 RefCountedBlockPtr (size_t size)
 RefCountedBlockPtr (size_t size, const T &model)
 RefCountedBlockPtr (size_t size, const NoInitTag &)
 RefCountedBlockPtr (T *p, size_t size)
 RefCountedBlockPtr (const This_t &model)
 RefCountedBlockPtr (const That_t &model)
 RefCountedBlockPtr (const This_t &model, Offset_t offset)
 ~RefCountedBlockPtr ()
This_toperator= (const This_t &rhs)
This_toperator= (const That_t &rhs)
template<class T1 , bool BoundsChecked1, class Controller1 >
bool operator== (const RefCountedBlockPtr< T1, BoundsChecked1, Controller1 > &) const
template<class T1 , bool BoundsChecked1, class Controller1 >
bool operator!= (const RefCountedBlockPtr< T1, BoundsChecked1, Controller1 > &) const
bool operator== (const This_t &a) const
bool operator!= (const This_t &a) const
bool operator< (const This_t &a) const
bool operator> (const This_t &a) const
bool operator<= (const This_t &a) const
bool operator>= (const This_t &a) const
bool operator== (const That_t &a) const
bool operator!= (const That_t &a) const
T & operator* () const
T & operator[] (Offset_t i) const
T * operator-> () const
This_toperator++ ()
This_toperator-- ()
This_t operator++ (int)
This_t operator-- (int)
void operator+= (Offset_t i)
void operator-= (Offset_t i)
This_t operator+ (Offset_t i) const
This_t operator- (Offset_t i) const
This_t begin () const
This_t end () const
void reserve (size_t size)
bool resize (size_t size, const NoInitTag &)
bool resize (size_t size)
bool resize (size_t size, const T &model)
void resizeAndCopy (size_t size, const NoInitTag &)
void resizeAndCopy (size_t size)
void resizeAndCopy (size_t size, const T &model)
void invalidate ()
This_tmakeOwnCopy ()
Offset_t offset () const
bool isValid () const
bool isShared () const
int count () const
size_t size () const
size_t capacity () const
bool empty () const
bool isAtBeginning () const
bool isMine () const
T * beginPointer () const
T * endPointer () const
T * currentPointer () const

Protected Member Functions

 RefCountedBlockPtr (Controller *con)
void boundsAssert (T *p) const

Protected Attributes

Offset_t offset_m
RefCountedPtr< Controller > blockControllerPtr_m

Friends

class RefCountedBlockPtr< T,!BoundsChecked, Controller >


Detailed Description

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
class RefCountedBlockPtr< T, BoundsChecked, Controller >

RefCountedBlockPtr<T> is a smart-pointer class that provides reference counting for arrays of objects of type T.

As long as only RefCountedBlockPtrs are used to reference this data block, it will stay around. As soon as the last such object is deleted, the block is deleted.

You create a block with:

RefCountedBlockPtr<T> p(size);

Then you use p like a pointer. Pointer operations are as efficient as they would be with a bare pointer as long as bounds checking is off.

RefCountedBlockPtr's second template parameter, BoundsChecked, is used to enable bounds checking. It defaults to the value of the preprocessor symbol POOMA_BOUNDS_CHECK_DEFAULT. This is usually set to false. However, if Pooma's configure script is passed the --bounds option, it will be set to true.

The third template parameter, Controller, is the object used to store the actual data. The concept is modeled by RefBlockController defined above, and it defaults to RefBlockController<T>. See DataBlockPtr.h for another example.

A RefCountedBlockPtr with bounds checking explicitly turned on is declare as:

RefCountedBlockPtr<T,true> p;

Similarly, a RefCountedBlockPtr with bounds checking explicitly turned off is declared as:

RefCountedBlockPtr<T,false> p;


Member Typedef Documentation

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef std::random_access_iterator_tag RefCountedBlockPtr< T, BoundsChecked, Controller >::iterator_category

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef T RefCountedBlockPtr< T, BoundsChecked, Controller >::value_type

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef ptrdiff_t RefCountedBlockPtr< T, BoundsChecked, Controller >::difference_type

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef T* RefCountedBlockPtr< T, BoundsChecked, Controller >::pointer

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef T& RefCountedBlockPtr< T, BoundsChecked, Controller >::reference

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef T RefCountedBlockPtr< T, BoundsChecked, Controller >::Element_t

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef T RefCountedBlockPtr< T, BoundsChecked, Controller >::Pointee_t

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef ptrdiff_t RefCountedBlockPtr< T, BoundsChecked, Controller >::Offset_t

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef RefCountedBlockPtr<T,BoundsChecked,Controller> RefCountedBlockPtr< T, BoundsChecked, Controller >::This_t

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
typedef RefCountedBlockPtr<T,!BoundsChecked,Controller> RefCountedBlockPtr< T, BoundsChecked, Controller >::That_t


Constructor & Destructor Documentation

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr (  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr ( size_t  size  )  [inline, explicit]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr ( size_t  size,
const T &  model 
) [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr ( size_t  size,
const NoInitTag  
) [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr ( T *  p,
size_t  size 
) [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr ( const This_t model  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr ( const That_t model  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr ( const This_t model,
Offset_t  offset 
) [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::~RefCountedBlockPtr (  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedBlockPtr< T, BoundsChecked, Controller >::RefCountedBlockPtr ( Controller *  con  )  [inline, protected]


Member Function Documentation

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t& RefCountedBlockPtr< T, BoundsChecked, Controller >::operator= ( const This_t rhs  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t& RefCountedBlockPtr< T, BoundsChecked, Controller >::operator= ( const That_t rhs  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
template<class T1 , bool BoundsChecked1, class Controller1 >
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator== ( const RefCountedBlockPtr< T1, BoundsChecked1, Controller1 > &   )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
template<class T1 , bool BoundsChecked1, class Controller1 >
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator!= ( const RefCountedBlockPtr< T1, BoundsChecked1, Controller1 > &   )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator== ( const This_t a  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator!= ( const This_t a  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator< ( const This_t a  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator> ( const This_t a  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator<= ( const This_t a  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator>= ( const This_t a  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator== ( const That_t a  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::operator!= ( const That_t a  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
T& RefCountedBlockPtr< T, BoundsChecked, Controller >::operator* (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
T& RefCountedBlockPtr< T, BoundsChecked, Controller >::operator[] ( Offset_t  i  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
T* RefCountedBlockPtr< T, BoundsChecked, Controller >::operator-> (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t& RefCountedBlockPtr< T, BoundsChecked, Controller >::operator++ (  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t& RefCountedBlockPtr< T, BoundsChecked, Controller >::operator-- (  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t RefCountedBlockPtr< T, BoundsChecked, Controller >::operator++ ( int   )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t RefCountedBlockPtr< T, BoundsChecked, Controller >::operator-- ( int   )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
void RefCountedBlockPtr< T, BoundsChecked, Controller >::operator+= ( Offset_t  i  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
void RefCountedBlockPtr< T, BoundsChecked, Controller >::operator-= ( Offset_t  i  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t RefCountedBlockPtr< T, BoundsChecked, Controller >::operator+ ( Offset_t  i  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t RefCountedBlockPtr< T, BoundsChecked, Controller >::operator- ( Offset_t  i  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t RefCountedBlockPtr< T, BoundsChecked, Controller >::begin (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t RefCountedBlockPtr< T, BoundsChecked, Controller >::end (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
void RefCountedBlockPtr< T, BoundsChecked, Controller >::reserve ( size_t  size  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::resize ( size_t  size,
const NoInitTag  
) [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::resize ( size_t  size  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::resize ( size_t  size,
const T &  model 
) [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
void RefCountedBlockPtr< T, BoundsChecked, Controller >::resizeAndCopy ( size_t  size,
const NoInitTag  
) [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
void RefCountedBlockPtr< T, BoundsChecked, Controller >::resizeAndCopy ( size_t  size  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
void RefCountedBlockPtr< T, BoundsChecked, Controller >::resizeAndCopy ( size_t  size,
const T &  model 
) [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
void RefCountedBlockPtr< T, BoundsChecked, Controller >::invalidate (  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
This_t& RefCountedBlockPtr< T, BoundsChecked, Controller >::makeOwnCopy (  )  [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
Offset_t RefCountedBlockPtr< T, BoundsChecked, Controller >::offset (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::isValid (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::isShared (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
int RefCountedBlockPtr< T, BoundsChecked, Controller >::count (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
size_t RefCountedBlockPtr< T, BoundsChecked, Controller >::size (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
size_t RefCountedBlockPtr< T, BoundsChecked, Controller >::capacity (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::empty (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::isAtBeginning (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
bool RefCountedBlockPtr< T, BoundsChecked, Controller >::isMine (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
T* RefCountedBlockPtr< T, BoundsChecked, Controller >::beginPointer (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
T* RefCountedBlockPtr< T, BoundsChecked, Controller >::endPointer (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
T* RefCountedBlockPtr< T, BoundsChecked, Controller >::currentPointer (  )  const [inline]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
void RefCountedBlockPtr< T, BoundsChecked, Controller >::boundsAssert ( T *  p  )  const [inline, protected]


Friends And Related Function Documentation

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
friend class RefCountedBlockPtr< T,!BoundsChecked, Controller > [friend]


Member Data Documentation

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
Offset_t RefCountedBlockPtr< T, BoundsChecked, Controller >::offset_m [protected]

template<class T, bool BoundsChecked = POOMA_BOUNDS_CHECK_DEFAULT, class Controller = RefBlockController<T>>
RefCountedPtr<Controller> RefCountedBlockPtr< T, BoundsChecked, Controller >::blockControllerPtr_m [protected]


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

Generated on Wed Mar 16 06:20:30 2011 for FreePOOMA by  doxygen 1.5.9