ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::PackedBitWriter Class Reference

a growing sequence of bits, packed in bytes, the first bit in the most significant bit of the first byte More...

#include <ADS/compression/PackedBits.h>

Public member functions

void put (bool b)
 appends the bit \( b \)
void put (std::uint64_t v, int k)
 appends the \( k \) low bits of \( v \), the most significant first
void put (const std::string &s)
 appends the bits of \( s \), a string of '0' and '1'
std::size_t size (void) const
 the number of bits written
const std::vector< std::uint8_t > & bytes (void) const
 the bytes, the last one padded with zeros

Detailed description

a growing sequence of bits, packed in bytes, the first bit in the most significant bit of the first byte

Member function documentation

◆ bytes()

const std::vector< std::uint8_t > & ADS::PackedBitWriter::bytes ( void ) const
inlinenodiscard

the bytes, the last one padded with zeros

◆ put() [1/3]

void ADS::PackedBitWriter::put ( bool b)

appends the bit \( b \)

◆ put() [2/3]

void ADS::PackedBitWriter::put ( const std::string & s)

appends the bits of \( s \), a string of '0' and '1'

Precondition
\( s \) has only '0' and '1', checked before any bit is written

◆ put() [3/3]

void ADS::PackedBitWriter::put ( std::uint64_t v,
int k )

appends the \( k \) low bits of \( v \), the most significant first

Precondition
\( 0 \le k \le 64 \), \( v < 2^k \)

◆ size()

std::size_t ADS::PackedBitWriter::size ( void ) const
inlinenodiscard

the number of bits written


The documentation for this class was generated from the following file: