#include <array2d.h>

Public Member Functions | |
| virtual int | getCols () const =0 |
| Get number of columns or, in case of an image, width. | |
| virtual int | getRows () const =0 |
| Get number of rows or, in case of an image, height. | |
| virtual float & | operator() (int col, int row)=0 |
| Access an element of the array for reading and writing. | |
| virtual const float & | operator() (int col, int row) const =0 |
| Access an element of the array for reading. | |
| virtual float & | operator() (int index)=0 |
| Access an element of the array for reading and writing. | |
| virtual const float & | operator() (int index) const =0 |
| Access an element of the array for reading. | |
| virtual | ~Array2D () |
| Each implementing class should provide its own destructor. | |
This is a thin interface of classes that hold 2 dimensional arrays of floats. The interface lets to access all types of arrays in the same way, regardless how data is really stored (row major, column major, 2D array, array of pointers, etc.). It also simplifies indexing.
See also implementing classes.
Definition at line 54 of file array2d.h.
| virtual float& pfs::Array2D::operator() | ( | int | col, | |
| int | row | |||
| ) | [pure virtual] |
Access an element of the array for reading and writing.
Whether the given row and column are checked against array bounds depends on an implementing class.
Note, that if an Array2D object is passed as a pointer (what is usually the case), to access its elements, you have to use somewhat strange syntax: (*array)(row, column).
| col | number of a column (x) within the range 0..(getCols()-1) | |
| row | number of a row (y) within the range 0..(getRows()-1) |
Implemented in pfs::Array2DImpl.
| virtual const float& pfs::Array2D::operator() | ( | int | col, | |
| int | row | |||
| ) | const [pure virtual] |
Access an element of the array for reading.
Whether the given row and column are checked against array bounds depends on an implementing class.
Note, that if an Array2D object is passed as a pointer (what is usually the case), to access its elements, you have to use somewhat strange syntax: (*array)(row, column).
| col | number of a column (x) within the range 0..(getCols()-1) | |
| row | number of a row (y) within the range 0..(getRows()-1) |
Implemented in pfs::Array2DImpl.
| virtual float& pfs::Array2D::operator() | ( | int | index | ) | [pure virtual] |
Access an element of the array for reading and writing.
This is probably faster way of accessing elements than operator(col, row). However there is no guarantee on the order of elements as it usually depends on an implementing class. The only assumption that can be make is that there are exactly columns*rows elements and they are all unique.
Whether the given index is checked against array bounds depends on an implementing class.
Note, that if an Array2D object is passed as a pointer (what is usually the case), to access its elements, you have to use somewhat strange syntax: (*array)(index).
| index | index of an element within the range 0..(getCols()*getRows()-1) |
Implemented in pfs::Array2DImpl.
| virtual const float& pfs::Array2D::operator() | ( | int | index | ) | const [pure virtual] |
Access an element of the array for reading.
This is probably faster way of accessing elements than operator(col, row). However there is no guarantee on the order of elements as it usually depends on an implementing class. The only assumption that can be make is that there are exactly columns*rows elements and they are all unique.
Whether the given index is checked against array bounds depends on an implementing class.
Note, that if an Array2D object is passed as a pointer (what is usually the case), to access its elements, you have to use somewhat strange syntax: (*array)(index).
| index | index of an element within the range 0..(getCols()*getRows()-1) |
Implemented in pfs::Array2DImpl.
1.5.3