Slim numerical data compression  1.0
Public Types | Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
bitstream Class Referenceabstract

Bit stream base class. More...

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 (FILE *file, int buffersize=DEFAULT_IOBUFFER_SIZE)
 Start bitstream using a FILE ptr to an open file.
 
 bitstream (const char *filename, int buffersize=DEFAULT_IOBUFFER_SIZE)
 Start bitstream by filename.
 
 bitstream (const bitstream &b)
 Copy constructor.
 
bitstreamoperator= (const bitstream &b)
 Assignment operator.
 
virtual ~bitstream ()
 Destructor deletes output buffer, closes file.
 
virtual void close ()
 Close the IO file.
 
bool is_open () const
 Is the IO file closed?
 
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
 

words ever I/O between buffer and disk.


 
FILE * fp
 The I/O stream.
 
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. More...
 

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

§ bitptr

int bitstream::bitptr
protected

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