Declaration of the Handler Chain functions, HandlerChain_SendMessage(), HandlerChain_AddWindow(), HandlerChain_RemoveWindow(), and HandlerChain_ToString(), as used in the HandlerChain Pattern. More...
#include "HandlerChain_Message.h"
Go to the source code of this file.
Macros | |
#define | __HANDLECHAIN_HANDLERFUNCTIONS_H__ |
Functions | |
void | HandlerChain_SendMessage (int windowId, Message *message) |
Send a message to each of the handlers in the list, protected by a multi-threading lock. | |
bool | HandlerChain_AddWindow (int windowId) |
Add an instance of a MessageWindow to end of the list of windows, protected by a multi-threading lock. | |
void | HandlerChain_RemoveWindow (int windowId) |
Remove an instance of a MessageWindow from the list, protected by a multi-threading lock. | |
bool | HandlerChain_ToString (DynamicString *output) |
Convert the Handler Chain to a string, protected by a multi-threading lock. | |
Declaration of the Handler Chain functions, HandlerChain_SendMessage(), HandlerChain_AddWindow(), HandlerChain_RemoveWindow(), and HandlerChain_ToString(), as used in the HandlerChain Pattern.
Definition in file HandlerChain_HandlerFunctions.h.
#define __HANDLECHAIN_HANDLERFUNCTIONS_H__ |
Definition at line 10 of file HandlerChain_HandlerFunctions.h.
bool HandlerChain_AddWindow | ( | int | windowId | ) |
Add an instance of a MessageWindow to end of the list of windows, protected by a multi-threading lock.
If a MessageWindow is already in the list, it is not added again.
windowId | ID of the MessageWindow to add. |
Definition at line 136 of file HandlerChain_HandlerFunctions.c.
References _handleList, _LockMutex(), _UnlockMutex(), UIntArray_AddInt(), and UIntArray_Find().
Referenced by MessageWindow_Create().
void HandlerChain_RemoveWindow | ( | int | windowId | ) |
Remove an instance of a MessageWindow from the list, protected by a multi-threading lock.
If the MessageWindow is not in the list, the request to remove is ignored.
windowId | ID of the MessageWindow to remove. |
Definition at line 162 of file HandlerChain_HandlerFunctions.c.
References _handleList, _LockMutex(), _UnlockMutex(), UIntArray_Find(), and UIntArray_RemoveInt().
Referenced by _HandleDestroyMessage().
void HandlerChain_SendMessage | ( | int | windowId, |
Message * | message | ||
) |
Send a message to each of the handlers in the list, protected by a multi-threading lock.
windowId | ID of window to target message with. -1 to target all windows. |
message | The Message object to send to each handler. |
Definition at line 105 of file HandlerChain_HandlerFunctions.c.
References _handleList, _LockMutex(), _UnlockMutex(), UIntArray::data, UIntArray::length, MessageWindow_ProcessMessage(), UIntArray_Clear(), and UIntArray_Copy().
Referenced by _HandleButtonUpMessage(), _HandleChain_DestroyWindows(), _HandleCloseMessage(), and HandlerChain_Exercise().
bool HandlerChain_ToString | ( | DynamicString * | output | ) |
Convert the Handler Chain to a string, protected by a multi-threading lock.
output | Returns a string representation of the Handler Chain and all the handlers it contains. |
Definition at line 176 of file HandlerChain_HandlerFunctions.c.
References _handleList, _LockMutex(), _UnlockMutex(), UIntArray::data, DynamicString_Append(), DynamicString_Clear(), UIntArray::length, MessageWindow_ToString(), DynamicString::string, UIntArray_Clear(), and UIntArray_Copy().
Referenced by _ShowHandlerChain().