33#include <NDEVR/BaseValues.h>
34#include <NDEVR/LibAssert.h>
35#include <NDEVR/Vector.h>
36#include <NDEVR/BitReference.h>
43 template<u
int01 t_dims>
63 template<
class t_vec_type>
66 for (
uint01 dim = 0; dim < t_dims; ++dim)
81 constexpr explicit Vector(
const bool& value)
83 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
81 constexpr explicit Vector(
const bool& value) {
…}
88 Vector(std::initializer_list<bool> active_list)
91 for (
auto val : active_list)
88 Vector(std::initializer_list<bool> active_list) {
…}
95 template<
class t_type>
96 Vector(std::initializer_list<t_type> active_list)
98 for (
auto i : active_list)
96 Vector(std::initializer_list<t_type> active_list) {
…}
119 constexpr Vector(
const bool& x,
const bool& y)
121 static_assert(t_dims == 2,
"Unexpected Number of Dimensions. Vector Size Required: 2");
119 constexpr Vector(
const bool& x,
const bool& y) {
…}
133 constexpr Vector(
const bool& x,
const bool& y,
const bool& z)
135 static_assert(t_dims == 3,
"Unexpected Number of Dimensions. Vector Size Required: 3");
133 constexpr Vector(
const bool& x,
const bool& y,
const bool& z) {
…}
149 constexpr Vector(
const bool& x,
const bool& y,
const bool& z,
const bool& w)
151 static_assert(t_dims == 4,
"Unexpected Number of Dimensions. Vector Size Required: 4");
149 constexpr Vector(
const bool& x,
const bool& y,
const bool& z,
const bool& w) {
…}
162 constexpr explicit Vector(
const bool(&vector)[t_dims])
164 for (
uint01 dim = 0; dim < t_dims; dim++)
165 m_values[dim / 8](dim % 8, vector[dim]);
162 constexpr explicit Vector(
const bool(&vector)[t_dims]) {
…}
175 static_assert(t_dims >= 2,
"Unexpected Number of Dimensions. Vector Size Required: >= 2");
176 for (
uint01 dim = 0; dim < t_dims - 1; ++dim)
177 m_values[dim / 8](dim % 8, vector[dim]);
178 m_values[(t_dims - 1) / 8]((t_dims - 1) % 8, suffix);
187 constexpr Vector(
const Vector<
getMax(t_dims - 2, 0),
bool>& vector,
const bool& suffix_a,
const bool& suffix_b)
189 static_assert(t_dims >= 3,
"Unexpected Number of Dimensions. Vector Size Required: >= 3");
190 for (
uint01 dim = 0; dim < t_dims - 2; ++dim)
191 m_values[dim / 8](dim % 8, vector[dim]);
192 m_values[(t_dims - 2) / 8]((t_dims - 2) % 8, suffix_a);
193 m_values[(t_dims - 1) / 8]((t_dims - 1) % 8, suffix_b);
187 constexpr Vector(
const Vector<
getMax(t_dims - 2, 0),
bool>& vector,
const bool& suffix_a,
const bool& suffix_b) {
…}
203 static_assert(t_dims >= 2,
"Unexpected Number of Dimensions. Vector Size Required: >= 2");
205 for (
uint01 dim = 1; dim < t_dims; ++dim)
206 m_values[dim / 8](dim % 8, vector[dim - 1]);
216 static_assert(t_dims >= 2,
"Unexpected Number of Dimensions. Vector Size Required: of at least 1");
219 for (
uint01 dim =
Z; dim < t_dims; ++dim)
229 template<u
int01 t_new_dim,
class t_new_type>
235 for (; dim < min; dim++)
237 for (; dim < t_new_dim; dim++)
238 vec[dim] = extra_fill_value;
249 constexpr operator bool()
const
251 static_assert(t_dims == 1,
"Cannot auto-convert from vector to scaler unless dimension of vector is 1.");
249 constexpr operator bool()
const {
…}
265 lib_assert(dimension_index < t_dims,
"Dimension requested Exceeded maximum vector dimension");
273 lib_assert(dimension_index < t_dims,
"Dimension requested Exceeded maximum vector dimension");
274 return m_values[dimension_index / 8][dimension_index % 8];
286 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
299 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
306 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
313 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
321 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
329 for (
uint01 dim = 0; dim < ByteCount(); ++dim)
346 constexpr static bool Type() {
return bool(); }
350 return (t_dims / 8) + (t_dims % 8 == 0 ? 0 : 1);
#define lib_assert(expression, message)
Definition LibAssert.h:61
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:55
A convenience class used with Buffers or Vectors of bools for referencing or acting on a single bit.
Definition BitReference.hpp:42
constexpr Vector(const bool &value)
Sets values in each dimension to the value in the passed in scaler.
Definition BoolVector.hpp:81
constexpr Vector(const bool &prefix, const Vector< t_dims - 1, bool > &vector)
Creates a vector where the prefix scaler is combined with the suffix vector.
Definition BoolVector.hpp:201
constexpr Vector< t_dims, bool > operator|(const Vector< t_dims, bool > &vector) const
Definition BoolVector.hpp:326
constexpr Vector< t_new_dim, t_new_type > as(t_new_type extra_fill_value=0) const
As the given extra fill value.
Definition BoolVector.hpp:230
constexpr Vector(const Vector< t_dims, t_vec_type > &vector)
Copy constructor.
Definition BoolVector.hpp:64
constexpr void operator()(const uint01 dim, bool value)
Definition BoolVector.hpp:102
static constexpr uint04 ByteCount()
Definition BoolVector.hpp:348
constexpr Vector()=default
static constexpr bool Type()
Returns the type of this class. Useful for using decltype to instantiate a member of this class in a ...
Definition BoolVector.hpp:346
Vector(std::initializer_list< t_type > active_list)
Definition BoolVector.hpp:96
constexpr Vector(const Vector< getMax(t_dims - 2, 0), bool > &vector, const bool &suffix_a, const bool &suffix_b)
Creates a vector where the prefix vector is combined with the suffix scalers.
Definition BoolVector.hpp:187
constexpr Vector(const bool &x, const bool &y, const bool &z)
Sets values in each dimension to the respective value in the passed in scaler. Note the Vector must b...
Definition BoolVector.hpp:133
constexpr Vector< t_dims, bool > & operator=(const bool &scaler)
Assignment operator. Setes all values to the value provided in scaler argument.
Definition BoolVector.hpp:296
constexpr Vector< t_dims, bool > & operator=(const Vector< t_dims, bool > &vector)
Assignment operator.
Definition BoolVector.hpp:284
constexpr Vector< t_dims, bool > & operator&=(const Vector< t_dims, bool > &vector)
Definition BoolVector.hpp:304
Vector(std::initializer_list< bool > active_list)
Definition BoolVector.hpp:88
constexpr Vector(const Vector< t_dims - 1, bool > &vector, const bool &suffix)
Vectors. Creates a vector where the prefix vector is combined with the suffix boolean.
Definition BoolVector.hpp:173
constexpr Vector(const bool &prefix_a, const bool &prefix_b, const Vector< t_dims - 1, bool > &vector)
Vectors. Creates a vector where the prefix scaler values are combined with the suffix vector.
Definition BoolVector.hpp:214
constexpr Vector(const bool &x, const bool &y, const bool &z, const bool &w)
Sets values in each dimension to the respective value in the passed in scaler. Note the Vector must b...
Definition BoolVector.hpp:149
static constexpr uint01 NumberOfDimensions()
Number of dimensions in this vector class.
Definition BoolVector.hpp:339
constexpr Vector< t_dims, bool > & operator|=(const Vector< t_dims, bool > &vector)
Definition BoolVector.hpp:311
constexpr Vector(const bool &x, const bool &y)
Sets values in each dimension to the respective value in the passed in scaler. Note the Vector must b...
Definition BoolVector.hpp:119
constexpr bool operator[](const uint01 dimension_index) const
Definition BoolVector.hpp:271
constexpr BitReference operator[](uint01 dimension_index)
Accesses the value of a certain dimension.
Definition BoolVector.hpp:263
constexpr Vector(const Vector< t_dims, bool > &vector)
Definition BoolVector.hpp:48
constexpr Vector< t_dims, bool > operator&(const Vector< t_dims, bool > &vector) const
Definition BoolVector.hpp:318
constexpr Vector(const bool(&vector)[t_dims])
Given a container of statically determined array, transforms it to a vector.
Definition BoolVector.hpp:162
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 The only requirement is that t_type have > ...
Definition BaseFunctions.hpp:94
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
@ Y
Definition BaseValues.hpp:169
@ X
Definition BaseValues.hpp:167
@ Z
Definition BaseValues.hpp:171
@ W
Definition BaseValues.hpp:173
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