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); }
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); }
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>); }
class_definer & def(std::string const &name, R (C::*f)(BOOST_PP_ENUM_PARAMS(n,T)), policies const &p = policies()) { ch_->register_method(name, boost::shared_ptr<details::object_cmd_base>( new details::BOOST_PP_CAT(method,n)<C, R BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n,T)>(f)), p); return *this; }
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; }
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)); }
expectation() : BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_EXPECTATION_INITIALIZE, _) BOOST_PP_COMMA_IF(MOCK_NUM_ARGS) i_( boost::make_shared< unlimited >() ) , file_( "unknown location" ) , line_( 0 ) {} expectation( const char* file, int line ) : BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_EXPECTATION_INITIALIZE, _) BOOST_PP_COMMA_IF(MOCK_NUM_ARGS) i_( boost::make_shared< unlimited >() ) , file_( file ) , line_( line ) {} ~expectation() { for( sequences_cit it = sequences_.begin(); it != sequences_.end(); ++it ) (*it)->remove( this ); } expectation& once() { i_ = boost::make_shared< detail::once >(); return *this; } expectation& never() { i_ = boost::make_shared< detail::never >(); return *this; } expectation& exactly( std::size_t count ) { i_ = boost::make_shared< detail::exactly >( count ); return *this; }
int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) > struct BOOST_PP_CAT(apply_wrap_impl,i_); #define BOOST_PP_ITERATION_PARAMS_2 \ (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, <boost/mpl/apply_wrap.hpp>)) #include BOOST_PP_ITERATE() template< typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) > struct BOOST_PP_CAT(apply_wrap,i_) : BOOST_PP_CAT(apply_wrap_impl,i_)< ::pdalboost::mpl::aux::arity<F,i_>::value , F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) >::type { }; # else // ISO98 C++, with minor concession to vc7 template< typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) #if i_ == 0 , typename has_apply_ = typename aux::has_apply<F>::type #endif > struct BOOST_PP_CAT(apply_wrap,i_) // metafunction forwarding confuses MSVC 7.0
void set() { this->func = &impl::create_function< T, D BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N,Param) >::create; }
// --------------- value_holder --------------- #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) # line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder)) # endif # define N BOOST_PP_ITERATION() # if (N != 0) template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)> # endif value_holder( PyObject* self BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) : m_held( BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) ) { python::detail::initialize_wrapper(self, &this->m_held); } # undef N // --------------- value_holder_back_reference --------------- #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) # line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder_back_reference))
# endif // POINTER_HOLDER_DWA20011215_HPP /* --------------- pointer_holder --------------- */ #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) # line BOOST_PP_LINE(__LINE__, pointer_holder.hpp) # endif # define N BOOST_PP_ITERATION() # if (N != 0) template< BOOST_PP_ENUM_PARAMS_Z(1, N, class A) > # endif pointer_holder(PyObject* self BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) : m_p(new Value( BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) )) { python::detail::initialize_wrapper(self, &*this->m_p); } # undef N /* --------------- pointer_holder_back_reference --------------- */ #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) # line BOOST_PP_LINE(__LINE__, pointer_holder.hpp(pointer_holder_back_reference)) # endif
boost::function<Ret (BOOST_PP_ENUM(n, param, Param))> bind_first(const boost::function<Ret (BOOST_PP_ENUM_PARAMS(m, Param))> &f, const O &o) { return boost::bind(f, o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, _)); }
boost::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))> bind_first(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param)) const, const O &o) { return boost::bind(boost::mem_fn(f), o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, _)); }
#include BOOST_PP_ITERATE() } #endif #elif BOOST_PP_ITERATION_FLAGS() == 1 #define MONOBIND_TYPE( z, n, _ ) typename convert_param< A ## n >::base #define MONOBIND_PARAMS( z, n, _ ) typename convert_param< A ## n >::base a ## n #define MONOBIND_CONVERTER( z, n, _ ) convert_param< A ## n >::convert( a ## n ) #if BOOST_PP_ITERATION() > 0 template < BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), class A ) > #endif static typename convert_result< R >::converted call_function( R(*f)( BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), A ) ) BOOST_PP_COMMA_IF( BOOST_PP_ITERATION() ) BOOST_PP_ENUM( BOOST_PP_ITERATION(), MONOBIND_PARAMS, nil ) ) { return convert_result< R >::convert( f( BOOST_PP_ENUM( BOOST_PP_ITERATION(), MONOBIND_CONVERTER, nil ) ) ); } #undef MONOBIND_PARAMS #undef MONOBIND_CONVERTER #undef MONOBIND_TYPE #elif BOOST_PP_ITERATION_FLAGS() == 2 #define MONOBIND_TYPE( z, n, _ ) typename convert_param< A ## n >::base #define MONOBIND_PARAMS( z, n, _ ) typename convert_param< A ## n >::base a ## n #define MONOBIND_CONVERTER( z, n, _ ) convert_param< A ## n >::convert( a ## n ) #if BOOST_PP_ITERATION() > 0
Proxy_Function build_constructor_(Class (*)(BOOST_PP_ENUM_PARAMS(n, Param))) { typedef boost::shared_ptr<Class> (sig)(BOOST_PP_ENUM_PARAMS(n, Param)); return Proxy_Function(new Proxy_Function_Impl<sig>(boost::function<sig>(&(constructor_<Class BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param)>)))); }