43 pValue = pValue +
steps;
56 return pValue == pEnd;
91 : pRowsStart(
pValues + (axisSize*(axisSize-1U))),
113 pRowsStart = pRowsStart - (rowWidth *
rows);
137 return pRowsStart == pRowsEnd;
146#define TABLE3D_TYPENAME_VALUE(size, xDom, yDom) CONCAT(TABLE3D_TYPENAME_BASE(size, xDom, yDom), _values)
148#define TABLE3D_GEN_VALUES(size, xDom, yDom) \
150 struct TABLE3D_TYPENAME_VALUE(size, xDom, yDom) { \
152 static constexpr table3d_dim_t row_size = (size); \
154 static constexpr table3d_dim_t num_rows = (size); \
162 table3d_value_t values[(uint16_t)row_size*num_rows]; \
165 table_value_iterator begin(void) \
167 return table_value_iterator(values, row_size); \
188 table3d_value_t& value_at(table3d_dim_t linear_index) \
190 static_assert(row_size<17U, "Table is too big"); \
191 static_assert(num_rows<17U, "Table is too big"); \
193 static_assert(row_size>0U, "No zero length rows"); \
194 static_assert(num_rows>0U, "No empty tables"); \
195 constexpr table3d_dim_t first_index = row_size*(table3d_dim_t)(num_rows-1U); \
196 const table3d_dim_t index = (table3d_dim_t)(first_index + (table3d_dim_t)(2U*(linear_index % row_size)) - linear_index); \
197 return values[index]; \
200TABLE3D_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:34
table_row_iterator & operator++(void)
Increment the iterator by one element.
Definition table3d_values.h:48
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:36
table3d_dim_t size(void) const
Number of elements available.
Definition table3d_values.h:71
table_row_iterator & advance(table3d_dim_t steps)
Advance the iterator.
Definition table3d_values.h:41
table3d_value_t & operator*(void)
Dereference the iterator.
Definition table3d_values.h:65
const table3d_value_t & operator*(void) const
Dereference the iterator.
Definition table3d_values.h:60
bool at_end(void) const
Test for end of iteration.
Definition table3d_values.h:54
Iterate through a tables values, row by row.
Definition table3d_values.h:82
table_row_iterator operator*(void)
Dereference the iterator to access a row of data.
Definition table3d_values.h:129
const table_row_iterator operator*(void) const
Dereference the iterator to access a row of data.
Definition table3d_values.h:124
table_value_iterator & operator++(void)
Increment the iterator by one row.
Definition table3d_values.h:118
table_value_iterator(const table3d_value_t *pValues, table3d_dim_t axisSize)
Construct.
Definition table3d_values.h:90
table_value_iterator & advance(table3d_dim_t rows)
Advance the iterator.
Definition table3d_values.h:111
bool at_end(void) const
Test for end of iteration.
Definition table3d_values.h:135
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
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.