这篇教程C++ BOOST_ASIO_MOVE_ARG函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BOOST_ASIO_MOVE_ARG函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOST_ASIO_MOVE_ARG函数的具体用法?C++ BOOST_ASIO_MOVE_ARG怎么用?C++ BOOST_ASIO_MOVE_ARG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BOOST_ASIO_MOVE_ARG函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: basic_yield_contextnamespace asio {template< typename Handler >class basic_yield_context {public: basic_yield_context( boost::fibers::context * ctx, Handler& handler) : ctx_( ctx), handler_( handler), ec_( 0) { } basic_yield_context operator[]( boost::system::error_code & ec) { basic_yield_context tmp( * this); tmp.ec_ = & ec; return tmp; }private: boost::fibers::context * ctx_; Handler & handler_; boost::system::error_code * ec_;};typedef basic_yield_context< boost::asio::detail::wrapped_handler< boost::asio::io_service::strand, void(*)(), boost::asio::detail::is_continuation_if_running> > yield_context;template< typename Handler, typename Function >void spawn( boost::asio::io_service & io_service, BOOST_ASIO_MOVE_ARG( Handler) handler, BOOST_ASIO_MOVE_ARG( Function) function);template< typename Handler, typename Function >void spawn( boost::asio::io_service & io_service, basic_yield_context< Handler > ctx, BOOST_ASIO_MOVE_ARG( Function) function);template< typename Function >void spawn( boost::asio::io_service::strand strand, BOOST_ASIO_MOVE_ARG( Function) function);template< typename Function >void spawn( boost::asio::io_service & io_service, BOOST_ASIO_MOVE_ARG( Function) function);}}}
开发者ID:flavioroth,项目名称:boost-fiber,代码行数:49,
示例2: async_accept async_accept(basic_socket<Protocol1, SocketService>& peer, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler, typename enable_if<is_convertible<Protocol, Protocol1>::value>::type* = 0) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a AcceptHandler. BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; return this->get_service().async_accept(this->get_implementation(), peer, static_cast<endpoint_type*>(0), BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); }
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:12,
示例3: async_accept async_accept(implementation_type& impl, basic_socket<Protocol1, SocketService>& peer, endpoint_type* peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler, typename enable_if< is_convertible<Protocol, Protocol1>::value>::type* = 0) { boost::asio::detail::async_result_init<AcceptHandler, void(boost::system::error_code)> init(BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); { boost::recursive_mutex::scoped_lock lock_state(impl->state_mutex); if (impl->closed) { auto handler_to_post = [init]() mutable { init.handler( boost::system::error_code(ssf::error::not_connected, ssf::error::get_ssf_category())); }; this->get_io_service().post(handler_to_post); return init.result.get(); } } boost::system::error_code ec; auto fiber_impl = peer.native_handle(); fiber_impl->p_fib_demux = impl->p_fib_demux; fiber_impl->id.set_local_port(impl->id.local_port()); BOOST_LOG_TRIVIAL(debug) << "fiber acceptor: local port set " << impl->id.local_port(); typedef detail::pending_accept_operation< AcceptHandler, typename Protocol::socket_type> op; typename op::ptr p = { boost::asio::detail::addressof(init.handler), boost_asio_handler_alloc_helpers::allocate(sizeof(op), init.handler), 0}; p.p = new (p.v) op(peer.native_handle(), &(peer.native_handle()->id), init.handler); { boost::recursive_mutex::scoped_lock lock(impl->accept_op_queue_mutex); impl->accept_op_queue.push(p.p); } p.v = p.p = 0; impl->a_queues_handler(); return init.result.get(); }
开发者ID:chrisaljoudi,项目名称:ssf,代码行数:50,
示例4: async_receive_header // @end code // @begin example // void receive_header_handler(const boost::system::error_code& ec) // { // if (!ec) // { // // 请求成功! // } // } // ... // avhttp::http_stream h(io_service); // ... // h.async_recvive_header(boost::bind(&receive_header_handler, boost::asio::placeholders::error)); // @end example template <typename Handler> void async_receive_header(BOOST_ASIO_MOVE_ARG(Handler) handler); ///清除读写缓冲区数据. // @备注: 非线程安全! 不应在正在进行读写操作时进行该操作! AVHTTP_DECL void clear(); ///关闭http_stream. // @失败抛出asio::system_error异常. // @备注: 停止所有正在进行的读写操作, 正在进行的异步调用将回调 // boost::asio::error::operation_aborted错误. AVHTTP_DECL void close(); ///关闭http_stream. // @param ec保存失败信息. // @备注: 停止所有正在进行的读写操作, 正在进行的异步调用将回调 // boost::asio::error::operation_aborted错误.
开发者ID:hicdre,项目名称:avhttp,代码行数:31,
示例5: wait { return service_impl_.cancel(impl, ec); } // Wait for a signaled state. void wait(implementation_type& impl, boost::system::error_code& ec) { service_impl_.wait(impl, ec); } /// Start an asynchronous wait. template <typename WaitHandler> BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, void (boost::system::error_code)) async_wait(implementation_type& impl, BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { boost::asio::detail::async_result_init< WaitHandler, void (boost::system::error_code)> init( BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); service_impl_.async_wait(impl, init.handler); return init.result.get(); }private: // Destroy all user-defined handler objects owned by the service. void shutdown_service() { service_impl_.shutdown_service();
开发者ID:Sandern,项目名称:py-source-sdk-2013,代码行数:31,
示例6: BOOST_ASIO_INITFN_RESULT_TYPE * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using * boost::asio::io_service::post(). * * @note This overload is equivalent to calling: * @code boost::asio::async_read_at( * d, 42, b, * boost::asio::transfer_all(), * handler); @endcode */template <typename AsyncRandomAccessReadDevice, typename Allocator, typename ReadHandler>BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (boost::system::error_code, std::size_t))async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(ReadHandler) handler);/// Start an asynchronous operation to read a certain amount of data at the/// specified offset./** * This function is used to asynchronously read a certain number of bytes of * data from a random access device at the specified offset. The function call * always returns immediately. The asynchronous operation will continue until * one of the following conditions is true: * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's * async_read_some_at function. * * @param d The device from which the data is to be read. The type must support
开发者ID:3Jade,项目名称:Sprawl,代码行数:31,
示例7: BOOST_ASIO_INITFN_RESULT_TYPE * * @param type The type of handshaking to be performed, i.e. as a client or as * a server. * * @param handler The handler to be called when the handshake operation * completes. Copies will be made of the handler as required. The equivalent * function signature of the handler must be: * @code void handler( * const boost::system::error_code& error // Result of operation. * ); @endcode */ template <typename HandshakeHandler> BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (boost::system::error_code)) async_handshake(handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a HandshakeHandler. BOOST_ASIO_HANDSHAKE_HANDLER_CHECK(HandshakeHandler, handler) type_check; boost::asio::detail::async_result_init< HandshakeHandler, void (boost::system::error_code)> init( BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler)); detail::async_io(next_layer_, core_, detail::handshake_op(type), init.handler); return init.result.get(); }
开发者ID:BranchMetrics,项目名称:react-native-branch-deep-linking,代码行数:30,
示例8: spawn/// completes./** * This function is used to launch a new coroutine. * * @param handler A handler to be called when the coroutine exits. More * importantly, the handler provides an execution context (via the the handler * invocation hook) for the coroutine. The handler must have the signature: * @code void handler(); @endcode * * @param function The coroutine function. The function must have the signature: * @code void function(basic_yield_context<Handler> yield); @endcode * * @param attributes Boost.Coroutine attributes used to customise the coroutine. */template <typename Handler, typename Function>void spawn(BOOST_ASIO_MOVE_ARG(Handler) handler, BOOST_ASIO_MOVE_ARG(Function) function, const pdalboost::coroutines::attributes& attributes = pdalboost::coroutines::attributes());/// Start a new stackful coroutine, inheriting the execution context of another./** * This function is used to launch a new coroutine. * * @param ctx Identifies the current coroutine as a parent of the new * coroutine. This specifies that the new coroutine should inherit the * execution context of the parent. For example, if the parent coroutine is * executing in a particular strand, then the new coroutine will execute in the * same strand. * * @param function The coroutine function. The function must have the signature:
开发者ID:GeospatialDaryl,项目名称:PDAL,代码行数:31,
示例9: BOOST_ASIO_INITFN_RESULT_TYPE * @li Constructs an object @c result of type <tt>async_result<Handler></tt>, * initializing the object as <tt>result(handler)</tt>. * * @li Obtains the handler's associated executor object @c ex by performing * <tt>get_associated_executor(handler)</tt>. * * @li Obtains the handler's associated allocator object @c alloc by performing * <tt>get_associated_allocator(handler)</tt>. * * @li Performs <tt>ex.dispatch(std::move(handler), alloc)</tt>. * * @li Returns <tt>result.get()</tt>. */template <typename CompletionToken>BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch( BOOST_ASIO_MOVE_ARG(CompletionToken) token);/// Submits a completion token or function object for execution./** * This function submits an object for execution using the specified executor. * The function object is queued for execution, and is never called from the * current thread prior to returning from <tt>dispatch()</tt>. * * This function has the following effects: * * @li Constructs a function object handler of type @c Handler, initialized * with <tt>handler(forward<CompletionToken>(token))</tt>. * * @li Constructs an object @c result of type <tt>async_result<Handler></tt>, * initializing the object as <tt>result(handler)</tt>. *
开发者ID:ASMlover,项目名称:study,代码行数:31,
示例10: operator template <typename CompletionHandler> void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) const { typedef typename decay<CompletionHandler>::type DecayedHandler; typename associated_executor<DecayedHandler>::type ex( (get_associated_executor)(handler)); typename associated_allocator<DecayedHandler>::type alloc( (get_associated_allocator)(handler)); ex.dispatch(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), alloc); } template <typename CompletionHandler, typename Executor> void operator()(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler, BOOST_ASIO_MOVE_ARG(Executor) ex) const { typedef typename decay<CompletionHandler>::type DecayedHandler; typename associated_allocator<DecayedHandler>::type alloc( (get_associated_allocator)(handler)); ex.dispatch(detail::work_dispatcher<DecayedHandler>( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc); }};} // namespace detailtemplate <typename CompletionToken>
开发者ID:boostorg,项目名称:asio,代码行数:31,
示例11: BOOST_ASIO_MOVE_ARG#include <boost/asio/detail/type_traits.hpp>#include <boost/asio/system_context.hpp>#include <boost/asio/detail/push_options.hpp>namespace boost {namespace asio {inline system_context& system_executor::context() const BOOST_ASIO_NOEXCEPT{ return detail::global<system_context>();}template <typename Function, typename Allocator>void system_executor::dispatch( BOOST_ASIO_MOVE_ARG(Function) f, const Allocator&) const{ typename decay<Function>::type tmp(BOOST_ASIO_MOVE_CAST(Function)(f)); boost_asio_handler_invoke_helpers::invoke(tmp, tmp);}template <typename Function, typename Allocator>void system_executor::post( BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const{ typedef typename decay<Function>::type function_type; system_context& ctx = detail::global<system_context>(); // Allocate and construct an operation to wrap the function. typedef detail::executor_op<function_type, Allocator> op;
开发者ID:PopcornTimeTV,项目名称:PopcornTorrent,代码行数:31,
示例12: BOOST_ASIO_DEFINE_HANDLER_ALLOCATOR_PTR#include <boost/asio/detail/push_options.hpp>namespace boost {namespace asio {namespace detail {template <typename Handler, typename Alloc, typename Operation = scheduler_operation>class executor_op : public Operation{public: BOOST_ASIO_DEFINE_HANDLER_ALLOCATOR_PTR(executor_op); template <typename H> executor_op(BOOST_ASIO_MOVE_ARG(H) h, const Alloc& allocator) : Operation(&executor_op::do_complete), handler_(BOOST_ASIO_MOVE_CAST(H)(h)), allocator_(allocator) { } static void do_complete(void* owner, Operation* base, const boost::system::error_code& /*ec*/, std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. executor_op* o(static_cast<executor_op*>(base)); Alloc allocator(o->allocator_); ptr p = { detail::addressof(allocator), o, o };
开发者ID:PopcornTimeTV,项目名称:PopcornTorrent,代码行数:29,
示例13: BOOST_ASIO_INITFN_RESULT_TYPE * } * } * * ... * * boost::asio::posix::stream_descriptor descriptor(io_context); * ... * descriptor.async_wait( * boost::asio::posix::stream_descriptor::wait_read, * wait_handler); * @endcode */ template <typename WaitHandler> BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, void (boost::system::error_code)) async_wait(wait_type w, BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a WaitHandler. BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; async_completion<WaitHandler, void (boost::system::error_code)> init(handler); this->get_service().async_wait( this->get_implementation(), w, init.completion_handler); return init.result.get(); }protected:
开发者ID:CustomOrthopaedics,项目名称:OTS-Boost,代码行数:31,
示例14: async_accept * { * // Accept succeeded. * } * } * * ... * * boost::asio::ip::tcp::acceptor acceptor(io_service); * ... * boost::asio::ip::tcp::socket socket(io_service); * acceptor.async_accept(socket, accept_handler); * @endcode */ template <typename SocketService, typename AcceptHandler> void async_accept(basic_socket<protocol_type, SocketService>& peer, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a AcceptHandler. BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; this->get_service().async_accept(this->get_implementation(), peer, 0, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); } /// Accept a new connection and obtain the endpoint of the peer /** * This function is used to accept a new connection from a peer into the * given socket, and additionally provide the endpoint of the remote peer. * The function call will block until a new connection has been accepted * successfully or an error occurs.
开发者ID:AndresGalaviz,项目名称:NAO,代码行数:31,
示例15: basic_registration : public basic_io_object<RegistrationService>{public: explicit basic_registration(io_service& io, std::string name) // eventually, this will have to be wstring or // something - name is UTF-8 [dns-sd.h : 883] : basic_io_object<RegistrationService>(io) { } /// Commit a registration template <typename CommitHandler> inline BOOST_ASIO_INITFN_RESULT_TYPE(CommitHandler, void(boost::system::error_code)) async_commit(BOOST_ASIO_MOVE_ARG(CommitHandler) handler) { return this->get_service().async_commit( this->get_implementation(), BOOST_ASIO_MOVE_CAST(CommitHandler)(handler)); }};typedef basic_registration<registration_service> registration;} // namespace dnssd} // namespace ip} // namespace asio} // namespace boost
开发者ID:bkietz,项目名称:boost-asio-dnssd,代码行数:30,
示例16: message if(timeout == Duration::zero()) { //TODO this can return false if it failed impl.send(m); return message(); } else { return impl.send_with_reply_and_block(m, chrono::milliseconds(timeout).count()); } } template<typename MessageHandler> inline BOOST_ASIO_INITFN_RESULT_TYPE(MessageHandler, void(boost::system::error_code, message)) async_send(implementation_type& impl, message& m, BOOST_ASIO_MOVE_ARG(MessageHandler) handler) { // begin asynchronous operation impl.start(this->get_io_service()); boost::asio::detail::async_result_init< MessageHandler, void(boost::system::error_code, message)> init( BOOST_ASIO_MOVE_CAST(MessageHandler)(handler)); detail::async_send_op< BOOST_ASIO_HANDLER_TYPE(MessageHandler, void(boost::system::error_code, message))>( this->get_io_service(), BOOST_ASIO_MOVE_CAST(MessageHandler)(init.handler)) (impl, m); return init.result.get();
开发者ID:10orochi01,项目名称:boost-dbus,代码行数:31,
示例17: flush return stream_impl_.next_layer().flush(); } /// Flush all data from the buffer to the next layer. Returns the number of /// bytes written to the next layer on the last write operation, or 0 if an /// error occurred. std::size_t flush(boost::system::error_code& ec) { return stream_impl_.next_layer().flush(ec); } /// Start an asynchronous flush. template <typename WriteHandler> BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void (boost::system::error_code, std::size_t)) async_flush(BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { return stream_impl_.next_layer().async_flush( BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Write the given data to the stream. Returns the number of bytes written. /// Throws an exception on failure. template <typename ConstBufferSequence> std::size_t write_some(const ConstBufferSequence& buffers) { return stream_impl_.write_some(buffers); } /// Write the given data to the stream. Returns the number of bytes written, /// or 0 if an error occurred.
开发者ID:Bugaa92,项目名称:ProiectAPP,代码行数:31,
示例18: request virtual ~basic_coproto_handle() { //std::cout << "coproto_handle destructor" << std::endl; } std::string request() const { return this->service.request(this->implementation); } void request(const std::string& req) { this->service.request(this->implementation, req); } template <typename DoHandler> BOOST_ASIO_INITFN_RESULT_TYPE(DoHandler, void (boost::system::error_code, std::string)) async_do(BOOST_ASIO_MOVE_ARG(DoHandler) handler) { // HANDLER_CHECK macro needs to be created and called return this->service.async_do(this->implementation, BOOST_ASIO_MOVE_CAST(DoHandler)(handler)); }};typedef basic_coproto_handle<std::string, QueueManager > coproto_handle;#endif /* COPROTO_HANDLE_HPP_ */
开发者ID:ryanpartridge,项目名称:scratchpad,代码行数:30,
示例19: async_wait * @li The timer was cancelled, in which case the handler is passed the error * code boost::asio::error::operation_aborted. * * @param handler The handler to be called when the timer expires. Copies * will be made of the handler as required. The function signature of the * handler must be: * @code void handler( * const boost::system::error_code& error // Result of operation. * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using * boost::asio::io_service::post(). */ template <typename WaitHandler> void async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a WaitHandler. BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; this->service.async_wait(this->implementation, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); }};} // namespace asio} // namespace boost#include <boost/asio/detail/pop_options.hpp>
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:30,
示例20: connect//.........这里部分代码省略......... * @par Example * @code tcp::resolver r(io_service); * tcp::resolver::query q("host", "service"); * tcp::socket s(io_service); * * // ... * * r.async_resolve(q, resolve_handler); * * // ... * * void resolve_handler( * const boost::system::error_code& ec, * tcp::resolver::iterator i) * { * if (!ec) * { * boost::asio::async_connect(s, i, connect_handler); * } * } * * // ... * * void connect_handler( * const boost::system::error_code& ec, * tcp::resolver::iterator i) * { * // ... * } @endcode */template <typename Protocol, typename SocketService, typename Iterator, typename ComposedConnectHandler>void async_connect(basic_socket<Protocol, SocketService>& s, Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);/// Asynchronously establishes a socket connection by trying each endpoint in a/// sequence./** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect * member function, once for each endpoint in the sequence, until a connection * is successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param end An iterator pointing to the end of a sequence of endpoints. * * @param handler The handler to be called when the connect operation * completes. Copies will be made of the handler as required. The function * signature of the handler must be: * @code void handler( * // Result of operation. if the sequence is empty, set to * // boost::asio::error::not_found. Otherwise, contains the * // error from the last connection attempt. * const boost::system::error_code& error, * * // On success, an iterator denoting the successfully * // connected endpoint. Otherwise, the end iterator. * Iterator iterator * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using
开发者ID:13609594236,项目名称:ph-open,代码行数:67,
示例21: BOOST_ASIO_INITFN_RESULT_TYPE * inside this function if the guarantee can be met. If this function is * called from within a handler that was posted or dispatched through the same * strand, then the new handler will be executed immediately. * * The strand's guarantee is in addition to the guarantee provided by the * underlying io_service. The io_service guarantees that the handler will only * be called in a thread in which the io_service's run member function is * currently being invoked. * * @param handler The handler to be called. The strand will make a copy of the * handler object as required. The function signature of the handler must be: * @code void handler(); @endcode */ template <typename CompletionHandler> BOOST_ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a CompletionHandler. BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; detail::async_result_init< CompletionHandler, void ()> init( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); service_.dispatch(impl_, init.handler); return init.result.get(); } /// Request the strand to invoke the given handler and return
开发者ID:AngelBerihuete,项目名称:stan,代码行数:31,
示例22: async_write_tail // void tail_handler(const boost::system::error_code& ec) // { // if (!ec) // { // // 发送成功! // } // } // ... // avhttp::file_upload f(io_service); // ... // f.async_write_tail(handler); // @end example // @备注: handler也可以使用boost.bind来绑定一个符合规定的函数作 // 为async_open的参数handler. template <typename Handler> void async_write_tail(BOOST_ASIO_MOVE_ARG(Handler) handler); ///设置http header选项. AVHTTP_DECL void request_option(request_opts& opts); ///返回http_stream对象的引用. AVHTTP_DECL http_stream& get_http_stream(); ///反回当前file_upload所使用的io_service的引用. AVHTTP_DECL boost::asio::io_service& get_io_service();private: template <typename Handler> struct open_coro;
开发者ID:Ricardo666666,项目名称:avhttp,代码行数:30,
示例23: BOOST_ASIO_INITFN_RESULT_TYPE * @param handler The handler to be called when the accept operation * completes. Copies will be made of the handler as required. The function * signature of the handler must be: * @code void handler( * const lslboost::system::error_code& error // Result of operation. * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using * lslboost::asio::io_service::post(). */ template <typename SocketService, typename AcceptHandler> BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, void (lslboost::system::error_code)) async_accept(basic_socket<protocol_type, SocketService>& peer, endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a AcceptHandler. BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; return this->get_service().async_accept(this->get_implementation(), peer, &peer_endpoint, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); }};} // namespace asio} // namespace lslboost#include <lslboost/asio/detail/pop_options.hpp>
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:30,
示例24: BOOST_ASIO_INITFN_RESULT_TYPE * @param handler The handler to be called when the signal occurs. Copies * will be made of the handler as required. The function signature of the * handler must be: * @code void handler( * const boost::system::error_code& error, // Result of operation. * int signal_number // Indicates which signal occurred. * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using * boost::asio::io_service::post(). */ template <typename SignalHandler> BOOST_ASIO_INITFN_RESULT_TYPE(SignalHandler, void (boost::system::error_code, int)) async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a SignalHandler. BOOST_ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check; return this->service.async_wait(this->implementation, BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); }};} // namespace asio} // namespace boost#include <boost/asio/detail/pop_options.hpp>
开发者ID:8c6794b6,项目名称:supercollider,代码行数:30,
示例25: BOOST_ASIO_INITFN_RESULT_TYPE * * // ... * * void connect_handler( * const boost::system::error_code& ec, * tcp::resolver::iterator i) * { * // ... * } @endcode */template <typename Protocol, typename SocketService, typename Iterator, typename ComposedConnectHandler>BOOST_ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler, void (boost::system::error_code, Iterator))async_connect(basic_socket<Protocol, SocketService>& s, Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);/// Asynchronously establishes a socket connection by trying each endpoint in a/// sequence./** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect * member function, once for each endpoint in the sequence, until a connection * is successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param end An iterator pointing to the end of a sequence of endpoints.
开发者ID:ngzHappy,项目名称:cpc2,代码行数:31,
示例26: dispatch /** * This function is used to ask the strand to execute the given function * object on its underlying executor. The function object will be executed * inside this function if the strand is not otherwise busy and if the * underlying executor's @c dispatch() function is also able to execute the * function before returning. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode * * @param a An allocator that may be used by the executor to allocate the * internal storage needed for function invocation. */ template <typename Function, typename Allocator> void dispatch(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const { detail::strand_executor_service::dispatch(impl_, executor_, BOOST_ASIO_MOVE_CAST(Function)(f), a); } /// Request the strand to invoke the given function object. /** * This function is used to ask the executor to execute the given function * object. The function object will never be executed inside this function. * Instead, it will be scheduled by the underlying executor's defer function. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode *
开发者ID:PopcornTimeTV,项目名称:PopcornTorrent,代码行数:31,
示例27: cancel return service_impl_.clear(impl, ec); } /// Cancel all operations associated with the signal set. lslboost::system::error_code cancel(implementation_type& impl, lslboost::system::error_code& ec) { return service_impl_.cancel(impl, ec); } // Start an asynchronous operation to wait for a signal to be delivered. template <typename SignalHandler> BOOST_ASIO_INITFN_RESULT_TYPE(SignalHandler, void (lslboost::system::error_code, int)) async_wait(implementation_type& impl, BOOST_ASIO_MOVE_ARG(SignalHandler) handler) { detail::async_result_init< SignalHandler, void (lslboost::system::error_code, int)> init( BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); service_impl_.async_wait(impl, init.handler); return init.result.get(); }private: // Destroy all user-defined handler objects owned by the service. void shutdown_service() { service_impl_.shutdown_service();
开发者ID:ALuehmann,项目名称:labstreaminglayer,代码行数:31,
示例28: defined# include <boost/bind.hpp>#else // defined(BOOST_ASIO_HAS_BOOST_BIND)# include <functional>#endif // defined(BOOST_ASIO_HAS_BOOST_BIND)namespace archetypes {#if defined(BOOST_ASIO_HAS_BOOST_BIND)namespace bindns = boost;#else // defined(BOOST_ASIO_HAS_BOOST_BIND)namespace bindns = std;#endif // defined(BOOST_ASIO_HAS_BOOST_BIND)template <typename CompletionToken>BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, void())async_op_0(BOOST_ASIO_MOVE_ARG(CompletionToken) token){ typedef typename boost::asio::async_completion<CompletionToken, void()>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void()> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); ex.post(BOOST_ASIO_MOVE_CAST(handler_type)(completion.completion_handler), a);
开发者ID:boostorg,项目名称:asio,代码行数:30,
示例29: asio_handler_invoke template <typename Function, typename ReadHandler> inline void asio_handler_invoke(const Function& function, buffered_fill_handler<ReadHandler>* this_handler) { boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); }} // namespace detailtemplate <typename Stream>template <typename ReadHandler>BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (boost::system::error_code, std::size_t))buffered_read_stream<Stream>::async_fill( BOOST_ASIO_MOVE_ARG(ReadHandler) handler){ // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; detail::async_result_init< ReadHandler, void (boost::system::error_code, std::size_t)> init( BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); std::size_t previous_size = storage_.size(); storage_.resize(storage_.capacity()); next_layer_.async_read_some( buffer( storage_.data() + previous_size, storage_.size() - previous_size),
开发者ID:8c6794b6,项目名称:supercollider,代码行数:30,
示例30: BOOST_ASIO_INITFN_RESULT_TYPE * * std::size_t bytes_transferred // Number of bytes written from the * // buffers. If an error occurred, * // this will be less than the sum * // of the buffer sizes. * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation of * the handler will be performed in a manner equivalent to using * pdalboost::asio::io_service::post(). */template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void (pdalboost::system::error_code, std::size_t))async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(WriteHandler) handler);/// Start an asynchronous operation to write a certain amount of data to a/// stream./** * This function is used to asynchronously write a certain number of bytes of * data to a stream. The function call always returns immediately. The * asynchronous operation will continue until one of the following conditions * is true: * * @li All of the data in the supplied basic_streambuf has been written. * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * async_write_some function, and is known as a <em>composed operation</em>. The
开发者ID:AsherBond,项目名称:PDAL,代码行数:31,
注:本文中的BOOST_ASIO_MOVE_ARG函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BOOST_ASIO_TEST_CASE函数代码示例 C++ BOOST_ASIO_HANDLER_INVOCATION_BEGIN函数代码示例 |