R operator()( BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, T, t) ) const { valid_ = false; for( expectations_cit it = expectations_.begin(); it != expectations_.end(); ++it ) if( it->is_valid( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, t) ) ) { if( ! it->invoke() ) { error_type::fail( "sequence failed", MOCK_FUNCTION_CONTEXT, it->file(), it->line() ); return error_type::abort(); } if( ! it->functor() ) { error_type::fail( "missing action", MOCK_FUNCTION_CONTEXT, it->file(), it->line() ); return error_type::abort(); } valid_ = true; error_type::call( MOCK_FUNCTION_CONTEXT, it->file(), it->line() ); return it->functor()( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, t) ); } error_type::fail( "unexpected call", MOCK_FUNCTION_CONTEXT ); return error_type::abort(); }
inline saga::task dispatch_sync (run_mode mode, char const * name, TR1::shared_ptr<v1_0::cpi> cpi_instance, void (Base::*sync ) (RetVal &, BOOST_PP_ENUM_PARAMS (K, FuncArg)), saga::task (Base::*async) ( BOOST_PP_ENUM_PARAMS (K, FuncArg)), BOOST_PP_ENUM_BINARY_PARAMS (K, Arg, const & arg)) { TR1::shared_ptr<Base> c = TR1::static_pointer_cast<Base>(cpi_instance); switch (mode) { case Sync_Sync: return sync_sync(c, sync, BOOST_PP_ENUM_PARAMS(K, arg)); case Sync_Async: return sync_async(c, async, BOOST_PP_ENUM_PARAMS(K, arg)); case Async_Sync: case Async_Async: BOOST_ASSERT(false); break; default: break; } // no adaptor found (Invalid mode)! SAGA_THROW_VERBATIM(cpi_instance.get(), std::string ("No adaptor implements method: ") + name, adaptors::NoAdaptor); return saga::task(saga::task_base::Done); }
typename lazy_enable_if_c< (mpl::size<param_types>::value == N) , make_nonterminal_holder< parameterized_nonterminal< Derived , fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> > , Derived > >::type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& f)) const { typename make_nonterminal_holder< parameterized_nonterminal< Derived , fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> > , Derived >::type result = {{ static_cast<Derived const*>(this) , fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)>( BOOST_PP_ENUM_PARAMS(N, f)) }}; return result; }
void emplace_alert(BOOST_PP_ENUM_BINARY_PARAMS(I, A, const& a) ) { mutex::scoped_lock lock(m_mutex); #ifndef TORRENT_NO_DEPRECATE if (m_dispatch) { m_dispatch(std::auto_ptr<alert>(new T(m_allocations[m_generation] BOOST_PP_COMMA_IF(I) BOOST_PP_ENUM_PARAMS(I, a)))); return; } #endif // don't add more than this number of alerts, unless it's a // high priority alert, in which case we try harder to deliver it // for high priority alerts, double the upper limit if (m_alerts[m_generation].size() >= m_queue_size_limit * (1 + T::priority)) return; T alert(m_allocations[m_generation] BOOST_PP_COMMA_IF(I) BOOST_PP_ENUM_PARAMS(I, a)); m_alerts[m_generation].push_back(alert); maybe_notify(&alert, lock); }
static instance construct_instance(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) { // An instance is similar to boost::any. Initialize it with // a void ptr. return instance(static_cast<void*>( construct<T BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param)> (BOOST_PP_ENUM_PARAMS(N, p))), &destruct<T>); }
bool operator!=( of_size_<BOOST_PP_ENUM_PARAMS(NT2_MAX_DIMENSIONS, D1)> const& a0 , of_size_<BOOST_PP_ENUM_PARAMS(NT2_MAX_DIMENSIONS, D2)> const& a1 ) { static const std::size_t a = of_size_<BOOST_PP_ENUM_PARAMS(NT2_MAX_DIMENSIONS, D1)>::static_size; static const std::size_t b = of_size_<BOOST_PP_ENUM_PARAMS(NT2_MAX_DIMENSIONS, D2)>::static_size; return details::compare_not_equal(a0,a1,boost::mpl::size_t<(a < b) ? b : a>()); }
inline saga::task dispatch_async (proxy * prxy, TR1::shared_ptr <adaptor_selector_state> state, void (Base::*sync_) (RetVal &, BOOST_PP_ENUM_PARAMS (K, FuncArg)), saga::task (Base::*async_) ( BOOST_PP_ENUM_PARAMS (K, FuncArg)), BOOST_PP_ENUM_BINARY_PARAMS (K, Arg, const & arg), bool (Base::*prep_) (RetVal &, BOOST_PP_ENUM_PARAMS(K, FuncArg), saga::uuid) = NULL) { typedef void (Base::*sync_func )(RetVal&, BOOST_PP_ENUM_PARAMS(K, FuncArg)); typedef saga::task (Base::*async_func)( BOOST_PP_ENUM_PARAMS(K, FuncArg)); typedef bool (Base::*prep_func )(RetVal&, BOOST_PP_ENUM_PARAMS(K, FuncArg), saga::uuid); void (Base::*sync )() = NULL; saga::task (Base::*async)() = NULL; bool (Base::*prep )() = NULL; run_mode mode = Unknown; TR1::shared_ptr<Base> c ( state->get_next_cpi (mode, &sync, &async, &prep)); // BOOST_ASSERT(NULL == sync || (sync_func) sync == sync_ ); // BOOST_ASSERT(NULL == async || (async_func) async == async_); // BOOST_ASSERT(NULL == prep || (prep_func) prep == prep_ ); switch (mode) { case Async_Sync: BOOST_ASSERT(sync); return async_sync(prxy, c, state, (sync_func)sync, BOOST_PP_ENUM_PARAMS(K, arg), (prep_func)prep); case Async_Async: BOOST_ASSERT(async); return async_async(c, state, (async_func)async, BOOST_PP_ENUM_PARAMS(K, arg)); case Sync_Sync: case Sync_Async: BOOST_ASSERT(false); break; default: break; } // no adaptor found (Invalid mode)! SAGA_THROW_VERBATIM(c.get(), std::string ("No adaptor implements method: ") + state->get_op_name(), adaptors::NoAdaptor); // this makes some compilers happy, but will never be called in fact // (didn't you see the throw above?) return saga::task(saga::task_base::Done); }
R operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, Arg, arg)) { BOOST_SQL_RESULT_TYPE result; impl->execute(BOOST_SQL_PARAM_TYPE(BOOST_PP_ENUM_PARAMS(N, arg))); impl->fetch(result); return make_result<R, BOOST_SQL_RESULT_TYPE>::call(result); }
void def(std::string const &name, R (*f)(BOOST_PP_ENUM_PARAMS(n,T)), policies const &p = policies()) { add_function(name, boost::shared_ptr<details::callback_base>( new details::BOOST_PP_CAT(callback,n)<R BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n,T)>(f)), p); }
BOOST_FORCEINLINE static type const call(src_type const &e) { type that = { BOOST_PP_ENUM_PARAMS(N, e.child) }; return that; }
/** Returns an instance of T (but does NOT retain ownership of the instance). * \param Params... The parameters described in the type of this factory. * \return An instance of T. * \pre is_valid() == true. * \post None. */ T* create(Params...) const { if (this->func) { return this->func(BOOST_PP_ENUM_PARAMS(N, p)); } else { return 0; } }
inline saga::task sync_async (TR1::shared_ptr <Cpi> cpi, saga::task (Base::*async)(BOOST_PP_ENUM_PARAMS (K, FuncArg)), BOOST_PP_ENUM_BINARY_PARAMS (K, Arg, const & arg)) { return saga::detail::run_wait( (cpi.get()->*async)(BOOST_PP_ENUM_PARAMS(K, arg))); }
T* create(BOOST_PP_ENUM_BINARY_PARAMS(N, Param, p)) const { if (this->func) { return this->func(BOOST_PP_ENUM_PARAMS(N, p)); } else { return 0; } }
inline bool generate( OutputIterator const& sink_ , Expr const& expr , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr)) { OutputIterator sink = sink_; return karma::generate(sink, expr, BOOST_PP_ENUM_PARAMS(N, attr)); }
void operator() (BOOST_PP_ENUM (BOOST_COROUTINE_ARG_MAX, BOOST_COROUTINE_param_with_default, arg)) { m_future_pimpl->assign(tuple_type (BOOST_PP_ENUM_PARAMS (BOOST_COROUTINE_ARG_MAX, arg))); }
inline saga::task sync_sync (TR1::shared_ptr <Cpi> cpi, void (Base::*sync) (RetVal &, BOOST_PP_ENUM_PARAMS (K, FuncArg)), BOOST_PP_ENUM_BINARY_PARAMS (K, Arg, const & arg)) { saga::task t(saga::task::Done); (cpi.get()->*sync)( t.get_result<RetVal>(), BOOST_PP_ENUM_PARAMS (K, arg)); return t; }
inline saga::task async_async (TR1::shared_ptr <Cpi> cpi, TR1::shared_ptr <adaptor_selector_state> state, saga::task (Base::*async) (BOOST_PP_ENUM_PARAMS (K, FuncArg)), BOOST_PP_ENUM_BINARY_PARAMS (K, Arg, const & arg)) { saga::task t ((cpi.get()->*async)(BOOST_PP_ENUM_PARAMS(K, arg))); detail::set_selector_state(t, state); return t; }
inline task::task ( char const *func_name, TR1::shared_ptr<Cpi> cpi, void (Base::*sync)(RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid), BOOST_PP_ENUM_BINARY_PARAMS (P, Arg, const& arg), bool (Base::*prep)( RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid)) : base_type(create_task(func_name, cpi, cpi->get_proxy(), sync, BOOST_PP_ENUM_PARAMS(P, arg), prep)) { }
/** * constructor */ wrapper_task (std::string const& func_name, TR1::shared_ptr<BaseCpi> cpi, void (Base::*sync)( RetVal&, BOOST_PP_ENUM_PARAMS (L, FuncArg), saga::uuid), BOOST_PP_ENUM_BINARY_PARAMS (L, Arg, arg), bool (Base::*prep)( RetVal&, BOOST_PP_ENUM_PARAMS (L, FuncArg), saga::uuid) = NULL) : base_type(func_name, cpi), exec_(sync), prep_func_(prep), func_args_(BOOST_PP_ENUM_PARAMS(L, arg)) { }
void set() { // This assertion will fire if a factory type is // set to a class from which it doesn't inherit. BOOST_STATIC_ASSERT((is_base_of<T, D>::value)); // This assertion will fire if D is const. BOOST_STATIC_ASSERT((!is_const<D>::value)); this->func = &impl::create_function< T, D BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N,Param) >::create; }
PHOENIX_LOCAL_GEN_NAME< fusion::tuple<BOOST_PP_ENUM_PARAMS(N, V)> , detail::map_local_index_to_tuple<BOOST_PP_ENUM_PARAMS(N, K)> > operator()( BOOST_PP_ENUM(N, PHOENIX_LOCAL_GEN_PARAM, _) ) const { return fusion::tuple<BOOST_PP_ENUM_PARAMS(N, V)>( BOOST_PP_ENUM(N, PHOENIX_LOCAL_GEN_ACTOR, _)); }
inline boost::function<Interface* ()> get_functor_func( boost::extensions::basic_parameter_map<Info, TypeInfo>& map, const std::vector<Info>& names) { #if N extensions::generic_parameter<TypeInfo>* gen; #define BOOST_EXTENSION_GET_FROM_LIST(z, n, data) \ gen = map.template get_first<BOOST_PP_CAT(Param, n)>(names[n]); \ if (!gen) return boost::function<Interface* ()>(); \ BOOST_PP_CAT(Param, n) BOOST_PP_CAT(p, n) = \ gen->template cast<BOOST_PP_CAT(Param, n)>(); BOOST_PP_REPEAT(N, BOOST_EXTENSION_GET_FROM_LIST, ) #undef BOOST_EXTENSION_GET_FROM_LIST #endif // N Interface* (*f)(BOOST_PP_ENUM_PARAMS(N, Param)) = impl::create_derived<Interface, Derived BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, Param)>; return bind(f BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, p)); }
inline bool test_delimited(Char const *expected, Generator const& g , Delimiter const& d, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr)) { namespace karma = boost::spirit::karma; std::ostringstream ostrm; ostrm << karma::format_delimited(g, d, BOOST_PP_ENUM_PARAMS(N, attr)); print_if_failed("test_delimited", ostrm.good(), ostrm.str(), expected); return ostrm.good() && ostrm.str() == expected; }
BOOST_FORCEINLINE typename make_dependent_c< of_size_< BOOST_PP_ENUM_PARAMS ( NT2_MAX_DIMENSIONS , std::ptrdiff_t(-1) BOOST_PP_INTERCEPT ) > , D0 >::type eval(of_size_<BOOST_PP_ENUM_PARAMS(NT2_MAX_DIMENSIONS,D)> const& t) { return t; }
inline saga::task sync_sync (TR1::shared_ptr <Cpi> cpi, void (Base::*sync) (saga::impl::void_t &, BOOST_PP_ENUM_PARAMS (K, FuncArg)), BOOST_PP_ENUM_BINARY_PARAMS (K, Arg, const& arg)) { saga::task t (saga::task::Done); saga::impl::void_t void_result; (cpi.get()->*sync)(void_result, BOOST_PP_ENUM_PARAMS (K, arg)); return t; }
nt2::container::table<T> cons(nt2::of_size_max const& sz, BOOST_PP_ENUM_PARAMS(N, T const& a)) { T const data[] = { BOOST_PP_ENUM_PARAMS(N, a) }; return nt2::container:: table<T> ( sz , &data[0] , &data[0] + N ); }
nt2::container::table<T, nt2::settings(nt2::of_size_<N>, nt2::automatic_)> cons(BOOST_PP_ENUM_PARAMS(N, T const& a)) { T const data[] = { BOOST_PP_ENUM_PARAMS(N, a) }; return nt2::container:: table<T, nt2::settings(nt2::of_size_<N>, nt2::automatic_)> ( nt2::of_size(N) , &data[0] , &data[0] + N ); }
BOOST_FORCEINLINE nt2::container::table<T,nt2::of_size_<N> > cons(BOOST_PP_ENUM_PARAMS(N, T const& a)) { T const data[] = { BOOST_PP_ENUM_PARAMS(N, a) }; return nt2::container:: table<T,nt2::of_size_<N> > ( nt2::of_size(N) , &data[0] , &data[0] + N ); }
inline saga::impl::wrapper_task < Cpi, Base, RetVal, BOOST_PP_REPEAT(P, GET_TEMP_ARG, _)>* task::create_task( char const *func_name, TR1::shared_ptr<Cpi> cpi, impl::proxy* prxy, void (Base::*sync)(RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid), BOOST_PP_ENUM_BINARY_PARAMS (P, Arg, const& arg), bool (Base::*prep)( RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid)) { return new saga::impl::wrapper_task< Cpi, Base, RetVal, BOOST_PP_REPEAT(P, GET_TEMP_ARG, _)>( func_name, cpi, prxy, sync, BOOST_PP_ENUM_PARAMS(P, arg), prep); }
BOOST_FORCEINLINE nt2::container::table<T, nt2::storage_size_<N> > cons(nt2::of_size_max const& sz, BOOST_PP_ENUM_PARAMS(N, T const& a)) { BOOST_ASSERT_MSG( nt2::numel(sz) <= N, "Incompatible size in cons"); T const data[] = { BOOST_PP_ENUM_PARAMS(N, a) }; return nt2::container:: table<T, nt2::storage_size_<N> > ( sz , &data[0] , &data[0] + N ); }