|
Capycore Engine
0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
|
Routes incoming network messages to registered handlers. More...
#include <router.h>
Public Member Functions | |
| void | register_handler (MessageType type, std::function< void(const Message &)> handler) |
| Registers a handler for a specific message type. If the handler already exists, it will be overwritten. | |
| void | unregister_handler (MessageType type) |
| Unregisters the handler associated with a message type. | |
| void | route (const Message &msg) const |
| Routes the message to its corresponding handler. If no handler exists, the message is ignored. | |
Routes incoming network messages to registered handlers.
| void Router::register_handler | ( | MessageType | type, |
| std::function< void(const Message &)> | handler | ||
| ) |
Registers a handler for a specific message type. If the handler already exists, it will be overwritten.
| void Router::route | ( | const Message & | msg | ) | const |
Routes the message to its corresponding handler. If no handler exists, the message is ignored.
| void Router::unregister_handler | ( | MessageType | type | ) |
Unregisters the handler associated with a message type.
| std::runtime_error | if no handler exists. |