CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::ResourceStreamData Class Referenceabstract

An object that allows storing side-band data for a resource. More...

#include <CeresEngine/Resource/ResourceStream.hpp>

Inheritance diagram for CeresEngine::ResourceStreamData:
CeresEngine::RefCounted< ResourceStreamData > CeresEngine::InMemoryResourceStreamData

Public Member Functions

 ResourceStreamData (ResourceData &resourceData, const ResourceStreamID &streamID, const ResourceStreamFlags &flags)
 Creates a new ResourceStreamData for the given resource and with the given stream ID.
 
virtual ~ResourceStreamData () noexcept=default
 Destroys the resource stream data.
 
virtual Async< ResourceInputStreamopenInputStream ()=0
 
virtual Async< ResourceOutputStreamopenOutputStream ()=0
 
bool isSeekable () const noexcept
 If defined, indicates that returned stream must be seekable.
 
bool isCompressible () const noexcept
 If defined, will indicate that the stream can be compressed.
 
- Public Member Functions inherited from CeresEngine::RefCounted< ResourceStreamData >
 RefCounted (Args &&... args)
 Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Relases the object by decrementing it's reference count by one.
 

Public Attributes

ResourceDataresourceData
 A handle to the resource that owns the stream.
 
const ResourceStreamID streamID
 The resource stream ID.
 
const ResourceStreamFlags flags
 A set of flags that determine the behavior of the resource stream.
 

Protected Member Functions

auto acquireReadLock ()
 Asynchronously acquires a read lock on the stream.
 
auto acquireWriteLock ()
 Asynchronously acquires a write lock on the stream.
 

Private Attributes

ResourceStreamLockMutex mMutex
 A mutex that provides synchronized access to the resource stream.
 

Detailed Description

An object that allows storing side-band data for a resource.

This data will not be loaded alongside the resource, but can be read at any time while the resource is loaded.

Constructor & Destructor Documentation

◆ ResourceStreamData()

CeresEngine::ResourceStreamData::ResourceStreamData ( ResourceData resourceData,
const ResourceStreamID streamID,
const ResourceStreamFlags flags 
)
explicit

Creates a new ResourceStreamData for the given resource and with the given stream ID.

Parameters
resourceThe resource to create a new stream for.
streamIDThe stream ID.

◆ ~ResourceStreamData()

virtual CeresEngine::ResourceStreamData::~ResourceStreamData ( )
virtualdefaultnoexcept

Destroys the resource stream data.

Member Function Documentation

◆ acquireReadLock()

auto CeresEngine::ResourceStreamData::acquireReadLock ( )
inlineprotected

Asynchronously acquires a read lock on the stream.

◆ acquireWriteLock()

auto CeresEngine::ResourceStreamData::acquireWriteLock ( )
inlineprotected

Asynchronously acquires a write lock on the stream.

◆ isCompressible()

bool CeresEngine::ResourceStreamData::isCompressible ( ) const
inlinenoexcept

If defined, will indicate that the stream can be compressed.

◆ isSeekable()

bool CeresEngine::ResourceStreamData::isSeekable ( ) const
inlinenoexcept

If defined, indicates that returned stream must be seekable.

This can severely limit what the implementations can do. For instance, it may disable compression on the data.

◆ openInputStream()

virtual Async< ResourceInputStream > CeresEngine::ResourceStreamData::openInputStream ( )
pure virtual

◆ openOutputStream()

virtual Async< ResourceOutputStream > CeresEngine::ResourceStreamData::openOutputStream ( )
pure virtual

Member Data Documentation

◆ flags

const ResourceStreamFlags CeresEngine::ResourceStreamData::flags

A set of flags that determine the behavior of the resource stream.

◆ mMutex

ResourceStreamLockMutex CeresEngine::ResourceStreamData::mMutex
private

A mutex that provides synchronized access to the resource stream.

◆ resourceData

ResourceData& CeresEngine::ResourceStreamData::resourceData

A handle to the resource that owns the stream.

◆ streamID

const ResourceStreamID CeresEngine::ResourceStreamData::streamID

The resource stream ID.

Uniquely identifies the stream on the owning resource.


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