CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::HResourceStream Class Reference

A stream associated to a resource. More...

#include <CeresEngine/Resource/ResourceStream.hpp>

Public Member Functions

 HResourceStream ()=default
 
 HResourceStream (const HResourceStream &)=delete
 
HResourceStreamoperator= (const HResourceStream &)=delete
 
 HResourceStream (HResourceStream &&) noexcept=default
 
HResourceStreamoperator= (HResourceStream &&) noexcept=default
 
Async< ResourceInputStreamopenInputStream () const
 Opens a resource stream for reading.
 
Async< ResourceOutputStreamopenOutputStream ()
 Creates a new resource stream.
 
 operator bool () const noexcept
 Determines if the stream is valid or not.
 

Private Member Functions

 HResourceStream (const ResourceStreamDataPtr &streamData)
 
 HResourceStream (ResourceStreamData &streamData)
 

Private Attributes

ResourceStreamDataPtr mData = nullptr
 The stream data pointer. If null, the stream is null.
 

Friends

class Resource
 
class ResourceManager
 

Detailed Description

A stream associated to a resource.

The stream can be read or written to and can contain any type of bulk data the resource desires to store. For instance, meshes can store the the vertex and index data into a stream. Texture can store their raw bitmaps into a stream.

Streams are not loaded when the resource is first loaded and it will be streamed during runtime when needed. This allows to store a large amount of data without worrying about memory usage.

Constructor & Destructor Documentation

◆ HResourceStream() [1/5]

CeresEngine::HResourceStream::HResourceStream ( )
default

◆ HResourceStream() [2/5]

CeresEngine::HResourceStream::HResourceStream ( const HResourceStream )
delete

◆ HResourceStream() [3/5]

CeresEngine::HResourceStream::HResourceStream ( HResourceStream &&  )
defaultnoexcept

◆ HResourceStream() [4/5]

CeresEngine::HResourceStream::HResourceStream ( const ResourceStreamDataPtr streamData)
explicitprivate

◆ HResourceStream() [5/5]

CeresEngine::HResourceStream::HResourceStream ( ResourceStreamData streamData)
inlineexplicitprivate

Member Function Documentation

◆ openInputStream()

Async< ResourceInputStream > CeresEngine::HResourceStream::openInputStream ( ) const

Opens a resource stream for reading.

Note
It is unspecified in which task the async task is normalize on. It may or may not be normalize on a background thread.
The stream may or may not be seekable, you must check with the stream wether it's seekable or not before attempting to perform a seek.
If an output stream is currently open for this resource stream, reading may be delayed until the write operation is complete.
Returns
An async task that returns the opened input stream, ready for reading.

◆ openOutputStream()

Async< ResourceOutputStream > CeresEngine::HResourceStream::openOutputStream ( )

Creates a new resource stream.

If the stream with the given ID already exists, its contents will be replaced with the new data written to the stream.

Note
It is unspecified in which task the async task is normalize on. It may or may not be normalize on a background thread.
You must manually flush (or close) the stream to ensure that data is written to the underlying storage.
If an input stream is currently open for this stream, writing may be delayed until all read operations are complete.
Returns
An async task that will return the newly created resource stream.

◆ operator bool()

CeresEngine::HResourceStream::operator bool ( ) const
inlineexplicitnoexcept

Determines if the stream is valid or not.

◆ operator=() [1/2]

HResourceStream & CeresEngine::HResourceStream::operator= ( const HResourceStream )
delete

◆ operator=() [2/2]

HResourceStream & CeresEngine::HResourceStream::operator= ( HResourceStream &&  )
defaultnoexcept

Friends And Related Symbol Documentation

◆ Resource

◆ ResourceManager

Member Data Documentation

◆ mData

ResourceStreamDataPtr CeresEngine::HResourceStream::mData = nullptr
private

The stream data pointer. If null, the stream is null.


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