mcrl2::utilities::obitstream =============================================================================== Include file: .. code-block:: c++ #include "mcrl2/utilities/bitstream.h .. cpp:class:: 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. Private attributes ------------------------------------------------------------------------------- .. cpp:member:: unsigned int mcrl2::utilities::obitstream::bits_in_buffer how many bits in are used in the buffer. .. cpp:member:: std::uint8_t mcrl2::utilities::obitstream::integer_buffer Reserved space to store an n byte integer. .. cpp:member:: std::ostream & mcrl2::utilities::obitstream::stream .. cpp:member:: std::bitset< 128 > mcrl2::utilities::obitstream::write_buffer Buffer that is filled starting from bit 127 when writing. Public member functions ------------------------------------------------------------------------------- .. cpp:function:: obitstream(std::ostream &stream) Provides the stream on which the write function operate. .. cpp:function:: void 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:** * **value** Variable that contains the bits. * **num_of_bits** Number of bits to write to the output stream. .. cpp:function:: void write_integer(std::size_t value) Write the given value to the output stream. Uses most significant bit encoding. .. cpp:function:: void write_string(const std::string &string) Write the given string to the output stream. Encoded in bits using .. cpp:function:: ~obitstream() Private member functions ------------------------------------------------------------------------------- .. cpp:function:: void 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. .. cpp:function:: void write(const std::uint8_t *buffer, std::size_t size) Writes size bytes from the given buffer.