Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
frechet::data::Array2D< T > Class Template Reference

Detailed Description

template<class T>
class frechet::data::Array2D< T >

A simple two-dimensional array of fixed size.

Data is arranged in column-major order.

Template Parameters
Tentry type (must be default constructible)
Author
Peter Schäfer

Definition at line 19 of file array2d.h.

#include <array2d.h>

Classes

class  iterator
 an Array2D iterator More...
 

Public Member Functions

 Array2D (int an=0, int am=0)
 default constructor More...
 
 Array2D (const Array2D &that)
 copy constructor More...
 
 Array2D (Array2D &&that)
 move constructor More...
 
 ~Array2D ()
 destructor; releases data More...
 
Array2Doperator= (const Array2D &that)
 assignment operator More...
 
Array2Doperator= (Array2D &&that)
 move assignment operator More...
 
T & at (int i, int j)
 array accessor More...
 
const T & at (int i, int j) const
 array accessor More...
 
T & at (int offset)
 array accessor More...
 
const T & at (int offset) const
 array accessor More...
 
T & operator[] (int offset)
 array accessor More...
 
const T & operator[] (int offset) const
 array accessor More...
 
iterator begin ()
 
iterator end ()
 
size_t offset (int i, int j) const
 compute linear offset More...
 
void indices (int off, int *i, int *j) const
 compute columnd and row from linear index More...
 

Static Public Member Functions

static void copy (T *dst, T *src, int count)
 copy a number of entries More...
 

Public Attributes

const int n
 number of columns More...
 
const int m
 number of rows More...
 

Protected Attributes

T * d
 array data More...
 

Constructor & Destructor Documentation

◆ Array2D() [1/3]

template<class T >
frechet::data::Array2D< T >::Array2D ( int  an = 0,
int  am = 0 
)

default constructor

Parameters
annumber of columns
amnumber of rows

Definition at line 27 of file array2d_impl.h.

◆ Array2D() [2/3]

template<class T >
frechet::data::Array2D< T >::Array2D ( const Array2D< T > &  that)

copy constructor

Parameters
thatobject to copy from

Definition at line 41 of file array2d_impl.h.

◆ Array2D() [3/3]

template<class T >
frechet::data::Array2D< T >::Array2D ( Array2D< T > &&  that)

move constructor

Parameters
thatobject to copy from

Definition at line 35 of file array2d_impl.h.

◆ ~Array2D()

template<class T >
frechet::data::Array2D< T >::~Array2D ( )

destructor; releases data

Definition at line 47 of file array2d_impl.h.

Member Function Documentation

◆ at() [1/4]

template<class T>
T& frechet::data::Array2D< T >::at ( int  i,
int  j 
)
inline

array accessor

Parameters
icolumn index
jrow index
Returns
current value at index (i,j)

Definition at line 54 of file array2d.h.

◆ at() [2/4]

template<class T>
const T& frechet::data::Array2D< T >::at ( int  i,
int  j 
) const
inline

array accessor

Parameters
icolumn index
jrow index
Returns
current value at index (i,j)

Definition at line 59 of file array2d.h.

◆ at() [3/4]

template<class T>
T& frechet::data::Array2D< T >::at ( int  offset)
inline

array accessor

Parameters
offsetlinear offset
Returns
current value at index (offset)

Definition at line 64 of file array2d.h.

◆ at() [4/4]

template<class T>
const T& frechet::data::Array2D< T >::at ( int  offset) const
inline

array accessor

Parameters
offsetlinear offset
Returns
current value at index (offset)

Definition at line 72 of file array2d.h.

◆ begin()

template<class T>
iterator frechet::data::Array2D< T >::begin ( )
inline
Returns
an iterator that points to the first entry in this Array2D

Definition at line 215 of file array2d.h.

◆ copy()

template<class T>
void frechet::data::Array2D< T >::copy ( T *  dst,
T *  src,
int  count 
)
static

copy a number of entries

Parameters
dstdestination
srcsource
countnumber of entries to copy

Definition at line 53 of file array2d_impl.h.

◆ end()

template<class T>
iterator frechet::data::Array2D< T >::end ( )
inline
Returns
an iterator that points one beyond the last entry. This iterator is invalid, but can be decremented.

Definition at line 217 of file array2d.h.

◆ indices()

template<class T>
void frechet::data::Array2D< T >::indices ( int  off,
int *  i,
int *  j 
) const
inline

compute columnd and row from linear index

Parameters
offlinear offset
iholds column index on return
jholds row index on return

Definition at line 236 of file array2d.h.

◆ offset()

template<class T>
size_t frechet::data::Array2D< T >::offset ( int  i,
int  j 
) const
inline

compute linear offset

Parameters
icolumn
jrow
Returns
linear offset into the array

Definition at line 226 of file array2d.h.

◆ operator=() [1/2]

template<class T >
Array2D< T > & frechet::data::Array2D< T >::operator= ( const Array2D< T > &  that)

assignment operator

Parameters
thatobject to copy from
Returns
this object, after assigning a copy

Definition at line 7 of file array2d_impl.h.

◆ operator=() [2/2]

template<class T >
Array2D< T > & frechet::data::Array2D< T >::operator= ( Array2D< T > &&  that)

move assignment operator

Parameters
thatobject to copy from
Returns
this object, after assigning a copy

Definition at line 17 of file array2d_impl.h.

◆ operator[]() [1/2]

template<class T>
T& frechet::data::Array2D< T >::operator[] ( int  offset)
inline

array accessor

Parameters
offsetlinear offset
Returns
current value at index (offset)

Definition at line 80 of file array2d.h.

◆ operator[]() [2/2]

template<class T>
const T& frechet::data::Array2D< T >::operator[] ( int  offset) const
inline

array accessor

Parameters
offsetlinear offset
Returns
current value at index (offset)

Definition at line 84 of file array2d.h.

Member Data Documentation

◆ d

template<class T>
T* frechet::data::Array2D< T >::d
protected

array data

Definition at line 22 of file array2d.h.

◆ m

template<class T>
const int frechet::data::Array2D< T >::m

number of rows

Definition at line 27 of file array2d.h.

◆ n

template<class T>
const int frechet::data::Array2D< T >::n

number of columns

Definition at line 25 of file array2d.h.


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