mCRL2
Loading...
Searching...
No Matches
mcrl2::utilities::ibitstream Class Reference

The counterpart of obitstream, guarantees that the same data is read as has been written when calling the read operators in the same sequence as the corresponding write operators. More...

#include <bitstream.h>

Public Member Functions

 ibitstream (std::istream &stream)
 Provides the stream on which the read function operate.
 
std::size_t read_bits (unsigned int num_of_bits)
 Reads an num_of_bits bits from the input stream and stores them in the least significant part (in descending order) of the return value.
 
const char * read_string ()
 
std::size_t read_integer ()
 

Private Member Functions

void read (std::size_t size, std::uint8_t *buffer)
 Read size bytes into the provided buffer.
 

Private Attributes

std::istream & stream
 
std::bitset< 128 > read_buffer = 0
 Buffer that is filled starting from bit 127 when reading.
 
unsigned int bits_in_buffer = 0
 how many bits in the buffer are used.
 
std::vector< char > m_text_buffer
 A temporary buffer to store char array strings.
 

Detailed Description

The counterpart of obitstream, guarantees that the same data is read as has been written when calling the read operators in the same sequence as the corresponding write operators.

Definition at line 71 of file bitstream.h.

Constructor & Destructor Documentation

◆ ibitstream()

ibitstream::ibitstream ( std::istream &  stream)

Provides the stream on which the read function operate.

Definition at line 163 of file bitstream.cpp.

Member Function Documentation

◆ read()

void ibitstream::read ( std::size_t  size,
std::uint8_t *  buffer 
)
private

Read size bytes into the provided buffer.

Definition at line 256 of file bitstream.cpp.

◆ read_bits()

std::size_t ibitstream::read_bits ( unsigned int  num_of_bits)

Reads an num_of_bits bits from the input stream and stores them in the least significant part (in descending order) of the return value.

Parameters
num_of_bitsNumber of bits to read from the input stream.

Definition at line 193 of file bitstream.cpp.

◆ read_integer()

std::size_t ibitstream::read_integer ( )
Returns
A natural number that was read from the binary stream encoded in most significant bit encoding.

Definition at line 227 of file bitstream.cpp.

◆ read_string()

const char * ibitstream::read_string ( )
Returns
A pointer to the read string.

Remains valid until the next call to read_string.

Definition at line 173 of file bitstream.cpp.

Member Data Documentation

◆ bits_in_buffer

unsigned int mcrl2::utilities::ibitstream::bits_in_buffer = 0
private

how many bits in the buffer are used.

Definition at line 97 of file bitstream.h.

◆ m_text_buffer

std::vector<char> mcrl2::utilities::ibitstream::m_text_buffer
private

A temporary buffer to store char array strings.

Definition at line 99 of file bitstream.h.

◆ read_buffer

std::bitset<128> mcrl2::utilities::ibitstream::read_buffer = 0
private

Buffer that is filled starting from bit 127 when reading.

Definition at line 95 of file bitstream.h.

◆ stream

std::istream& mcrl2::utilities::ibitstream::stream
private

Definition at line 92 of file bitstream.h.


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