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

Output bit stream class. More...

#include <bitStream.hpp>

Inheritance diagram for SPL::OutputBitStream:
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

 OutputBitStream ()
 Create a bit stream that is not initially bound to any (character) stream. More...
 
 OutputBitStream (std::ostream &out)
 Create a bit stream that sends its output to the specified (character) stream. More...
 
 ~OutputBitStream ()
 Destroy a bit stream. More...
 
std::ostream * getOutput () const
 Get the output (character) stream associated with the bit stream. More...
 
void setOutput (std::ostream *out)
 Set the output (character) stream associated with the bit stream. More...
 
void clearWriteCount ()
 Clear the count of the number of bits written to the bit stream. More...
 
Size getWriteCount () const
 Get the number of bits written to the bit stream. More...
 
void setWriteLimit (Offset writeLimit)
 Set the number of bits that may still be written to the bit stream. More...
 
Offset getWriteLimit () const
 Get the number of bits that may still be written to the underlying (character) stream. More...
 
int putBits (long data, int numBits)
 Output the specified number of bits to the bit stream. More...
 
void align ()
 Align the bit stream output position to the nearest byte boundary. More...
 
void flush ()
 Flush any pending output to the underlying (character) stream. More...
 
void dump (std::ostream &out) const
 Dump the internal state of the bit stream to the specified (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

Output 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::OutputBitStream::OutputBitStream ( )

Create a bit stream that is not initially bound to any (character) stream.

SPL::OutputBitStream::OutputBitStream ( std::ostream &  out)

Create a bit stream that sends its output to the specified (character) stream.

SPL::OutputBitStream::~OutputBitStream ( )

Destroy a bit stream.

Member Function Documentation

void SPL::OutputBitStream::align ( )

Align the bit stream output position to the nearest byte boundary.

void SPL::OutputBitStream::dump ( std::ostream &  out) const

Dump the internal state of the bit stream to the specified (character) stream for debugging purposes.

void SPL::OutputBitStream::flush ( )

Flush any pending output to the underlying (character) stream.

The bit stream is aligned to the nearest byte boundary and any pending output is flushed to the underlying (character) stream.

std::ostream * SPL::OutputBitStream::getOutput ( ) const

Get the output (character) stream associated with the bit stream.

int SPL::OutputBitStream::putBits ( long  data,
int  numBits 
)

Output the specified number of bits to the bit stream.

This function returns a nonnegative value upon success and a negative value if an error is encountered.

void SPL::OutputBitStream::setOutput ( std::ostream *  out)

Set the output (character) stream associated with the bit stream.

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: