示例#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);
 }
示例#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;
 }
示例#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);
    }
示例#4
0
 Result call(Range0& rng0) const
 {
     return m_fun(
         to_cref(boost::begin(rng0)),
         to_cref(boost::end(rng0))
     );
 }
示例#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);
 }
示例#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);
    }
示例#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);
	}
示例#8
0
//执行任务
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);
	}
}
示例#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);
    }
示例#10
0
 ResultType operator()(
    typename ParentFunctor::Parm1 p1
 ) const {
    return m_fun(p1);
 }
示例#11
0
 reference operator[](int n) { return m_fun(m_it[n]); }
示例#12
0
 pointer operator->() const { return &m_fun(*m_it); }
示例#13
0
 reference operator*() const { return m_fun(*m_it); }
示例#14
0
void wxClosure::Invoke( wxEvent* event )
{
  if (event && m_fun) { m_fun((void*)m_fun, m_data, event); }
};
示例#15
0
 typename detail::get_callable_trait<F>::result_type operator()(Ts&&... xs) {
   return m_fun(unopt(std::forward<Ts>(xs))...);
 }
示例#16
0
 ~scope_guard() {
     if (m_enabled) m_fun();
 }
示例#17
0
		~scope_end_impl() { if (m_armed) m_fun(); }
示例#18
0
文件: bind.hpp 项目: 13W/icq-desktop
 result_type operator() () const
 {
     return m_fun(m_arg);
 }
示例#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);
 }
示例#20
0
文件: fiber.cpp 项目: Fresh1/libcppa
 virtual void run() {
     m_fun(m_arg);
 }
示例#21
0
 unit_t operator()(Ts&&... xs) {
   m_fun(unopt(std::forward<Ts>(xs))...);
   return unit;
 }
示例#22
0
 ResultType operator()() const {
    return m_fun();
 }
示例#23
0
文件: bind.hpp 项目: 13W/icq-desktop
 result_type operator() (T const& arg) const
 {
     return m_fun(arg, m_arg);
 }
示例#24
0
  ~generic_guard() {
    m_fun(m_arg);
#ifdef DEBUG
    std::cout << __PRETTY_FUNCTION__ << std::endl; 
#endif
  }
示例#25
0
文件: bind.hpp 项目: 13W/icq-desktop
 result_type operator() (T0 const& arg0, T1 const& arg1) const
 {
     return m_fun(m_arg, arg0, arg1);
 }
示例#26
0
		virtual void run (){
			m_fun();
		}
示例#27
0
void CustomInputEvent::execute()
{
    m_fun();
}
示例#28
0
 void handle_timeout() { m_fun(); }
 virtual void invoke() const {
     m_fun();
 }
示例#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); }
}