CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::TResource< T, Base > Class Template Reference

Utility template class that can be extended by Resources to automatically implement methods that are deducible from the resource type. More...

#include <CeresEngine/Resource/Resource.hpp>

Inheritance diagram for CeresEngine::TResource< T, Base >:
CeresEngine::Resource CeresEngine::IReflectable

Public Member Functions

ResourceHandle< TgetResourceHandle () const noexcept
 Generates a hash for the provided type.
 
SPtr< TgetShared () noexcept
 Gets a shared pointer to the resource.
 
SPtr< const TgetShared () const noexcept
 Gets a shared pointer to the resource.
 
const ResourceTypeInfogetResourceType () const noexcept override
 Returns the resource type information descriptor.
 
 TResource (ResourceData &data, InputStream &dataStream)
 
void serialize (OutputStream &dataStream) const override
 Serializes a resource by writing data to dataStream.
 
- Public Member Functions inherited from CeresEngine::Resource
 Resource ()
 Default constructor for the Resource class.
 
 Resource (ResourceData &data)
 Creates a new Resource instance by passing a ResourceData instance.
 
virtual ~Resource () noexcept=default
 Resource virtual destructor.
 
ResourceManagergetResourceManager () const noexcept
 
HResource getResourceHandle () const noexcept
 Generates a hash for the provided type.
 
UUID getResourceID () const noexcept
 
HResource getParentResource () const noexcept
 A parent resource to which this resource is attached to.
 
SPtr< ResourceMetadatagetResourceMetadata () const noexcept
 A pointer to the user-defined resource metadata.
 
const PackagePtrgetPackage () const noexcept
 The package from which the resource was loaded from.
 
template<typename T = Resource>
SPtr< TgetShared () noexcept
 Gets a shared pointer to the resource.
 
template<typename T = Resource>
SPtr< const TgetShared () const noexcept
 Gets a shared pointer to the resource.
 
 Resource (ResourceData &data, InputStream &dataStream)
 Creates a new resource by reading data from dataStream.
 
- Public Member Functions inherited from CeresEngine::IReflectable
virtual ~IReflectable () noexcept=default
 

Private Member Functions

::CeresEngine::ClassInfo getClassInfo () noexcept override
 
::CeresEngine::ClassInfo getClassInfo () const noexcept override
 

Additional Inherited Members

- Static Public Member Functions inherited from CeresEngine::Resource
template<typename Processor >
static constexpr void reflect (Processor &&RTTI)
 Executes the given processor for every field of the struct.
 
- Protected Member Functions inherited from CeresEngine::Resource
HResourceStream createStream (const ResourceStreamFlags &flags=ResourceStreamFlag::Default)
 Creates a new resource stream.
 
void destroyStream (HResourceStream &stream)
 Destroys a stream.
 
void markAsDirty ()
 Marks the resource as dirty.
 

Detailed Description

template<typename T, typename Base = Resource>
class CeresEngine::TResource< T, Base >

Utility template class that can be extended by Resources to automatically implement methods that are deducible from the resource type.

Constructor & Destructor Documentation

◆ TResource()

template<typename T , typename Base = Resource>
CeresEngine::TResource< T, Base >::TResource ( ResourceData data,
InputStream dataStream 
)
inlineexplicit

Member Function Documentation

◆ getClassInfo() [1/2]

◆ getClassInfo() [2/2]

◆ getResourceHandle()

template<typename T , typename Base = Resource>
ResourceHandle< T > CeresEngine::TResource< T, Base >::getResourceHandle ( ) const
inlinenoexcept

Generates a hash for the provided type.

Type must have a std::hash specialization.

Template Parameters
Tthe type to be hashed
Parameters
vThe value to be hashed
Returns
The hashed value

◆ getResourceType()

template<typename T , typename Base = Resource>
const ResourceTypeInfo & CeresEngine::TResource< T, Base >::getResourceType ( ) const
inlineoverridevirtualnoexcept

◆ getShared() [1/2]

template<typename T , typename Base = Resource>
SPtr< const T > CeresEngine::TResource< T, Base >::getShared ( ) const
inlinenoexcept

Gets a shared pointer to the resource.

◆ getShared() [2/2]

template<typename T , typename Base = Resource>
SPtr< T > CeresEngine::TResource< T, Base >::getShared ( )
inlinenoexcept

Gets a shared pointer to the resource.

◆ serialize()

template<typename T , typename Base = Resource>
void CeresEngine::TResource< T, Base >::serialize ( OutputStream dataStream) const
inlineoverridevirtual

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