Exemple #1
0
 ResultType operator()(
    typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2,
    typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4,
    typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6
 ) const {
    return m_fun(p1, p2, p3, p4, p5, p6);
 }
Exemple #2
0
 bool operator()(Ts&&... args) {
   message_handler handler = match_expr_collect(std::forward<Ts>(args)...);
   for ( ; m_pos != m_end; ++m_pos) {
     if (!handler(m_fun(*m_pos))) return false;
   }
   return true;
 }
Exemple #3
0
    ~proxy_function_caller() noexcept(false)
    {
        if (m_called) return;

        m_called = true;
        lua_State* L = m_state;

        int top = lua_gettop(L);

        push_args_from_tuple<1>::apply(L, m_args);
        if (m_fun(L, boost::tuples::length<Tuple>::value, 0))
        {
            assert(lua_gettop(L) == top - m_params + 1);
#ifndef LUABIND_NO_EXCEPTIONS
            throw luabind::error(L);
#else
            error_callback_fun e = get_error_callback();
            if (e) e(L);

            assert(0 && "the lua function threw an error and exceptions are disabled."
                   " If you want to handle the error you can use luabind::set_error_callback()");
            std::terminate();

#endif
        }

        // pops the return values from the function call
        stack_pop pop(L, lua_gettop(L) - top + m_params);
    }
Exemple #4
0
 Result call(Range0& rng0) const
 {
     return m_fun(
         to_cref(boost::begin(rng0)),
         to_cref(boost::end(rng0))
     );
 }
