Skip to main content

TypedTargetedCommandDispatcher.ixx File

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

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game 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

classTypedTargetedCommandDispatcher<T>

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

Description

Type-safe dispatcher template for TargetedCommand handling.

File Listing

The file content with the documentation metadata removed is:

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

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.