SCENE C++ API  2.1.0
Public Member Functions | List of all members
LSBinaryReader Class Referenceabstract

Abstract interface for reading binary data. More...

#include <lsbinaryreader.h>

+ Inheritance diagram for LSBinaryReader:

Public Member Functions

virtual size_t read (uint8_t *buffer, size_t bufferSize)=0
 Reads the number of requested bytes to the supplied memory buffer until the end of the stream is reached. More...
 
virtual size_t getSize () const =0
 Returns the exact overall size in bytes. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LSRefType
void ref () const
 Increments the internal reference counter. More...
 
void unref () const
 Decrements the internal reference counter. More...
 

Detailed Description

Abstract interface for reading binary data.

The exact overall size of the data stream must be known in advance. This is an interface intended for streaming and the implementations must track the internal position on the data stream. Subsequent calls to read() will consume the stream until the end was reached and will never return the same data. In some cases this interface will be implemented by the SCENE API to allow apps to read data provided by the API, for example when reading Generic Binary Objects. In other cases this interface needs to be implemented by an app to provide data for the API, for example when creating Generic Binary Objects.

Version
SCENE API version 2.0.26.

Member Function Documentation

◆ read()

virtual size_t read ( uint8_t *  buffer,
size_t  bufferSize 
)
pure virtual

Reads the number of requested bytes to the supplied memory buffer until the end of the stream is reached.

Parameters
bufferDestination buffer, needs to be preallocated.
bufferSizeMaximum number of bytes to write into the buffer.
Returns
Number of bytes written to buffer. At the end of the stream this could be less than bufferSize. If the data stream has reached the end, it will always return 0. If it returns 0 before all bytes of the stream are read, there was an error.
Version
SCENE API Version 2.0.26

◆ getSize()

virtual size_t getSize ( ) const
pure virtual

Returns the exact overall size in bytes.

May be slow depending on the implementation!

Version
SCENE API Version 2.0.26