Engine → Modules → module_consumer.h
module_consumer¶
| Type | Class |
| Namespace | conjure::modules |
| Include File Path | engine/include/conjure/modules/module_consumer.h |
| Source File Path | engine/src/modules/module_consumer.cpp |
| API ↗ | Loading and managing modules |
Syntax¶
Constructors¶
| Access | Signature | Description |
|---|---|---|
| public | module_consumer(); |
Important
Copy constructor and assignment has been deleted.
Destructors¶
| Access | Signature | Description |
|---|---|---|
| public | virtual ~module_consumer(); |
Functions¶
Public¶
attach¶
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¶
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¶
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¶
live_use_count¶How many live objects still use the module's registrations (entities with its components, open assets, ...).
name¶
name¶[[nodiscard]] virtual core::string_id name() const noexcept = 0;The consumer's name ("ecs"), used in REGISTRATION_CONFLICT messages.
participates_in_managed_reload¶
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¶
restore¶virtual void restore(
module_id id,
const reload_context &reload) = 0;Restores what detach() stored, after the module was attached again.
validate¶
validate¶[[nodiscard]] virtual core::result<void> validate(
module_id id,
const module_registration_set &set,
const module_registry ®istry) = 0;Rejects conflicting registrations before anything is applied. Runs for every consumer before the first attach, so a veto leaves the engine untouched.