Signal/Geometry Processing Library (SPL)  1.1.24
SPL::InputBitStream Class Reference

Input bit stream class. More...

#include <bitStream.hpp>

Inheritance diagram for SPL::InputBitStream:
SPL::BitStream

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...
 

Detailed Description

Input bit stream class.

Member Typedef Documentation

typedef unsigned SPL::BitStream::IoState
inherited

The type used for the error state for a stream.

typedef long long SPL::BitStream::Offset
inherited

A signed integral type (used for differences).

typedef unsigned long long SPL::BitStream::Size
inherited

An unsigned integral type (used for sizes/counts).

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Member Data Documentation

const IoState SPL::BitStream::allIoBits = eofBit | limitBit | badBit
staticinherited

all error bits

const IoState SPL::BitStream::badBit = 4
staticinherited

I/O error.

const IoState SPL::BitStream::eofBit = 1
staticinherited

end of file (EOF) reached on input

const IoState SPL::BitStream::limitBit = 2
staticinherited

read/write limit exceeded


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