Include file:
#include "mcrl2/utilities/bitstream.h
mcrl2::utilities::
obitstream
¶A bitstream provides per bit writing of data to any stream (including stdout).
Internally uses bitpacking and buffering for compact and efficient IO.
mcrl2::utilities::obitstream::
bits_in_buffer
¶how many bits in are used in the buffer.
mcrl2::utilities::obitstream::
integer_buffer
¶Reserved space to store an n byte integer.
mcrl2::utilities::obitstream::
stream
¶mcrl2::utilities::obitstream::
write_buffer
¶Buffer that is filled starting from bit 127 when writing.
obitstream
(std::ostream &stream)¶Provides the stream on which the write function operate.
write_bits
(std::size_t value, unsigned int num_of_bits)¶Write the num_of_bits least significant bits in descending order from value.
Parameters:
write_integer
(std::size_t value)¶Write the given value to the output stream.
Uses most significant bit encoding.
write_string
(const std::string &string)¶Write the given string to the output stream.
Encoded in bits using <length, string>
~obitstream
()¶flush
()¶Flush the remaining bits in the buffer to the output stream.
Note that this aligns it to the next byte, e.g. when bits_in_buffer is 6 then two zero bits are added redundantly.
write
(const std::uint8_t *buffer, std::size_t size)¶Writes size bytes from the given buffer.