Skip to content

Engine → Modules → module_consumer.h

module_consumer

Syntax

class CONJURE_API module_consumer

Constructors

AccessSignatureDescription
publicmodule_consumer();

Important

Copy constructor and assignment has been deleted.

Destructors

AccessSignatureDescription
publicvirtual ~module_consumer();

Functions

Public

attach

virtual void attach(
    module_id id,
    module_context &context,
    const module_registration_set &set) = 0;

Applies the registrations. Cannot fail: validate() already accepted them.

can_detach

[[nodiscard]] virtual core::result<void> can_detach(
    module_id id,
    unload_policy policy) = 0;

Side-effect free veto: IN_USE under REFUSE_IF_IN_USE, UNLOAD_BLOCKED in play mode.

detach

virtual void detach(
    module_id id,
    reload_context *reload) = 0;

Removes everything the module registered. reload is null for a plain unload and points at the snapshot to fill during a reload.

live_use_count

[[nodiscard]] virtual u32 live_use_count(
    module_id id) const = 0;

How many live objects still use the module's registrations (entities with its components, open assets, ...).

name

[[nodiscard]] virtual core::string_id name() const noexcept = 0;

The consumer's name ("ecs"), used in REGISTRATION_CONFLICT messages.

participates_in_managed_reload

[[nodiscard]] virtual bool participates_in_managed_reload() const noexcept;

True for consumers that take part in reload_scope::MANAGED_ONLY (scripting).

restore

virtual void restore(
    module_id id,
    const reload_context &reload) = 0;

Restores what detach() stored, after the module was attached again.

validate

[[nodiscard]] virtual core::result<void> validate(
    module_id id,
    const module_registration_set &set,
    const module_registry &registry) = 0;

Rejects conflicting registrations before anything is applied. Runs for every consumer before the first attach, so a veto leaves the engine untouched.