Input bit stream class. More...
#include <bitStream.hpp>
Public Types | |
| typedef unsigned | IoState |
| The type used for the error state for a stream. More... | |
| typedef unsigned long long | Size |
| An unsigned integral type (used for sizes/counts). More... | |
| typedef long long | Offset |
| A signed integral type (used for differences). More... | |
Public Member Functions | |
| InputBitStream () | |
| Create a bit stream that is not initially bound to any (character) stream. More... | |
| InputBitStream (std::istream &in) | |
| Create a bit stream that reads data from the specified (character) stream. More... | |
| ~InputBitStream () | |
| Destroy a bit stream. More... | |
| std::istream * | getInput () const |
| Get the (character) stream from which data is read. More... | |
| void | setInput (std::istream *in) |
| Set the (character) stream from which data is read. More... | |
| Offset | getReadLimit () const |
| Get the number of bits that still may be read from the bit stream before the read limit is reached. More... | |
| void | setReadLimit (Offset readLimit) |
| Specify the maximum allowable number of bits that may be read from the bit stream. More... | |
| Size | getReadCount () const |
| Get the number of bits read from the bit stream so far. More... | |
| void | clearReadCount () |
| Set the read count to zero. More... | |
| long | getBits (int numBits) |
| Read the specified number of bits from the bit stream. More... | |
| void | align () |
| Force byte-alignment of the bit stream. More... | |
| void | dump (std::ostream &out) const |
| Dump the internal state of the bit stream to a (character) stream for debugging purposes. More... | |
| bool | isOkay () const |
| Test if the bitstream in an okay (i.e., non-error) state. More... | |
| bool | isEof () const |
| Test if the bitstream has encountered end-of-file (EOF). More... | |
| bool | isLimit () const |
| Test if the bitstream has encountered a read/write limit. More... | |
| IoState | getIoState () const |
| Get the I/O state of a bit stream. More... | |
| void | setIoState (IoState state) |
| Set the I/O state of a bit stream. More... | |
| void | setIoStateBits (IoState state) |
| Set the specified bits in the I/O state of a bit stream. More... | |
| void | clearIoStateBits (IoState state=allIoBits) |
| Clear the specified bits in the I/O state of a bit stream. More... | |
Static Public Attributes | |
| static const IoState | eofBit = 1 |
| end of file (EOF) reached on input More... | |
| static const IoState | limitBit = 2 |
| read/write limit exceeded More... | |
| static const IoState | badBit = 4 |
| I/O error. More... | |
| static const IoState | allIoBits = eofBit | limitBit | badBit |
| all error bits More... | |
Input bit stream class.
|
inherited |
The type used for the error state for a stream.
|
inherited |
A signed integral type (used for differences).
|
inherited |
An unsigned integral type (used for sizes/counts).
| SPL::InputBitStream::InputBitStream | ( | ) |
Create a bit stream that is not initially bound to any (character) stream.
| SPL::InputBitStream::InputBitStream | ( | std::istream & | in | ) |
Create a bit stream that reads data from the specified (character) stream.
| SPL::InputBitStream::~InputBitStream | ( | ) |
Destroy a bit stream.
| void SPL::InputBitStream::align | ( | ) |
Force byte-alignment of the bit stream.
The bit stream position is moved forward to the nearest byte (i.e., multiple of 8 bits) boundary.
| void SPL::InputBitStream::dump | ( | std::ostream & | out | ) | const |
Dump the internal state of the bit stream to a (character) stream for debugging purposes.
| long SPL::InputBitStream::getBits | ( | int | numBits | ) |
Read the specified number of bits from the bit stream.
The bits that are read from the bit stream are assigned to the returned integer value in most-significant to least-significant order.
| std::istream* SPL::InputBitStream::getInput | ( | ) | const |
Get the (character) stream from which data is read.
| void SPL::InputBitStream::setInput | ( | std::istream * | in | ) |
Set the (character) stream from which data is read.
|
staticinherited |
I/O error.
|
staticinherited |
end of file (EOF) reached on input
|
staticinherited |
read/write limit exceeded