Manager Class
Type-erased wrapper for game world managers. More...
Declaration
Public Constructors Index
| Manager ()=default | |
template <typename T> | |
| Manager (T manager) | |
| Manager (const Manager &)=delete | |
| Manager (Manager &&) noexcept=default | |
Public Operators Index
| Manager & | operator= (const Manager &)=delete |
| Manager & | operator= (Manager &&)=default |
Public Member Functions Index
| void | flush (UpdateContext &updateContext) noexcept |
|
Delegates to the wrapped manager's `flush()` method. More... | |
| void | init (GameWorld &gameWorld) noexcept |
|
Delegates to the wrapped manager's `init()` method, if present. More... | |
| void | reset () 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
- See Also
ConceptModelRegistry
Definition at line 63 of file Manager.ixx.
Public Constructors
Manager()
| default |
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.
Manager()
| delete |
Definition at line 136 of file Manager.ixx.
Reference Manager.
Manager()
| noexcept default |
Definition at line 140 of file Manager.ixx.
Reference Manager.
Public Operators
operator=()
| delete |
Definition at line 137 of file Manager.ixx.
Reference Manager.
operator=()
| default |
Definition at line 139 of file Manager.ixx.
Reference Manager.
Public Member Functions
flush()
| 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.
Reference flush.
Referenced by flush.
init()
| 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.
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.
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.
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.
Private Member Attributes
pimpl_
|
Definition at line 116 of file Manager.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.