|
CCSDS 124.0-B-1 C++ 1.0.0
CCSDS 124.0-B-1 Lossless Compression
|
Fixed-length bit vector with compile-time size. More...
#include <bitvector.hpp>
Public Member Functions | |
| constexpr | BitVector () noexcept |
| Default constructor - initializes all bits to zero. | |
| constexpr std::size_t | length () const noexcept |
| Get the number of bits. | |
| constexpr std::size_t | num_words () const noexcept |
| Get the number of 32-bit words. | |
| void | zero () noexcept |
| Set all bits to zero. | |
| int | get_bit (std::size_t pos) const noexcept |
| Get bit value at position. | |
| int | get_bit_unchecked (std::size_t pos) const noexcept |
| Get bit value at position without bounds checking. | |
| void | set_bit (std::size_t pos, int value) noexcept |
| Set bit value at position. | |
| void | set_bit_unchecked (std::size_t pos, int value) noexcept |
| Set bit value at position without bounds checking. | |
| void | copy_from (const BitVector &src) noexcept |
| Copy from another BitVector. | |
| void | xor_of (const BitVector &a, const BitVector &b) noexcept |
| Compute XOR of two vectors. | |
| void | or_of (const BitVector &a, const BitVector &b) noexcept |
| Compute OR of two vectors. | |
| void | and_of (const BitVector &a, const BitVector &b) noexcept |
| Compute AND of two vectors. | |
| void | not_of (const BitVector &a) noexcept |
| Compute NOT of a vector. | |
| void | left_shift_of (const BitVector &a) noexcept |
| Compute left shift by 1 of a vector. | |
| void | reverse_of (const BitVector &a) noexcept |
| Compute bit reversal of a vector. | |
| void | xor_with (const BitVector &other) noexcept |
| XOR in-place with another vector. | |
| void | xor_with (const BitVector &a, const BitVector &b) noexcept |
| Compute XOR of two vectors (result = a ^ b). | |
| void | or_with (const BitVector &other) noexcept |
| OR in-place with another vector. | |
| void | or_with (const BitVector &a, const BitVector &b) noexcept |
| Compute OR of two vectors (result = a | b). | |
| void | or_in_place (const BitVector &other) noexcept |
| OR in-place with another vector (alias for or_with). | |
| void | and_with (const BitVector &other) noexcept |
| AND in-place with another vector. | |
| void | invert () noexcept |
| Invert all bits in-place. | |
| void | left_shift () noexcept |
| Left shift by 1 in-place. | |
| void | left_shift (const BitVector &src) noexcept |
| Compute left shift of another vector (result = src << 1). | |
| std::size_t | hamming_weight () const noexcept |
| Count number of set bits (Hamming weight). | |
| bool | operator== (const BitVector &other) const noexcept |
| Compare for equality. | |
| bool | operator!= (const BitVector &other) const noexcept |
| Compare for inequality. | |
| void | from_bytes (const std::uint8_t *bytes, std::size_t num_bytes) noexcept |
| Load from byte array (big-endian). | |
| void | to_bytes (std::uint8_t *bytes, std::size_t num_bytes) const noexcept |
| Store to byte array (big-endian). | |
| word_t * | data () noexcept |
| Get raw data pointer (for advanced use). | |
| const word_t * | data () const noexcept |
| Get raw data pointer (const version). | |
Static Public Attributes | |
| static constexpr std::size_t | NUM_WORDS = (N + 31) / 32 |
| Number of 32-bit words needed. | |
| static constexpr std::size_t | NUM_BYTES = (N + 7) / 8 |
| Number of bytes needed. | |
Fixed-length bit vector with compile-time size.
| N | Number of bits in the vector |
Uses static allocation only - no heap allocation. Suitable for embedded systems with -fno-exceptions -fno-rtti.
Definition at line 90 of file bitvector.hpp.
|
inlineconstexprnoexcept |
Default constructor - initializes all bits to zero.
Definition at line 101 of file bitvector.hpp.
|
inlinenoexcept |
Compute AND of two vectors.
| a | First operand |
| b | Second operand |
Definition at line 216 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
|
inlinenoexcept |
AND in-place with another vector.
| other | Operand |
Definition at line 323 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
|
inlinenoexcept |
Copy from another BitVector.
| src | Source vector |
Definition at line 185 of file bitvector.hpp.
|
inlinenoexcept |
Get raw data pointer (const version).
Definition at line 462 of file bitvector.hpp.
|
inlinenoexcept |
Get raw data pointer (for advanced use).
Definition at line 454 of file bitvector.hpp.
Referenced by ccsds124::Decompressor< N >::decompress_packet().
|
inlinenoexcept |
Load from byte array (big-endian).
| bytes | Source byte array |
| num_bytes | Number of bytes to load |
Definition at line 404 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_BYTES, and ccsds124::BitVector< N >::zero().
Referenced by ccsds124::compress().
|
inlinenoexcept |
Get bit value at position.
| pos | Bit position (0 = MSB, N-1 = LSB) |
Definition at line 132 of file bitvector.hpp.
References ccsds124::BitVector< N >::get_bit_unchecked().
Referenced by ccsds124::Decompressor< N >::decompress_packet().
|
inlinenoexcept |
Get bit value at position without bounds checking.
| pos | Bit position (0 = MSB, N-1 = LSB) |
Definition at line 145 of file bitvector.hpp.
Referenced by ccsds124::BitVector< N >::get_bit().
|
inlinenoexcept |
Count number of set bits (Hamming weight).
Definition at line 363 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
Referenced by ccsds124::Decompressor< N >::decompress_packet().
|
inlinenoexcept |
Invert all bits in-place.
Definition at line 332 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
|
inlinenoexcept |
Left shift by 1 in-place.
Definition at line 342 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
|
inlinenoexcept |
Compute left shift of another vector (result = src << 1).
| src | Source operand |
Definition at line 355 of file bitvector.hpp.
References ccsds124::BitVector< N >::left_shift_of().
|
inlinenoexcept |
Compute left shift by 1 of a vector.
| a | Operand |
Definition at line 237 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
Referenced by ccsds124::BitVector< N >::left_shift().
|
inlineconstexprnoexcept |
Get the number of bits.
Definition at line 107 of file bitvector.hpp.
|
inlinenoexcept |
Compute NOT of a vector.
| a | Operand |
Definition at line 226 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
|
inlineconstexprnoexcept |
Get the number of 32-bit words.
Definition at line 115 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
|
inlinenoexcept |
Compare for inequality.
| other | Other vector |
Definition at line 394 of file bitvector.hpp.
|
inlinenoexcept |
Compare for equality.
| other | Other vector |
Definition at line 385 of file bitvector.hpp.
|
inlinenoexcept |
OR in-place with another vector (alias for or_with).
| other | Operand |
Definition at line 315 of file bitvector.hpp.
References ccsds124::BitVector< N >::or_with().
|
inlinenoexcept |
Compute OR of two vectors.
| a | First operand |
| b | Second operand |
Definition at line 205 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
Referenced by ccsds124::Decompressor< N >::decompress_packet(), and ccsds124::BitVector< N >::or_with().
|
inlinenoexcept |
Compute OR of two vectors (result = a | b).
| a | First operand |
| b | Second operand |
Definition at line 307 of file bitvector.hpp.
References ccsds124::BitVector< N >::or_of().
|
inlinenoexcept |
OR in-place with another vector.
| other | Operand |
Definition at line 296 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
Referenced by ccsds124::BitVector< N >::or_in_place().
|
inlinenoexcept |
Compute bit reversal of a vector.
| a | Operand |
Definition at line 250 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
|
inlinenoexcept |
Set bit value at position.
| pos | Bit position (0 = MSB, N-1 = LSB) |
| value | Bit value (0 or 1) |
Definition at line 157 of file bitvector.hpp.
References ccsds124::BitVector< N >::set_bit_unchecked().
|
inlinenoexcept |
Set bit value at position without bounds checking.
| pos | Bit position (0 = MSB, N-1 = LSB) |
| value | Bit value (0 or 1) |
Definition at line 170 of file bitvector.hpp.
Referenced by ccsds124::BitVector< N >::set_bit().
|
inlinenoexcept |
Store to byte array (big-endian).
| bytes | Destination byte array |
| num_bytes | Number of bytes to store |
Definition at line 436 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_BYTES, and ccsds124::BitVector< N >::NUM_WORDS.
Referenced by ccsds124::decompress().
|
inlinenoexcept |
Compute XOR of two vectors.
| a | First operand |
| b | Second operand |
Definition at line 194 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
Referenced by ccsds124::BitVector< N >::xor_with().
|
inlinenoexcept |
Compute XOR of two vectors (result = a ^ b).
| a | First operand |
| b | Second operand |
Definition at line 288 of file bitvector.hpp.
References ccsds124::BitVector< N >::xor_of().
|
inlinenoexcept |
XOR in-place with another vector.
| other | Operand |
Definition at line 277 of file bitvector.hpp.
References ccsds124::BitVector< N >::NUM_WORDS.
|
inlinenoexcept |
Set all bits to zero.
Definition at line 122 of file bitvector.hpp.
Referenced by ccsds124::BitVector< N >::from_bytes().
|
staticconstexpr |
Number of bytes needed.
Definition at line 96 of file bitvector.hpp.
Referenced by ccsds124::BitVector< N >::from_bytes(), and ccsds124::BitVector< N >::to_bytes().
|
staticconstexpr |
Number of 32-bit words needed.
Definition at line 93 of file bitvector.hpp.
Referenced by ccsds124::BitVector< N >::and_of(), ccsds124::BitVector< N >::and_with(), ccsds124::BitVector< N >::hamming_weight(), ccsds124::BitVector< N >::invert(), ccsds124::BitVector< N >::left_shift(), ccsds124::BitVector< N >::left_shift_of(), ccsds124::BitVector< N >::not_of(), ccsds124::BitVector< N >::num_words(), ccsds124::BitVector< N >::or_of(), ccsds124::BitVector< N >::or_with(), ccsds124::BitVector< N >::reverse_of(), ccsds124::BitVector< N >::to_bytes(), ccsds124::BitVector< N >::xor_of(), and ccsds124::BitVector< N >::xor_with().