Class BaseModule

Inheritance Relationships

Derived Type

Class Documentation

class BaseModule

Polymorphic base class for all modules in the application.

BaseModule provides the common interface for all modules, defining virtual lifecycle hooks that modules can override to participate in frame execution. All lifecycle methods are no-ops by default; modules only override the hooks they need.

Derived classes (typically TaggedModule) implement has_tag() to declare which lifecycle phases they participate in, enabling the ModuleStack to organize execution efficiently.

Subclassed by portal::TaggedModule< Tags, Dependencies >

Public Functions

inline explicit BaseModule(const StringId &name)
virtual ~BaseModule() = default
virtual void begin_frame(FrameContext &frame)

Called at the beginning of each frame. Override to perform per-frame initialization.

Parameters:

frame – Per-frame context data

virtual void update(FrameContext &frame)

Called during the update phase for game logic.

Parameters:

frame – Per-frame context data

virtual void post_update(FrameContext &frame)

Called during the post-update phase (typically rendering).

Parameters:

frame – Per-frame context data

virtual void end_frame(FrameContext &frame)

Called at the end of each frame in reverse dependency order. Override to perform per-frame cleanup.

Parameters:

frame – Per-frame context data

virtual void gui_update(FrameContext &frame)

Called during the GUI update phase.

Parameters:

frame – Per-frame context data

virtual void on_event(Event &event)

Called when events are dispatched to modules.

Parameters:

event – The event to process

inline const StringId &get_name() const
Returns:

The module’s name for debugging and introspection

inline virtual std::vector<BaseModule*> get_dependencies() const
Returns:

Vector of modules this module depends on (empty by default)

template<ModuleTags T>
inline bool has_tag()

Check if this module has a specific tag.

Template Parameters:

T – The ModuleTags value to check

Returns:

true if this module participates in the specified lifecycle phase

template<ModuleTags... T>
inline bool has_tags()

Check if this module has all specified tags.

Template Parameters:

T – Variadic pack of ModuleTags to check

Returns:

true if this module participates in all specified lifecycle phases

virtual bool has_tag(TagFlag tag) const = 0

Check if this module has a specific tag (runtime version). Pure virtual - implemented by TaggedModule.

Parameters:

tag – The TagFlag to check

Returns:

true if this module participates in the specified lifecycle phase

Protected Attributes

StringId name