Project
Loading...
Searching...
No Matches
BitStreamReader Class Reference

Utility class to provide bitstream access to an underlying resource. More...

#include <BitstreamReader.h>

Detailed Description

Utility class to provide bitstream access to an underlying resource.

Allows to access bits of variable length, supports integral types and also bitsets as target type. At the moment, the access is in direction MSB -> LSB.

BitstreamReader<uint8_t> reader(start, end);
while (reader.good() && not reader.eof()) {
  // get an 8 bit value from the stream, moves the position
  uint8_t ivalue;
  reader.get(ivalue);

  // get a 13 bit bitset without moving the position
  std::bitset<13> value;
  reader.peek(value, value.size());
  // e.g. use 7 bits of the data
  value >>= value.size() - 7;
  // move position by the specific number of bits
  reader.seek(7);
} 

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