Design Pattern Examples
Overview of object-oriented design patterns
Observer_NumberChangedFunctionList.h
Go to the documentation of this file.
1
9
10#pragma once
11#ifndef __OBSERVER_NUMBERCHANGEDFUNCTIONLIST_H__
12#define __OBSERVER_NUMBERCHANGEDFUNCTIONLIST_H__
13
14#include <stdbool.h>
15#include <stdint.h>
16
20typedef void (*NumberChangedFunction)(uint32_t);
21
26typedef struct
27{
32
38
45
55
65
73void NumberChangedFunctionList_Remove(NumberChangedFunctionList* functionList, int functionIndex);
74
84
85#endif // __OBSERVER_NUMBERCHANGEDFUNCTIONLIST_H__
86
void NumberChangedFunctionList_Initialize(NumberChangedFunctionList *functionList)
Initialize the given function pointer list.
void(* NumberChangedFunction)(uint32_t)
Alias for a function that receives notifications about a number change.
bool NumberChangedFunctionList_Add(NumberChangedFunctionList *functionList, NumberChangedFunction function)
Add a function pointer to the given function pointer list.
bool NumberChangedFunctionList_Copy(NumberChangedFunctionList *sourceList, NumberChangedFunctionList *destinationList)
Duplicate the given source function pointer list into the destination function pointer list.
void NumberChangedFunctionList_Remove(NumberChangedFunctionList *functionList, int functionIndex)
Removed the function pointer at the given index from the function pointer list.
int NumberChangedFunctionList_Find(NumberChangedFunctionList *functionList, NumberChangedFunction function)
Search the function list for the specified function pointer.
void NumberChangedFunctionList_Clear(NumberChangedFunctionList *functionList)
Clear the given function pointer list, releasing all associated memory. The function list can then be...
Represents a dynamic list of function pointers of the type NumberChangedFunction.
size_t functions_count
Number of active function pointers in the functions array.
size_t allocation_count
The number of function pointers that can be held in the functions array.
NumberChangedFunction * functions
Array of function pointers.