My Project
Loading...
Searching...
No Matches
Public Member Functions | List of all members
HandlerDispatcher Class Reference
Collaboration diagram for HandlerDispatcher:
Collaboration graph

Public Member Functions

void registerHandler (MessageType type, IMessageHandler *handler)
 Registers a handler for a specific message type.
 
bool dispatch (const std::string &messageId, const std::string &payload, MessageType type, System &system)
 Dispatches a message to the appropriate handler.
 
bool hasHandler (MessageType type) const
 Checks if a handler is registered for a message type.
 
size_t getHandlerCount () const
 Gets the number of registered handlers.
 

Member Function Documentation

◆ dispatch()

bool HandlerDispatcher::dispatch ( const std::string &  messageId,
const std::string &  payload,
MessageType  type,
System system 
)

Dispatches a message to the appropriate handler.

Parameters
messageIdThe message ID
payloadThe message payload
typeThe message type
systemReference to the system
Returns
true if handler was found and executed, false otherwise

◆ getHandlerCount()

size_t HandlerDispatcher::getHandlerCount ( ) const

Gets the number of registered handlers.

Returns
Number of handlers

◆ hasHandler()

bool HandlerDispatcher::hasHandler ( MessageType  type) const

Checks if a handler is registered for a message type.

Parameters
typeThe message type
Returns
true if handler exists

◆ registerHandler()

void HandlerDispatcher::registerHandler ( MessageType  type,
IMessageHandler handler 
)

Registers a handler for a specific message type.

Parameters
typeThe message type to handle
handlerPointer to the handler (not owned by dispatcher)

The documentation for this class was generated from the following files: