libqi-api  release-2.5.3-2016-11-18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros
strand.hpp File Reference
#include <deque>
#include <atomic>
#include <qi/assert.hpp>
#include <qi/detail/executioncontext.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <boost/type_traits/function_traits.hpp>

Go to the source code of this file.

Classes

struct  qi::detail::WrapInStrand< F >
 
class  qi::StrandPrivate
 
class  qi::Strand
 
struct  qi::detail::WrapInStrand< F >
 

Namespaces

 qi
 Deprecated in 2.5. Use int8_t from <cstdint>.
 
 qi::detail
 

Macros

#define _QI_STRAND_HPP_
 
#define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma)
 
#define typedefi(z, n, _)
 
#define placeholders(z, n, __)   , BOOST_PP_CAT(_, BOOST_PP_INC(n))
 
#define genCall(n, ATYPEDECL, ATYPES, ADECL, AUSE, comma)
 

Macro Definition Documentation

#define _QI_STRAND_HPP_

Definition at line 8 of file strand.hpp.

#define genCall (   n,
  ATYPEDECL,
  ATYPES,
  ADECL,
  AUSE,
  comma 
)
Value:
template <typename T, typename F, typename ARG0 comma ATYPEDECL> \
QI_API_DEPRECATED_MSG(Use generic 'schedulerFor' overload instead) boost::function<T> schedulerFor( \
const F& func, const ARG0& arg0 comma ADECL, \
const boost::function<void()>& fallbackCb = boost::function<void()>()) \
{ \
boost::function<T> funcbind = qi::bind<T>(func, arg0 comma AUSE); \
fallbackCb, \
SchedulerHelper<boost::function_traits<T>::arity, T>::_scheduler( \
funcbind, this), \
arg0); \
}
#define QI_API_DEPRECATED_MSG(msg__)
Compiler flags to mark a function as deprecated. It will generate a compiler warning.
Definition: macro.hpp:53
auto trackWithFallback(boost::function< void()> onFail, F &&f, Arg0 &&arg0) -> decltype(detail::BindTransform< Arg0 >::wrap(std::forward< Arg0 >(arg0), std::forward< F >(f), std::move(onFail)))
Definition: trackable.hxx:404

Definition at line 176 of file strand.hpp.

#define genCall (   n,
  ATYPEDECL,
  ATYPES,
  ADECL,
  AUSE,
  comma 
)
Value:
template <typename T> \
struct SchedulerHelper<n, T> \
{ \
BOOST_PP_REPEAT(n, typedefi, _); \
typedef typename boost::function_traits<T>::result_type R; \
static boost::function<T> _scheduler(const boost::function<T>& f, \
Strand* strand) \
{ \
return qi::bind<T>(&_asyncCall, strand, \
f BOOST_PP_REPEAT(n, placeholders, _)); \
} \
static qi::Future<R> _asyncCall(Strand* strand, \
const boost::function<T>& func comma \
ADECL) \
{ \
/* use qi::bind again since first arg may be a Trackable */ \
return ((qi::ExecutionContext*)strand) \
->async(qi::bind<R()>(func comma AUSE)); \
} \
};
#define typedefi(z, n, _)
Definition: strand.hpp:172
#define placeholders(z, n, __)
Definition: strand.hpp:175
std::enable_if< std::is_function< RF >::value, boost::function< RF > >::type bind(AF &&fun, Arg0 &&arg0, Args &&...args)
Definition: trackable.hxx:327

Definition at line 176 of file strand.hpp.

#define placeholders (   z,
  n,
  __ 
)    , BOOST_PP_CAT(_, BOOST_PP_INC(n))

Definition at line 175 of file strand.hpp.

#define typedefi (   z,
  n,
 
)
Value:
typedef typename boost::function_traits<T>::BOOST_PP_CAT( \
BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type) BOOST_PP_CAT(P, n);

Definition at line 172 of file strand.hpp.