obitstream Class Reference

Output bit stream. More...

Inheritance diagram for obitstream:

bitstream

List of all members.

Public Member Functions

 obitstream (FILE *file, int buffersize=DEFAULT_IOBUFFER_SIZE)
 Start obitstream using a FILE ptr to an open file.
 obitstream (const char *filename, int buffersize=DEFAULT_IOBUFFER_SIZE)
 Start outputbitstream by filename.
void writebits (uint32_t data, int nbits)
 Write data to the buffer.
void writestring (const char *str, bool write_trailing_null=false)
 Write 8-bit character strings to the buffer.
template<typename T >
void writeword (const T data)
 Write all the bits of a word.
void write_unary (unsigned int value)
virtual void print () const
 Print buffer contents.
virtual void close ()
 Close the output stream by flushing and closing the FILE *.
void windup ()
 Put the current word to the buffer with upper 0 bits as needed.
void flush (bool flush_trailing_bits)
 Flush the write buffer and reset for more data.


Detailed Description

Output bit stream.

Allows you to write data one bit at a time with buffered writing.


Member Function Documentation

void obitstream::flush ( bool  flush_trailing_bits  ) 

Flush the write buffer and reset for more data.

Do we need to flush even the partial words, as at EOF?

References bitstream::bitptr, bitstream::buf_used, bitstream::buffer_base, bitstream::buffptr, and bitstream::fp.

Referenced by close(), and writebits().

void obitstream::writebits ( uint32_t  data32,
int  nbits 
)

Write data to the buffer.

Parameters:
nbits Number of bits to use
data Data to write (in the lowest nbits bits).

References bitstream::beyondbuffer, bitstream::bitptr, bitstream::Bits_per_word, bitstream::buffptr, and flush().

Referenced by mexp_golomb_write(), windup(), writestring(), and writeword().

void obitstream::writestring ( const char *  str,
bool  write_trailing_null = false 
)

Write 8-bit character strings to the buffer.

Parameters:
str The string to write. 0-terminated
write_trailing_null Whether to put the 0 terminator to the output.

References writebits().

template<typename T >
void obitstream::writeword ( const T  data  )  [inline]

Write all the bits of a word.

Parameters:
data The word to write.

References writebits().


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

Generated on Mon Jun 15 14:45:04 2009 for Slim numerical data compression by  doxygen 1.5.7.1