libqi-api
2.0.6.8
|
#include <periodictask.hpp>
Public Types | |
typedef boost::function< void()> | Callback |
Public Member Functions | |
PeriodicTask () | |
~PeriodicTask () | |
void | setCallback (const Callback &cb) |
template<typename T , typename ARG0 > | |
PeriodicTask & | setCallback (const T &callable, ARG0 tracked,...) |
void | setUsPeriod (qi::int64_t usPeriod) |
void | start (bool immediate=true) |
void | stop () |
void | asyncStop () |
void | compensateCallbackTime (bool compensate) |
void | setName (const std::string &name) |
Set name for debugging and tracking purpose. | |
bool | isRunning () const |
bool | isStopping () const |
Control a task executed periodically and asynchronously.
Definition at line 23 of file periodictask.hpp.
typedef boost::function<void()> qi::PeriodicTask::Callback |
Definition at line 26 of file periodictask.hpp.
void qi::PeriodicTask::asyncStop | ( | ) |
Request for periodic task to stop asynchronously. Can be safely called from within the callback.
void qi::PeriodicTask::compensateCallbackTime | ( | bool | compensate | ) |
If argument is true, call interval will take into account call duration to maintain the period.
bool qi::PeriodicTask::isRunning | ( | ) | const |
bool qi::PeriodicTask::isStopping | ( | ) | const |
void qi::PeriodicTask::setCallback | ( | const Callback & | cb | ) |
One of the setCallback() functions below must be called before any other operation. Once set the callback cannot be changed. If the callback throws, async task will be stopped
PeriodicTask& qi::PeriodicTask::setCallback | ( | const T & | callable, |
ARG0 | tracked, | ||
... | |||
) |
void qi::PeriodicTask::setName | ( | const std::string & | name | ) |
Set name for debugging and tracking purpose.
void qi::PeriodicTask::setUsPeriod | ( | qi::int64_t | usPeriod | ) |
Set the call interval in microseconds. This call will wait until next callback invocation to apply the change. Use: task.stop(); task.setUsPeriod() task.start() to apply the change immediately.
void qi::PeriodicTask::start | ( | bool | immediate = true | ) |
void qi::PeriodicTask::stop | ( | ) |