Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::IReader Class Referenceabstract

A reader supports binary block reads and string-oriented line reads that zero-terminate the result. More...

Inheritance diagram for mi::neuraylib::IReader:
mi::base::Interface_declare< 0xc03de0cf, 0x5a03, 0x4e8f, 0xa1, 0x59, 0x6c, 0xad, 0xd6, 0xf8, 0xae, 0x58, neuraylib::IReader_writer_base > mi::neuraylib::IReader_writer_base mi::base::Interface_declare< 0x919370c2, 0x2bb4, 0x40db, 0x81, 0xff, 0xd3, 0x1c, 0x52, 0x10, 0x54, 0x64 > mi::base::IInterface

Public Member Functions

virtual Sint64 read (char *buffer, Sint64 size)=0
 Reads a number of bytes from the stream. More...
 
virtual bool readline (char *buffer, Sint32 size)=0
 Reads a line from the stream. More...
 
Lookahead capability
virtual bool supports_lookahead () const =0
 Indicates whether lookahead is (in principle) supported. More...
 
virtual Sint64 lookahead (Sint64 size, const char **buffer) const =0
 Gives access to the lookahead data. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xc03de0cf, 0x5a03, 0x4e8f, 0xa1, 0x59, 0x6c, 0xad, 0xd6, 0xf8, 0xae, 0x58, neuraylib::IReader_writer_base >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
neuraylib::IReader_writer_base
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xc03de0cf, 0x5a03, 0x4e8f, 0xa1, 0x59, 0x6c, 0xad, 0xd6, 0xf8, 0xae, 0x58, neuraylib::IReader_writer_base >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

A reader supports binary block reads and string-oriented line reads that zero-terminate the result.

Member Function Documentation

virtual Sint64 mi::neuraylib::IReader::lookahead ( Sint64  size,
const char **  buffer 
) const
pure virtual

Gives access to the lookahead data.

The first size bytes of binary data are made available from the reader without changing its read position. The method sets the buffer pointer to point to the available lookahead data. It may be set to 0 if no lookahead is available, in which case the return value must be either 0 or -1.

Parameters
sizeThe size of the desired lookahead.
[out]bufferThe address of a pointer to the buffer with the lookahead data. The address might be NULL if no lookahead is available, in which case the return value is either 0 or -1. The buffer is owned by the reader and must not be changed or deleted.
Returns
The number of bytes made available in the buffer, which may larger than, equal to, or less than the requested size, or 0 if no lookahead is available, or -1 in case of errors.
virtual Sint64 mi::neuraylib::IReader::read ( char *  buffer,
Sint64  size 
)
pure virtual

Reads a number of bytes from the stream.

Parameters
bufferThe buffer to store the data in.
sizeThe number of bytes to be read.
Returns
The number of bytes read, which may be less than size, or -1 in case of errors.
virtual bool mi::neuraylib::IReader::readline ( char *  buffer,
Sint32  size 
)
pure virtual

Reads a line from the stream.

Reads at most size - 1 characters from the stream and stores them in buffer. Reading stops after a newline character or an end-of-file. If a newline is read, it is stored in the buffer. The buffer contents will be zero-terminated.

Parameters
bufferThe buffer to store the data in.
sizeThe maximum number of bytes to be read.
Returns
true in case of success, or false in case of errors.
virtual bool mi::neuraylib::IReader::supports_lookahead ( ) const
pure virtual

Indicates whether lookahead is (in principle) supported.

An actual lookahead request might still report zero bytes of available lookahead data.