33#include <NDEVR/BaseValues.h>
34#include <NDEVR/LibAssert.h>
35#include <NDEVR/Vector.h>
36#include <NDEVR/BitReference.h>
49 template<u
int01 t_dims>
69 template<
class t_vec_type>
72 for (
uint01 dim = 0; dim < t_dims; ++dim)
87 constexpr explicit Vector(
const bool& value)
89 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
94 Vector(std::initializer_list<bool> active_list)
97 for (
auto val : active_list)
101 template<
class t_type>
102 Vector(std::initializer_list<t_type> active_list)
104 for (
auto i : active_list)
125 constexpr Vector(
const bool& x,
const bool& y)
127 static_assert(t_dims == 2,
"Unexpected Number of Dimensions. Vector Size Required: 2");
145 constexpr Vector(
const bool& x,
const bool& y,
const bool& z)
147 static_assert(t_dims == 3,
"Unexpected Number of Dimensions. Vector Size Required: 3");
167 constexpr Vector(
const bool& x,
const bool& y,
const bool& z,
const bool& w)
169 static_assert(t_dims == 4,
"Unexpected Number of Dimensions. Vector Size Required: 4");
186 constexpr explicit Vector(
const bool(&vector)[t_dims])
188 for (
uint01 dim = 0; dim < t_dims; dim++)
189 m_values[dim / 8](dim % 8, vector[dim]);
205 static_assert(t_dims >= 2,
"Unexpected Number of Dimensions. Vector Size Required: >= 2");
206 for (
uint01 dim = 0; dim < t_dims - 1; ++dim)
207 m_values[dim / 8](dim % 8, vector[dim]);
208 m_values[(t_dims - 1) / 8]((t_dims - 1) % 8, suffix);
224 constexpr Vector(
const Vector<
getMax(t_dims - 2, 0),
bool>& vector,
const bool& suffix_a,
const bool& suffix_b)
226 static_assert(t_dims >= 3,
"Unexpected Number of Dimensions. Vector Size Required: >= 3");
227 for (
uint01 dim = 0; dim < t_dims - 2; ++dim)
228 m_values[dim / 8](dim % 8, vector[dim]);
229 m_values[(t_dims - 2) / 8]((t_dims - 2) % 8, suffix_a);
230 m_values[(t_dims - 1) / 8]((t_dims - 1) % 8, suffix_b);
246 static_assert(t_dims >= 2,
"Unexpected Number of Dimensions. Vector Size Required: >= 2");
248 for (
uint01 dim = 1; dim < t_dims; ++dim)
249 m_values[dim / 8](dim % 8, vector[dim - 1]);
265 static_assert(t_dims >= 2,
"Unexpected Number of Dimensions. Vector Size Required: of at least 1");
268 for (
uint01 dim =
Z; dim < t_dims; ++dim)
285 template<u
int01 t_new_dim,
class t_new_type>
291 for (; dim < min; dim++)
293 for (; dim < t_new_dim; dim++)
294 vec[dim] = extra_fill_value;
310 constexpr operator bool()
const
312 static_assert(t_dims == 1,
"Cannot auto-convert from vector to scaler unless dimension of vector is 1.");
333 lib_assert(dimension_index < t_dims,
"Dimension requested Exceeded maximum vector dimension");
341 lib_assert(dimension_index < t_dims,
"Dimension requested Exceeded maximum vector dimension");
342 return m_values[dimension_index / 8][dimension_index % 8];
361 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
382 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
389 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
396 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
404 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
412 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
439 constexpr static bool Type() {
return bool(); }
443 return (t_dims / 8) + (t_dims % 8 == 0 ? 0 : 1);
#define lib_assert(expression, message)
Asserts some logic in the code. Disabled in non debug mode by default. Can be re-enabled in release u...
Definition LibAssert.h:68
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:62
A convenience class used with Buffers or Vectors of bools for referencing or acting on a.
Definition BitReference.hpp:42
constexpr Vector(const bool &value)
Definition BoolVector.hpp:87
constexpr Vector(const bool &prefix, const Vector< t_dims - 1, bool > &vector)
Definition BoolVector.hpp:244
constexpr Vector< t_dims, bool > operator|(const Vector< t_dims, bool > &vector) const
Definition BoolVector.hpp:409
constexpr Vector< t_new_dim, t_new_type > as(t_new_type extra_fill_value=0) const
Definition BoolVector.hpp:286
constexpr Vector(const Vector< t_dims, t_vec_type > &vector)
Definition BoolVector.hpp:70
constexpr void operator()(const uint01 dim, bool value)
Definition BoolVector.hpp:108
static constexpr uint04 ByteCount()
Definition BoolVector.hpp:441
constexpr Vector()=default
static constexpr bool Type()
Definition BoolVector.hpp:439
Vector(std::initializer_list< t_type > active_list)
Definition BoolVector.hpp:102
constexpr Vector(const Vector< getMax(t_dims - 2, 0), bool > &vector, const bool &suffix_a, const bool &suffix_b)
Definition BoolVector.hpp:224
constexpr Vector(const bool &x, const bool &y, const bool &z)
Definition BoolVector.hpp:145
constexpr Vector< t_dims, bool > & operator=(const bool &scaler)
Definition BoolVector.hpp:379
constexpr Vector< t_dims, bool > & operator=(const Vector< t_dims, bool > &vector)
Definition BoolVector.hpp:359
constexpr Vector< t_dims, bool > & operator&=(const Vector< t_dims, bool > &vector)
Definition BoolVector.hpp:387
Vector(std::initializer_list< bool > active_list)
Definition BoolVector.hpp:94
constexpr Vector(const Vector< t_dims - 1, bool > &vector, const bool &suffix)
Definition BoolVector.hpp:203
constexpr Vector(const bool &prefix_a, const bool &prefix_b, const Vector< t_dims - 1, bool > &vector)
Definition BoolVector.hpp:263
constexpr Vector(const bool &x, const bool &y, const bool &z, const bool &w)
Definition BoolVector.hpp:167
static constexpr uint01 NumberOfDimensions()
Definition BoolVector.hpp:427
constexpr Vector< t_dims, bool > & operator|=(const Vector< t_dims, bool > &vector)
Definition BoolVector.hpp:394
constexpr Vector(const bool &x, const bool &y)
Definition BoolVector.hpp:125
constexpr bool operator[](const uint01 dimension_index) const
Definition BoolVector.hpp:339
constexpr BitReference operator[](uint01 dimension_index)
Definition BoolVector.hpp:331
constexpr Vector(const Vector< t_dims, bool > &vector)
Definition BoolVector.hpp:54
constexpr Vector< t_dims, bool > operator&(const Vector< t_dims, bool > &vector) const
Definition BoolVector.hpp:401
constexpr Vector(const bool(&vector)[t_dims])
Definition BoolVector.hpp:186
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
t_type m_values[t_dims]
Definition Vector.hpp:623
constexpr t_type getMax(const t_type &left, const t_type &right)
Finds the max of the given arguments using the > operator.
Definition BaseFunctions.hpp:101
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:78
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:94
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:379
@ Y
Definition BaseValues.hpp:165
@ X
Definition BaseValues.hpp:163
@ Z
Definition BaseValues.hpp:167
@ W
Definition BaseValues.hpp:169
constexpr t_type getMin(const t_type &left, const t_type &right)
Finds the minimum of the given arguments based on the < operator Author: Tyler Parke Date: 2017-11-05...
Definition BaseFunctions.hpp:56