|
CeresEngine 0.2.0
A game development framework
|
An object, provided by the resource manager, to view and alter data from the resource itself. More...
#include <CeresEngine/Resource/Resource.hpp>
Public Member Functions | |
| ResourceData (ResourceManager &resourceManager) noexcept | |
Creates a new ResourceData instance. | |
| virtual | ~ResourceData () noexcept=default |
ResourceData virtual destructor. | |
| virtual ResourceStreamData & | createStream (const ResourceStreamFlags &flags=ResourceStreamFlag::Default)=0 |
| Creates a new resource stream. | |
| virtual ResourceStreamDataPtr | getStream (const ResourceStreamID &streamID) const =0 |
| Gets a resource by it's stream ID. | |
| virtual Vector< ResourceStreamDataPtr > | getStreams () const =0 |
| Gets a list of streams that are owned by this resource. | |
| virtual void | destroyStream (ResourceStreamData &stream)=0 |
| Destroys a stream by ID. | |
Public Member Functions inherited from CeresEngine::RefCounted< ResourceData > | |
| 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 | |
| ResourceManager & | manager |
| The resource manager that owns the resource. | |
| const PackagePtr | package = nullptr |
| The package from which the resource was loaded from. | |
| const ResourceID | id = ResourceID::null |
| The resource UUID, if registered with a resource manager. | |
| const WeakResourceHandle< Resource > | handle = nullptr |
| A weak handle to the resource. | |
| const WeakResourceHandle< Resource > | parent = nullptr |
| A parent resource to which this resource is attached to. | |
| SPtr< ResourceMetadata > | metadata = nullptr |
| A pointer to the user-defined resource metadata. | |
Private Attributes | |
| Map< ResourceID, WeakResourceHandle< Resource > > | mSubResources |
| A map that enumerates the sub-resurces attached to this resource. | |
| Vector< HResource > | mUnsavedResources |
| A list of sub-resources that are pending a save. | |
An object, provided by the resource manager, to view and alter data from the resource itself.
|
inlineexplicitnoexcept |
Creates a new ResourceData instance.
| resourceManager | The resource manager instance that owns this resource data object. |
|
virtualdefaultnoexcept |
ResourceData virtual destructor.
|
pure virtual |
Creates a new resource stream.
| streamID | The ID of the stream to be created or replaced. |
Implemented in CeresEngine::MemoryResourceData.
|
pure virtual |
Destroys a stream by ID.
| streamID | The ID of the stream to be returned. |
Implemented in CeresEngine::MemoryResourceData.
|
pure virtual |
Gets a resource by it's stream ID.
| streamID | The ID of the stream to be fetched. |
Implemented in CeresEngine::MemoryResourceData.
|
pure virtual |
Gets a list of streams that are owned by this resource.
Implemented in CeresEngine::MemoryResourceData.
| const WeakResourceHandle<Resource> CeresEngine::ResourceData::handle = nullptr |
A weak handle to the resource.
Can be used to get a resource handle from the resource itself, thus extending it's own lifetime.
| const ResourceID CeresEngine::ResourceData::id = ResourceID::null |
The resource UUID, if registered with a resource manager.
| ResourceManager& CeresEngine::ResourceData::manager |
The resource manager that owns the resource.
| SPtr<ResourceMetadata> CeresEngine::ResourceData::metadata = nullptr |
A pointer to the user-defined resource metadata.
Can be freely changed by the user to store metadata for the package. The metadata will be serialized alongside the resource and can be loaded separatedly from the resource. This allows quickly fetching data from the resource and let the user determine if it needs to be loaded or not.
|
private |
A map that enumerates the sub-resurces attached to this resource.
A list of sub-resources that are pending a save.
| const PackagePtr CeresEngine::ResourceData::package = nullptr |
The package from which the resource was loaded from.
Can be nullptr if the resource is not contained in a package.
| const WeakResourceHandle<Resource> CeresEngine::ResourceData::parent = nullptr |
A parent resource to which this resource is attached to.
This will ensure that the parent resource remains alive for as long as the children is referenced somewhere.