Skip to content

Class ControllerManager

ClassList > ControllerManager

Centralized manager for controller registration and ownership. More...

  • #include <Controllers.h>

Public Functions

Type Name
void RegisterController (EventPool & pool)
Register a controller of specified type and bind to EventPool .

Detailed Description

ControllerManager owns all active controllers and ensures each controller type is registered exactly once. Controllers are identified by RTTI type_index to prevent duplicate registration.

Registration Process: * Template instantiation via RegisterController<ControllerType>() * RTTI lookup to check if type already exists * Controller constructed via new and wrapped in unique_ptr * bind() called to establish EventPool subscriptions * Controller stored in type-indexed map

Ownership: * Manager owns controllers via unique_ptr (exclusive ownership) * Controllers are destroyed when manager is destroyed * No external references to controller instances

Note:

Controllers are registered during Editor initialization phase.

Note:

Registration order does not matter (event-driven coordination).

Public Functions Documentation

function RegisterController

Register a controller of specified type and bind to EventPool .

template<typename _Ctrler>
inline void ControllerManager::RegisterController (
    EventPool & pool
) 

Template method that instantiates a controller, binds it to the EventPool, and stores it in the manager. If a controller of the same type already exists, the call is silently ignored (idempotent registration).

Type Safety: * _Ctrler must inherit from Controllers * RTTI ensures unique registration per concrete type * Template allows compile-time type checking

Template parameters:

  • _Ctrler Controller type to register (must inherit from Controllers)

Parameters:

  • pool EventPool for the controller to subscribe to

Note:

Registration is idempotent - duplicate calls are no-ops.

Note:

Controllers are immediately bound after construction.

Example:

ControllerManager manager;
EventPool events;
manager.RegisterController<CameraController>(events);
manager.RegisterController<ViewportController>(events);



The documentation for this class was generated from the following file src/editor/Controllers.h