#include <bit/ibstream.h>
Inheritance diagram for bit::ibstream:
Public Member Functions | |
ibstream () | |
Create an ibstream with no attached stream source. | |
ibstream (std::istream &input) | |
Create an ibstream from a standard stream source. | |
virtual | ~ibstream () |
Performs any stream cleanup including output of any remaining bits. | |
size_t | read_octets (unsigned char *buf, size_t octets) |
MSB read of up to n octets into a memory buffer. | |
size_t | read_octets (unsigned char *buf, size_t bufsize, size_t octets) |
LSB read of up to n octets into a memory buffer of size m with zero padding. | |
size_t | read_bits (unsigned char *buf, size_t bits) |
MSB bit read of up to n bits into a memory buffer. | |
size_t | read_bits (unsigned char *buf, size_t bufsize, size_t bits) |
LSB bit read of up to n bits into a memory buffer of size m octets with zero padding. | |
template<typename T> | |
size_t | read_octets (T &t, size_t n=sizeof(T)) |
LSB read of up to n octets into variable t with zero padding. | |
size_t | read_octets (uint16_t &t, size_t n=2) |
size_t | read_octets (uint32_t &t, size_t n=4) |
size_t | read_octets (uint64_t &t, size_t n=8) |
size_t | read_octets (int16_t &t, size_t n=2) |
size_t | read_octets (int32_t &t, size_t n=4) |
size_t | read_octets (int64_t &t, size_t n=8) |
template<typename T> | |
size_t | read_bits (T &t, size_t n=sizeof(T)*8) |
LSB read of up to n bits into variable t with zero padding. | |
size_t | read_bits (uint16_t &t, size_t n=2) |
size_t | read_bits (uint32_t &t, size_t n=4) |
size_t | read_bits (uint64_t &t, size_t n=8) |
size_t | read_bits (int16_t &t, size_t n=2) |
size_t | read_bits (int32_t &t, size_t n=4) |
size_t | read_bits (int64_t &t, size_t n=8) |
void | attach_stream (std::istream &stream, bool clearbits=false) |
Set the associated input stream to stream. | |
void | detach_stream (bool clearbits=false) |
Remove the currently attached stream. | |
Protected Attributes | |
std::istream * | m_input |
A pointer to the associated input stream. | |
Friends | |
ibstream & | operator>> (ibstream &s, const bits &b) |
ibstream & | operator>> (ibstream &s, const octets &o) |
ibstream & | operator>> (ibstream &s, const whole &w) |
template<typename T> | |
ibstream & | operator>> (ibstream &s, T &t) |
|
Create an ibstream from a standard stream source. The stream source will be used to retrieve actual data from. |
|
Set the associated input stream to stream.
|
|
Remove the currently attached stream. Futher attempts to read will fail unless there are cached bits.
|
|
LSB read of up to n bits into variable t with zero padding. For architecture specific integer types the "right" thing is done to result in a usable value. The default is to read the entire variable off the stream. |
|
LSB bit read of up to n bits into a memory buffer of size m octets with zero padding. No adjustment is made for x86 integer or any other architectures or types.
|
|
MSB bit read of up to n bits into a memory buffer.
|
|
LSB read of up to n octets into variable t with zero padding. For architecture specific integer types the "right" thing is done to result in a usable value. The default is to read the entire variable off the stream. |
|
LSB read of up to n octets into a memory buffer of size m with zero padding. LSB, is not necessarily x86 little endian! A read of 1234 into a 6 octet buffer results in 001234. If n is greater than m, only m octets will be read.
|
|
MSB read of up to n octets into a memory buffer. This method will only result in whole octet reads. Thus, if there are 4 bits buffered, a request for 4 octets is made, and 2 octets are actually available only 2 octets will be read with 4 bits still buffered.
|
|
A pointer to the associated input stream. A reference is not used since it is anticipated that future versions will provide a constructor that does not require an associated stream. |