SpectMorph
Public Member Functions | Static Public Member Functions | List of all members
SpectMorph::StdioIn Class Reference
Inheritance diagram for SpectMorph::StdioIn:
SpectMorph::GenericIn

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 ()
 
GenericInopen_subfile (size_t pos, size_t len)
 

Static Public Member Functions

static GenericInopen (const std::string &filename)
 
- Static Public Member Functions inherited from SpectMorph::GenericIn
static GenericInopen (const std::string &filename)
 

Member Function Documentation

int StdioIn::get_byte ( )
virtual

Reads one byte from the input stream.

Returns
the byte if successful, or EOF on end of file

Implements SpectMorph::GenericIn.

size_t StdioIn::get_pos ( )
virtual

Get input stream position.

Returns
the position in the input stream

Implements SpectMorph::GenericIn.

unsigned char * StdioIn::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.

Parameters
remainingis set to the number to the number of bytes that are available
Returns
pointer to the memory, or NULL if input is not memory mapped

Implements SpectMorph::GenericIn.

GenericIn * StdioIn::open_subfile ( size_t  pos,
size_t  len 
)
virtual

Open a new input stream that contains a part of the original file.

Parameters
posstart position in the input stream (offset like get_pos())
lenlength of the new subfile object
Returns
a GenericIn object with the subfile or NULL on error (open failed)

Implements SpectMorph::GenericIn.

int StdioIn::read ( void *  ptr,
size_t  size 
)
virtual

Reads a block of binary input data.

Parameters
ptrpointer to the buffer for the data read
sizenumber of bytes to be read
Returns
the number of bytes successfully read or 0; can be less than size on EOF/error

Implements SpectMorph::GenericIn.

bool StdioIn::skip ( size_t  size)
virtual

Skips a block of input data.

Parameters
sizenumber of bytes to be skipped
Returns
true if the number of bytes was available and could be skipped, false otherwise

Implements SpectMorph::GenericIn.


The documentation for this class was generated from the following files: