Ejemplo n.º 1
0
 static T* call(lua_State* L, const constructor<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY,A)>*, const Policies*)
 {
     // L is used, but the metrowerks compiler warns about this before expanding the macros
     L = L;
     BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_DECL, _)
     return new T(BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_PARAM, _));
 }
Ejemplo n.º 2
0
Archivo: wait_n.hpp Proyecto: eile/hpx
    void wait_n(std::size_t n, HPX_ENUM_FWD_ARGS(N, T, f),
        error_code& ec = throws)
    {
        typedef HPX_STD_TUPLE<
            BOOST_PP_ENUM(N, HPX_WAIT_N_SHARED_STATE_FOR_FUTURE, _)>
            result_type;

        result_type lazy_values_(
            BOOST_PP_ENUM(N, HPX_WAIT_N_GET_SHARED_STATE, _));

        if (n == 0)
        {
            return;
        }

        if (n > N)
        {
            HPX_THROWS_IF(ec, hpx::bad_parameter,
                "hpx::lcos::wait_n",
                "number of results to wait for is out of bounds");
            return;
        }

        boost::shared_ptr<detail::wait_n<result_type> > f =
            boost::make_shared<detail::wait_n<result_type> >(
                std::move(lazy_values_), n);

        return (*f.get())();
    }
Ejemplo n.º 3
0
 inline actor<
     typename as_composite<EvalPolicy, BOOST_PP_ENUM_PARAMS(N, T)>::type>
 compose(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
 {
     return actor<
         typename as_composite<EvalPolicy, BOOST_PP_ENUM_PARAMS(N, T)>::type>(
             BOOST_PP_ENUM(N, PHOENIX_AS_ACTOR_CONVERT, _));
 }
Ejemplo n.º 4
0
	static typename
		boost::disable_if<
			boost::is_same<typename FunctionTraits<Function>::Return, void>,
			typename GetReturnStorage<typename FunctionTraits<Function>::Return>::type
		>::type
	invoke(Function ptr, Tuple& args)
	{
		return ((boost::get<0>(args))->*ptr)(BOOST_PP_ENUM(N, GET_ARGUMENT_THIS, args));
	}
Ejemplo n.º 5
0
	static typename
		boost::enable_if<
			boost::is_same<typename FunctionTraits<Function>::Return, void>,
			typename GetReturnStorage<typename FunctionTraits<Function>::Return>::type
		>::type
	invoke(Function ptr, Tuple& args)
	{
		(*ptr)(BOOST_PP_ENUM(N, GET_ARGUMENT, args));
		return 0;
	}
Ejemplo n.º 6
0
 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, _));
 }
Ejemplo n.º 7
0
 void operator()(
     naming::id_type const & cont
   , naming::id_type const & id
   , Vector & args
 ) const
 {
     LLCO_(info)
         << "dataflow apply action "
         << hpx::actions::detail::get_action_name<Action>();
     hpx::apply_c<Action>(
         cont
       , id
       , BOOST_PP_ENUM(N, HPX_LCOS_DATAFLOW_M0, _)
     );
 }
Ejemplo n.º 8
0
int main(int argc , char **argv)
{
  std::string temp;
  google::InitGoogleLogging("exp");
  // 
  std::map<std::string, std::string> opt_map = parse_opts(argc, argv);
  
  if (str_cstr_equals(opt_map["type"], "put") ) {
    // 
  }
  else if (str_cstr_equals(opt_map["type"], "get") ) {
    // 
  }
  else if (str_cstr_equals(opt_map["type"], "ri") ) {
    std::string ib_lports[] = {"1234","1235","1236","1237"};
    std::list<std::string> ib_lport_list(ib_lports, ib_lports + sizeof(ib_lports)/sizeof(*ib_lports) );
    
    PALGO_T palgo_t = MALGO_W_PPM;
    int max_num_key_ver_in_mpbuffer = 10;
    
    SALGO_T salgo_t = SALGO_H;
    COOR_T lcoor_[] = { BOOST_PP_ENUM(NDIM, FIXED_REP, 0) };
    COOR_T ucoor_[] = { BOOST_PP_ENUM(NDIM, FIXED_REP, 16) };
    int sexpand_length = 1;
    
    bool w_prefetch = true;
    
    if (str_cstr_equals(opt_map["join_control_lip"], "") ) {
      boost::shared_ptr<RIManager> ri_manager_(
        new MMRIManager(
          boost::lexical_cast<int>(opt_map["cl_id"] ), boost::lexical_cast<int>(opt_map["base_client_id"] ), boost::lexical_cast<int>(opt_map["num_client"] ),
          intf_to_ip(opt_map["lcontrol_lintf"] ), boost::lexical_cast<int>(opt_map["lcontrol_lport"] ), opt_map["join_lcontrol_lip"], boost::lexical_cast<int>(opt_map["join_lcontrol_lport"] ),
          boost::lexical_cast<int>(opt_map["ds_id"] ), intf_to_ip(opt_map["control_lintf"] ), boost::lexical_cast<int>(opt_map["control_lport"] ), opt_map["join_control_lip"], boost::lexical_cast<int>(opt_map["join_control_lport"] ),
          palgo_t, max_num_key_ver_in_mpbuffer, w_prefetch,
          opt_map["trans_protocol"], intf_to_ip(opt_map["ib_lintf"] ), ib_lport_list,
          intf_to_ip(opt_map["tcp_lintf"] ), boost::lexical_cast<int>(opt_map["tcp_lport"] ),
          opt_map["gftp_lintf"], intf_to_ip(opt_map["gftp_lintf"] ), opt_map["gftp_lport"], opt_map["tmpfs_dir"] ) );
      
      // boost::shared_ptr<RIManager> ri_manager_(
      //   new SMRIManager(
      //     boost::lexical_cast<int>(opt_map["cl_id"] ), boost::lexical_cast<int>(opt_map["base_client_id"] ), boost::lexical_cast<int>(opt_map["num_client"] ),
      //     intf_to_ip(opt_map["lcontrol_lintf"] ), boost::lexical_cast<int>(opt_map["lcontrol_lport"] ), opt_map["join_lcontrol_lip"], boost::lexical_cast<int>(opt_map["join_lcontrol_lport"] ),
      //     boost::lexical_cast<int>(opt_map["ds_id"] ), intf_to_ip(opt_map["control_lintf"] ), boost::lexical_cast<int>(opt_map["control_lport"] ), opt_map["join_control_lip"], boost::lexical_cast<int>(opt_map["join_control_lport"] ),
      //     salgo_t, lcoor_, ucoor_, sexpand_length, w_prefetch,
      //     opt_map["trans_protocol"], intf_to_ip(opt_map["ib_lintf"] ), ib_lport_list,
      //     intf_to_ip(opt_map["tcp_lintf"] ), boost::lexical_cast<int>(opt_map["tcp_lport"] ),
      //     opt_map["gftp_lintf"], intf_to_ip(opt_map["gftp_lintf"] ), opt_map["gftp_lport"], opt_map["tmpfs_dir"] ) );
    }
    else {
      boost::shared_ptr<RIManager> ri_manager_(
        new MSRIManager(
          boost::lexical_cast<int>(opt_map["cl_id"] ), boost::lexical_cast<int>(opt_map["base_client_id"] ), boost::lexical_cast<int>(opt_map["num_client"] ),
          intf_to_ip(opt_map["lcontrol_lintf"] ), boost::lexical_cast<int>(opt_map["lcontrol_lport"] ), opt_map["join_lcontrol_lip"], boost::lexical_cast<int>(opt_map["join_lcontrol_lport"] ),
          boost::lexical_cast<int>(opt_map["ds_id"] ), intf_to_ip(opt_map["control_lintf"] ), boost::lexical_cast<int>(opt_map["control_lport"] ), opt_map["join_control_lip"], boost::lexical_cast<int>(opt_map["join_control_lport"] ),
          opt_map["trans_protocol"], intf_to_ip(opt_map["ib_lintf"] ), ib_lport_list,
          intf_to_ip(opt_map["tcp_lintf"] ), boost::lexical_cast<int>(opt_map["tcp_lport"] ),
          opt_map["gftp_lintf"], intf_to_ip(opt_map["gftp_lintf"] ), opt_map["gftp_lport"], opt_map["tmpfs_dir"] ) );
      
      // boost::shared_ptr<RIManager> ri_manager_(
      //   new SSRIManager(
      //     boost::lexical_cast<int>(opt_map["cl_id"] ), boost::lexical_cast<int>(opt_map["base_client_id"] ), boost::lexical_cast<int>(opt_map["num_client"] ),
      //     intf_to_ip(opt_map["lcontrol_lintf"] ), boost::lexical_cast<int>(opt_map["lcontrol_lport"] ), opt_map["join_lcontrol_lip"], boost::lexical_cast<int>(opt_map["join_lcontrol_lport"] ),
      //     boost::lexical_cast<int>(opt_map["ds_id"] ), intf_to_ip(opt_map["control_lintf"] ), boost::lexical_cast<int>(opt_map["control_lport"] ), opt_map["join_control_lip"], boost::lexical_cast<int>(opt_map["join_control_lport"] ),
      //     opt_map["trans_protocol"], intf_to_ip(opt_map["ib_lintf"] ), ib_lport_list,
      //     intf_to_ip(opt_map["tcp_lintf"] ), boost::lexical_cast<int>(opt_map["tcp_lport"] ),
      //     opt_map["gftp_lintf"], intf_to_ip(opt_map["gftp_lintf"] ), opt_map["gftp_lport"], opt_map["tmpfs_dir"] ) );
    }
    // usleep(1*1000*1000);
    
    std::cout << "Enter\n";
    getline(std::cin, temp);
  }
  else
    log_(ERROR, "unknown type= " << opt_map["type"] )
  
  return 0;
}
Ejemplo n.º 9
0
 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, _));
 }
