|
template<typename... Ts, typename = std::enable_if_t<std::is_constructible_v<Policy, Ts...>>> |
| bit_reader (Ts &&... args) noexcept(std::is_nothrow_constructible_v< Policy, Ts... >) |
| Construct a reader with the parameters passed to the underlying policy.
|
|
| bit_reader (const bit_reader &)=delete |
|
| bit_reader (bit_reader &&other) noexcept |
|
bit_reader & | operator= (const bit_reader &)=delete |
|
bit_reader & | operator= (bit_reader &&rhs) noexcept |
|
const uint8_t * | get_buffer () const noexcept |
| Returns the buffer that this reader is currently serializing from.
|
|
uint32_t | get_num_bits_serialized () const noexcept |
| Returns the number of bits which have been read from the buffer.
|
|
uint32_t | get_num_bytes_serialized () const noexcept |
| Returns the number of bytes which have been read from the buffer.
|
|
bool | can_serialize_bits (uint32_t num_bits) const noexcept |
| Returns whether the num_bits be read from the buffer.
|
|
uint32_t | get_remaining_bits () const noexcept |
| Returns the number of bits which have not been read yet.
|
|
uint32_t | get_total_bits () const noexcept |
| Returns the size of the buffer, in bits.
|
|
bool | pad_to_size (uint32_t num_bytes) noexcept |
| Pads the buffer up to the given number of bytes.
|
|
bool | pad (uint32_t num_bytes) noexcept |
| Pads the buffer up with the given number of bytes.
|
|
bool | align () noexcept |
| Pads the buffer with up to 8 zeros, so that the next read is byte-aligned @notes Return false if the padded bits are not zeros.
|
|
bool | serialize_bits (uint32_t &value, uint32_t num_bits) noexcept |
| Reads the first num_bits bits of value from the buffer.
|
|
bool | serialize_bytes (uint8_t *bytes, uint32_t num_bits) noexcept |
| Reads the first num_bits bits of the given byte array, 32 bits at a time.
|
|
template<typename Trait , typename... Args, typename = utility::has_serialize_t<Trait, bit_reader, Args...>> |
bool | serialize (Args &&... args) noexcept(utility::is_serialize_noexcept_v< Trait, bit_reader, Args... >) |
| Reads from the buffer, using the given Trait .
|
|
template<typename... Args, typename Trait , typename = utility::has_deduce_serialize_t<Trait, bit_reader, Args...>> |
bool | serialize (Trait &&arg, Args &&... args) noexcept(utility::is_deduce_serialize_noexcept_v< Trait, bit_reader, Args... >) |
| Reads from the buffer, by trying to deduce the trait.
|
|
A stream for reading objects from a tightly packed buffer.
- Template Parameters
-
Policy | The underlying representation of the buffer |
template<typename Policy >
template<typename Trait , typename... Args, typename = utility::has_serialize_t<Trait, bit_reader, Args...>>
Reads from the buffer, using the given Trait
.
- Note
- The Trait type in this function must always be explicitly declared
- Template Parameters
-
Trait | A template specialization of serialize_trait<> |
...Args | The types of the arguments to pass to the serialize function |
- Parameters
-
...args | The arguments to pass to the serialize function |
- Returns
- Whether successful or not
template<typename Policy >
template<typename... Args, typename Trait , typename = utility::has_deduce_serialize_t<Trait, bit_reader, Args...>>
Reads from the buffer, by trying to deduce the trait.
- Note
- The Trait type in this function is always implicit and will be deduced from the first argument if possible. If the trait cannot be deduced it will not compile.
- Template Parameters
-
Trait | The type of the first argument, which will be used to deduce the trait specialization |
...Args | The types of the arguments to pass to the serialize function |
- Parameters
-
arg | The first argument to pass to the serialize function |
...args | The rest of the arguments to pass to the serialize function |
- Returns
- Whether successful or not