2 #include "../utility/assert.h"
3 #include "../utility/meta.h"
4 #include "../utility/parameter.h"
6 #include "../stream/serialize_traits.h"
16 template<
typename Stream>
20 uint32_t unsigned_value = value;
22 return writer.serialize_bits(unsigned_value, 1U);
25 template<
typename Stream>
29 uint32_t unsigned_value;
31 BS_ASSERT(reader.serialize_bits(unsigned_value, 1U));
33 value = unsigned_value;
45 template<
typename Stream>
47 static serialize(Stream& writer,
const bool* values) noexcept
49 uint32_t unsigned_value;
50 for (
size_t i = 0; i < Size; i++)
52 unsigned_value = values[i];
53 BS_ASSERT(writer.serialize_bits(unsigned_value, 1U));
56 return writer.serialize_bits(unsigned_value, 1U);
59 template<
typename Stream>
61 static serialize(Stream& reader,
bool* values) noexcept
63 uint32_t unsigned_value;
64 for (
size_t i = 0; i < Size; i++)
66 BS_ASSERT(reader.serialize_bits(unsigned_value, 1U));
68 values[i] = unsigned_value;
#define BS_ASSERT(x)
Definition: assert.h:15
Definition: parameter.h:64
std::enable_if_t< T::writing, R > is_writing_t
Definition: meta.h:25
std::enable_if_t< T::reading, R > is_reading_t
Definition: meta.h:28
Definition: bounded_range.h:28
std::conditional_t<(sizeof(T)<=16 &&std::is_trivially_copy_constructible_v< T >), std::add_const_t< T >, std::add_lvalue_reference_t< std::add_const_t< T > >> in
Passes by const or const reference depending on size.
Definition: parameter.h:94
static utility::is_writing_t< Stream > serialize(Stream &writer, in< bool > value) noexcept
Definition: bool_trait.h:18
static utility::is_reading_t< Stream > serialize(Stream &reader, out< bool > value) noexcept
Definition: bool_trait.h:27
static utility::is_reading_t< Stream > serialize(Stream &reader, bool *values) noexcept
Definition: bool_trait.h:61
static utility::is_writing_t< Stream > serialize(Stream &writer, const bool *values) noexcept
Definition: bool_trait.h:47
A class for specializing trait serialization functions.
Definition: serialize_traits.h:11