Skip to main content

TypedWorldCommandDispatcher.ixx File

Type-safe dispatcher template for WorldCommand handling. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacemodules

Domain-specific components and systems. More...

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespacemessaging

Communication infrastructure for commands and events. More...

namespacecommand

Command pattern implementation for deferred action execution. More...

Classes Index

classTypedWorldCommandDispatcher<T>

Type-safe dispatcher template for handling specific WorldCommand types. More...

Description

Type-safe dispatcher template for WorldCommand handling.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file TypedWorldCommandDispatcher.ixx
3 * @brief Type-safe dispatcher template for WorldCommand handling.
4 */
5module;
6
7#include <memory>
8
9export module helios.engine.runtime.messaging.command.TypedWorldCommandDispatcher;
10
11import helios.engine.runtime.messaging.command.WorldCommand;
12import helios.engine.runtime.messaging.command.WorldCommandDispatcher;
13
14
15export namespace helios::engine::modules {
16 class GameWorld;
17}
18
20
21 /**
22 * @brief Type-safe dispatcher template for handling specific WorldCommand types.
23 *
24 * @tparam T The concrete WorldCommand type this dispatcher handles.
25 *
26 * @details TypedWorldCommandDispatcher provides a type-safe bridge between the
27 * polymorphic dispatch() method and a typed dispatchTyped() handler. Derived
28 * classes override dispatchTyped() to handle commands with full type information.
29 *
30 * @see WorldCommandDispatcher for the base interface
31 * @see CommandBuffer::addDispatcher for registration
32 */
33 template<typename T>
35 static_assert(std::is_base_of_v<WorldCommand, T>, "T must derive from WorldCommand");
36
37 protected:
38
39 /**
40 * @brief Handles the dispatched command with full type information.
41 *
42 * @param gameWorld The game world context.
43 * @param command The typed command to process.
44 *
45 * @note Implementations must be noexcept.
46 */
47 virtual void dispatchTyped(
49 const T& command
50 ) noexcept = 0;
51
52 public:
53
54 /**
55 * @brief Dispatches the command by downcasting to the concrete type.
56 *
57 * @param gameWorld The game world context.
58 * @param command The base command reference.
59 */
60 void dispatch(
63 ) override {
64 dispatchTyped(gameWorld, static_cast<const T&>(command));
65 }
66
67 };
68
69
70}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.