|
CCSDS 124.0-B-1 C++ 1.0.0
CCSDS 124.0-B-1 Lossless Compression
|
Variable-length bit buffer with static allocation. More...
#include <bitbuffer.hpp>
Public Member Functions | |
| constexpr | BitBuffer () noexcept |
| Default constructor - initializes to empty state. | |
| void | clear () noexcept |
| Clear buffer to empty state. | |
| std::size_t | size () const noexcept |
| Get number of bits in buffer. | |
| Error | append_bit (int bit) noexcept |
| Append a single bit. | |
| Error | append_bits (const std::uint8_t *bytes, std::size_t num_bits) noexcept |
| Append multiple bits from byte array. | |
| Error | append_value (std::uint32_t value, std::size_t num_bits) noexcept |
| Append multiple bits from a value. | |
| template<std::size_t N> | |
| Error | append_bitvector (const BitVector< N > &bv, std::size_t num_bits) noexcept |
| Append bits from a BitVector. | |
| template<std::size_t N> | |
| Error | append_bitvector (const BitVector< N > &bv) noexcept |
| Append all bits from a BitVector. | |
| std::size_t | to_bytes (std::uint8_t *bytes, std::size_t max_bytes) const noexcept |
| Convert bit buffer to byte array. | |
Variable-length bit buffer with static allocation.
| MaxBytes | Maximum output size in bytes |
Uses static allocation only - no heap allocation. Suitable for embedded systems with -fno-exceptions -fno-rtti.
Definition at line 51 of file bitbuffer.hpp.
|
inlineconstexprnoexcept |
Default constructor - initializes to empty state.
Definition at line 56 of file bitbuffer.hpp.
|
inlinenoexcept |
Append a single bit.
| bit | Bit value (0 or 1) |
Definition at line 82 of file bitbuffer.hpp.
References ccsds124::Ok, and ccsds124::Overflow.
Referenced by ccsds124::Compressor< N, MaxOutputBytes >::compress_packet().
|
inlinenoexcept |
Append multiple bits from byte array.
| bytes | Source bytes (MSB first within each byte) |
| num_bits | Number of bits to append |
Definition at line 108 of file bitbuffer.hpp.
References ccsds124::BitBuffer< MaxBytes >::append_value(), ccsds124::Ok, and ccsds124::Overflow.
|
inlinenoexcept |
Append all bits from a BitVector.
| N | BitVector length |
| bv | Source bit vector |
Definition at line 238 of file bitbuffer.hpp.
References ccsds124::BitBuffer< MaxBytes >::append_bitvector().
|
inlinenoexcept |
Append bits from a BitVector.
| N | BitVector length |
| bv | Source bit vector |
| num_bits | Number of bits to append |
Definition at line 177 of file bitbuffer.hpp.
References ccsds124::BitBuffer< MaxBytes >::append_value(), ccsds124::Ok, and ccsds124::Overflow.
Referenced by ccsds124::BitBuffer< MaxBytes >::append_bitvector(), and ccsds124::Compressor< N, MaxOutputBytes >::compress_packet().
|
inlinenoexcept |
Append multiple bits from a value.
| value | Value containing bits (right-justified) |
| num_bits | Number of bits to append (1-24) |
Definition at line 144 of file bitbuffer.hpp.
References ccsds124::InvalidArg, ccsds124::Ok, and ccsds124::Overflow.
Referenced by ccsds124::BitBuffer< MaxBytes >::append_bits(), ccsds124::BitBuffer< MaxBytes >::append_bitvector(), and ccsds124::Compressor< N, MaxOutputBytes >::compress_packet().
|
inlinenoexcept |
Clear buffer to empty state.
Definition at line 61 of file bitbuffer.hpp.
Referenced by ccsds124::Compressor< N, MaxOutputBytes >::compress_packet().
|
inlinenoexcept |
Get number of bits in buffer.
Definition at line 72 of file bitbuffer.hpp.
|
inlinenoexcept |
Convert bit buffer to byte array.
Pads final byte with zeros if not byte-aligned.
| bytes | Destination byte array |
| max_bytes | Maximum bytes to write |
Definition at line 251 of file bitbuffer.hpp.
Referenced by ccsds124::compress().