SpectMorph
|
Public Member Functions | |
int | get_byte () |
int | read (void *ptr, size_t size) |
bool | skip (size_t size) |
unsigned char * | mmap_mem (size_t &remaining) |
size_t | get_pos () |
GenericIn * | open_subfile (size_t pos, size_t len) |
Static Public Member Functions | |
static GenericIn * | open (const std::string &filename) |
static GenericIn * | open_mem (unsigned char *mem_start, unsigned char *mem_end) |
int MMapIn::get_byte | ( | ) | [virtual] |
Reads one byte from the input stream.
Implements SpectMorph::GenericIn.
size_t MMapIn::get_pos | ( | ) | [virtual] |
Get input stream position.
Implements SpectMorph::GenericIn.
unsigned char * MMapIn::mmap_mem | ( | size_t & | remaining | ) | [virtual] |
Try to access the memory of a memory-based input stream. This will fail for streams that are not memory mapped. This function is useful because it allows writing faster code than with read(); however, an alternative way of reading the data must be used if this function fails.
remaining | is set to the number to the number of bytes that are available |
Implements SpectMorph::GenericIn.
GenericIn * MMapIn::open | ( | const std::string & | filename | ) | [static] |
Open a file for reading, using memory mapping if possible, stdio based reading otherwise.
Reimplemented from SpectMorph::GenericIn.
GenericIn * MMapIn::open_subfile | ( | size_t | pos, |
size_t | len | ||
) | [virtual] |
Open a new input stream that contains a part of the original file.
pos | start position in the input stream (offset like get_pos()) |
len | length of the new subfile object |
Implements SpectMorph::GenericIn.
int MMapIn::read | ( | void * | ptr, |
size_t | size | ||
) | [virtual] |
Reads a block of binary input data.
ptr | pointer to the buffer for the data read |
size | number of bytes to be read |
Implements SpectMorph::GenericIn.
bool MMapIn::skip | ( | size_t | size | ) | [virtual] |
Skips a block of input data.
size | number of bytes to be skipped |
Implements SpectMorph::GenericIn.