Guard class against code repetitions.
More...
#include <RepeatGuard.h>
List of all members.
Detailed Description
Guard class against code repetitions.
This class intends to be a generic class to avoid repetition of code blocks. It is also intended as a base class for other specific uses, such as RepetGuardLogger.
Constructor & Destructor Documentation
RepeatGuard::RepeatGuard |
( |
ACS::TimeInterval |
interval, |
|
|
unsigned int |
maxRepetitions, |
|
|
bool |
or_or_and = true | |
|
) |
| | |
Constructor
- Parameters:
-
| interval | minimum interval between allowing an action(i.e. check returns true)(in 100ns)(condition 1) |
| maxRepetitions | maxRepetitions between logs.(condition 2) |
| OR | true: conditions 1 or 2 must be met, false: conditions 1 and 2 must be met. Ignored if interval or maxRepetitions is zero. |
RepeatGuard::~RepeatGuard |
( |
|
) |
|
Member Function Documentation
bool RepeatGuard::check |
( |
|
) |
|
This method returns true or false if the next block of code is allowed to be executed or not.
- Returns:
- true if the conditions to allow an action have been met(conditions depend on the constructor used)
Referenced by Logging::RepeatGuardLogger< ALogger >::log().
bool RepeatGuard::checkAndIncrement |
( |
|
) |
|
This method returns true or false if the next block of code is allowed to be executed or not. Also it increments the counter.
- Returns:
- true if the conditions to allow an action have been met(conditions depend on the constructor used)
Referenced by Logging::RepeatGuardLogger< ALogger >::logAndIncrement().
unsigned int RepeatGuard::count |
( |
|
) |
|
void RepeatGuard::increment |
( |
|
) |
|
Increments the repetition counter.
void RepeatGuard::reset |
( |
ACS::TimeInterval |
interval, |
|
|
unsigned int |
maxRepetitions, |
|
|
bool |
or_or_and = true | |
|
) |
| | |
Resets counter and time of the last time check() returned true.
- Parameters:
-
| interval | minimum interval between allowing an action(i.e. check returns true)(in 100ns)(condition 1) |
| maxRepetitions | maxRepetitions between logs.(condition 2) |
| OR | true: conditions 1 or 2 must be met, false: conditions 1 and 2 must be met. Ignored if interval or maxRepetitions is zero. |
void RepeatGuard::reset |
( |
|
) |
|
Resets counter and time of the last time check() returned true.
Member Data Documentation
The documentation for this class was generated from the following file: