Zivid C++ API 2.14.0+e4a0c4a9-1
|
Two-dimensional container of data. More...
#include <Zivid/Array2D.h>
Public Types | |
using | ValueType = DataFormat |
The type of the elements stored in the Array2D. | |
using | ConstIterator = const DataFormat * |
The iterator type for immutable access. It iterates over individual Array2D elements in row major order. | |
Public Member Functions | |
Array2D () | |
Create an empty Array2D. | |
size_t | width () const |
Get the width of the array (number of columns) | |
size_t | height () const |
Get the height of the array (number of rows) | |
size_t | size () const |
Get the number of elements in the array. | |
bool | isEmpty () const |
Check if the array is empty. | |
const DataFormat * | data () const |
Pointer to the first data element of the array. | |
const DataFormat & | operator() (size_t idx) const |
Constant reference to an element given by a 1D linear index. | |
const DataFormat & | operator() (size_t i, size_t j) const |
Constant reference to an element given by row and column. | |
ConstIterator | begin () const |
Iterator to the beginning of the array. | |
ConstIterator | end () const |
Iterator to the end of the array. | |
ConstIterator | cbegin () const |
Iterator to the beginning of the array. | |
ConstIterator | cend () const |
Iterator to the end of the array. | |
std::string | toString () const |
Get array information as string. | |
Friends | |
class | Array2DFactory |
class | Image< DataFormat > |
Two-dimensional container of data.
Array2D manages the data using implicit sharing via reference counting. Copy or assignment of an Array2D object is shallow (only a pointer to the data is copied), which makes copy/assignment of Array2D fast. The data stored in the array is deallocated when there are no Array2D instances pointing to it.
The type of the elements stored in the array is given by template parameter DataFormat. Elements are stored sequentially in row-major order. Use data to get a pointer to the first element (row 0, column 0).
using Zivid::Array2D< DataFormat >::ConstIterator = const DataFormat * |
The iterator type for immutable access. It iterates over individual Array2D elements in row major order.
using Zivid::Array2D< DataFormat >::ValueType = DataFormat |
The type of the elements stored in the Array2D.
|
inline |
Create an empty Array2D.
|
inline |
Iterator to the beginning of the array.
|
inline |
Iterator to the beginning of the array.
|
inline |
Iterator to the end of the array.
|
inline |
Pointer to the first data element of the array.
If the array is empty then this method returns nullptr
|
inline |
Iterator to the end of the array.
|
inline |
Get the height of the array (number of rows)
|
inline |
Check if the array is empty.
|
inline |
Constant reference to an element given by row and column.
Data is stored in row-major order. No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the Array2D is empty causes undefined behavior.
|
inline |
Constant reference to an element given by a 1D linear index.
Data is stored in row-major order. No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the Array2D is empty causes undefined behavior.
idx | Index (from 0 to size - 1) |
|
inline |
|
inline |
Get array information as string.
|
inline |
Get the width of the array (number of columns)
|
friend |
|
friend |