Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

base::pointer_t< T > Class Template Reference

A simple reference with maximal capacity for access checks. More...

#include <pointer.h>

Inheritance diagram for base::pointer_t< T >:

base::array_t< T > List of all members.

Public Member Functions

 pointer_t ()
 Default constructor.
 pointer_t (T *ptr, size_t max)
 Constructor:.
bool isSamePointerAs (const pointer_t< T > &other) const
 Pointer equality testing.
T & operator[] (size_t at)
 wrap and check ptr[at]
const T operator[] (size_t at) const
 wrap and check read only ptr[at]
T * operator-> ()
 wrap and check ptr->something
T & operator * ()
 wrap and check *ptr
size_t size () const
 size of pointed area in T nb of elements
void reset ()
 reset all pointed elements
uint32_t hash () const
void copyFrom (const pointer_t< T > &src)
 copy all pointed elements from a pointer.
const T * begin () const
 Simple iteration.
const T * end () const
T * begin ()
T * end ()
const T * operator() () const
 Reading data.

Protected Attributes

T * data
 data pointed
size_t capa
 size of data, important for checks

Detailed Description

template<class T>
class base::pointer_t< T >

A simple reference with maximal capacity for access checks.

This is a pointer to some bounded memory. array_t is defined too, but pointer_t has no memory management, it is only a reference. Accesses ptr[i] are checked. Main purpose is debugging + simple iteration. std::vector does not provide these debugging capabilities. Everything is assumed to be 32 bits aligned so this wrapper is obviously not designed for int8 or int16 types.


Constructor & Destructor Documentation

template<class T>
base::pointer_t< T >::pointer_t  )  [inline]
 

Default constructor.

template<class T>
base::pointer_t< T >::pointer_t T *  ptr,
size_t  max
[inline]
 

Constructor:.

Parameters:
ptr,: pointer to wrap.
max,: number of elements pointed by ptr.


Member Function Documentation

template<class T>
T* base::pointer_t< T >::begin  )  [inline]
 

template<class T>
const T* base::pointer_t< T >::begin  )  const [inline]
 

Simple iteration.

template<class T>
void base::pointer_t< T >::copyFrom const pointer_t< T > &  src  )  [inline]
 

copy all pointed elements from a pointer.

Parameters:
src,: compatible pointer
Precondition:
sizes are the same.

template<class T>
T* base::pointer_t< T >::end  )  [inline]
 

template<class T>
const T* base::pointer_t< T >::end  )  const [inline]
 

template<class T>
uint32_t base::pointer_t< T >::hash  )  const [inline]
 

Returns:
a hash value.

template<class T>
bool base::pointer_t< T >::isSamePointerAs const pointer_t< T > &  other  )  const [inline]
 

Pointer equality testing.

It is ambiguous to define a == operator since it could be interpreted as pointer or content testing.

template<class T>
T& base::pointer_t< T >::operator *  )  [inline]
 

wrap and check *ptr

template<class T>
const T* base::pointer_t< T >::operator()  )  const [inline]
 

Reading data.

template<class T>
T* base::pointer_t< T >::operator->  )  [inline]
 

wrap and check ptr->something

template<class T>
const T base::pointer_t< T >::operator[] size_t  at  )  const [inline]
 

wrap and check read only ptr[at]

template<class T>
T& base::pointer_t< T >::operator[] size_t  at  )  [inline]
 

wrap and check ptr[at]

template<class T>
void base::pointer_t< T >::reset  )  [inline]
 

reset all pointed elements

template<class T>
size_t base::pointer_t< T >::size  )  const [inline]
 

size of pointed area in T nb of elements


Member Data Documentation

template<class T>
size_t base::pointer_t< T >::capa [protected]
 

size of data, important for checks

template<class T>
T* base::pointer_t< T >::data [protected]
 

data pointed


The documentation for this class was generated from the following file:
Generated on Fri Jun 30 00:02:30 2006 for Module base by  doxygen 1.4.2