Ejemplo n.º 10
0
 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, _));
 }
Ejemplo n.º 11
0
 inline tuple<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
 make_tuple(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
 {
     return tuple<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
         BOOST_PP_ENUM_PARAMS(N, _));
 }
Ejemplo n.º 12
0
blitz::Array<float, 1+NUM_STRATIFICATION_DIMENSIONS> EpidemicDataSet::getVariableAtFinalTime(std::string varName)
{
    if(variables_.count(varName) == 0)
    {
        put_flog(LOG_ERROR, "no such variable %s", varName.c_str());
        return blitz::Array<float, 1+NUM_STRATIFICATION_DIMENSIONS>();
    }

    // this should produce a slice that references the data in the original variable array
    int finalTime = variables_[varName].extent(0) - 1;

    blitz::Array<float, 1+NUM_STRATIFICATION_DIMENSIONS> subVar = variables_[varName](finalTime, blitz::Range::all(), BOOST_PP_ENUM(NUM_STRATIFICATION_DIMENSIONS, TEXT, blitz::Range::all()));

    return subVar;
}
Ejemplo n.º 13
0
#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
Ejemplo n.º 14
0
int
# ifdef LUABIND_INVOKE_MEMBER
invoke_member
# else
invoke_normal
# endif
(
    lua_State* L, F const& f, Signature, Policies const&, mpl::long_<N>
# ifdef LUABIND_INVOKE_VOID
  , mpl::true_
# else
  , mpl::false_
# endif
)
{
    typedef typename mpl::begin<Signature>::type first;
# ifndef LUABIND_INVOKE_VOID
    typedef typename mpl::deref<first>::type result_type;
    typedef typename find_conversion_policy<0, Policies>::type result_policy;
    typename mpl::apply_wrap2<
        result_policy, result_type, cpp_to_lua>::type result_converter;
# endif

# if N > 0
#  define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_DECLARE_CONVERTER(n)
#  define BOOST_PP_LOCAL_LIMITS (0,N-1)
#  include BOOST_PP_LOCAL_ITERATE()
# endif

    int const arguments = lua_gettop(L);

# ifndef LUABIND_INVOKE_VOID
    result_converter.apply(
        L,
# endif
# ifdef LUABIND_INVOKE_MEMBER
        (c0.apply(L, LUABIND_DECORATE_TYPE(a0), index0).*f)(
            BOOST_PP_ENUM(BOOST_PP_DEC(N), LUABIND_INVOKE_ARG, BOOST_PP_INC)
        )
# else
#  define LUABIND_INVOKE_IDENTITY(x) x
        f(
            BOOST_PP_ENUM(N, LUABIND_INVOKE_ARG, LUABIND_INVOKE_IDENTITY)
        )
#  undef LUABIND_INVOKE_IDENTITY
# endif
# ifndef LUABIND_INVOKE_VOID
    )
# endif
    ;

# if N > 0
#  define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_CONVERTER_POSTCALL(n)
#  define BOOST_PP_LOCAL_LIMITS (0,N-1)
#  include BOOST_PP_LOCAL_ITERATE()
# endif

    int const results = lua_gettop(L) - arguments;

    int const indices[] = {
        arguments + results BOOST_PP_ENUM_TRAILING_PARAMS(N, index)
    };

    policy_list_postcall<Policies>::apply(L, indices);

    return maybe_yield(L, results, (Policies*)0);
}