RepeatGuard − Guard class against code repetitions. |
#include <RepeatGuard.h> Inherited by Logging::RepeatGuardLogger< ALogger > [private], Logging::RepeatGuardLogger< ACSErr::ACSbaseExImpl > [private], and Logging::RepeatGuardLogger< Logging::BaseLog > [private]. |
Public Member Functions |
RepeatGuard (ACS::TimeInterval interval, unsigned int maxRepetitions, bool or_or_and=true) |
~RepeatGuard () |
bool check () |
bool checkAndIncrement () |
void increment () |
unsigned int count () |
void reset () |
void reset (ACS::TimeInterval interval, unsigned int maxRepetitions, bool or_or_and=true) |
Protected Attributes |
unsigned int counter |
unsigned int counterAtLastCheck |
unsigned int maxRepetitions |
unsigned int method |
bool firstTime |
ACS::TimeInterval interval |
ACS::Time lastTime |
ACE_Recursive_Thread_Mutex mutex |
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. |
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) |
RepeatGuard::~RepeatGuard () |
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 () To see how many attempts have been made. |
Returns: |
the counter at the moment of the last call to check() or checkAndIncrement() |
Referenced by Logging::RepeatGuardLogger< ALogger >::log(), and Logging::RepeatGuardLogger< ALogger >::logAndIncrement(). |
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) |
void RepeatGuard::reset () Resets counter and time of the last time check() returned true. |
unsigned int RepeatGuard::counter [protected] |
unsigned int RepeatGuard::counterAtLastCheck [protected] |
bool RepeatGuard::firstTime [protected] |
ACS::TimeInterval RepeatGuard::interval [protected] |
ACS::Time RepeatGuard::lastTime [protected] |
unsigned int RepeatGuard::maxRepetitions [protected] |
unsigned int RepeatGuard::method [protected] |
ACE_Recursive_Thread_Mutex RepeatGuard::mutex [protected] |
Generated automatically by Doxygen for ACS-2015.2 C++ API from the source code. |