5 #ifndef _QI_PERIODICTASK_HPP_
6 # define _QI_PERIODICTASK_HPP_
10 # include <boost/function.hpp>
11 # include <boost/utility.hpp>
22 struct PeriodicTaskPrivate;
33 typedef boost::function<qi::Future<void>(
48 void setCallback(
const Callback& cb);
50 template <
typename T,
typename ARG0>
PeriodicTask& setCallback(
const T& callable, ARG0 tracked, ...);
52 #define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma) \
53 template <typename AF, typename ARG0 comma ATYPEDECL> \
54 inline void setCallback(const AF& fun, const ARG0& arg0 comma ADECL) \
56 setCallback(boost::bind(fun, arg0 comma AUSE)); \
57 _connectMaybeActor<ARG0>(arg0); \
99 void start(
bool immediate =
true);
128 void compensateCallbackTime(
bool compensate);
132 void setName(
const std::string& name);
135 bool isRunning()
const;
143 bool isStopping()
const;
146 boost::shared_ptr<PeriodicTaskPrivate> _p;
148 template <
typename ARG0>
149 inline typename boost::enable_if<
150 boost::is_base_of<Actor, typename detail::Unwrap<ARG0>::type>,
152 _connectMaybeActor(
const ARG0& arg0)
156 template <
typename ARG0>
157 inline typename boost::disable_if<
158 boost::is_base_of<Actor, typename detail::Unwrap<ARG0>::type>,
160 _connectMaybeActor(
const ARG0& arg0)
boost::chrono::duration< int64_t, boost::nano > Duration
Convenience typedefs.
Control a task executed periodically and asynchronously. <includename>qi/periodictask.hpp</includename> .
boost::function< void()> Callback
Callback is a boost::function.
#define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma)
boost::function< qi::Future< void > const Callback &, qi::Duration delay)> ScheduleCallback
int64_t int64_t
Cross-platform signed integer of length 64 bits (8 bytes).