|
| bit_measure () noexcept |
| Default construct a writer pointing to a null buffer. More...
|
|
| bit_measure (uint32_t num_bytes) noexcept |
| Construct a writer pointing to the given byte array with num_bytes size. More...
|
|
| bit_measure (const bit_measure &)=delete |
|
| bit_measure (bit_measure &&other) noexcept |
|
bit_measure & | operator= (const bit_measure &)=delete |
|
bit_measure & | operator= (bit_measure &&rhs) noexcept |
|
uint8_t * | get_buffer () const noexcept |
| Returns the buffer that this writer is currently serializing into. More...
|
|
uint32_t | get_num_bits_serialized () const noexcept |
| Returns the number of bits which have been written to the buffer. More...
|
|
uint32_t | get_num_bytes_serialized () const noexcept |
| Returns the number of bytes which have been written to the buffer. More...
|
|
bool | can_serialize_bits (uint32_t num_bits) const noexcept |
| Returns whether the num_bits can fit in the buffer. More...
|
|
uint32_t | get_remaining_bits () const noexcept |
| Returns the number of bits which have not been written yet. More...
|
|
uint32_t | get_total_bits () const noexcept |
| Returns the size of the buffer, in bits. More...
|
|
bool | prepend_checksum () noexcept |
| Instructs the writer that you intend to use serialize_checksum() later on, and to reserve the first 32 bits. More...
|
|
uint32_t | serialize_checksum (uint32_t protocol_version) noexcept |
| Writes a checksum of the protocol_version and the rest of the buffer as the first 32 bits. More...
|
|
bool | pad_to_size (uint32_t num_bytes) noexcept |
| Pads the buffer up to the given number of bytes with zeros. More...
|
|
bool | pad (uint32_t num_bytes) noexcept |
| Pads the buffer up with the given number of bytes. More...
|
|
bool | align () noexcept |
| Pads the buffer with up to 8 zeros, so that the next write is byte-aligned. More...
|
|
bool | serialize_bits (uint32_t value, uint32_t num_bits) noexcept |
| Writes the first num_bits bits of value into the buffer. More...
|
|
bool | serialize_bytes (const uint8_t *bytes, uint32_t num_bits) noexcept |
| Writes the first num_bits bits of the given byte array, 32 bits at a time. More...
|
|
template<typename Trait , typename... Args, typename = utility::has_serialize_t<Trait, bit_measure, Args...>> |
bool | serialize (Args &&... args) noexcept(utility::is_serialize_noexcept_v< Trait, bit_measure, Args... >) |
| Writes to the buffer, using the given Trait . More...
|
|
template<typename... Args, typename Trait , typename = utility::has_deduce_serialize_t<Trait, bit_measure, Args...>> |
bool | serialize (Trait &&arg, Args &&... args) noexcept(utility::is_deduce_serialize_noexcept_v< Trait, bit_measure, Args... >) |
| Writes to the buffer, by trying to deduce the trait. More...
|
|
A stream for writing objects tightly into a buffer.
- Note
- Does not take ownership of the buffer
template<typename Trait , typename... Args, typename = utility::has_serialize_t<Trait, bit_measure, Args...>>
bool bitstream::bit_measure::serialize |
( |
Args &&... |
args | ) |
|
|
inlinenoexcept |
Writes to 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... Args, typename Trait , typename = utility::has_deduce_serialize_t<Trait, bit_measure, Args...>>
bool bitstream::bit_measure::serialize |
( |
Trait && |
arg, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinenoexcept |
Writes to 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