SleepHelper
|
Base class for a list of zero or more callback functions. More...
#include <SleepHelper.h>
Public Member Functions | |
void | add (std::function< bool(Types... args)> callback) |
Adds a callback function. Zero or more callbacks can be defined. More... | |
void | forEach (Types... args) |
Calls all callbacks, regardless of return value returned. More... | |
bool | untilTrue (bool defaultResult, Types... args) |
Calls callbacks until the first one returns true. The others are not called. More... | |
bool | whileAnyTrue (bool defaultResult, Types... args) |
Calls all callbacks. Returns true if any returns true, but all are still called. More... | |
bool | untilFalse (bool defaultResult, Types... args) |
Calls all callbacks until the first one returns false, then returns without calling others. More... | |
bool | whileAnyFalse (bool defaultResult, Types... args) |
Calls all callbacks. If any returns false then returns false, but all are still called. More... | |
void | removeAll () |
Remove all registered callbacks. More... | |
Data Fields | |
std::vector< std::function< bool(Types... args)> > | callbackFunctions |
Vector of all callbacks, limited only by available RAM. | |
Base class for a list of zero or more callback functions.
Types |
Callbacks can have different parameters, and this template allows the parameters to be specified.
|
inline |
Adds a callback function. Zero or more callbacks can be defined.
callback |
The callback always returns a bool, but the parameters are defined by the template.
|
inline |
Calls all callbacks, regardless of return value returned.
args |
The bool result is ignored when using forEach.
|
inline |
Remove all registered callbacks.
You normally will never use this. It's used by the automated test suite. There's no function to remove a single callback since they're typically lambdas and it would be difficult to specify which one to remove.
|
inline |
Calls all callbacks until the first one returns false, then returns without calling others.
defaultResult | The value to return if all callbacks return true. |
args |
This is fast return false. See also whileAnyFalse.
|
inline |
Calls callbacks until the first one returns true. The others are not called.
defaultResult | The value to return if all callbacks return false. |
args |
This is fast return true, see also whileAnyTrue.
|
inline |
Calls all callbacks. If any returns false then returns false, but all are still called.
defaultResult | The value to return if all callbacks return true. |
args |
|
inline |
Calls all callbacks. Returns true if any returns true, but all are still called.
defaultResult | The value to return if all callbacks return false. |
args |