XII Release 0.1.0
Loading...
Searching...
No Matches
xiiResourceLock< RESOURCE_TYPE > Class Template Reference

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

#include <ResourceLock.h>

Public Member Functions

XII_ALWAYS_INLINE xiiResourceLock (const xiiTypedResourceHandle< RESOURCE_TYPE > &hResource, xiiResourceAcquireMode mode, const xiiTypedResourceHandle< RESOURCE_TYPE > &hFallbackResource=xiiTypedResourceHandle< RESOURCE_TYPE >())
 xiiResourceLock (const xiiResourceLock &)=delete
 xiiResourceLock (xiiResourceLock &&other)
XII_ALWAYS_INLINE RESOURCE_TYPE * operator-> ()
XII_ALWAYS_INLINE const RESOURCE_TYPE * operator-> () const
XII_ALWAYS_INLINE bool IsValid () const
XII_ALWAYS_INLINE operator bool () const
XII_ALWAYS_INLINE xiiResourceAcquireResult GetAcquireResult () const
XII_ALWAYS_INLINE const RESOURCE_TYPE * GetPointer () const
XII_ALWAYS_INLINE RESOURCE_TYPE * GetPointerNonConst () const

Detailed Description

template<class RESOURCE_TYPE>
class xiiResourceLock< RESOURCE_TYPE >

Copyright (c) Theophilus Eriata. All Rights Reserved.

Helper class to acquire and release a resource safely.

The constructor calls xiiResourceManager::BeginAcquireResource, the destructor makes sure to call xiiResourceManager::EndAcquireResource. The instance of this class can be used like a pointer to the resource.

Whether the acquisition succeeded or returned a loading fallback, missing fallback or even no result, at all, can be retrieved through GetAcquireResult().

Note
If a resource is missing, but no missing fallback is specified for the resource type, the code will fail with an assertion, unless you used xiiResourceAcquireMode::BlockTillLoaded_NeverFail. Only then will the error be silently ignored and the acquire result will be xiiResourceAcquireResult::None.
See also
xiiResourceManager::BeginAcquireResource()
xiiResourceAcquireMode
xiiResourceAcquireResult

The documentation for this class was generated from the following file:
  • /home/runner/work/XII/XII/Source/Engine/Core/ResourceManager/Implementation/ResourceLock.h