Argus API
Argus Camera API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes
Argus::Array2D< T > Class Template Reference

A template class to hold a 2-dimensional array of data. More...

#include <Types.h>

List of all members.

Public Types

typedef T * iterator
typedef const T * const_iterator

Public Member Functions

 Array2D ()
 Default Constructor.
 Array2D (const Size2D< uint32_t > &size)
 Constructor given initial array size.
 Array2D (const Size2D< uint32_t > &size, const T &value)
 Constructor given initial array size and initial fill value.
 Array2D (const Array2D< T > &other)
 Copy constructor.
Array2Doperator= (const Array2D< T > &other)
 Assignment operator.
bool operator== (const Array2D< T > &other) const
 Equality operator.
Size2D< uint32_t > size () const
 Returns the size (dimensions) of the array.
bool resize (const Size2D< uint32_t > &size)
 Resize the array.
const_iterator begin () const
 STL style iterators.
const_iterator end () const
iterator begin ()
iterator end ()
T & operator[] (unsigned int i)
 Array indexing using [] operator.
const T & operator[] (unsigned int i) const
const T & operator() (uint32_t i) const
 Array indexing using () operator.
const T & operator() (uint32_t x, uint32_t y) const
const T & operator() (const Point2D< uint32_t > &p) const
T & operator() (uint32_t i)
T & operator() (uint32_t x, uint32_t y)
T & operator() (const Point2D< uint32_t > &p)
const T * data () const
T * data ()

Private Member Functions

uint32_t checkIndex (uint32_t i) const
uint32_t checkIndex (uint32_t x, uint32_t y) const

Private Attributes

std::vector< T > m_data
Size2D< uint32_t > m_size

Detailed Description

template<typename T>
class Argus::Array2D< T >

A template class to hold a 2-dimensional array of data.

Data in this array is tightly packed in a 1-dimensional vector in row-major order; that is, the vector index for any value given its 2-dimensional location (Point2D) is index = location.x() + (location.y() * size.x()); Indexing operators using iterators, 1-dimensional, or 2-dimensional coordinates are provided.

Definition at line 791 of file Types.h.


Member Typedef Documentation

template<typename T>
typedef const T* Argus::Array2D< T >::const_iterator

Definition at line 796 of file Types.h.

template<typename T>
typedef T* Argus::Array2D< T >::iterator

Definition at line 795 of file Types.h.


Constructor & Destructor Documentation

template<typename T>
Argus::Array2D< T >::Array2D ( )
inline

Default Constructor.

Definition at line 799 of file Types.h.

template<typename T>
Argus::Array2D< T >::Array2D ( const Size2D< uint32_t > &  size)
inline

Constructor given initial array size.

Definition at line 802 of file Types.h.

template<typename T>
Argus::Array2D< T >::Array2D ( const Size2D< uint32_t > &  size,
const T &  value 
)
inline

Constructor given initial array size and initial fill value.

Definition at line 808 of file Types.h.

template<typename T>
Argus::Array2D< T >::Array2D ( const Array2D< T > &  other)
inline

Copy constructor.

Definition at line 814 of file Types.h.


Member Function Documentation

template<typename T>
const_iterator Argus::Array2D< T >::begin ( ) const
inline

STL style iterators.

Definition at line 850 of file Types.h.

template<typename T>
iterator Argus::Array2D< T >::begin ( )
inline

Definition at line 852 of file Types.h.

template<typename T>
uint32_t Argus::Array2D< T >::checkIndex ( uint32_t  i) const
inlineprivate

Definition at line 874 of file Types.h.

template<typename T>
uint32_t Argus::Array2D< T >::checkIndex ( uint32_t  x,
uint32_t  y 
) const
inlineprivate

Definition at line 880 of file Types.h.

template<typename T>
const T* Argus::Array2D< T >::data ( ) const
inline

Definition at line 870 of file Types.h.

template<typename T>
T* Argus::Array2D< T >::data ( )
inline

Definition at line 871 of file Types.h.

template<typename T>
const_iterator Argus::Array2D< T >::end ( ) const
inline

Definition at line 851 of file Types.h.

template<typename T>
iterator Argus::Array2D< T >::end ( )
inline

Definition at line 853 of file Types.h.

template<typename T>
const T& Argus::Array2D< T >::operator() ( uint32_t  i) const
inline

Array indexing using () operator.

Definition at line 860 of file Types.h.

template<typename T>
const T& Argus::Array2D< T >::operator() ( uint32_t  x,
uint32_t  y 
) const
inline

Definition at line 861 of file Types.h.

template<typename T>
const T& Argus::Array2D< T >::operator() ( const Point2D< uint32_t > &  p) const
inline

Definition at line 862 of file Types.h.

template<typename T>
T& Argus::Array2D< T >::operator() ( uint32_t  i)
inline

Definition at line 864 of file Types.h.

template<typename T>
T& Argus::Array2D< T >::operator() ( uint32_t  x,
uint32_t  y 
)
inline

Definition at line 865 of file Types.h.

template<typename T>
T& Argus::Array2D< T >::operator() ( const Point2D< uint32_t > &  p)
inline

Definition at line 866 of file Types.h.

template<typename T>
Array2D& Argus::Array2D< T >::operator= ( const Array2D< T > &  other)
inline

Assignment operator.

Definition at line 821 of file Types.h.

template<typename T>
bool Argus::Array2D< T >::operator== ( const Array2D< T > &  other) const
inline

Equality operator.

Definition at line 829 of file Types.h.

template<typename T>
T& Argus::Array2D< T >::operator[] ( unsigned int  i)
inline

Array indexing using [] operator.

Definition at line 856 of file Types.h.

template<typename T>
const T& Argus::Array2D< T >::operator[] ( unsigned int  i) const
inline

Definition at line 857 of file Types.h.

template<typename T>
bool Argus::Array2D< T >::resize ( const Size2D< uint32_t > &  size)
inline

Resize the array.

Array contents after resize are undefined. Boolean return value enables error checking when exceptions are not available.

Definition at line 839 of file Types.h.

template<typename T>
Size2D<uint32_t> Argus::Array2D< T >::size ( ) const
inline

Returns the size (dimensions) of the array.

Definition at line 835 of file Types.h.


Member Data Documentation

template<typename T>
std::vector<T> Argus::Array2D< T >::m_data
private

Definition at line 887 of file Types.h.

template<typename T>
Size2D<uint32_t> Argus::Array2D< T >::m_size
private

Definition at line 888 of file Types.h.


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