|
Slim numerical data compression 1.0
|
Bit stream base class. More...
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. | |
Bit stream base class.
Allows you to R/W data one bit at a time with buffered reading/writing.
| anonymous enum |
Make *Dptr always point to same place as Bptr.
But where Bptr is a (Byte_t *), *Dptr is a (Word_t *)
|
pure virtual |
Implemented in ibitstream, and obitstream.
|
virtual |
Return the number of bytes used so far in this stream.
Reimplemented in ibitstream.
References bitptr, buf_used, buffer_base, and buffptr.
|
pure virtual |
Implemented in ibitstream, and obitstream.
|
pure virtual |
Print properties of stream (pure virt)
Implemented in ibitstream, and obitstream.
|
virtual |
Allocate a buffer and set up all pointers.
Reimplemented in ibitstream.
References beyondbuffer, bitptr, buf_used, buffer_base, buffptr, and bufsize.
Referenced by obitstream::obitstream(), obitstream::obitstream(), and ibitstream::setupstream().
|
pure virtual |
Implemented in ibitstream, and obitstream.
|
protected |
Referenced by ibitstream::fill(), obitstream::flush(), get_bytes_used(), ibitstream::get_bytes_used(), and setupstream().