#include <mnt_bit_stream.h>
Public Member Functions | |
BitStream (int size) | |
Allocate a new BitStream of size bytes, and return a pointer to the BitStream. | |
BitStream (char *name) | |
Allocate and return a new BitStream whose contents are a memory map of the file fname. | |
~BitStream () | |
Deallocate the BitStream. | |
void | resize (int newsize) |
Reallocate the BitStream to size number of bytes. | |
int | bytes_left (int offset) |
Return the number of bytes of data in this BitStream, from the given offset postion off to the end. | |
void | share (BitStream *dest) |
Share the buffer of this BitStream with another BitStream dest. | |
Public Attributes | |
unsigned char * | buffer_ |
unsigned char * | endDataPtr_ |
unsigned char * | endBufPtr_ |
unsigned char | isVirtual_ |
unsigned char | isMMap_ |
int | size_ |
|
Allocate a new BitStream of size bytes, and return a pointer to the BitStream. If size=0, only the header, not the buffer, is allocated. This form is useful in conjunction with share().
|
|
Allocate and return a new BitStream whose contents are a memory map of the file fname. This BitStream can be used for reading only.
|
|
Deallocate the BitStream. If the BitStream is not a ``virtual'' BitStream (i.e., not pointing to someone else's buffer), then the memory are deallocated. If the BitStream is created through memory map, the memory is unmapped. |
|
Return the number of bytes of data in this BitStream, from the given offset postion off to the end. For example, if this BitStream has 80 bytes of valid date, bytes_left(60) will return 20. |
|
Reallocate the BitStream to size number of bytes. If the BitStream size is increased, the contents of the buffer are unchanged. If it is decreased, the data will be truncated. This should not be used on memory mapped buffer.
|
|
Share the buffer of this BitStream with another BitStream dest. That is, dest's buffer will be set to the buffer of this BitStream. Warning: dest's buffer is not free'd, so memory leaks can occur if not used carefully. A common way to use this function is in conjunction with "dest = new BitStream(0)"
|
|
pointer to first byte of memory buffer |
|
pointer to the next byte after the last byte in buffer |
|
pointer to the byte after last valid data byte in buffer |
|
1 iff this is a memory mapped stream |
|
1 iff this is a virtual BitStream |
|
size of buffer in bytes |