Represents a list of handlers that all implement the IMessageHandler interface. This list can be dynamically updated and each element in the list is passed messages for processing. More...
#include <HandlerChain_Class.h>
Public Types | |
using | unique_ptr_t = std::unique_ptr< HandlerChain > |
Public Member Functions | |
void | SendMessage (Message *message) |
Send a message to each of the handlers in the list, protected by a multi-threading lock. | |
void | AddHandler (IMessageHandler::shared_ptr_t window) |
Add an instance of the IMessageHandler interface to end of the list of handlers, protected by a multi-threading lock. | |
void | RemoveHandler (IMessageHandler::shared_ptr_t window) |
Remove an instance of the IMessageHandler interface from the list, protected by a multi-threading lock. | |
void | RemoveHandler (IMessageHandler *window) |
Remove an instance of the IMessageHandler interface from the list, protected by a multi-threading lock. | |
std::string | ToString () |
Convert this HandlerChain to a string, protected by a multi-threading lock. | |
Private Attributes | |
std::list< IMessageHandler::shared_ptr_t > | _messageHandlers |
The list of message handlers. | |
std::mutex | _messageHandlersLock |
Object used to lock access to the message handlers list for multi-threaded support. | |
Represents a list of handlers that all implement the IMessageHandler interface. This list can be dynamically updated and each element in the list is passed messages for processing.
Definition at line 77 of file HandlerChain_Class.h.
using unique_ptr_t = std::unique_ptr<HandlerChain> |
Definition at line 80 of file HandlerChain_Class.h.
|
inline |
Add an instance of the IMessageHandler interface to end of the list of handlers, protected by a multi-threading lock.
If a message handler is already in the list, it is not added again.
window | The IMessageHandler object to add. |
Definition at line 128 of file HandlerChain_Class.h.
References HandlerChain::_messageHandlers, and HandlerChain::_messageHandlersLock.
Referenced by MessageWindow::CreateWindow().
|
inline |
Remove an instance of the IMessageHandler interface from the list, protected by a multi-threading lock.
If the message handler is not in the list, the request to remove is ignored.
window | The window to remove |
Definition at line 166 of file HandlerChain_Class.h.
References HandlerChain::_messageHandlers, HandlerChain::_messageHandlersLock, and IMessageHandler::ID().
|
inline |
Remove an instance of the IMessageHandler interface from the list, protected by a multi-threading lock.
If the message handler is not in the list, the request to remove is ignored.
window | The window to remove |
Definition at line 152 of file HandlerChain_Class.h.
References HandlerChain::_messageHandlers, and HandlerChain::_messageHandlersLock.
Referenced by MessageWindow::_HandleCloseMessage().
|
inline |
Send a message to each of the handlers in the list, protected by a multi-threading lock.
message | The Message object to send to each handler. |
Definition at line 100 of file HandlerChain_Class.h.
References HandlerChain::_messageHandlers, and HandlerChain::_messageHandlersLock.
Referenced by MessageWindow::_HandleButtonUpMessage().
|
inline |
Convert this HandlerChain to a string, protected by a multi-threading lock.
Definition at line 179 of file HandlerChain_Class.h.
References HandlerChain::_messageHandlers, HandlerChain::_messageHandlersLock, and Helpers::formatstring().
|
private |
The list of message handlers.
Definition at line 86 of file HandlerChain_Class.h.
Referenced by HandlerChain::AddHandler(), MessageWindow::ProcessMessage(), HandlerChain::RemoveHandler(), HandlerChain::SendMessage(), and HandlerChain::ToString().
|
private |
Object used to lock access to the message handlers list for multi-threaded support.
Definition at line 92 of file HandlerChain_Class.h.
Referenced by HandlerChain::AddHandler(), HandlerChain::RemoveHandler(), HandlerChain::SendMessage(), and HandlerChain::ToString().