|
libqi-api
2.1.0.18
|
#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 | trigger () |
| 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 | ( | ) |
| void qi::PeriodicTask::trigger | ( | ) |
Trigger a started periodic task to run right now. Does nothing if the periodic task just ran, is running, starting, stopping or stopped.