Skip to main content

Manager Class

Type-erased wrapper for game world managers. More...

Declaration

class helios::engine::runtime::world::Manager { ... }

Public Constructors Index

Manager ()=default

Default constructor creating an empty Manager. More...

template <typename T>
Manager (T manager)

Wraps a concrete manager in a type-erased Manager. More...

Manager (const Manager &)=delete
Manager (Manager &&) noexcept=default

Public Operators Index

Manager &operator= (const Manager &)=delete
Manager &operator= (Manager &&)=default

Public Member Functions Index

voidflush (UpdateContext &updateContext) noexcept

Delegates to the wrapped manager's `flush()` method. More...

voidinit (GameWorld &gameWorld) noexcept

Delegates to the wrapped manager's `init()` method, if present. More...

voidreset () noexcept

Delegates to the wrapped manager's `reset()` method, if present. More...

void *underlying () noexcept

Returns a type-erased pointer to the wrapped manager instance. More...

const void *underlying () const noexcept

Returns a type-erased pointer to the wrapped manager instance. More...

Private Member Attributes Index

std::unique_ptr< Concept >pimpl_

Description

Type-erased wrapper for game world managers.

Manager uses the Concept/Model pattern to erase the concrete manager type. Concrete managers are plain classes that satisfy `IsManagerLike<T>` (i.e. provide `flush(UpdateContext&)` and declare `using EngineRoleTag = ManagerRole;`).

The internal `Concept` base defines the virtual interface, and `Model<T>` adapts the concrete type T, owning it by value. `init()` and `reset()` are conditionally forwarded if the concrete type satisfies `HasInit<T>` or `HasReset<T>` respectively.

Manager is move-only (non-copyable).

See Also

IsManagerLike

See Also

ManagerRole

See Also

ManagerRegistry

See Also

ConceptModelRegistry

Definition at line 63 of file Manager.ixx.

Public Constructors

Manager()

helios::engine::runtime::world::Manager::Manager ()
default

Default constructor creating an empty Manager.

Definition at line 123 of file Manager.ixx.

Referenced by Manager, Manager, operator= and operator=.

Manager()

template <typename T>
helios::engine::runtime::world::Manager::Manager (T manager)
inline explicit

Wraps a concrete manager in a type-erased Manager.

Template Parameters
T

The concrete manager type, must satisfy `IsManagerLike<T>`.

Parameters
manager

The concrete manager instance to wrap (moved into internal storage).

Definition at line 134 of file Manager.ixx.

134 explicit Manager(T manager) : pimpl_(std::make_unique<Model<T>>(std::move(manager))) {}

Manager()

helios::engine::runtime::world::Manager::Manager (const Manager &)
delete

Definition at line 136 of file Manager.ixx.

Reference Manager.

Manager()

helios::engine::runtime::world::Manager::Manager (Manager &&)
noexcept default

Definition at line 140 of file Manager.ixx.

Reference Manager.

Public Operators

operator=()

Manager & helios::engine::runtime::world::Manager::operator= (const Manager &)
delete

Definition at line 137 of file Manager.ixx.

Reference Manager.

operator=()

Manager & helios::engine::runtime::world::Manager::operator= (Manager &&)
default

Definition at line 139 of file Manager.ixx.

Reference Manager.

Public Member Functions

flush()

void helios::engine::runtime::world::Manager::flush (UpdateContext & updateContext)
inline noexcept

Delegates to the wrapped manager's `flush()` method.

Called by the GameLoop at each commit point after CommandBuffers have been flushed. Managers process their accumulated requests in batch.

Parameters
updateContext

The current frame's update context.

Precondition

Manager must be initialized (pimpl_ != nullptr).

Definition at line 154 of file Manager.ixx.

154 void flush(UpdateContext& updateContext) noexcept {
155 assert(pimpl_ && "Manager not initialized");
156 pimpl_->flush(updateContext);
157 }

Reference flush.

Referenced by flush.

init()

void helios::engine::runtime::world::Manager::init (GameWorld & gameWorld)
inline noexcept

Delegates to the wrapped manager's `init()` method, if present.

If the concrete type satisfies `HasInit<T>`, its `init()` is called. Otherwise this is a no-op. Typically used by managers to register their TypedCommandHandlers with the GameWorld.

Parameters
gameWorld

The GameWorld for one-time initialization.

Precondition

Manager must be initialized (pimpl_ != nullptr).

Definition at line 171 of file Manager.ixx.

171 void init(GameWorld& gameWorld) noexcept {
172 assert(pimpl_ && "Manager not initialized");
173 pimpl_->init(gameWorld);
174 }

reset()

void helios::engine::runtime::world::Manager::reset ()
inline noexcept

Delegates to the wrapped manager's `reset()` method, if present.

If the concrete type satisfies `HasReset<T>`, its `reset()` is called. Otherwise this is a no-op. Used during level transitions or game restarts to clear accumulated state.

Precondition

Manager must be initialized (pimpl_ != nullptr).

Definition at line 185 of file Manager.ixx.

185 void reset() noexcept {
186 assert(pimpl_ && "Manager not initialized");
187 pimpl_->reset();
188 }

underlying()

void * helios::engine::runtime::world::Manager::underlying ()
inline nodiscard noexcept

Returns a type-erased pointer to the wrapped manager instance.

Returns

Pointer to the underlying concrete manager.

Precondition

Manager must be initialized (pimpl_ != nullptr).

Definition at line 197 of file Manager.ixx.

197 [[nodiscard]] void* underlying() noexcept {
198 assert(pimpl_ && "Manager not initialized");
199 return pimpl_->underlying();
200 }

underlying()

const void * helios::engine::runtime::world::Manager::underlying ()
inline nodiscard noexcept

Returns a type-erased pointer to the wrapped manager instance.

Returns

Pointer to the underlying concrete manager.

Precondition

Manager must be initialized (pimpl_ != nullptr).

Definition at line 205 of file Manager.ixx.

205 [[nodiscard]] const void* underlying() const noexcept {
206 assert(pimpl_ && "Manager not initialized");
207 return pimpl_->underlying();
208 }

Private Member Attributes

pimpl_

std::unique_ptr<Concept> helios::engine::runtime::world::Manager::pimpl_

Definition at line 116 of file Manager.ixx.

116 std::unique_ptr<Concept> pimpl_;

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.