Implementation of the NumberChangedFunctionList structure's support functions, NumberChangedFunctionList_Initialize(), NumberChangedFunctionList_Clear(), NumberChangedFunctionList_Add(), NumberChangedFunctionList_Find(), NumberChangedFunctionList_Remove(), and NumberChangedFunctionList_Copy(), as used in the Observer Pattern. More...
#include <stdlib.h>#include <stdio.h>#include <memory.h>#include "Observer_NumberChangedFunctionList.h"
Go to the source code of this file.
Functions | |
| void | NumberChangedFunctionList_Initialize (NumberChangedFunctionList *functionList) |
| Initialize the given function pointer list. | |
| void | NumberChangedFunctionList_Clear (NumberChangedFunctionList *functionList) |
| Clear the given function pointer list, releasing all associated memory. The function list can then be used for new function pointers. | |
| bool | NumberChangedFunctionList_Add (NumberChangedFunctionList *functionList, NumberChangedFunction function) |
| Add a function pointer to the given function pointer list. | |
| int | NumberChangedFunctionList_Find (NumberChangedFunctionList *functionList, NumberChangedFunction function) |
| Search the function list for the specified function pointer. | |
| void | NumberChangedFunctionList_Remove (NumberChangedFunctionList *functionList, int functionIndex) |
| Removed the function pointer at the given index from the function pointer list. | |
| bool | NumberChangedFunctionList_Copy (NumberChangedFunctionList *sourceList, NumberChangedFunctionList *destinationList) |
| Duplicate the given source function pointer list into the destination function pointer list. | |
Implementation of the NumberChangedFunctionList structure's support functions, NumberChangedFunctionList_Initialize(), NumberChangedFunctionList_Clear(), NumberChangedFunctionList_Add(), NumberChangedFunctionList_Find(), NumberChangedFunctionList_Remove(), and NumberChangedFunctionList_Copy(), as used in the Observer Pattern.
Definition in file Observer_NumberChangedFunctionList.c.
| bool NumberChangedFunctionList_Add | ( | NumberChangedFunctionList * | functionList, |
| NumberChangedFunction | function | ||
| ) |
Add a function pointer to the given function pointer list.
| functionList | The NumberChangedFunctionList object to add to. |
| function | The NumberChangedFunction pointer to add. |
Definition at line 43 of file Observer_NumberChangedFunctionList.c.
References NumberChangedFunctionList::allocation_count, NumberChangedFunctionList::functions, and NumberChangedFunctionList::functions_count.
Referenced by NumberProducer_SubscribeToNumberChanged().
| void NumberChangedFunctionList_Clear | ( | NumberChangedFunctionList * | functionList | ) |
Clear the given function pointer list, releasing all associated memory. The function list can then be used for new function pointers.
| functionList | The NumberChangedFunctionList object to clear. |
Definition at line 31 of file Observer_NumberChangedFunctionList.c.
References NumberChangedFunctionList::functions, and NumberChangedFunctionList_Initialize().
Referenced by _NumberProducer_NotifyNumberChanged(), and NumberProducer_Destroy().
| bool NumberChangedFunctionList_Copy | ( | NumberChangedFunctionList * | sourceList, |
| NumberChangedFunctionList * | destinationList | ||
| ) |
Duplicate the given source function pointer list into the destination function pointer list.
| sourceList | The NumberChangedFunctionList object to copy from. |
| destinationList | The NumberChangedFunctionList object to copy to. |
Definition at line 122 of file Observer_NumberChangedFunctionList.c.
References NumberChangedFunctionList::allocation_count, NumberChangedFunctionList::functions, and NumberChangedFunctionList::functions_count.
Referenced by _NumberProducer_NotifyNumberChanged().
| int NumberChangedFunctionList_Find | ( | NumberChangedFunctionList * | functionList, |
| NumberChangedFunction | function | ||
| ) |
Search the function list for the specified function pointer.
| functionList | The NumberChangedFunctionList object to search. |
| function | The NumberChangedFunction pointer to search for. |
Definition at line 85 of file Observer_NumberChangedFunctionList.c.
References NumberChangedFunctionList::functions, and NumberChangedFunctionList::functions_count.
Referenced by NumberProducer_SubscribeToNumberChanged(), and NumberProducer_UnsubscribeFromNumberChanged().
| void NumberChangedFunctionList_Initialize | ( | NumberChangedFunctionList * | functionList | ) |
Initialize the given function pointer list.
| functionList | The NumberChangedFunctionList object to initialize. |
Definition at line 18 of file Observer_NumberChangedFunctionList.c.
References NumberChangedFunctionList::allocation_count, NumberChangedFunctionList::functions, and NumberChangedFunctionList::functions_count.
Referenced by NumberChangedFunctionList_Clear().
| void NumberChangedFunctionList_Remove | ( | NumberChangedFunctionList * | functionList, |
| int | functionIndex | ||
| ) |
Removed the function pointer at the given index from the function pointer list.
| functionList | The NumberChangedFunctionList object to remove from. |
| functionIndex | The index of the function pointer to remove. Get this index by calling the NumberChangedFunctionList_Find() function. |
Definition at line 107 of file Observer_NumberChangedFunctionList.c.
References NumberChangedFunctionList::allocation_count, and NumberChangedFunctionList::functions.
Referenced by NumberProducer_UnsubscribeFromNumberChanged().