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

#include <CeresEngine/Resource/ResourceHandle.hpp>

Inheritance diagram for CeresEngine::ResourceHandle< T >:
CeresEngine::AbstractResourceHandle

Public Member Functions

 ResourceHandle () noexcept=default
 
 ResourceHandle (std::nullptr_t) noexcept
 
ResourceHandleoperator= (std::nullptr_t)
 
 ResourceHandle (const ResourceHandle &other)
 
ResourceHandleoperator= (const ResourceHandle &other)
 
template<typename U >
requires (std::is_convertible_v<U*, T*>)
 ResourceHandle (const ResourceHandle< U > &other) noexcept
 
template<typename U >
requires (std::is_convertible_v<U*, T*>)
ResourceHandleoperator= (const ResourceHandle< U > &other)
 
 ResourceHandle (ResourceHandle &&other) noexcept
 
ResourceHandleoperator= (ResourceHandle &&other) noexcept
 
template<typename U >
requires (std::is_convertible_v<U*, T*>)
 ResourceHandle (ResourceHandle< U > &&other) noexcept
 
template<typename U >
requires (std::is_convertible_v<U*, T*>)
ResourceHandleoperator= (ResourceHandle< U > &&other)
 
 ResourceHandle (SPtr< T > resource) noexcept
 
 ~ResourceHandle () noexcept
 
Tget () const noexcept
 
SPtr< TgetPointer () const noexcept
 
Toperator-> () const noexcept
 
Toperator* () const noexcept
 
Async< ResourceHandle< T > > load () const
 Loads the resource, if not loaded.
 
template<typename Func >
EventConnection didLoadResource (Func &&func)
 Attaches a new event that will called whenever the.
 
template<typename Func >
EventConnection didUnloadResource (Func &&func)
 
- Public Member Functions inherited from CeresEngine::AbstractResourceHandle
 AbstractResourceHandle ()=default
 
 AbstractResourceHandle (ResourceHandleData *data)
 
 AbstractResourceHandle (SPtr< Resource > resource) noexcept
 
const UUIDgetUUID () const noexcept
 
bool isValid () const noexcept
 Checks if the resource handle is valid.
 
Async< HResourceload () const
 Loads the resource, if not loaded.
 
bool isLoaded () const noexcept
 Checks if the resource handle is valid and loaded.
 
 operator bool () const noexcept
 Checks if the resource handle is valid.
 
void reset ()
 Resets the resource handle to the default state.
 

Private Member Functions

 ResourceHandle (ResourceHandleData *data)
 

Friends

class ResourceManager
 
class AbstractResourceHandle
 
class ResourceHandleData
 
template<typename >
class ResourceHandle
 
template<typename >
class WeakResourceHandle
 
template<typename U1 , typename U2 >
bool operator== (const ResourceHandle< U1 > &lhs, const ResourceHandle< U2 > &rhs) noexcept
 Checks if both references represent the same handle.
 
template<typename U1 , typename U2 >
bool operator!= (const ResourceHandle< U1 > &lhs, const ResourceHandle< U2 > &rhs) noexcept
 Checks if both references not represent the same handle.
 
template<typename U >
bool operator== (const ResourceHandle< U > &lhs, std::nullptr_t) noexcept
 Checks if the reference lhs is nullptr.
 
template<typename U >
bool operator== (std::nullptr_t, const ResourceHandle< U > &rhs) noexcept
 Checks if both references represent the same handle.
 
template<typename U >
bool operator!= (const ResourceHandle< U > &lhs, std::nullptr_t) noexcept
 Checks if the reference lhs is not nullptr.
 
template<typename U >
bool operator!= (std::nullptr_t, const ResourceHandle< U > &rhs) noexcept
 Checks if both references not represent the same handle.
 
template<typename U , typename V >
ResourceHandle< Ustatic_resource_cast (const ResourceHandle< V > &handle)
 
template<typename U , typename V >
ResourceHandle< Ustatic_resource_cast (ResourceHandle< V > &&handle)
 

Additional Inherited Members

- Protected Member Functions inherited from CeresEngine::AbstractResourceHandle
void set (ResourceHandleData *const data) noexcept
 Changes the internal resource handle data object of the handle.
 
- Protected Attributes inherited from CeresEngine::AbstractResourceHandle
ResourceHandleDatamData = nullptr
 

Constructor & Destructor Documentation

◆ ResourceHandle() [1/8]

template<typename T >
CeresEngine::ResourceHandle< T >::ResourceHandle ( )
defaultnoexcept

◆ ResourceHandle() [2/8]

template<typename T >
CeresEngine::ResourceHandle< T >::ResourceHandle ( std::nullptr_t  )
inlinenoexcept

◆ ResourceHandle() [3/8]

template<typename T >
CeresEngine::ResourceHandle< T >::ResourceHandle ( const ResourceHandle< T > &  other)
inline

◆ ResourceHandle() [4/8]

template<typename T >
template<typename U >
requires (std::is_convertible_v<U*, T*>)
CeresEngine::ResourceHandle< T >::ResourceHandle ( const ResourceHandle< U > &  other)
inlinenoexcept

◆ ResourceHandle() [5/8]

template<typename T >
CeresEngine::ResourceHandle< T >::ResourceHandle ( ResourceHandle< T > &&  other)
inlinenoexcept

◆ ResourceHandle() [6/8]

template<typename T >
template<typename U >
requires (std::is_convertible_v<U*, T*>)
CeresEngine::ResourceHandle< T >::ResourceHandle ( ResourceHandle< U > &&  other)
inlinenoexcept

