Faro Engine 0.0.0.b519570 (main)
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Faro::DataStream Class Referenceabstract

Interface that reads and writes data to and from a stream. More...

#include <Stream.hpp>

Inheritance diagram for Faro::DataStream:
Faro::IObject Faro::DataStreamCopy Faro::FileStream

Public Member Functions

virtual uint32 Read (void *destination, uint16 elementSize, uint32 elementCount)=0
 Read data from the stream.
 
virtual uint32 Write (void *source, uint16 elementSize, uint32 elementCount)=0
 Write data to the stream.
 
virtual uint32 Size ()=0
 Get the byte-size of this stream.
 
virtual uint32 Tell ()=0
 Get the current position of the stream.
 
virtual void Seek (EStreamSeekOrigin origin, int32 offset)=0
 Move the position relative to the specified origin.
 
template<typename T >
uint32 Read (T *destination, uint32 elementCount)
 Read data from the stream.
 
template<typename T >
Read ()
 Read en element from the stream.
 
template<typename T >
Array< TReadToArray ()
 Read the data to an array of elements.
 
String ReadToString ()
 Read the data to a stream.
 
template<typename T >
uint32 Write (T *source, uint32 elementCount)
 Write data to the stream.
 
template<typename T >
void Write (T value)
 Write an element to the stream.
 
void Close ()
 Close the stream. This also releases it from memory.
 
DataStreamCopyOpenCopy ()
 
virtual void Init ()
 Run the initialization logic of this object. Should be overriden by deriving classes.
 

Protected Member Functions

void Destroy () override
 Run the destruction logic of this class. This also frees its memory.
 
void AddCopy (DataStream *otherStream)
 
void RemoveCopy (DataStream *otherStream)
 

Protected Attributes

uint32 copies = 0
 

Detailed Description

Interface that reads and writes data to and from a stream.

Member Function Documentation

◆ AddCopy()

void Faro::DataStream::AddCopy ( DataStream otherStream)
protected

◆ Close()

void Faro::DataStream::Close ( )

Close the stream. This also releases it from memory.

◆ Destroy()

void Faro::DataStream::Destroy ( )
overrideprotectedvirtual

Run the destruction logic of this class. This also frees its memory.

Warning
When overriding, the super call must be performed last

Reimplemented from Faro::IObject.

Reimplemented in Faro::DataStreamCopy.

◆ Init()

void Faro::IObject::Init ( )
virtualinherited

◆ OpenCopy()

DataStreamCopy * Faro::DataStream::OpenCopy ( )

◆ Read() [1/3]

template<typename T >
T Faro::DataStream::Read ( )
inline

Read en element from the stream.

Template Parameters
TElement type to read
Returns
T Element that was read

◆ Read() [2/3]

template<typename T >
uint32 Faro::DataStream::Read ( T *  destination,
uint32  elementCount 
)
inline

Read data from the stream.

Template Parameters
TElement type to read
Parameters
destinationDestination memory. This must be a valid pointer.
elementCountAmount of elements to read
Returns
uint32 Amount of elements read

◆ Read() [3/3]

virtual uint32 Faro::DataStream::Read ( void *  destination,
uint16  elementSize,
uint32  elementCount 
)
pure virtual

Read data from the stream.

Parameters
destinationDestination memory. This must be a valid pointer.
elementSizeSize of a single element
elementCountAmount of elements to read
Returns
uint32 Amount of bytes read

Implemented in Faro::DataStreamCopy.

◆ ReadToArray()

template<typename T >
Array< T > Faro::DataStream::ReadToArray ( )
inline

Read the data to an array of elements.

Template Parameters
TElement type to read
Returns
Array<T> Array of elements read from the stream

◆ ReadToString()

String Faro::DataStream::ReadToString ( )

Read the data to a stream.

Returns
String String read from the stream

◆ RemoveCopy()

void Faro::DataStream::RemoveCopy ( DataStream otherStream)
protected

◆ Seek()

virtual void Faro::DataStream::Seek ( EStreamSeekOrigin  origin,
int32  offset 
)
pure virtual

Move the position relative to the specified origin.

Parameters
originStart point of the seeking operation
offsetAmount of bytes to seek relative to the origin

Implemented in Faro::DataStreamCopy.

◆ Size()

virtual uint32 Faro::DataStream::Size ( )
pure virtual

Get the byte-size of this stream.

Returns
uint32 Amount of bytes in this stream

Implemented in Faro::DataStreamCopy.

◆ Tell()

virtual uint32 Faro::DataStream::Tell ( )
pure virtual

Get the current position of the stream.

Returns
uint32 Current position

Implemented in Faro::DataStreamCopy.

◆ Write() [1/3]

template<typename T >
uint32 Faro::DataStream::Write ( T source,
uint32  elementCount 
)
inline

Write data to the stream.

Template Parameters
TElement type to write
Parameters
sourceSource memory
elementCountAmount of elements to write
Returns
uint32 Amount of elements written

◆ Write() [2/3]

template<typename T >
void Faro::DataStream::Write ( T  value)
inline

Write an element to the stream.

Template Parameters
TElement type to write
Parameters
valueElement to write

◆ Write() [3/3]

virtual uint32 Faro::DataStream::Write ( void source,
uint16  elementSize,
uint32  elementCount 
)
pure virtual

Write data to the stream.

Parameters
sourceSource memory
elementSizeSize of a single element
elementCountAmount of elements to write
Returns
uint32 Amount of bytes written

Implemented in Faro::DataStreamCopy.

Member Data Documentation

◆ copies

uint32 Faro::DataStream::copies = 0
protected

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