summaryrefslogtreecommitdiff
path: root/boost/asio/basic_seq_packet_socket.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/basic_seq_packet_socket.hpp')
-rw-r--r--boost/asio/basic_seq_packet_socket.hpp71
1 files changed, 62 insertions, 9 deletions
diff --git a/boost/asio/basic_seq_packet_socket.hpp b/boost/asio/basic_seq_packet_socket.hpp
index a638c71733..630296c38e 100644
--- a/boost/asio/basic_seq_packet_socket.hpp
+++ b/boost/asio/basic_seq_packet_socket.hpp
@@ -2,7 +2,7 @@
// basic_seq_packet_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -171,6 +171,51 @@ public:
BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other));
return *this;
}
+
+ /// Move-construct a basic_seq_packet_socket from a socket of another protocol
+ /// type.
+ /**
+ * This constructor moves a sequenced packet socket from one object to
+ * another.
+ *
+ * @param other The other basic_seq_packet_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_seq_packet_socket(io_service&) constructor.
+ */
+ template <typename Protocol1, typename SeqPacketSocketService1>
+ basic_seq_packet_socket(
+ basic_seq_packet_socket<Protocol1, SeqPacketSocketService1>&& other,
+ typename enable_if<is_convertible<Protocol1, Protocol>::value>::type* = 0)
+ : basic_socket<Protocol, SeqPacketSocketService>(
+ BOOST_ASIO_MOVE_CAST2(basic_seq_packet_socket<
+ Protocol1, SeqPacketSocketService1>)(other))
+ {
+ }
+
+ /// Move-assign a basic_seq_packet_socket from a socket of another protocol
+ /// type.
+ /**
+ * This assignment operator moves a sequenced packet socket from one object to
+ * another.
+ *
+ * @param other The other basic_seq_packet_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_seq_packet_socket(io_service&) constructor.
+ */
+ template <typename Protocol1, typename SeqPacketSocketService1>
+ typename enable_if<is_convertible<Protocol1, Protocol>::value,
+ basic_seq_packet_socket>::type& operator=(
+ basic_seq_packet_socket<Protocol1, SeqPacketSocketService1>&& other)
+ {
+ basic_socket<Protocol, SeqPacketSocketService>::operator=(
+ BOOST_ASIO_MOVE_CAST2(basic_seq_packet_socket<
+ Protocol1, SeqPacketSocketService1>)(other));
+ return *this;
+ }
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Send some data on the socket.
@@ -267,7 +312,9 @@ public:
* std::vector.
*/
template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (boost::system::error_code, std::size_t))
+ async_send(const ConstBufferSequence& buffers,
socket_base::message_flags flags,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
@@ -275,7 +322,7 @@ public:
// not meet the documented type requirements for a WriteHandler.
BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
- this->get_service().async_send(this->get_implementation(),
+ return this->get_service().async_send(this->get_implementation(),
buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
@@ -437,7 +484,9 @@ public:
* std::vector.
*/
template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+ async_receive(const MutableBufferSequence& buffers,
socket_base::message_flags& out_flags,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
@@ -445,8 +494,9 @@ public:
// not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- this->get_service().async_receive(this->get_implementation(), buffers,
- 0, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+ return this->get_service().async_receive(
+ this->get_implementation(), buffers, 0, out_flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
/// Start an asynchronous receive.
@@ -492,7 +542,9 @@ public:
* std::vector.
*/
template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (boost::system::error_code, std::size_t))
+ async_receive(const MutableBufferSequence& buffers,
socket_base::message_flags in_flags,
socket_base::message_flags& out_flags,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
@@ -501,8 +553,9 @@ public:
// not meet the documented type requirements for a ReadHandler.
BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
- this->get_service().async_receive(this->get_implementation(), buffers,
- in_flags, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+ return this->get_service().async_receive(
+ this->get_implementation(), buffers, in_flags, out_flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
};