libtgd 4.3
A library that makes working with multidimensional arrays in C++ easy
|
The ArrayDescription manages array metadata. More...
#include <array.hpp>
Inherited by TGD::ArrayContainer.
Public Member Functions | |
Constructors / Destructor | |
ArrayDescription () | |
Constructor for an empty array description. | |
ArrayDescription (const std::vector< size_t > &dimensions, size_t componentCount, Type componentType) | |
Constructor for an array description. | |
ArrayDescription (const ArrayDescription &descr, Type type) | |
Constructor for an array description. | |
Access to array data specifications. | |
size_t | dimensionCount () const |
Returns the number of dimensions. | |
size_t | dimension (size_t d) const |
Returns the size of dimension d. | |
const std::vector< size_t > & | dimensions () const |
Returns the list of dimensions. | |
size_t | componentCount () const |
Returns the number of components in each element. | |
Type | componentType () const |
Returns the type represented by each element component. | |
size_t | componentSize () const |
Returns the size of a component. | |
size_t | elementSize () const |
Returns the size of an element. | |
size_t | elementCount () const |
Returns the number of elements in the array. | |
size_t | dataSize () const |
Returns the total data size. | |
bool | isCompatible (const ArrayDescription &a) const |
Returns whether the dimensions and components of array match those of this array. | |
const ArrayDescription & | description () const |
Returns this as a description. This is useful for derived classes. | |
Index management | |
size_t | toLinearIndex (const std::vector< size_t > &elementIndex) const |
Convert the given multidimensional element index to a linear element index. For example, for a 800x600 array, the multidimensional index { 1, 1 } is converted to linear index 601. | |
size_t | toLinearIndex (const std::initializer_list< size_t > &elementIndex) const |
Convert the given multidimensional element index to a linear element index. For example, for a 800x600 array, the multidimensional index { 1, 1 } is converted to linear index 601. | |
void | toVectorIndex (size_t elementIndex, size_t *vectorIndex) const |
Convert the given linear element index to a multidimensional index. For example, for a 800x600 array, the linear index 601 is converted to the multidimensional index { 1, 1 }. | |
size_t | elementOffset (size_t elementIndex) const |
Returns the offset of the element with index elementIndex within the data. | |
size_t | elementOffset (const std::vector< size_t > &elementIndex) const |
Returns the offset of the element with index elementIndex within the data. | |
size_t | elementOffset (const std::initializer_list< size_t > &elementIndex) const |
Returns the offset of the element with index elementIndex within the data. | |
size_t | componentOffset (size_t componentIndex) const |
Returns the offset of the component with index componentIndex within an array element. | |
size_t | componentOffset (size_t elementIndex, size_t componentIndex) const |
Returns the offset of the component with index componentIndex in the element with index elementIndex within an array element. | |
size_t | componentOffset (const std::vector< size_t > &elementIndex, size_t componentIndex) const |
Returns the offset of the component with index componentIndex in the element with index elementIndex within an array element. | |
size_t | componentOffset (const std::initializer_list< size_t > &elementIndex, size_t componentIndex) const |
Returns the offset of the component with index componentIndex in the element with index elementIndex within an array element. | |
Metadata management | |
const TagList & | globalTagList () const |
Returns the global tag list. | |
TagList & | globalTagList () |
Returns the global tag list. | |
const TagList & | dimensionTagList (size_t d) const |
Returns the tag list for dimension d. | |
TagList & | dimensionTagList (size_t d) |
Returns the tag list for dimension d. | |
const TagList & | componentTagList (size_t c) const |
Returns the tag list for component c. | |
TagList & | componentTagList (size_t c) |
Returns the tag list for component c. | |
The ArrayDescription manages array metadata.
|
inline |
Constructor for an empty array description.
|
inline |
Constructor for an array description.
dimensions | List of sizes, defining both the number of dimensions and the array size. |
componentCount | Number of components in one array element |
componentType | Data type of the components |
The array dimensions and the type and number of the element components must be specified. For example, for an image with 800x600 RGB pixels one might construct the following array: Array image({ 800, 600}, 3, uint8);
|
inlineexplicit |
Constructor for an array description.
descr | Existing array description |
type | New type |
Constructs an array description that is a copy of the given description except that it has the given new type.
|
inline |
Returns the number of components in each element.
|
inline |
Returns the offset of the component with index componentIndex in the element with index elementIndex within an array element.
|
inline |
Returns the offset of the component with index componentIndex in the element with index elementIndex within an array element.
|
inline |
Returns the offset of the component with index componentIndex within an array element.
|
inline |
Returns the offset of the component with index componentIndex in the element with index elementIndex within an array element.
|
inline |
Returns the size of a component.
|
inline |
Returns the tag list for component c.
|
inline |
Returns the tag list for component c.
|
inline |
Returns the type represented by each element component.
|
inline |
Returns the total data size.
|
inline |
Returns this as a description. This is useful for derived classes.
|
inline |
Returns the size of dimension d.
|
inline |
Returns the number of dimensions.
|
inline |
Returns the list of dimensions.
|
inline |
Returns the tag list for dimension d.
|
inline |
Returns the tag list for dimension d.
|
inline |
Returns the number of elements in the array.
|
inline |
Returns the offset of the element with index elementIndex within the data.
|
inline |
Returns the offset of the element with index elementIndex within the data.
|
inline |
Returns the offset of the element with index elementIndex within the data.
|
inline |
Returns the size of an element.
|
inline |
Returns the global tag list.
|
inline |
Returns the global tag list.
|
inline |
Returns whether the dimensions and components of array match those of this array.
|
inline |
Convert the given multidimensional element index to a linear element index. For example, for a 800x600 array, the multidimensional index { 1, 1 } is converted to linear index 601.
|
inline |
Convert the given multidimensional element index to a linear element index. For example, for a 800x600 array, the multidimensional index { 1, 1 } is converted to linear index 601.
|
inline |
Convert the given linear element index to a multidimensional index. For example, for a 800x600 array, the linear index 601 is converted to the multidimensional index { 1, 1 }.