SpectMorph
|
Generic Input Stream. More...
#include <smgenericin.hh>
Public Member Functions | |
virtual int | get_byte ()=0 |
virtual int | read (void *ptr, size_t size)=0 |
virtual bool | skip (size_t size)=0 |
virtual size_t | get_pos ()=0 |
virtual unsigned char * | mmap_mem (size_t &remaining)=0 |
virtual GenericIn * | open_subfile (size_t pos, size_t len)=0 |
Static Public Member Functions | |
static GenericIn * | open (const std::string &filename) |
Generic Input Stream.
This class is the abstract base class for different (binary) input streams like "from memory", "from file", ...
|
pure virtual |
Reads one byte from the input stream.
Implemented in SpectMorph::MMapIn, SpectMorph::StdioSubIn, and SpectMorph::StdioIn.
|
pure virtual |
Get input stream position.
Implemented in SpectMorph::MMapIn, SpectMorph::StdioSubIn, and SpectMorph::StdioIn.
|
pure 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 |
Implemented in SpectMorph::MMapIn, SpectMorph::StdioSubIn, and SpectMorph::StdioIn.
|
static |
Open a file for reading, using memory mapping if possible, stdio based reading otherwise.
|
pure 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 |
Implemented in SpectMorph::MMapIn, SpectMorph::StdioSubIn, and SpectMorph::StdioIn.
|
pure virtual |
Reads a block of binary input data.
ptr | pointer to the buffer for the data read |
size | number of bytes to be read |
Implemented in SpectMorph::MMapIn, SpectMorph::StdioSubIn, and SpectMorph::StdioIn.
|
pure virtual |
Skips a block of input data.
size | number of bytes to be skipped |
Implemented in SpectMorph::MMapIn, SpectMorph::StdioSubIn, and SpectMorph::StdioIn.