asset_payload.h
| File Path | engine/include/conjure/assets/asset_payload.h |
| API ↗ | Database, importers and hot reload |
Type erasure for published payloads. This is the only erasure in the module: asset types need no base class, no shared_ptr and no virtual call on the hot path.
Type Aliases
asset_payload
An owned, type-erased payload: the object pointer plus the deleter that knows its type.
Functions
Public
detail::delete_nothing
detail::delete_nothinginline void delete_nothing(void *) noexcept;detail::delete_payload
detail::delete_payloadtemplate <typename ValueType> void delete_payload(void *object) noexcept;make_null_payload
make_null_payload[[nodiscard]] inline asset_payload make_null_payload() noexcept;A payload that owns nothing. Destroying it does nothing.
make_payload
make_payloadtemplate <typename ValueType> [[nodiscard]] asset_payload make_payload(
ValueType &&value);Moves (or copies) a value onto the heap and erases its type. The payload destroys the value through its real type.
payload_as
payload_astemplate <typename ValueType> [[nodiscard]] ValueType *payload_as(
const asset_payload &payload) noexcept;Views the payload as its real type. The caller must know the type (the slot's type id).