◆ ResourceHandle() [7/8]

template<typename T >
CeresEngine::ResourceHandle< T >::ResourceHandle ( SPtr< T resource)
inlineexplicitnoexcept

◆ ~ResourceHandle()

template<typename T >
CeresEngine::ResourceHandle< T >::~ResourceHandle ( )
inlinenoexcept

◆ ResourceHandle() [8/8]

template<typename T >
CeresEngine::ResourceHandle< T >::ResourceHandle ( ResourceHandleData data)
inlineexplicitprivate

Member Function Documentation

◆ didLoadResource()

template<typename T >
template<typename Func >
EventConnection CeresEngine::ResourceHandle< T >::didLoadResource ( Func &&  func)
inline

Attaches a new event that will called whenever the.

Template Parameters
Func
Parameters
func
Returns

◆ didUnloadResource()

template<typename T >
template<typename Func >
EventConnection CeresEngine::ResourceHandle< T >::didUnloadResource ( Func &&  func)
inline

◆ get()

template<typename T >
T * CeresEngine::ResourceHandle< T >::get ( ) const
inlinenoexcept

◆ getPointer()

template<typename T >
SPtr< T > CeresEngine::ResourceHandle< T >::getPointer ( ) const
inlinenoexcept

◆ load()

template<typename T >
Async< ResourceHandle< T > > CeresEngine::ResourceHandle< T >::load ( ) const

Loads the resource, if not loaded.

◆ operator*()

template<typename T >
T & CeresEngine::ResourceHandle< T >::operator* ( ) const
inlinenoexcept

◆ operator->()

template<typename T >
T * CeresEngine::ResourceHandle< T >::operator-> ( ) const
inlinenoexcept

◆ operator=() [1/5]

◆ operator=() [2/5]

template<typename T >
template<typename U >
requires (std::is_convertible_v<U*, T*>)
ResourceHandle & CeresEngine::ResourceHandle< T >::operator= ( const ResourceHandle< U > &  other)
inline

◆ operator=() [3/5]

template<typename T >
ResourceHandle & CeresEngine::ResourceHandle< T >::operator= ( ResourceHandle< T > &&  other)
inlinenoexcept

◆ operator=() [4/5]

template<typename T >
template<typename U >
requires (std::is_convertible_v<U*, T*>)
ResourceHandle & CeresEngine::ResourceHandle< T >::operator= ( ResourceHandle< U > &&  other)
inline

◆ operator=() [5/5]

template<typename T >
ResourceHandle & CeresEngine::ResourceHandle< T >::operator= ( std::nullptr_t  )
inline

Friends And Related Symbol Documentation

◆ AbstractResourceHandle

◆ operator!= [1/3]

template<typename T >
template<typename U >
bool operator!= ( const ResourceHandle< U > &  lhs,
std::nullptr_t   
)
friend

Checks if the reference lhs is not nullptr.

Template Parameters
UThe resource type
Parameters
lhsThe first operand
Returns
true if lhs is not nullptr

◆ operator!= [2/3]

template<typename T >
template<typename U1 , typename U2 >
bool operator!= ( const ResourceHandle< U1 > &  lhs,
const ResourceHandle< U2 > &  rhs 
)
friend

Checks if both references not represent the same handle.

Template Parameters
U1The first resource type
U2The second resource type
Parameters
lhsThe first operand
rhsThe second operand
Returns
true if both lhs and rhs do not represent the same handle

◆ operator!= [3/3]

template<typename T >
template<typename U >
bool operator!= ( std::nullptr_t  ,
const ResourceHandle< U > &  rhs 
)
friend

Checks if both references not represent the same handle.

Template Parameters
U1The first resource type
U2The second resource type
Parameters
lhsThe first operand
rhsThe second operand
Returns
true if both lhs and rhs do not represent the same handle

◆ operator== [1/3]

template<typename T >
template<typename U >
bool operator== ( const ResourceHandle< U > &  lhs,
std::nullptr_t   
)
friend

Checks if the reference lhs is nullptr.

Template Parameters
UThe resource type
Parameters
lhsThe first operand
Returns
true if lhs is nullptr

◆ operator== [2/3]

template<typename T >
template<typename U1 , typename U2 >
bool operator== ( const ResourceHandle< U1 > &  lhs,
const ResourceHandle< U2 > &  rhs 
)
friend

Checks if both references represent the same handle.

Template Parameters
U1The first resource type
U2The second resource type
Parameters
lhsThe first operand
rhsThe second operand
Returns
true if both lhs and rhs represent the same handle

◆ operator== [3/3]

template<typename T >
template<typename U >
bool operator== ( std::nullptr_t  ,
const ResourceHandle< U > &  rhs 
)
friend

Checks if both references represent the same handle.

Template Parameters
U1The first resource type
U2The second resource type
Parameters
lhsThe first operand
rhsThe second operand
Returns
true if both lhs and rhs represent the same handle

◆ ResourceHandle

template<typename T >
template<typename >
friend class ResourceHandle
friend

◆ ResourceHandleData

◆ ResourceManager

template<typename T >
friend class ResourceManager
friend

◆ static_resource_cast [1/2]

template<typename T >
template<typename U , typename V >
ResourceHandle< U > static_resource_cast ( const ResourceHandle< V > &  handle)
friend

◆ static_resource_cast [2/2]

template<typename T >
template<typename U , typename V >
ResourceHandle< U > static_resource_cast ( ResourceHandle< V > &&  handle)
friend

◆ WeakResourceHandle

template<typename T >
template<typename >
friend class WeakResourceHandle
friend

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