5 #ifndef _QI_PERIODICTASK_HPP_
6 # define _QI_PERIODICTASK_HPP_
10 # include <boost/function.hpp>
11 # include <boost/utility.hpp>
22 struct PeriodicTaskPrivate;
48 auto setCallback(T&& cb) ->
typename std::enable_if<detail::IsAsyncBind<typename std::decay<T>::type>::value>::type
50 static_assert(
sizeof(T) &&
false,
51 "Don't use PeriodicTask::setCallback(qi::bind(...)) but setCallback(...) directly");
54 auto setCallback(T&& cb) ->
typename std::enable_if<!detail::IsAsyncBind<typename std::decay<T>::type>::value>::type
56 _setCallback(std::forward<T>(cb));
58 template <
typename AF,
typename ARG0,
typename... ARGS>
59 inline void setCallback(AF&& callable, ARG0&& arg0, ARGS&&... args)
61 _connectMaybeActor(arg0);
62 _setCallback(
boost::bind(std::forward<AF>(callable), std::forward<ARG0>(arg0), std::forward<ARGS>(args)...));
96 void start(
bool immediate =
true);
125 void compensateCallbackTime(
bool compensate);
129 void setName(
const std::string& name);
132 bool isRunning()
const;
140 bool isStopping()
const;
143 boost::shared_ptr<PeriodicTaskPrivate> _p;
145 template <
typename ARG0>
146 inline typename boost::enable_if<
147 boost::is_base_of<Actor, typename detail::Unwrap<ARG0>::type>,
149 _connectMaybeActor(
const ARG0& arg0)
153 template <
typename ARG0>
154 inline typename boost::disable_if<
155 boost::is_base_of<Actor, typename detail::Unwrap<ARG0>::type>,
157 _connectMaybeActor(
const ARG0& arg0)
162 void _setCallback(
const Callback& cb);
boost::function< qi::Future< void >(const Callback &, qi::Duration delay)> ScheduleCallback
Control a task executed periodically and asynchronously. <includename>qi/periodictask.hpp</includename> .
void setCallback(AF &&callable, ARG0 &&arg0, ARGS &&...args)
auto setCallback(T &&cb) -> typename std::enable_if<!detail::IsAsyncBind< typename std::decay< T >::type >::value >::type
std::enable_if< std::is_function< RF >::value, boost::function< RF > >::type bind(AF &&fun, Arg0 &&arg0, Args &&...args)
auto setCallback(T &&cb) -> typename std::enable_if< detail::IsAsyncBind< typename std::decay< T >::type >::value >::type
boost::function< void()> Callback
Callback is a boost::function.