24 #ifndef PDCOM5_SIZETYPEINFO_H 25 #define PDCOM5_SIZETYPEINFO_H 37 boolean_T = DataTypeBegin,
66 class SizeInfo :
public std::vector<unsigned int>
69 using std::vector<unsigned int>::vector;
71 bool isScalar()
const {
return size() == 1 && (*this)[0] == 1; }
72 bool isVector()
const {
return size() == 1 && (*this)[0] > 1; }
73 bool is2DMatrix()
const {
return size() == 2; }
74 std::size_t dimension()
const noexcept
76 return size() == 1 && (*this)[0] == 1 ? 0 : size();
79 std::size_t totalElements()
const 88 static SizeInfo Scalar() {
return {1U}; }
89 static SizeInfo RowVector(
unsigned int rows) {
return {rows}; }
90 static SizeInfo Matrix(
unsigned int rows,
unsigned int cols)
92 return {{rows, cols}};
95 Matrix(
unsigned int layers,
unsigned int rows,
unsigned int cols)
97 return {{layers, rows, cols}};
100 unsigned int layers()
const 104 return size() >= 3 ? operator[](size() - 3) : 1;
107 unsigned int rows()
const 111 return size() >= 2 ? operator[](size() - 2) : 1;
114 unsigned int columns()
const {
return empty() ? 0 : back(); }
119 #endif // PDCOM5_SIZETYPEINFO_H const char * ctype
name of the correspondig c type (double, char, ...)
Definition: SizeTypeInfo.h:54
Size of a Variable.
Definition: SizeTypeInfo.h:66
Type of a Variable.
Definition: SizeTypeInfo.h:33
size_t element_size
Size of one element in bytes.
Definition: SizeTypeInfo.h:56
Definition: ClientStatistics.h:31