Exemple #5
0
 ResultType operator()(
    typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2,
    typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4,
    typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6,
    typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8,
    typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10
 ) const {
    return m_fun(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
 }
Exemple #6
0
    void coroutine_impl::operator()()
    {
        typedef super_type::context_exit_status context_exit_status;
        context_exit_status status = super_type::ctx_exited_return;

        // loop as long this coroutine has been rebound
        do
        {
            boost::exception_ptr tinfo;
            try
            {
                this->check_exit_state();

                HPX_ASSERT(this->count() > 0);

                {
                    coroutine_self* old_self = coroutine_self::get_self();
                    coroutine_self self(this, old_self);
                    reset_self_on_exit on_exit(&self, old_self);

                    this->m_result_last = m_fun(*this->args());

                    // if this thread returned 'terminated' we need to reset
                    // the functor and the bound arguments
                    if (this->m_result_last.first == terminated)
                        this->reset();
                }

                // return value to other side of the fence
                this->bind_result(&this->m_result_last);
            }
            catch (exit_exception const&) {
                status = super_type::ctx_exited_exit;
                tinfo = boost::current_exception();
                this->reset();            // reset functor
            } catch (boost::exception const&) {
                status = super_type::ctx_exited_abnormally;
                tinfo = boost::current_exception();
                this->reset();
            } catch (std::exception const&) {
                status = super_type::ctx_exited_abnormally;
                tinfo = boost::current_exception();
                this->reset();
            } catch (...) {
                status = super_type::ctx_exited_abnormally;
                tinfo = boost::current_exception();
                this->reset();
            }

            this->do_return(status, std::move(tinfo));

        } while (this->m_state == super_type::ctx_running);

        // should not get here, never
        HPX_ASSERT(this->m_state == super_type::ctx_running);
    }
Exemple #7
0
	void reply(msg const& r)
	{
		observer_ptr o(new (m_rpc.allocator().malloc()) announce_observer(
			m_rpc.allocator(), m_info_hash, m_listen_port, r.write_token));
#ifndef NDEBUG
		o->m_in_constructor = false;
#endif
		m_rpc.invoke(messages::announce_peer, r.addr, o);
		m_fun(r.peers, m_info_hash);
	}
//执行任务
void* Task::Execute()
{
	if ( NULL == m_pObj && NULL == m_fun ) return NULL;
	if ( NULL == m_pObj )
	{
		return m_fun(m_pParam);
	}
	else
	{
		return Executor::CallMethod(m_method, m_pObj, m_pParam);
	}
}
Exemple #9
0
    Ret operator[](const Policies& p)
    {
        typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
        typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;

        m_called = true;
        lua_State* L = m_state;

        int top = lua_gettop(L);

        detail::push_args_from_tuple<1>::apply(L, m_args, p);
        if (m_fun(L, boost::tuples::length<Tuple>::value, 1))
        {
            assert(lua_gettop(L) == top - m_params + 1);
#ifndef LUABIND_NO_EXCEPTIONS
            throw error(L);
#else
            error_callback_fun e = get_error_callback();
            if (e) e(L);

            assert(0 && "the lua function threw an error and exceptions are disabled."
                   " If you want to handle the error you can use luabind::set_error_callback()");
            std::terminate();
#endif
        }

        // pops the return values from the function call
        stack_pop pop(L, lua_gettop(L) - top + m_params);

        if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
        {
#ifndef LUABIND_NO_EXCEPTIONS
            throw cast_failed(L, typeid(Ret));
#else
            cast_failed_callback_fun e = get_cast_failed_callback();
            if (e) e(L, typeid(Ret));

            assert(0 && "the lua function's return value could not be converted."
                   " If you want to handle the error you can use luabind::set_error_callback()");
            std::terminate();

#endif
        }

        return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
    }
Exemple #10
0
 ResultType operator()(
    typename ParentFunctor::Parm1 p1
 ) const {
    return m_fun(p1);
 }
Exemple #11
0
 reference operator[](int n) { return m_fun(m_it[n]); }
Exemple #12
0
 pointer operator->() const { return &m_fun(*m_it); }
Exemple #13
0
 reference operator*() const { return m_fun(*m_it); }
Exemple #14
0
void wxClosure::Invoke( wxEvent* event )
{
  if (event && m_fun) { m_fun((void*)m_fun, m_data, event); }
};
Exemple #15
0
 typename detail::get_callable_trait<F>::result_type operator()(Ts&&... xs) {
   return m_fun(unopt(std::forward<Ts>(xs))...);
 }
Exemple #16
0
 ~scope_guard() {
     if (m_enabled) m_fun();
 }
Exemple #17
0
		~scope_end_impl() { if (m_armed) m_fun(); }
Exemple #18
0
 result_type operator() () const
 {
     return m_fun(m_arg);
 }
Exemple #19
0
 ResultType operator()(
    typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2,
    typename ParentFunctor::Parm1 p3, typename ParentFunctor::Parm4 p4
 ) const {
    return m_fun(p1, p2, p3, p4);
 }
Exemple #20
0
 virtual void run() {
     m_fun(m_arg);
 }
Exemple #21
0
 unit_t operator()(Ts&&... xs) {
   m_fun(unopt(std::forward<Ts>(xs))...);
   return unit;
 }
Exemple #22
0
 ResultType operator()() const {
    return m_fun();
 }
Exemple #23
0
 result_type operator() (T const& arg) const
 {
     return m_fun(arg, m_arg);
 }
Exemple #24
0
  ~generic_guard() {
    m_fun(m_arg);
#ifdef DEBUG
    std::cout << __PRETTY_FUNCTION__ << std::endl; 
#endif
  }
Exemple #25
0
 result_type operator() (T0 const& arg0, T1 const& arg1) const
 {
     return m_fun(m_arg, arg0, arg1);
 }
		virtual void run (){
			m_fun();
		}
void CustomInputEvent::execute()
{
    m_fun();
}
 void handle_timeout() { m_fun(); }
 virtual void invoke() const {
     m_fun();
 }
Exemple #30
0
wxClosure::~wxClosure()
{
  /* call for the last time with a NULL event. Give opportunity to clean up resources */
  if (m_fun) { m_fun((void*)m_fun, m_data, NULL); }
}