SpectMorph
Public Member Functions | Static Public Member Functions | List of all members
SpectMorph::StdioSubIn Class Reference
Inheritance diagram for SpectMorph::StdioSubIn:
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, size_t pos, size_t len)
 
- Static Public Member Functions inherited from SpectMorph::GenericIn
static GenericInopen (const std::string &filename)
 

Member Function Documentation

◆ get_byte()

int StdioSubIn::get_byte ( )
virtual

Reads one byte from the input stream.

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

Implements SpectMorph::GenericIn.

◆ get_pos()

size_t StdioSubIn::get_pos ( )
virtual

Get input stream position.

Returns
the position in the input stream

Implements SpectMorph::GenericIn.

◆ mmap_mem()

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

◆ open_subfile()

GenericIn * StdioSubIn::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.

◆ read()

int StdioSubIn::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.

◆ skip()

bool StdioSubIn::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: