Engine → Modules → module_context.h
module_context¶
| Type | Class |
| Namespace | conjure::modules |
| Include File Path | engine/include/conjure/modules/module_context.h |
| Source File Path | engine/src/modules/module_context.cpp |
| API ↗ | Writing a module |
Syntax¶
Constructors¶
| Access | Signature | Description |
|---|---|---|
| public | module_context(
module_id id,
module_host_kind host,
semantic_version engineVersion,
const module_manifest &manifest,
std::filesystem::path rootDirectory,
const service_table &services); |
Important
Copy constructor and assignment has been deleted.
Destructors¶
| Access | Signature | Description |
|---|---|---|
| public | ~module_context(); |
Variables¶
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | m | semantic_version | {} | |
| private | mHost | module_host_kind | module_ | |
| private | mId | module_id | {} | |
| private | mManifest | const module_manifest * | nullptr | |
| private | mRegistrar | module_registrar * | nullptr | |
| private | m | std::filesystem::path | {} | |
| private | mServices | const service_table * | nullptr | |
| private | m | std:: | {} |
Functions¶
Public¶
begin_entry¶
begin_entry¶void begin_entry(
module_registrar ®istrar) noexcept;Binds the registrar for the duration of the entry. Called by the module manager.
end_entry¶
end_entry¶void end_entry() noexcept;Unbinds the registrar once the entry returned. Called by the module manager.
engine_version¶
engine_version¶[[nodiscard]] semantic_version engine_version() const noexcept;host¶
host¶[[nodiscard]] module_host_kind host() const noexcept;is_entry_running¶
is_entry_running¶[[nodiscard]] bool is_entry_running() const noexcept;True while the entry runs and registrar() may be called.
manifest¶
manifest¶[[nodiscard]] const module_manifest &manifest() const noexcept;registrar¶
registrar¶[[nodiscard]] module_registrar ®istrar() noexcept;The registrar, available only while the entry runs; asserts (and returns a registrar over a scratch set) outside of it.
require_service¶
require_service¶template <typename ServiceType> [[nodiscard]] core::result<ServiceType *> require_service() const;The host service, or SERVICE_MISSING naming the interface.
retain¶
retain¶void retain(
core::event_subscription &&subscription);Owns an event subscription so its callback (module code) is released before the binary is unmapped. Module code never hands the host a callback any other way except through descriptors.
retained_subscription_count¶
retained_subscription_count¶[[nodiscard]] usize retained_subscription_count() const noexcept;Number of retained subscriptions.
root_directory¶
root_directory¶[[nodiscard]] const std::filesystem::path &root_directory() const noexcept;try_service¶
try_service¶template <typename ServiceType> [[nodiscard]] ServiceType *try_service() const noexcept;The host service, or nullptr when the host did not provide it.