Plasma Engine  2.0
Loading...
Searching...
No Matches
plCustomDataResourceBase Class Referenceabstract

Base class for resources that represent different implementations of plCustomData. More...

#include <CustomData.h>

Inheritance diagram for plCustomDataResourceBase:

Protected Member Functions

virtual void CreateAndLoadData (plAbstractObjectGraph &ref_graph, plRttiConverterContext &ref_context, const plAbstractObjectNode *pRootNode)=0
 
virtual plResourceLoadDesc UnloadData (Unload WhatToUnload) override
 Requests the resource to unload another quality level. If bFullUnload is true, the resource should unload all data, because it is going to be deleted afterwards.
 
plResourceLoadDesc UpdateContent_Internal (plStreamReader *Stream, const plRTTI &rtti)
 
- Protected Member Functions inherited from plResource
 plResource (DoUpdate ResourceUpdateThread, plUInt8 uiQualityLevelsLoadable)
 Default constructor.
 
virtual ~plResource ()
 virtual destructor.
 
MemoryUsageModifyMemoryUsage ()
 Non-const version for resources that want to write this variable directly.
 
void SetIsReloadable (bool bIsReloadable)
 Call this to specify whether a resource is reloadable.
 
void SetHasLoadingFallback (bool bHasLoadingFallback)
 Used internally by the code injection macros.
 

Additional Inherited Members

- Public Member Functions inherited from plResource
PL_ALWAYS_INLINE const plStringGetResourceID () const
 Returns the unique ID that identifies this resource. On a file resource this might be a path. Can also be a GUID or any other scheme that uniquely identifies the resource.
 
PL_ALWAYS_INLINE plUInt64 GetResourceIDHash () const
 Returns the hash of the unique ID.
 
void SetResourceDescription (plStringView sDescription)
 The resource description allows to store an additional string that might be more descriptive during debugging, than the unique ID.
 
const plStringGetResourceDescription () const
 The resource description allows to store an additional string that might be more descriptive during debugging, than the unique ID.
 
const plStringGetResourceIdOrDescription () const
 The returns the resource description, if available, otherwise the resource ID.
 
PL_ALWAYS_INLINE plResourceState GetLoadingState () const
 Returns the current state in which this resource is in.
 
PL_ALWAYS_INLINE plUInt8 GetNumQualityLevelsDiscardable () const
 Returns the current maximum quality level that the resource could have.
 
PL_ALWAYS_INLINE plUInt8 GetNumQualityLevelsLoadable () const
 Returns how many quality levels the resource may additionally load.
 
float GetLoadingPriority (plTime now) const
 Returns the priority that is used by the resource manager to determine which resource to load next.
 
plResourcePriority GetPriority () const
 Returns the current resource priority.
 
void SetPriority (plResourcePriority priority)
 Changes the current resource priority.
 
PL_ALWAYS_INLINE const plBitflags< plResourceFlags > & GetBaseResourceFlags () const
 Returns the basic flags for the resource type. Mostly used the resource manager.
 
PL_ALWAYS_INLINE const MemoryUsageGetMemoryUsage () const
 Returns the information about the current memory usage of the resource.
 
PL_ALWAYS_INLINE plTime GetLastAcquireTime () const
 Returns the time at which the resource was (tried to be) acquired last. If a resource is acquired using plResourceAcquireMode::PointerOnly, this does not update the last acquired time, since the resource is not acquired for full use.
 
PL_ALWAYS_INLINE plInt32 GetReferenceCount () const
 Returns the reference count of this resource.
 
PL_ALWAYS_INLINE const plTimestampGetLoadedFileModificationTime () const
 Returns the modification date of the file from which this resource was loaded.
 
PL_ALWAYS_INLINE plUInt32 GetCurrentResourceChangeCounter () const
 Returns the current value of the resource change counter. Can be used to detect whether the resource has changed since using it last time.
 
PL_ALWAYS_INLINE void IncResourceChangeCounter ()
 Allows to manually increase the resource change counter to signal that dependent code might need to update.
 
virtual void ResetResource ()
 If the resource has modifications from the original state, it should reset itself to that state now (or force a reload on itself).
 
void PrintHandleStackTraces ()
 Prints the stack-traces for all handles that currently reference this resource.
 
- Public Member Functions inherited from plReflectedClass
virtual const plRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const plRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
PL_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 
- Static Public Member Functions inherited from plNoBase
static const plRTTIGetStaticRTTI ()
 
- Public Attributes inherited from plResource
plEvent< const plResourceEvent &, plMutexm_ResourceEvents
 
- Protected Types inherited from plResource
enum class  DoUpdate { OnMainThread , OnAnyThread }
 
enum class  Unload { AllQualityLevels , OneQualityLevel }
 

Detailed Description

Base class for resources that represent different implementations of plCustomData.

These resources are automatically generated using these macros: PL_DECLARE_CUSTOM_DATA_RESOURCE(YourCustomData) PL_DEFINE_CUSTOM_DATA_RESOURCE(YourCustomData)

Put the former into a header next to YourCustomData and the latter into a cpp file.

This builds these types: YourCustomDataResource YourCustomDataResourceHandle

You can then use these to reference this resource type for example in components. For a full example search the SampleGamePlugin for SampleCustomDataResource and SampleCustomDataResourceHandle and see how they are used.

Member Function Documentation

◆ UnloadData()

plResourceLoadDesc plCustomDataResourceBase::UnloadData ( Unload WhatToUnload)
overrideprotectedvirtual

Requests the resource to unload another quality level. If bFullUnload is true, the resource should unload all data, because it is going to be deleted afterwards.

Implements plResource.

Reimplemented in plCustomDataResource< T >.


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