Slim numerical data compression  1.0
Public Types | Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
bitstream Class Referenceabstract
Inheritance diagram for bitstream:
ibitstream obitstream

Public Types

enum  { DEFAULT_IOBUFFER_SIZE =1024*1024 }
 Make *Dptr always point to same place as Bptr. More...
 
enum  { MAX_BITSTREAM_BUFSIZE =16*1024*1024 }
 

Public Member Functions

 bitstream ()
 Dummy default constructor.
 
 bitstream (const char *filename, int buffersize=DEFAULT_IOBUFFER_SIZE)
 Start bitstream by filename.
 
virtual ~bitstream ()
 Destructor deletes output buffer, closes file.
 
virtual void close ()=0
 
virtual bool is_open () const =0
 
virtual void setupstream ()
 Allocate a buffer and set up all pointers.
 
virtual void windup ()=0
 
virtual int get_bytes_used ()
 Return the number of bytes used so far in this stream.
 
int get_bitptr ()
 Get the position of the bitptr.
 
virtual void print () const =0
 Print properties of stream (pure virt)
 

Protected Attributes

size_t bufsize
 Size of I/O buffer (bytes)
 
size_t buf_used
 
Byte_t * buffer_base
 Pointer to the buffer.
 
Byte_t * beyondbuffer
 Pointer just beyond buffer (convenience).
 
union {
   Byte_t *   Bptr
 Pointer to the current word (as Byte_t *).
 
   Word_t *   Dptr
 Pointer to the current word (as Word_t *).
 
buffptr
 Pointer to the current word.
 
int bitptr
 Pointer to the current bits.
 

Static Protected Attributes

static const int Bits_per_word = 8*sizeof(Word_t)
 Bits per buffer word.
 

Detailed Description

Bit stream base class. Allows you to R/W data one bit at a time with buffered reading/writing.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Make *Dptr always point to same place as Bptr.

But where Bptr is a (Byte_t *), *Dptr is a (Word_t *)

Member Data Documentation

◆ buf_used

size_t bitstream::buf_used
protected

words ever I/O between buffer and disk.

Referenced by ibitstream::fill(), obitstream::flush(), get_bytes_used(), ibitstream::get_bytes_used(), and setupstream().


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