Skip to content

Engine → Assets → asset_ref.h

asset_handle

Syntax

class CONJURE_API asset_handle

Constructors

AccessSignatureDescription
publicconstexpr asset_handle() noexcept = default;
publicexplicit asset_handle( asset_slot *slot) noexcept;Acquires one strong reference on slot (nullptr yields an unbound handle).
publicasset_handle( const asset_handle &other) noexcept;
publicasset_handle( asset_handle &&other) noexcept;

Destructors

AccessSignatureDescription
public~asset_handle();

Variables

AccessNameTypeDefaultDescription
privatemSlotasset_slot *nullptr

Functions

Public

get

template <declared_asset_type AssetType> [[nodiscard]] AssetType *get() const noexcept;

The payload as AssetType, or nullptr when unbound, not LOADED or of another type.

id

[[nodiscard]] asset_id id() const noexcept;

The uuid, or the null uuid when unbound.

is_bound

[[nodiscard]] constexpr bool is_bound() const noexcept;

is_terminal

[[nodiscard]] bool is_terminal() const noexcept;

True when the slot is LOADED or FAILED (also true for an unbound handle, which can never make progress).

ref

template <declared_asset_type AssetType> [[nodiscard]] asset_ref<AssetType> ref() const noexcept;

A typed reference to the same slot. A type mismatch logs an ERROR once per uuid and yields an unbound reference that still carries the uuid; a slot whose type is not known yet (never bound typed, never loaded) yields an unbound reference quietly.

reset

void reset() noexcept;

Releases the strong reference and makes the handle unbound.

slot

[[nodiscard]] constexpr asset_slot *slot() const noexcept;

The bound slot, or nullptr.

state

[[nodiscard]] asset_state state() const noexcept;

type

[[nodiscard]] asset_type_id type() const noexcept;

The slot's type id (INVALID when unbound or not yet known).

version

[[nodiscard]] u32 version() const noexcept;

Operator Overloads

Public

operator=

asset_handle &operator=(
    const asset_handle &other) noexcept;
asset_handle &operator=(
    asset_handle &&other) noexcept;

operator==

[[nodiscard]] constexpr bool operator==(
    const asset_handle &other) const noexcept;

Two handles are equal when they refer to the same slot.