Engine → Assets → asset_ref.h
asset_handle
| Type | Class |
| Namespace | conjure::assets |
| Include File Path | engine/include/conjure/assets/asset_ref.h |
| Source File Path | engine/src/assets/asset_ref.cpp |
| API ↗ | Assets, Referencing and loading assets |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | constexpr asset_handle() noexcept = default; | |
| public | explicit asset_handle(
asset_slot *slot) noexcept; | Acquires one strong reference on slot (nullptr yields an unbound handle). |
| public | asset_handle(
const asset_handle &other) noexcept; | |
| public | asset_handle(
asset_handle &&other) noexcept; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~asset_handle(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mSlot | asset_slot * | nullptr |
Functions
Public
get
gettemplate <declared_asset_type AssetType> [[nodiscard]] AssetType *get() const noexcept;The payload as AssetType, or nullptr when unbound, not LOADED or of another type.
is_bound
is_bound[[nodiscard]] constexpr bool is_bound() const noexcept;is_terminal
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
reftemplate <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
resetvoid reset() noexcept;Releases the strong reference and makes the handle unbound.
state
state[[nodiscard]] asset_state state() const noexcept;type
type[[nodiscard]] asset_type_id type() const noexcept;The slot's type id (INVALID when unbound or not yet known).
version
version[[nodiscard]] u32 version() const noexcept;Operator Overloads
Public
operator=
operator=asset_handle &operator=(
const asset_handle &other) noexcept;asset_handle &operator=(
asset_handle &&other) noexcept;operator==
operator==[[nodiscard]] constexpr bool operator==(
const asset_handle &other) const noexcept;Two handles are equal when they refer to the same slot.