The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

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

Array::RefArray Class Template Reference

#include <Array.h>

List of all members.

Public Types

enum  { array_dims = N }
typedef const T * const_iterator
typedef const T * const_pointer
typedef const T & const_reference
typedef ptrdiff_t difference_type
typedef T * iterator
typedef T * pointer
typedef T & reference
typedef size_t size_type
typedef T value_type

Public Member Functions

const_iterator begin () const
iterator begin ()
unsigned int dimensions () const
const_iterator end () const
iterator end ()
const RefArray< N-1 > operator[] (size_type Index) const
RefArray< N-1 > operator[] (size_type Index)
size_type size (unsigned int Dim) const
size_type size () const

Protected Member Functions

void copy (const RefArray< N > &SA, const T &Init=T())
void initialize (const T &Init=T())

Private Member Functions

 RefArray (T *pElements, const size_type *pNDimensions, const size_type *pSubArrayLen)

Private Attributes

T *const m_pElements
const size_type *const m_pNDimensions
const size_type *const m_pSubArrayLen

template<typename T, unsigned int N>
template<unsigned int N>
class Array< T, N >::RefArray< N >


Member Typedef Documentation

typedef const T* const_iterator
 

Definition at line 115 of file Array.h.

typedef const T* const_pointer
 

Definition at line 113 of file Array.h.

typedef const T& const_reference
 

Definition at line 111 of file Array.h.

typedef ptrdiff_t difference_type
 

Definition at line 117 of file Array.h.

typedef T* iterator
 

Definition at line 114 of file Array.h.

typedef T* pointer
 

Definition at line 112 of file Array.h.

typedef T& reference
 

Definition at line 110 of file Array.h.

typedef size_t size_type
 

Definition at line 116 of file Array.h.

typedef T value_type
 

Definition at line 109 of file Array.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
array_dims 

Definition at line 120 of file Array.h.

00120 { array_dims = N };


Constructor & Destructor Documentation

RefArray T *  pElements,
const size_type pNDimensions,
const size_type pSubArrayLen
[inline, private]
 


Member Function Documentation

const_iterator begin  )  const [inline]
 

Definition at line 158 of file Array.h.

00158 { return m_pElements; }

iterator begin  )  [inline]
 

Definition at line 157 of file Array.h.

00157 { return m_pElements; }

void copy const RefArray< N > &  SA,
const T &  Init = T()
[inline, protected]
 

Definition at line 182 of file Array.h.

References i, and size().

Referenced by Array::copy().

00183        {
00184            size_type below=std::_MIN(size(1),SA.size(1));
00185            size_type above=size(1);
00186 
00187            // Copy the elements we can copy
00188            for (size_type i=0;i<below;i++) 
00189                (*this)[i].copy(SA[i],Init);
00190 
00191            // Reset the elements we can't copy
00192            for (size_type j=below;j<above;j++)
00193                (*this)[j].initialize(Init);
00194        }

Here is the call graph for this function:

unsigned int dimensions  )  const [inline]
 

Definition at line 173 of file Array.h.

00173 { return N; }

const_iterator end  )  const [inline]
 

Definition at line 160 of file Array.h.

00160 { return m_pElements+size(); } 

iterator end  )  [inline]
 

Definition at line 159 of file Array.h.

00159 { return m_pElements+size(); }

void initialize const T &  Init = T()  )  [inline, protected]
 

Definition at line 197 of file Array.h.

References end.

Referenced by Array::copy().

00198        {
00199            std::fill(begin(),end(),Init);
00200        }

const RefArray<N-1> operator[] size_type  Index  )  const [inline]
 

Definition at line 148 of file Array.h.

00149        {
00150           assert(m_pElements);
00151           assert(Index<m_pNDimensions[0]);
00152           return RefArray<N-1>(&m_pElements[Index*m_pSubArrayLen[0]],
00153                                 m_pNDimensions+1,m_pSubArrayLen+1);
00154        }

RefArray<N-1> operator[] size_type  Index  )  [inline]
 

Definition at line 140 of file Array.h.

00141        {
00142           assert(m_pElements);
00143           assert(Index<m_pNDimensions[0]);
00144           return RefArray<N-1>(&m_pElements[Index*m_pSubArrayLen[0]],
00145                                 m_pNDimensions+1,m_pSubArrayLen+1);
00146        }

size_type size unsigned int  Dim  )  const [inline]
 

Definition at line 166 of file Array.h.

00167        {  
00168           assert(Dim>=1 && Dim<=N); 
00169           return m_pNDimensions[Dim-1];  
00170        }

size_type size  )  const [inline]
 

Definition at line 163 of file Array.h.

Referenced by Array::RefArray< 1 >::copy(), and copy().

00163 { return m_pNDimensions[0]*m_pSubArrayLen[0]; }


Member Data Documentation

T* const m_pElements [private]
 

Definition at line 127 of file Array.h.

Referenced by Array::RefArray< 1 >::copy().

const size_type* const m_pNDimensions [private]
 

Definition at line 124 of file Array.h.

const size_type* const m_pSubArrayLen [private]
 

Definition at line 125 of file Array.h.


The documentation for this class was generated from the following file:
Generated on Mon Nov 8 17:08:29 2004 for MPT by  doxygen 1.3.9.1