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...

voidflushParallel (UpdateContext &updateContext) noexcept

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

voidinit (CommandHandlerRegistry &commandHandlerRegistry) 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 144 of file Manager.ixx.

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 155 of file Manager.ixx.

155 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 157 of file Manager.ixx.

Manager()

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

Definition at line 161 of file Manager.ixx.

Public Operators

operator=()

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

Definition at line 158 of file Manager.ixx.

operator=()

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

Definition at line 160 of file Manager.ixx.

Public Member Functions

flush()

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

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

Parameters
updateContext

The current frame's update context.

Precondition

Manager must be initialized (pimpl_ != nullptr).

Definition at line 171 of file Manager.ixx.

172 assert(pimpl_ && "Manager not initialized");
173 pimpl_->flush(updateContext);
174 }

Reference helios::engine::runtime::registerComponents.

flushParallel()

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

Delegates to the wrapped manager's flushParallel() method.

Parameters
updateContext

The current frame's update context.

Precondition

Manager must be initialized (pimpl_ != nullptr).

Definition at line 183 of file Manager.ixx.

184 assert(pimpl_ && "Manager not initialized");
185 pimpl_->flushParallel(updateContext);
186 }

Reference helios::engine::runtime::registerComponents.

init()

void helios::engine::runtime::world::Manager::init (CommandHandlerRegistry & commandHandlerRegistry)
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 command handlers in the command-handler registry.

Parameters
commandHandlerRegistry

Registry used for one-time handler registration.

Precondition

Manager must be initialized (pimpl_ != nullptr).

Definition at line 199 of file Manager.ixx.

199 void init(CommandHandlerRegistry& commandHandlerRegistry) noexcept {
200 assert(pimpl_ && "Manager not initialized");
201 pimpl_->init(commandHandlerRegistry);
202 }

Reference helios::engine::runtime::registerComponents.

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 213 of file Manager.ixx.

213 void reset() noexcept {
214 assert(pimpl_ && "Manager not initialized");
215 pimpl_->reset();
216 }

Reference helios::engine::runtime::registerComponents.

underlying()

void * helios::engine::runtime::world::Manager::underlying ()
inline 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 225 of file Manager.ixx.

226 assert(pimpl_ && "Manager not initialized");
227 return pimpl_->underlying();
228 }

Reference helios::engine::runtime::registerComponents.

underlying()

const void * helios::engine::runtime::world::Manager::underlying ()
inline 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 233 of file Manager.ixx.

233 [[nodiscard]] const void* underlying() const noexcept {
234 assert(pimpl_ && "Manager not initialized");
235 return pimpl_->underlying();
236 }

Reference helios::engine::runtime::registerComponents.

Private Member Attributes

pimpl_

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

Definition at line 137 of file Manager.ixx.

137 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.9.8.