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 (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. | |
| bitstream & | operator= (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. | |
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 *)
int bitstream::bitptr [protected] |
Pointer to the current bits.
Referenced by ibitstream::fill(), obitstream::flush(), get_bitptr(), ibitstream::get_bytes_used(), get_bytes_used(), ibitstream::print(), obitstream::print(), ibitstream::readbits(), setupstream(), ibitstream::windup(), obitstream::windup(), and obitstream::writebits().
1.6.1