#include <ArrayTable.hpp>
Public Member Functions | |
ArrayTable () | |
template<typename... Sizes> | |
ArrayTable (Sizes... sizes) | |
template<typename... Indices, typename = std::enable_if_t<CompileTimeUtils::isIntegralArgList<N, Indices...>()>> | |
double & | operator() (Indices... indices) |
template<typename... Indices, typename = std::enable_if_t<CompileTimeUtils::isIntegralArgList<N - 1, Indices...>()>> | |
Array & | operator() (Indices... indices) |
template<typename... Indices, typename = std::enable_if_t<CompileTimeUtils::isIntegralArgList<N, Indices...>()>> | |
double | operator() (Indices... indices) const |
template<typename... Indices, typename = std::enable_if_t<CompileTimeUtils::isIntegralArgList<N - 1, Indices...>()>> | |
const Array & | operator() (Indices... indices) const |
template<typename Index , typename = std::enable_if_t<N == 2 && CompileTimeUtils::isIntegralArgList<1, Index>()>> | |
Array & | operator[] (Index index) |
template<typename Index , typename = std::enable_if_t<N == 2 && CompileTimeUtils::isIntegralArgList<1, Index>()>> | |
const Array & | operator[] (Index index) const |
template<typename... Sizes, typename = std::enable_if_t<CompileTimeUtils::isIntegralArgList<N, Sizes...>()>> | |
void | resize (Sizes... sizes) |
size_t | rowSize () const |
void | setToZero () |
size_t | size () const |
size_t | size (size_t dim) const |
Private Attributes | |
std::vector< Array > | _rows |
std::array< size_t, N > | _sizes |
The ArrayTable<N> class template implements multi-dimensional tables with special support for rows in the last table dimension. Specifically, a ArrayTable<N> instance holds an N-dimensional table of double values. The combination of the first N-1 indices addresses a row in an (N-1)-dimensional table of rows; the last index addresses a column within a row. The values are stored as a list of Array objects, allowing read and write access to individual values as well as to rows of values as a whole.
It is possible and allowed to resize the rows individually through their reference. In that case the caller should ensure that all rows end up with the same size (the ArrayTable implementation does not check this requirement and does not rely on it). Note that the size(N-1) function returns the original row size as it has been specified in the constructor or in the most recent resize() invocation. The rowsize() function returns the size of the first row in the table, or zero if the table is empty.
|
inline |
The default constructor constructs an empty table.
|
inlineexplicit |
This constructor constructs a table holding the specified number of items in each of the N dimensions. If the last dimension in the list is nonzero, the arrays holding the data are resized correspondingly and all values are set to zero. If the last dimension is zero, the arrays remain empty and should be appropriately resized by the client code.
|
inline |
This function returns a writable reference to the value at the specified N indices. There is no range checking. Out-of-range index values cause unpredictable behavior.
|
inline |
This function returns a writable reference to the row at the specified N-1 indices. There is no range checking. Out-of-range index values cause unpredictable behavior.
|
inline |
This function returns a copy of the value at the specified N indices. There is no range checking. Out-of-range index values cause unpredictable behavior.
|
inline |
This function returns a read-only reference to the row at the specified N-1 indices. There is no range checking. Out-of-range index values cause unpredictable behavior.
|
inline |
This function returns a writable reference to the row at the specified index (for a 2-dimensional table only). There is no range checking. Out-of-range index values cause unpredictable behavior.
|
inline |
This function returns a read-only reference to the row at the specified index (for a 2-dimensional table only). There is no range checking. Out-of-range index values cause unpredictable behavior.
|
inline |
This function resizes the table so that it holds the specified number of items in each of the N dimensions. If the last dimension in the list is nonzero, the arrays holding the data are resized correspondingly and all values are set to zero. If the last dimension is zero, the arrays are emptied and should be appropriately resized by the client code. In any case, any values that were previously in the table are lost.
|
inline |
This function returns the number of columns in a row, i.e. the number of items in the last dimension, defined as the size of the first row in the table, or zero if the table is empty.
|
inline |
This function sets all values in the table to zero, without changing the number of items.
|
inline |
This function returns an estimate for the total number of items in the table, obtained by multiplying the total number of rows in the table by the size of the first row. In other words, the estimate assumes that all rows have the same size.
|
inline |
This function returns the number of items in the dimension indicated by the specified zero-based index. For the last dimension, the function returns the number of items as it has been specified in the constructor or in the most recent resize() invocation, even if the underlying arrays have since been resized by cient code.