45 pValue = pValue +
steps;
58 return pValue == pEnd;
117 pRowsStart = pRowsStart - (rowWidth *
rows);
141 return pRowsStart == pRowsEnd;
150#define TABLE3D_TYPENAME_VALUE(size, xDom, yDom) CONCAT(TABLE3D_TYPENAME_BASE(size, xDom, yDom), _values)
152#define TABLE3D_GEN_VALUES(size, xDom, yDom) \
154 struct TABLE3D_TYPENAME_VALUE(size, xDom, yDom) { \
156 static constexpr table3d_dim_t row_size = (size); \
158 static constexpr table3d_dim_t num_rows = (size); \
166 table3d_value_t values[(uint16_t)row_size*num_rows]; \
169 table_value_iterator begin(void) \
171 return table_value_iterator(values, row_size); \
192 table3d_value_t& value_at(table3d_dim_t linear_index) \
194 static_assert(row_size<17U, "Table is too big"); \
195 static_assert(num_rows<17U, "Table is too big"); \
197 static_assert(row_size>0U, "No zero length rows"); \
198 static_assert(num_rows>0U, "No empty tables"); \
199 constexpr table3d_dim_t first_index = row_size*(table3d_dim_t)(num_rows-1U); \
200 const table3d_dim_t index = (table3d_dim_t)(first_index + (table3d_dim_t)(2U*(linear_index % row_size)) - linear_index); \
201 return values[index]; \
204TABLE3D_GENERATOR(TABLE3D_GEN_VALUES)
Iterate through a table row. I.e. constant Y, changing X.
Definition table3d_values.h:20
const table3d_value_t * end(void) const
Pointer to the end of the row.
Definition table3d_values.h:35
table_row_iterator & operator++(void)
Increment the iterator by one element.
Definition table3d_values.h:50
table_row_iterator(const table3d_value_t *pRowStart, table3d_dim_t rowWidth)
Construct.
Definition table3d_values.h:28
table3d_value_t * end(void)
Pointer to the end of the row.
Definition table3d_values.h:37
table3d_dim_t size(void) const
Number of elements available.
Definition table3d_values.h:75
table_row_iterator & advance(table3d_dim_t steps)
Advance the iterator.
Definition table3d_values.h:43
table3d_value_t & operator*(void)
Dereference the iterator.
Definition table3d_values.h:68
const table3d_value_t & operator*(void) const
Dereference the iterator.
Definition table3d_values.h:63
bool at_end(void) const
Test for end of iteration.
Definition table3d_values.h:56
Iterate through a tables values, row by row.
Definition table3d_values.h:86
table_row_iterator operator*(void)
Dereference the iterator to access a row of data.
Definition table3d_values.h:133
const table_row_iterator operator*(void) const
Dereference the iterator to access a row of data.
Definition table3d_values.h:128
table_value_iterator & operator++(void)
Increment the iterator by one row.
Definition table3d_values.h:122
table_value_iterator(const table3d_value_t *pValues, table3d_dim_t axisSize)
Construct.
Definition table3d_values.h:94
table_value_iterator & advance(table3d_dim_t rows)
Advance the iterator.
Definition table3d_values.h:115
bool at_end(void) const
Test for end of iteration.
Definition table3d_values.h:139
static TIntegral readSerialIntegralTimeout(void)
Reads an integral type, timing out if necessary.
Definition comms.cpp:175
uint8_t table3d_value_t
The type of each table value.
Definition table3d_typedefs.h:25
uint8_t table3d_dim_t
Encodes the length of the axes.
Definition table3d_typedefs.h:22
Typedefs for primitive 3D table elements.