Unravel Engine C++ Reference
Loading...
Searching...
No Matches
asset_handle< T > Struct Template Reference

Represents a handle to an asset, providing access and management functions. More...

#include <asset_handle.h>

Public Types

using asset_link_t = asset_link<T>
 

Public Member Functions

auto operator== (const asset_handle &rhs) const -> bool
 Equality operator for asset handles.
 
auto version () const -> uintptr_t
 
 operator bool () const
 Conversion operator to bool.
 
auto id () const -> const std::string &
 Gets the string identifier of the asset.
 
auto uid () const -> const hpp::uuid &
 Gets the unique identifier of the asset.
 
auto name () const -> std::string
 Gets the name of the asset derived from its path.
 
auto extension () const -> std::string
 
auto get (bool wait=true) const -> std::shared_ptr< T >
 Gets the shared pointer to the asset.
 
auto is_valid () const -> bool
 Checks if the handle is valid.
 
auto is_ready () const -> bool
 Checks if the task is ready.
 
auto task_id () const
 Gets the task ID.
 
void set_internal_job (const typename asset_link_t::task_future_t &future)
 Sets the internal job future.
 
void set_internal_ids (const hpp::uuid &internal_uid, const std::string &internal_id=get_empty_id())
 Sets the internal IDs.
 
void set_internal_id (const std::string &internal_id=get_empty_id())
 Sets the internal string identifier.
 
void invalidate ()
 Invalidates the handle, resetting its state.
 
void ensure ()
 Ensures the asset link is initialized.
 

Static Public Member Functions

static auto get_empty () -> const asset_handle &
 Gets an empty asset handle.
 
static auto get_empty_id () -> const std::string &
 Gets an empty string identifier.
 

Detailed Description

template<typename T>
struct asset_handle< T >

Represents a handle to an asset, providing access and management functions.

Template Parameters
TThe type of the asset.

Definition at line 42 of file asset_handle.h.

Member Typedef Documentation

◆ asset_link_t

template<typename T >
using asset_handle< T >::asset_link_t = asset_link<T>

Definition at line 44 of file asset_handle.h.

Member Function Documentation

◆ ensure()

template<typename T >
void asset_handle< T >::ensure ( )
inline

Ensures the asset link is initialized.

Definition at line 262 of file asset_handle.h.

◆ extension()

template<typename T >
auto asset_handle< T >::extension ( ) const -> std::string
inline

Definition at line 109 of file asset_handle.h.

◆ get()

template<typename T >
auto asset_handle< T >::get ( bool wait = true) const -> std::shared_ptr<T>
inline

Gets the shared pointer to the asset.

Parameters
waitIf true, waits for the task to complete if not ready.
Returns
The shared pointer to the asset.

Definition at line 119 of file asset_handle.h.

◆ get_empty()

template<typename T >
static auto asset_handle< T >::get_empty ( ) -> const asset_handle&
inlinestatic

Gets an empty asset handle.

Returns
The empty asset handle.

Definition at line 238 of file asset_handle.h.

◆ get_empty_id()

template<typename T >
static auto asset_handle< T >::get_empty_id ( ) -> const std::string&
inlinestatic

Gets an empty string identifier.

Returns
The empty string identifier.

Definition at line 253 of file asset_handle.h.

◆ id()

template<typename T >
auto asset_handle< T >::id ( ) const -> const std::string&
inline

Gets the string identifier of the asset.

Returns
The string identifier of the asset.

Definition at line 74 of file asset_handle.h.

◆ invalidate()

template<typename T >
void asset_handle< T >::invalidate ( )
inline

Invalidates the handle, resetting its state.

Definition at line 220 of file asset_handle.h.

◆ is_ready()

template<typename T >
auto asset_handle< T >::is_ready ( ) const -> bool
inline

Checks if the task is ready.

Returns
True if the task is ready, false otherwise.

Definition at line 164 of file asset_handle.h.

◆ is_valid()

template<typename T >
auto asset_handle< T >::is_valid ( ) const -> bool
inline

Checks if the handle is valid.

Returns
True if the handle is valid, false otherwise.

Definition at line 155 of file asset_handle.h.

◆ name()

template<typename T >
auto asset_handle< T >::name ( ) const -> std::string
inline

Gets the name of the asset derived from its path.

Returns
The name of the asset.

Definition at line 104 of file asset_handle.h.

◆ operator bool()

template<typename T >
asset_handle< T >::operator bool ( ) const
inline

Conversion operator to bool.

Returns
True if the handle is valid, false otherwise.

Definition at line 65 of file asset_handle.h.

◆ operator==()

template<typename T >
auto asset_handle< T >::operator== ( const asset_handle< T > & rhs) const -> bool
inline

Equality operator for asset handles.

Parameters
rhsThe right-hand side asset handle.
Returns
True if the handles are equal, false otherwise.

Definition at line 51 of file asset_handle.h.

◆ set_internal_id()

template<typename T >
void asset_handle< T >::set_internal_id ( const std::string & internal_id = get_empty_id())
inline

Sets the internal string identifier.

Parameters
internal_idThe string identifier to set.

Definition at line 211 of file asset_handle.h.

◆ set_internal_ids()

template<typename T >
void asset_handle< T >::set_internal_ids ( const hpp::uuid & internal_uid,
const std::string & internal_id = get_empty_id() )
inline

Sets the internal IDs.

Parameters
internal_uidThe unique identifier to set.
internal_idThe string identifier to set.

Definition at line 200 of file asset_handle.h.

◆ set_internal_job()

template<typename T >
void asset_handle< T >::set_internal_job ( const typename asset_link_t::task_future_t & future)
inline

Sets the internal job future.

Parameters
futureThe task future to set.

Definition at line 188 of file asset_handle.h.

◆ task_id()

template<typename T >
auto asset_handle< T >::task_id ( ) const
inline

Gets the task ID.

Returns
The task ID.

Definition at line 174 of file asset_handle.h.

◆ uid()

template<typename T >
auto asset_handle< T >::uid ( ) const -> const hpp::uuid&
inline

Gets the unique identifier of the asset.

Returns
The unique identifier of the asset.

Definition at line 89 of file asset_handle.h.

◆ version()

template<typename T >
auto asset_handle< T >::version ( ) const -> uintptr_t
inline

Definition at line 56 of file asset_handle.h.


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