rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
listener_array.h File Reference

Data Structures

class  IntListenerArray< MAX_INT_LISTENER_COUNT >
 

Typedefs

typedef void(* IntIntVoidListener) (int value1, int value2, void *arg)
 
typedef void(* ArgListener) (void *arg)
 
typedef void(* ArgIntListener) (void *arg, int value)
 

Functions

template<int MAX_INT_LISTENER_COUNT>
void invokeCallbacks (IntListenerArray< MAX_INT_LISTENER_COUNT > *array, int value)
 
template<int MAX_INT_LISTENER_COUNT>
void invokeArgIntCallbacks (IntListenerArray< MAX_INT_LISTENER_COUNT > *array, int value)
 
template<int MAX_INT_LISTENER_COUNT>
void invokeIntIntCallbacks (IntListenerArray< MAX_INT_LISTENER_COUNT > *array, int value, int value2)
 
template<int MAX_INT_LISTENER_COUNT>
void invokeIntIntVoidCallbacks (IntListenerArray< MAX_INT_LISTENER_COUNT > *array, int value, int value2)
 
template<int MAX_INT_LISTENER_COUNT>
void clearCallbacks (IntListenerArray< MAX_INT_LISTENER_COUNT > *array)
 

Typedef Documentation

◆ ArgIntListener

typedef void(* ArgIntListener) (void *arg, int value)

Definition at line 18 of file listener_array.h.

◆ ArgListener

typedef void(* ArgListener) (void *arg)

Definition at line 17 of file listener_array.h.

◆ IntIntVoidListener

typedef void(* IntIntVoidListener) (int value1, int value2, void *arg)

Definition at line 14 of file listener_array.h.

Function Documentation

◆ clearCallbacks()

template<int MAX_INT_LISTENER_COUNT>
void clearCallbacks ( IntListenerArray< MAX_INT_LISTENER_COUNT > *  array)

Definition at line 118 of file listener_array.h.

118 {
119 array->currentListenersCount = 0;
120}

◆ invokeArgIntCallbacks()

template<int MAX_INT_LISTENER_COUNT>
void invokeArgIntCallbacks ( IntListenerArray< MAX_INT_LISTENER_COUNT > *  array,
int  value 
)

Definition at line 93 of file listener_array.h.

93 {
94 for (int i = 0; i < array->currentListenersCount; i++) {
96 void *arg = array->args[i];
97 (listener)(arg, value);
98 }
99}
void * args[MAX_INT_LISTENER_COUNT]
VoidInt callbacks[MAX_INT_LISTENER_COUNT]
void(* ArgIntListener)(void *arg, int value)
static CanTsListener listener

◆ invokeCallbacks()

template<int MAX_INT_LISTENER_COUNT>
void invokeCallbacks ( IntListenerArray< MAX_INT_LISTENER_COUNT > *  array,
int  value 
)

Definition at line 78 of file listener_array.h.

78 {
79 for (int i = 0; i < array->currentListenersCount; i++)
80 (array->callbacks[i])(value);
81}

◆ invokeIntIntCallbacks()

template<int MAX_INT_LISTENER_COUNT>
void invokeIntIntCallbacks ( IntListenerArray< MAX_INT_LISTENER_COUNT > *  array,
int  value,
int  value2 
)

Definition at line 102 of file listener_array.h.

102 {
103 for (int i = 0; i < array->currentListenersCount; i++) {
105 (listener)(value, value2);
106 }
107}
void(* VoidIntInt)(int, int)

◆ invokeIntIntVoidCallbacks()

template<int MAX_INT_LISTENER_COUNT>
void invokeIntIntVoidCallbacks ( IntListenerArray< MAX_INT_LISTENER_COUNT > *  array,
int  value,
int  value2 
)

Definition at line 110 of file listener_array.h.

110 {
111 for (int i = 0; i < array->currentListenersCount; i++) {
113 (listener)(value, value2, array->args[i]);
114 }
115}
void(* IntIntVoidListener)(int value1, int value2, void *arg)

Go to the source code of this file.