You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wh...@apache.org on 2015/07/07 23:32:34 UTC
[47/50] [abbrv] hadoop git commit: HDFS-8724. Import third_party
libraries into the repository.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b1aba70/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_serial_port.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_serial_port.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_serial_port.hpp
new file mode 100644
index 0000000..007d293
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_serial_port.hpp
@@ -0,0 +1,695 @@
+//
+// basic_serial_port.hpp
+// ~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.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)
+//
+
+#ifndef ASIO_BASIC_SERIAL_PORT_HPP
+#define ASIO_BASIC_SERIAL_PORT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+
+#if defined(ASIO_HAS_SERIAL_PORT) \
+ || defined(GENERATING_DOCUMENTATION)
+
+#include <string>
+#include "asio/basic_io_object.hpp"
+#include "asio/detail/handler_type_requirements.hpp"
+#include "asio/detail/throw_error.hpp"
+#include "asio/error.hpp"
+#include "asio/serial_port_base.hpp"
+#include "asio/serial_port_service.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+/// Provides serial port functionality.
+/**
+ * The basic_serial_port class template provides functionality that is common
+ * to all serial ports.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Unsafe.
+ */
+template <typename SerialPortService = serial_port_service>
+class basic_serial_port
+ : public basic_io_object<SerialPortService>,
+ public serial_port_base
+{
+public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// serial port.
+ typedef typename SerialPortService::native_handle_type native_type;
+
+ /// The native representation of a serial port.
+ typedef typename SerialPortService::native_handle_type native_handle_type;
+
+ /// A basic_serial_port is always the lowest layer.
+ typedef basic_serial_port<SerialPortService> lowest_layer_type;
+
+ /// Construct a basic_serial_port without opening it.
+ /**
+ * This constructor creates a serial port without opening it.
+ *
+ * @param io_service The io_service object that the serial port will use to
+ * dispatch handlers for any asynchronous operations performed on the port.
+ */
+ explicit basic_serial_port(asio::io_service& io_service)
+ : basic_io_object<SerialPortService>(io_service)
+ {
+ }
+
+ /// Construct and open a basic_serial_port.
+ /**
+ * This constructor creates and opens a serial port for the specified device
+ * name.
+ *
+ * @param io_service The io_service object that the serial port will use to
+ * dispatch handlers for any asynchronous operations performed on the port.
+ *
+ * @param device The platform-specific device name for this serial
+ * port.
+ */
+ explicit basic_serial_port(asio::io_service& io_service,
+ const char* device)
+ : basic_io_object<SerialPortService>(io_service)
+ {
+ asio::error_code ec;
+ this->get_service().open(this->get_implementation(), device, ec);
+ asio::detail::throw_error(ec, "open");
+ }
+
+ /// Construct and open a basic_serial_port.
+ /**
+ * This constructor creates and opens a serial port for the specified device
+ * name.
+ *
+ * @param io_service The io_service object that the serial port will use to
+ * dispatch handlers for any asynchronous operations performed on the port.
+ *
+ * @param device The platform-specific device name for this serial
+ * port.
+ */
+ explicit basic_serial_port(asio::io_service& io_service,
+ const std::string& device)
+ : basic_io_object<SerialPortService>(io_service)
+ {
+ asio::error_code ec;
+ this->get_service().open(this->get_implementation(), device, ec);
+ asio::detail::throw_error(ec, "open");
+ }
+
+ /// Construct a basic_serial_port on an existing native serial port.
+ /**
+ * This constructor creates a serial port object to hold an existing native
+ * serial port.
+ *
+ * @param io_service The io_service object that the serial port will use to
+ * dispatch handlers for any asynchronous operations performed on the port.
+ *
+ * @param native_serial_port A native serial port.
+ *
+ * @throws asio::system_error Thrown on failure.
+ */
+ basic_serial_port(asio::io_service& io_service,
+ const native_handle_type& native_serial_port)
+ : basic_io_object<SerialPortService>(io_service)
+ {
+ asio::error_code ec;
+ this->get_service().assign(this->get_implementation(),
+ native_serial_port, ec);
+ asio::detail::throw_error(ec, "assign");
+ }
+
+#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_serial_port from another.
+ /**
+ * This constructor moves a serial port from one object to another.
+ *
+ * @param other The other basic_serial_port 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_serial_port(io_service&) constructor.
+ */
+ basic_serial_port(basic_serial_port&& other)
+ : basic_io_object<SerialPortService>(
+ ASIO_MOVE_CAST(basic_serial_port)(other))
+ {
+ }
+
+ /// Move-assign a basic_serial_port from another.
+ /**
+ * This assignment operator moves a serial port from one object to another.
+ *
+ * @param other The other basic_serial_port 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_serial_port(io_service&) constructor.
+ */
+ basic_serial_port& operator=(basic_serial_port&& other)
+ {
+ basic_io_object<SerialPortService>::operator=(
+ ASIO_MOVE_CAST(basic_serial_port)(other));
+ return *this;
+ }
+#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
+ /// Get a reference to the lowest layer.
+ /**
+ * This function returns a reference to the lowest layer in a stack of
+ * layers. Since a basic_serial_port cannot contain any further layers, it
+ * simply returns a reference to itself.
+ *
+ * @return A reference to the lowest layer in the stack of layers. Ownership
+ * is not transferred to the caller.
+ */
+ lowest_layer_type& lowest_layer()
+ {
+ return *this;
+ }
+
+ /// Get a const reference to the lowest layer.
+ /**
+ * This function returns a const reference to the lowest layer in a stack of
+ * layers. Since a basic_serial_port cannot contain any further layers, it
+ * simply returns a reference to itself.
+ *
+ * @return A const reference to the lowest layer in the stack of layers.
+ * Ownership is not transferred to the caller.
+ */
+ const lowest_layer_type& lowest_layer() const
+ {
+ return *this;
+ }
+
+ /// Open the serial port using the specified device name.
+ /**
+ * This function opens the serial port for the specified device name.
+ *
+ * @param device The platform-specific device name.
+ *
+ * @throws asio::system_error Thrown on failure.
+ */
+ void open(const std::string& device)
+ {
+ asio::error_code ec;
+ this->get_service().open(this->get_implementation(), device, ec);
+ asio::detail::throw_error(ec, "open");
+ }
+
+ /// Open the serial port using the specified device name.
+ /**
+ * This function opens the serial port using the given platform-specific
+ * device name.
+ *
+ * @param device The platform-specific device name.
+ *
+ * @param ec Set the indicate what error occurred, if any.
+ */
+ asio::error_code open(const std::string& device,
+ asio::error_code& ec)
+ {
+ return this->get_service().open(this->get_implementation(), device, ec);
+ }
+
+ /// Assign an existing native serial port to the serial port.
+ /*
+ * This function opens the serial port to hold an existing native serial port.
+ *
+ * @param native_serial_port A native serial port.
+ *
+ * @throws asio::system_error Thrown on failure.
+ */
+ void assign(const native_handle_type& native_serial_port)
+ {
+ asio::error_code ec;
+ this->get_service().assign(this->get_implementation(),
+ native_serial_port, ec);
+ asio::detail::throw_error(ec, "assign");
+ }
+
+ /// Assign an existing native serial port to the serial port.
+ /*
+ * This function opens the serial port to hold an existing native serial port.
+ *
+ * @param native_serial_port A native serial port.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ asio::error_code assign(const native_handle_type& native_serial_port,
+ asio::error_code& ec)
+ {
+ return this->get_service().assign(this->get_implementation(),
+ native_serial_port, ec);
+ }
+
+ /// Determine whether the serial port is open.
+ bool is_open() const
+ {
+ return this->get_service().is_open(this->get_implementation());
+ }
+
+ /// Close the serial port.
+ /**
+ * This function is used to close the serial port. Any asynchronous read or
+ * write operations will be cancelled immediately, and will complete with the
+ * asio::error::operation_aborted error.
+ *
+ * @throws asio::system_error Thrown on failure.
+ */
+ void close()
+ {
+ asio::error_code ec;
+ this->get_service().close(this->get_implementation(), ec);
+ asio::detail::throw_error(ec, "close");
+ }
+
+ /// Close the serial port.
+ /**
+ * This function is used to close the serial port. Any asynchronous read or
+ * write operations will be cancelled immediately, and will complete with the
+ * asio::error::operation_aborted error.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ asio::error_code close(asio::error_code& ec)
+ {
+ return this->get_service().close(this->get_implementation(), ec);
+ }
+
+ /// (Deprecated: Use native_handle().) Get the native serial port
+ /// representation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * serial port. This is intended to allow access to native serial port
+ * functionality that is not otherwise provided.
+ */
+ native_type native()
+ {
+ return this->get_service().native_handle(this->get_implementation());
+ }
+
+ /// Get the native serial port representation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * serial port. This is intended to allow access to native serial port
+ * functionality that is not otherwise provided.
+ */
+ native_handle_type native_handle()
+ {
+ return this->get_service().native_handle(this->get_implementation());
+ }
+
+ /// Cancel all asynchronous operations associated with the serial port.
+ /**
+ * This function causes all outstanding asynchronous read or write operations
+ * to finish immediately, and the handlers for cancelled operations will be
+ * passed the asio::error::operation_aborted error.
+ *
+ * @throws asio::system_error Thrown on failure.
+ */
+ void cancel()
+ {
+ asio::error_code ec;
+ this->get_service().cancel(this->get_implementation(), ec);
+ asio::detail::throw_error(ec, "cancel");
+ }
+
+ /// Cancel all asynchronous operations associated with the serial port.
+ /**
+ * This function causes all outstanding asynchronous read or write operations
+ * to finish immediately, and the handlers for cancelled operations will be
+ * passed the asio::error::operation_aborted error.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ asio::error_code cancel(asio::error_code& ec)
+ {
+ return this->get_service().cancel(this->get_implementation(), ec);
+ }
+
+ /// Send a break sequence to the serial port.
+ /**
+ * This function causes a break sequence of platform-specific duration to be
+ * sent out the serial port.
+ *
+ * @throws asio::system_error Thrown on failure.
+ */
+ void send_break()
+ {
+ asio::error_code ec;
+ this->get_service().send_break(this->get_implementation(), ec);
+ asio::detail::throw_error(ec, "send_break");
+ }
+
+ /// Send a break sequence to the serial port.
+ /**
+ * This function causes a break sequence of platform-specific duration to be
+ * sent out the serial port.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ asio::error_code send_break(asio::error_code& ec)
+ {
+ return this->get_service().send_break(this->get_implementation(), ec);
+ }
+
+ /// Set an option on the serial port.
+ /**
+ * This function is used to set an option on the serial port.
+ *
+ * @param option The option value to be set on the serial port.
+ *
+ * @throws asio::system_error Thrown on failure.
+ *
+ * @sa SettableSerialPortOption @n
+ * asio::serial_port_base::baud_rate @n
+ * asio::serial_port_base::flow_control @n
+ * asio::serial_port_base::parity @n
+ * asio::serial_port_base::stop_bits @n
+ * asio::serial_port_base::character_size
+ */
+ template <typename SettableSerialPortOption>
+ void set_option(const SettableSerialPortOption& option)
+ {
+ asio::error_code ec;
+ this->get_service().set_option(this->get_implementation(), option, ec);
+ asio::detail::throw_error(ec, "set_option");
+ }
+
+ /// Set an option on the serial port.
+ /**
+ * This function is used to set an option on the serial port.
+ *
+ * @param option The option value to be set on the serial port.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @sa SettableSerialPortOption @n
+ * asio::serial_port_base::baud_rate @n
+ * asio::serial_port_base::flow_control @n
+ * asio::serial_port_base::parity @n
+ * asio::serial_port_base::stop_bits @n
+ * asio::serial_port_base::character_size
+ */
+ template <typename SettableSerialPortOption>
+ asio::error_code set_option(const SettableSerialPortOption& option,
+ asio::error_code& ec)
+ {
+ return this->get_service().set_option(
+ this->get_implementation(), option, ec);
+ }
+
+ /// Get an option from the serial port.
+ /**
+ * This function is used to get the current value of an option on the serial
+ * port.
+ *
+ * @param option The option value to be obtained from the serial port.
+ *
+ * @throws asio::system_error Thrown on failure.
+ *
+ * @sa GettableSerialPortOption @n
+ * asio::serial_port_base::baud_rate @n
+ * asio::serial_port_base::flow_control @n
+ * asio::serial_port_base::parity @n
+ * asio::serial_port_base::stop_bits @n
+ * asio::serial_port_base::character_size
+ */
+ template <typename GettableSerialPortOption>
+ void get_option(GettableSerialPortOption& option)
+ {
+ asio::error_code ec;
+ this->get_service().get_option(this->get_implementation(), option, ec);
+ asio::detail::throw_error(ec, "get_option");
+ }
+
+ /// Get an option from the serial port.
+ /**
+ * This function is used to get the current value of an option on the serial
+ * port.
+ *
+ * @param option The option value to be obtained from the serial port.
+ *
+ * @param ec Set to indicate what error occured, if any.
+ *
+ * @sa GettableSerialPortOption @n
+ * asio::serial_port_base::baud_rate @n
+ * asio::serial_port_base::flow_control @n
+ * asio::serial_port_base::parity @n
+ * asio::serial_port_base::stop_bits @n
+ * asio::serial_port_base::character_size
+ */
+ template <typename GettableSerialPortOption>
+ asio::error_code get_option(GettableSerialPortOption& option,
+ asio::error_code& ec)
+ {
+ return this->get_service().get_option(
+ this->get_implementation(), option, ec);
+ }
+
+ /// Write some data to the serial port.
+ /**
+ * This function is used to write data to the serial port. The function call
+ * will block until one or more bytes of the data has been written
+ * successfully, or until an error occurs.
+ *
+ * @param buffers One or more data buffers to be written to the serial port.
+ *
+ * @returns The number of bytes written.
+ *
+ * @throws asio::system_error Thrown on failure. An error code of
+ * asio::error::eof indicates that the connection was closed by the
+ * peer.
+ *
+ * @note The write_some operation may not transmit all of the data to the
+ * peer. Consider using the @ref write function if you need to ensure that
+ * all data is written before the blocking operation completes.
+ *
+ * @par Example
+ * To write a single data buffer use the @ref buffer function as follows:
+ * @code
+ * serial_port.write_some(asio::buffer(data, size));
+ * @endcode
+ * See the @ref buffer documentation for information on writing multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t write_some(const ConstBufferSequence& buffers)
+ {
+ asio::error_code ec;
+ std::size_t s = this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
+ asio::detail::throw_error(ec, "write_some");
+ return s;
+ }
+
+ /// Write some data to the serial port.
+ /**
+ * This function is used to write data to the serial port. The function call
+ * will block until one or more bytes of the data has been written
+ * successfully, or until an error occurs.
+ *
+ * @param buffers One or more data buffers to be written to the serial port.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes written. Returns 0 if an error occurred.
+ *
+ * @note The write_some operation may not transmit all of the data to the
+ * peer. Consider using the @ref write function if you need to ensure that
+ * all data is written before the blocking operation completes.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t write_some(const ConstBufferSequence& buffers,
+ asio::error_code& ec)
+ {
+ return this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
+ }
+
+ /// Start an asynchronous write.
+ /**
+ * This function is used to asynchronously write data to the serial port.
+ * The function call always returns immediately.
+ *
+ * @param buffers One or more data buffers to be written to the serial port.
+ * Although the buffers object may be copied as necessary, ownership of the
+ * underlying memory blocks is retained by the caller, which must guarantee
+ * that they remain valid until the handler is called.
+ *
+ * @param handler The handler to be called when the write operation completes.
+ * Copies will be made of the handler as required. The function signature of
+ * the handler must be:
+ * @code void handler(
+ * const asio::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes written.
+ * ); @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
+ * asio::io_service::post().
+ *
+ * @note The write operation may not transmit all of the data to the peer.
+ * Consider using the @ref async_write function if you need to ensure that all
+ * data is written before the asynchronous operation completes.
+ *
+ * @par Example
+ * To write a single data buffer use the @ref buffer function as follows:
+ * @code
+ * serial_port.async_write_some(asio::buffer(data, size), handler);
+ * @endcode
+ * See the @ref buffer documentation for information on writing multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename ConstBufferSequence, typename WriteHandler>
+ ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ void (asio::error_code, std::size_t))
+ async_write_some(const ConstBufferSequence& buffers,
+ ASIO_MOVE_ARG(WriteHandler) handler)
+ {
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ return this->get_service().async_write_some(this->get_implementation(),
+ buffers, ASIO_MOVE_CAST(WriteHandler)(handler));
+ }
+
+ /// Read some data from the serial port.
+ /**
+ * This function is used to read data from the serial port. The function
+ * call will block until one or more bytes of data has been read successfully,
+ * or until an error occurs.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ *
+ * @returns The number of bytes read.
+ *
+ * @throws asio::system_error Thrown on failure. An error code of
+ * asio::error::eof indicates that the connection was closed by the
+ * peer.
+ *
+ * @note The read_some operation may not read all of the requested number of
+ * bytes. Consider using the @ref read function if you need to ensure that
+ * the requested amount of data is read before the blocking operation
+ * completes.
+ *
+ * @par Example
+ * To read into a single data buffer use the @ref buffer function as follows:
+ * @code
+ * serial_port.read_some(asio::buffer(data, size));
+ * @endcode
+ * See the @ref buffer documentation for information on reading into multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t read_some(const MutableBufferSequence& buffers)
+ {
+ asio::error_code ec;
+ std::size_t s = this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
+ asio::detail::throw_error(ec, "read_some");
+ return s;
+ }
+
+ /// Read some data from the serial port.
+ /**
+ * This function is used to read data from the serial port. The function
+ * call will block until one or more bytes of data has been read successfully,
+ * or until an error occurs.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes read. Returns 0 if an error occurred.
+ *
+ * @note The read_some operation may not read all of the requested number of
+ * bytes. Consider using the @ref read function if you need to ensure that
+ * the requested amount of data is read before the blocking operation
+ * completes.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t read_some(const MutableBufferSequence& buffers,
+ asio::error_code& ec)
+ {
+ return this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
+ }
+
+ /// Start an asynchronous read.
+ /**
+ * This function is used to asynchronously read data from the serial port.
+ * The function call always returns immediately.
+ *
+ * @param buffers One or more buffers into which the data will be read.
+ * Although the buffers object may be copied as necessary, ownership of the
+ * underlying memory blocks is retained by the caller, which must guarantee
+ * that they remain valid until the handler is called.
+ *
+ * @param handler The handler to be called when the read operation completes.
+ * Copies will be made of the handler as required. The function signature of
+ * the handler must be:
+ * @code void handler(
+ * const asio::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes read.
+ * ); @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
+ * asio::io_service::post().
+ *
+ * @note The read operation may not read all of the requested number of bytes.
+ * Consider using the @ref async_read function if you need to ensure that the
+ * requested amount of data is read before the asynchronous operation
+ * completes.
+ *
+ * @par Example
+ * To read into a single data buffer use the @ref buffer function as follows:
+ * @code
+ * serial_port.async_read_some(asio::buffer(data, size), handler);
+ * @endcode
+ * See the @ref buffer documentation for information on reading into multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence, typename ReadHandler>
+ ASIO_INITFN_RESULT_TYPE(ReadHandler,
+ void (asio::error_code, std::size_t))
+ async_read_some(const MutableBufferSequence& buffers,
+ 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.
+ ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ return this->get_service().async_read_some(this->get_implementation(),
+ buffers, ASIO_MOVE_CAST(ReadHandler)(handler));
+ }
+};
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // defined(ASIO_HAS_SERIAL_PORT)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#endif // ASIO_BASIC_SERIAL_PORT_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b1aba70/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_signal_set.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_signal_set.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_signal_set.hpp
new file mode 100644
index 0000000..2dd71ce
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/basic_signal_set.hpp
@@ -0,0 +1,384 @@
+//
+// basic_signal_set.hpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// 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)
+//
+
+#ifndef ASIO_BASIC_SIGNAL_SET_HPP
+#define ASIO_BASIC_SIGNAL_SET_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+
+#include "asio/basic_io_object.hpp"
+#include "asio/detail/handler_type_requirements.hpp"
+#include "asio/detail/throw_error.hpp"
+#include "asio/error.hpp"
+#include "asio/signal_set_service.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+/// Provides signal functionality.
+/**
+ * The basic_signal_set class template provides the ability to perform an
+ * asynchronous wait for one or more signals to occur.
+ *
+ * Most applications will use the asio::signal_set typedef.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe.@n
+ * @e Shared @e objects: Unsafe.
+ *
+ * @par Example
+ * Performing an asynchronous wait:
+ * @code
+ * void handler(
+ * const asio::error_code& error,
+ * int signal_number)
+ * {
+ * if (!error)
+ * {
+ * // A signal occurred.
+ * }
+ * }
+ *
+ * ...
+ *
+ * // Construct a signal set registered for process termination.
+ * asio::signal_set signals(io_service, SIGINT, SIGTERM);
+ *
+ * // Start an asynchronous wait for one of the signals to occur.
+ * signals.async_wait(handler);
+ * @endcode
+ *
+ * @par Queueing of signal notifications
+ *
+ * If a signal is registered with a signal_set, and the signal occurs when
+ * there are no waiting handlers, then the signal notification is queued. The
+ * next async_wait operation on that signal_set will dequeue the notification.
+ * If multiple notifications are queued, subsequent async_wait operations
+ * dequeue them one at a time. Signal notifications are dequeued in order of
+ * ascending signal number.
+ *
+ * If a signal number is removed from a signal_set (using the @c remove or @c
+ * erase member functions) then any queued notifications for that signal are
+ * discarded.
+ *
+ * @par Multiple registration of signals
+ *
+ * The same signal number may be registered with different signal_set objects.
+ * When the signal occurs, one handler is called for each signal_set object.
+ *
+ * Note that multiple registration only works for signals that are registered
+ * using Asio. The application must not also register a signal handler using
+ * functions such as @c signal() or @c sigaction().
+ *
+ * @par Signal masking on POSIX platforms
+ *
+ * POSIX allows signals to be blocked using functions such as @c sigprocmask()
+ * and @c pthread_sigmask(). For signals to be delivered, programs must ensure
+ * that any signals registered using signal_set objects are unblocked in at
+ * least one thread.
+ */
+template <typename SignalSetService = signal_set_service>
+class basic_signal_set
+ : public basic_io_object<SignalSetService>
+{
+public:
+ /// Construct a signal set without adding any signals.
+ /**
+ * This constructor creates a signal set without registering for any signals.
+ *
+ * @param io_service The io_service object that the signal set will use to
+ * dispatch handlers for any asynchronous operations performed on the set.
+ */
+ explicit basic_signal_set(asio::io_service& io_service)
+ : basic_io_object<SignalSetService>(io_service)
+ {
+ }
+
+ /// Construct a signal set and add one signal.
+ /**
+ * This constructor creates a signal set and registers for one signal.
+ *
+ * @param io_service The io_service object that the signal set will use to
+ * dispatch handlers for any asynchronous operations performed on the set.
+ *
+ * @param signal_number_1 The signal number to be added.
+ *
+ * @note This constructor is equivalent to performing:
+ * @code asio::signal_set signals(io_service);
+ * signals.add(signal_number_1); @endcode
+ */
+ basic_signal_set(asio::io_service& io_service, int signal_number_1)
+ : basic_io_object<SignalSetService>(io_service)
+ {
+ asio::error_code ec;
+ this->service.add(this->implementation, signal_number_1, ec);
+ asio::detail::throw_error(ec, "add");
+ }
+
+ /// Construct a signal set and add two signals.
+ /**
+ * This constructor creates a signal set and registers for two signals.
+ *
+ * @param io_service The io_service object that the signal set will use to
+ * dispatch handlers for any asynchronous operations performed on the set.
+ *
+ * @param signal_number_1 The first signal number to be added.
+ *
+ * @param signal_number_2 The second signal number to be added.
+ *
+ * @note This constructor is equivalent to performing:
+ * @code asio::signal_set signals(io_service);
+ * signals.add(signal_number_1);
+ * signals.add(signal_number_2); @endcode
+ */
+ basic_signal_set(asio::io_service& io_service, int signal_number_1,
+ int signal_number_2)
+ : basic_io_object<SignalSetService>(io_service)
+ {
+ asio::error_code ec;
+ this->service.add(this->implementation, signal_number_1, ec);
+ asio::detail::throw_error(ec, "add");
+ this->service.add(this->implementation, signal_number_2, ec);
+ asio::detail::throw_error(ec, "add");
+ }
+
+ /// Construct a signal set and add three signals.
+ /**
+ * This constructor creates a signal set and registers for three signals.
+ *
+ * @param io_service The io_service object that the signal set will use to
+ * dispatch handlers for any asynchronous operations performed on the set.
+ *
+ * @param signal_number_1 The first signal number to be added.
+ *
+ * @param signal_number_2 The second signal number to be added.
+ *
+ * @param signal_number_3 The third signal number to be added.
+ *
+ * @note This constructor is equivalent to performing:
+ * @code asio::signal_set signals(io_service);
+ * signals.add(signal_number_1);
+ * signals.add(signal_number_2);
+ * signals.add(signal_number_3); @endcode
+ */
+ basic_signal_set(asio::io_service& io_service, int signal_number_1,
+ int signal_number_2, int signal_number_3)
+ : basic_io_object<SignalSetService>(io_service)
+ {
+ asio::error_code ec;
+ this->service.add(this->implementation, signal_number_1, ec);
+ asio::detail::throw_error(ec, "add");
+ this->service.add(this->implementation, signal_number_2, ec);
+ asio::detail::throw_error(ec, "add");
+ this->service.add(this->implementation, signal_number_3, ec);
+ asio::detail::throw_error(ec, "add");
+ }
+
+ /// Add a signal to a signal_set.
+ /**
+ * This function adds the specified signal to the set. It has no effect if the
+ * signal is already in the set.
+ *
+ * @param signal_number The signal to be added to the set.
+ *
+ * @throws asio::system_error Thrown on failure.
+ */
+ void add(int signal_number)
+ {
+ asio::error_code ec;
+ this->service.add(this->implementation, signal_number, ec);
+ asio::detail::throw_error(ec, "add");
+ }
+
+ /// Add a signal to a signal_set.
+ /**
+ * This function adds the specified signal to the set. It has no effect if the
+ * signal is already in the set.
+ *
+ * @param signal_number The signal to be added to the set.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ asio::error_code add(int signal_number,
+ asio::error_code& ec)
+ {
+ return this->service.add(this->implementation, signal_number, ec);
+ }
+
+ /// Remove a signal from a signal_set.
+ /**
+ * This function removes the specified signal from the set. It has no effect
+ * if the signal is not in the set.
+ *
+ * @param signal_number The signal to be removed from the set.
+ *
+ * @throws asio::system_error Thrown on failure.
+ *
+ * @note Removes any notifications that have been queued for the specified
+ * signal number.
+ */
+ void remove(int signal_number)
+ {
+ asio::error_code ec;
+ this->service.remove(this->implementation, signal_number, ec);
+ asio::detail::throw_error(ec, "remove");
+ }
+
+ /// Remove a signal from a signal_set.
+ /**
+ * This function removes the specified signal from the set. It has no effect
+ * if the signal is not in the set.
+ *
+ * @param signal_number The signal to be removed from the set.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Removes any notifications that have been queued for the specified
+ * signal number.
+ */
+ asio::error_code remove(int signal_number,
+ asio::error_code& ec)
+ {
+ return this->service.remove(this->implementation, signal_number, ec);
+ }
+
+ /// Remove all signals from a signal_set.
+ /**
+ * This function removes all signals from the set. It has no effect if the set
+ * is already empty.
+ *
+ * @throws asio::system_error Thrown on failure.
+ *
+ * @note Removes all queued notifications.
+ */
+ void clear()
+ {
+ asio::error_code ec;
+ this->service.clear(this->implementation, ec);
+ asio::detail::throw_error(ec, "clear");
+ }
+
+ /// Remove all signals from a signal_set.
+ /**
+ * This function removes all signals from the set. It has no effect if the set
+ * is already empty.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Removes all queued notifications.
+ */
+ asio::error_code clear(asio::error_code& ec)
+ {
+ return this->service.clear(this->implementation, ec);
+ }
+
+ /// Cancel all operations associated with the signal set.
+ /**
+ * This function forces the completion of any pending asynchronous wait
+ * operations against the signal set. The handler for each cancelled
+ * operation will be invoked with the asio::error::operation_aborted
+ * error code.
+ *
+ * Cancellation does not alter the set of registered signals.
+ *
+ * @throws asio::system_error Thrown on failure.
+ *
+ * @note If a registered signal occurred before cancel() is called, then the
+ * handlers for asynchronous wait operations will:
+ *
+ * @li have already been invoked; or
+ *
+ * @li have been queued for invocation in the near future.
+ *
+ * These handlers can no longer be cancelled, and therefore are passed an
+ * error code that indicates the successful completion of the wait operation.
+ */
+ void cancel()
+ {
+ asio::error_code ec;
+ this->service.cancel(this->implementation, ec);
+ asio::detail::throw_error(ec, "cancel");
+ }
+
+ /// Cancel all operations associated with the signal set.
+ /**
+ * This function forces the completion of any pending asynchronous wait
+ * operations against the signal set. The handler for each cancelled
+ * operation will be invoked with the asio::error::operation_aborted
+ * error code.
+ *
+ * Cancellation does not alter the set of registered signals.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note If a registered signal occurred before cancel() is called, then the
+ * handlers for asynchronous wait operations will:
+ *
+ * @li have already been invoked; or
+ *
+ * @li have been queued for invocation in the near future.
+ *
+ * These handlers can no longer be cancelled, and therefore are passed an
+ * error code that indicates the successful completion of the wait operation.
+ */
+ asio::error_code cancel(asio::error_code& ec)
+ {
+ return this->service.cancel(this->implementation, ec);
+ }
+
+ /// Start an asynchronous operation to wait for a signal to be delivered.
+ /**
+ * This function may be used to initiate an asynchronous wait against the
+ * signal set. It always returns immediately.
+ *
+ * For each call to async_wait(), the supplied handler will be called exactly
+ * once. The handler will be called when:
+ *
+ * @li One of the registered signals in the signal set occurs; or
+ *
+ * @li The signal set was cancelled, in which case the handler is passed the
+ * error code asio::error::operation_aborted.
+ *
+ * @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 asio::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
+ * asio::io_service::post().
+ */
+ template <typename SignalHandler>
+ ASIO_INITFN_RESULT_TYPE(SignalHandler,
+ void (asio::error_code, int))
+ async_wait(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.
+ ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check;
+
+ return this->service.async_wait(this->implementation,
+ ASIO_MOVE_CAST(SignalHandler)(handler));
+ }
+};
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_BASIC_SIGNAL_SET_HPP