#include <CPrecisionTimer.h>
Public Member Functions | |
cPrecisionTimer () | |
Constructor of cPrecisionTimer. | |
~cPrecisionTimer () | |
Destructor of cPrecisionTimer. Stops the timer implicitly. | |
int | set (int a_interval, PRECISION_TIMER_CALLBACK *a_fpCallback, void *a_pUserData=0) |
Request that a callback function be queued for repeated callbacks. | |
bool | stop () |
Stop current timer. | |
Public Attributes | |
double | m_averageExecutionTime |
This is the average time (in seconds) that your callback function has required for execution. | |
Private Member Functions | |
void | defaults () |
Private Attributes | |
string | m_lastErrorMessage |
Last error message. | |
long | m_interval |
Our current timing interval in milliseconds. |
This class also maintains statistics about how long your callbacks are taking to execute, how much time has elapsed since the previous callback, etc.
cPrecisionTimer::cPrecisionTimer | ( | ) |
Constructor of cPrecisionTimer.
Constructor of cPrecisionTimer.
cPrecisionTimer::~cPrecisionTimer | ( | ) |
Destructor of cPrecisionTimer. Stops the timer implicitly.
Destructor of cPrecisionTimer.
int cPrecisionTimer::set | ( | int | a_interval, | |
PRECISION_TIMER_CALLBACK * | a_fpCallback, | |||
void * | a_pUserData = 0 | |||
) |
Request that a callback function be queued for repeated callbacks.
Request that a callback function be queued for repeated callbacks. Calling this function replaces any timer previously associated with this object (i.e., you need two cPrecisionTimers if you want two separate callbacks).
a_interval | The interval (in milliseconds) between successive callbacks. |
a_fpCallback | Pointer to a callback function. The callback should be a function of type PRECISION_TIMER_CALLBACK, which is defined above. Your function should look like : |
When your function gets called, you'll get back whatever value you supplied as the user_data value in the set(...) function.
a_pUserData | This value is handed back to your callback function every time it gets called. |
bool cPrecisionTimer::stop | ( | ) |
Stop current timer.
Stop an active timer.
void cPrecisionTimer::defaults | ( | ) | [private] |
Assign default values to variables; used for internal initialization only.