Manager.ixx File
Type-erased manager wrapper using the Concept/Model pattern. More...
Included Headers
#include <cassert>
#include <memory>
#include <helios.engine.runtime.messaging.command.CommandHandlerRegistry>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.engine.runtime.world.concepts.IsManagerLike>
Namespaces Index
| namespace | helios |
| namespace | engine |
| namespace | runtime |
| namespace | world |
Classes Index
| class | Manager |
|
Type-erased wrapper for game world managers. More... | |
| class | Concept |
|
Internal virtual interface for type erasure. More... | |
| class | Model<T> |
|
Typed wrapper that adapts a concrete manager to the Concept interface. More... | |
Description
Type-erased manager wrapper using the Concept/Model pattern.
File Listing
The file content with the documentation metadata removed is:
17using namespace helios::engine::runtime::messaging::command;
19export namespace helios::engine::runtime::world {
27 concept HasInit = requires(T& t, CommandHandlerRegistry& commandHandlerRegistry) {
28 {t.init(commandHandlerRegistry) } -> std::same_as<void>;
37 concept HasReset = requires(T& t) {
38 {t.reset() } -> std::same_as<void>;
72 virtual void flush(UpdateContext& updateContext) noexcept = 0;
73 virtual void init(CommandHandlerRegistry& commandHandlerRegistry) noexcept = 0;
76 [[nodiscard]] virtual void* underlying() noexcept = 0;
77 [[nodiscard]] virtual const void* underlying() const noexcept = 0;
86 class Model final : public Concept {
93 void flush(UpdateContext& updateContext) noexcept override {
94 manager_.flush(updateContext);
96 void init(CommandHandlerRegistry& commandHandlerRegistry) noexcept override {
133 requires IsManagerLike<T>
134 explicit Manager(T manager) : pimpl_(std::make_unique<Model<T>>(std::move(manager))) {}
154 void flush(UpdateContext& updateContext) noexcept {
155 assert(pimpl_ && "Manager not initialized");
156 pimpl_->flush(updateContext);
171 void init(CommandHandlerRegistry& commandHandlerRegistry) noexcept {
172 assert(pimpl_ && "Manager not initialized");
186 assert(pimpl_ && "Manager not initialized");
197 [[nodiscard]] void* underlying() noexcept {
198 assert(pimpl_ && "Manager not initialized");
205 [[nodiscard]] const void* underlying() const noexcept {
206 assert(pimpl_ && "Manager not initialized");
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.