#include <frequencyGoverner.h>
Public Member Functions | |
| FrequencyGoverner (double frequency, double duration) | |
| The constructor initializes the FrequencyGoverner and starts the internal timer. | |
| ~FrequencyGoverner () | |
| The destructor destroys the FrequencyGoverner instance and deletes any file created by the constructor, thereby releasing the lock. | |
| bool | isFinished () |
| This method reports whether or not the specified period (from constructor argument "duration") has elapsed. | |
| void | sleepIfNecessary () |
Here's an example of how it might be used:
double frequency = 30.0; // Hz. double duration = 10.0; // Seconds. FrequencyGoverner governer(frequency, duration); while(!governer.isFinished()) { // Do something. // [..] governer.sleepIfNecessary(); }
Definition at line 40 of file frequencyGoverner.h.
| dlr::utilities::FrequencyGoverner::FrequencyGoverner | ( | double | frequency, | |
| double | duration | |||
| ) | [inline] |
The constructor initializes the FrequencyGoverner and starts the internal timer.
| frequency | This argument specifies how fast you'd like the loop to run. Setting this argument to zero indicates no throttling of loop speed. | |
| duration | This argument specifies how long you'd like the loop to run. Setting this argument to zero indicates no timeout. |
Definition at line 55 of file frequencyGoverner.h.
| dlr::utilities::FrequencyGoverner::~FrequencyGoverner | ( | ) | [inline] |
The destructor destroys the FrequencyGoverner instance and deletes any file created by the constructor, thereby releasing the lock.
Definition at line 64 of file frequencyGoverner.h.
| bool dlr::utilities::FrequencyGoverner::isFinished | ( | ) | [inline] |
This method reports whether or not the specified period (from constructor argument "duration") has elapsed.
Definition at line 75 of file frequencyGoverner.h.
References dlr::portability::getCurrentTime().
1.5.2