32 #ifndef SPL_bitStream_hpp
33 #define SPL_bitStream_hpp
39 #include <SPL/config.hpp>
86 typedef unsigned long long Size;
312 void dump(std::ostream& out)
const;
356 readLimit_ = readLimit;
454 int putBits(
long data,
int numBits);
482 void dump(std::ostream& out)
const;
531 writeLimit_ = writeLimit;
void setIoStateBits(IoState state)
Set the specified bits in the I/O state of a bit stream.
Definition: bitStream.hpp:195
bool isOkay() const
Test if the bitstream in an okay (i.e., non-error) state.
Definition: bitStream.hpp:163
static const IoState eofBit
end of file (EOF) reached on input
Definition: bitStream.hpp:75
Size getWriteCount() const
Get the number of bits written to the bit stream.
Definition: bitStream.hpp:514
unsigned IoState
The type used for the error state for a stream.
Definition: bitStream.hpp:69
Definition: Arcball.hpp:48
bool isLimit() const
Test if the bitstream has encountered a read/write limit.
Definition: bitStream.hpp:173
IoState getIoState() const
Get the I/O state of a bit stream.
Definition: bitStream.hpp:184
bool isEof() const
Test if the bitstream has encountered end-of-file (EOF).
Definition: bitStream.hpp:168
void setWriteLimit(Offset writeLimit)
Set the number of bits that may still be written to the bit stream.
Definition: bitStream.hpp:529
Size getReadCount() const
Get the number of bits read from the bit stream so far.
Definition: bitStream.hpp:349
Output bit stream class.
Definition: bitStream.hpp:372
static const IoState allIoBits
all error bits
Definition: bitStream.hpp:81
void flush()
Flush any pending output to the underlying (character) stream.
Definition: bitStream.cpp:249
OutputBitStream()
Create a bit stream that is not initially bound to any (character) stream.
Definition: bitStream.cpp:158
~OutputBitStream()
Destroy a bit stream.
Definition: bitStream.cpp:172
void clearIoStateBits(IoState state=allIoBits)
Clear the specified bits in the I/O state of a bit stream.
Definition: bitStream.hpp:189
void setOutput(std::ostream *out)
Set the output (character) stream associated with the bit stream.
Definition: bitStream.cpp:181
static const IoState limitBit
read/write limit exceeded
Definition: bitStream.hpp:77
void clearReadCount()
Set the read count to zero.
Definition: bitStream.hpp:344
void align()
Align the bit stream output position to the nearest byte boundary.
Definition: bitStream.cpp:256
A common base class for the input and output bit stream classes.
Definition: bitStream.hpp:61
void dump(std::ostream &out) const
Dump the internal state of the bit stream to the specified (character) stream for debugging purposes...
Definition: bitStream.cpp:266
void setReadLimit(Offset readLimit)
Specify the maximum allowable number of bits that may be read from the bit stream.
Definition: bitStream.hpp:354
void setIoState(IoState state)
Set the I/O state of a bit stream.
Definition: bitStream.hpp:178
int putBits(long data, int numBits)
Output the specified number of bits to the bit stream.
Definition: bitStream.cpp:197
void clearWriteCount()
Clear the count of the number of bits written to the bit stream.
Definition: bitStream.hpp:519
std::ostream * getOutput() const
Get the output (character) stream associated with the bit stream.
Definition: bitStream.cpp:188
Offset getWriteLimit() const
Get the number of bits that may still be written to the underlying (character) stream.
Definition: bitStream.hpp:524
unsigned long long Size
An unsigned integral type (used for sizes/counts).
Definition: bitStream.hpp:86
static const IoState badBit
I/O error.
Definition: bitStream.hpp:79
long long Offset
A signed integral type (used for differences).
Definition: bitStream.hpp:91
Offset getReadLimit() const
Get the number of bits that still may be read from the bit stream before the read limit is reached...
Definition: bitStream.hpp:359