diff options
| author | Remko Tronçon <git@el-tramo.be> | 2012-12-23 13:16:26 (GMT) |
|---|---|---|
| committer | Remko Tronçon <git@el-tramo.be> | 2012-12-23 14:43:26 (GMT) |
| commit | 491ddd570a752cf9bda85933bed0c6942e39b1f9 (patch) | |
| tree | 10c25c1be8cc08d0497df1dccd56a10fbb30beee | |
| parent | da7d7a0ca71b80281aa9ff2526290b61ccb0cc60 (diff) | |
| download | swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.zip swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.tar.bz2 | |
Update Boost to 1.52.0.
Change-Id: I1e56bea2600bf2ed9c5b3aba8c4f9d2a0f350e77
1201 files changed, 72838 insertions, 23803 deletions
diff --git a/3rdParty/Boost/01_fix_return_type_warning.diff b/3rdParty/Boost/01_fix_return_type_warning.diff new file mode 100644 index 0000000..3f1fe83 --- /dev/null +++ b/3rdParty/Boost/01_fix_return_type_warning.diff @@ -0,0 +1,13 @@ +diff --git a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp +index 4321a26..c83eac1 100644 +--- a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp ++++ b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp +@@ -27,6 +27,8 @@ + + #include "./timeconv.inl" + ++#pragma GCC diagnostic ignored "-Wreturn-type" ++ + namespace boost + { + namespace detail diff --git a/3rdParty/Boost/SConscript b/3rdParty/Boost/SConscript index f0d438b..6578736 100644 --- a/3rdParty/Boost/SConscript +++ b/3rdParty/Boost/SConscript @@ -65,17 +65,14 @@ elif env.get("BOOST_BUNDLED", False) : "src/libs/signals/src/signal_base.cpp", "src/libs/signals/src/slot.cpp", "src/libs/signals/src/trackable.cpp", - "src/libs/filesystem/v3/src/codecvt_error_category.cpp", - "src/libs/filesystem/v3/src/operations.cpp", - "src/libs/filesystem/v3/src/path.cpp", - "src/libs/filesystem/v3/src/path_traits.cpp", - "src/libs/filesystem/v3/src/portability.cpp", - "src/libs/filesystem/v3/src/unique_path.cpp", - "src/libs/filesystem/v3/src/windows_file_codecvt.cpp", -# "src/libs/filesystem/v2/src/v2_operations.cpp", -# "src/libs/filesystem/v2/src/v2_path.cpp", -# "src/libs/filesystem/v2/src/v2_portability.cpp", - "src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp", + "src/libs/filesystem/src/codecvt_error_category.cpp", + "src/libs/filesystem/src/operations.cpp", + "src/libs/filesystem/src/path.cpp", + "src/libs/filesystem/src/path_traits.cpp", + "src/libs/filesystem/src/portability.cpp", + "src/libs/filesystem/src/unique_path.cpp", + "src/libs/filesystem/src/windows_file_codecvt.cpp", + "src/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp", "src/libs/regex/src/c_regex_traits.cpp", "src/libs/regex/src/cpp_regex_traits.cpp", "src/libs/regex/src/cregex.cpp", diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp index 5b0064f..42621c7 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp @@ -15,6 +15,8 @@ #include <locale> #include <functional> +#include <boost/type_traits/make_unsigned.hpp> + namespace boost { namespace algorithm { namespace detail { @@ -37,7 +39,7 @@ namespace boost { CharT operator ()( CharT Ch ) const { #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) - return std::tolower( Ch); + return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch )); #else return std::tolower<CharT>( Ch, *m_Loc ); #endif @@ -57,7 +59,7 @@ namespace boost { CharT operator ()( CharT Ch ) const { #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) - return std::toupper( Ch); + return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch )); #else return std::toupper<CharT>( Ch, *m_Loc ); #endif diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/classification.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/classification.hpp index fb43955..704d9d2 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/classification.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/classification.hpp @@ -126,7 +126,7 @@ namespace boost { } // Use fixed storage - ::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); + ::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); } // Destructor @@ -206,7 +206,7 @@ namespace boost { } // Copy the data - ::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); + ::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); return *this; } diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/formatter.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/formatter.hpp index bd6a780..8e7b727 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/formatter.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/formatter.hpp @@ -87,6 +87,31 @@ namespace boost { } }; +// dissect format functor ----------------------------------------------------// + + // dissect format functor + template<typename FinderT> + struct dissect_formatF + { + public: + // Construction + dissect_formatF(FinderT Finder) : + m_Finder(Finder) {} + + // Operation + template<typename RangeT> + inline iterator_range< + BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> + operator()(const RangeT& Replace) const + { + return m_Finder(::boost::begin(Replace), ::boost::end(Replace)); + } + + private: + FinderT m_Finder; + }; + + } // namespace detail } // namespace algorithm } // namespace boost diff --git a/3rdParty/Boost/src/boost/algorithm/string/find.hpp b/3rdParty/Boost/src/boost/algorithm/string/find.hpp index 304646d..cc99ca1 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/find.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/find.hpp @@ -228,13 +228,13 @@ namespace boost { //! Find head algorithm /*! Get the head of the input. Head is a prefix of the string of the - given size. If the input is shorter then required, whole input if considered + given size. If the input is shorter then required, whole input is considered to be the head. \param Input An input string \param N Length of the head For N>=0, at most N characters are extracted. - For N<0, size(Input)-|N| characters are extracted. + For N<0, at most size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c Range1T::iterator or @@ -258,13 +258,13 @@ namespace boost { //! Find tail algorithm /*! Get the tail of the input. Tail is a suffix of the string of the - given size. If the input is shorter then required, whole input if considered + given size. If the input is shorter then required, whole input is considered to be the tail. \param Input An input string \param N Length of the tail. For N>=0, at most N characters are extracted. - For N<0, size(Input)-|N| characters are extracted. + For N<0, at most size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c RangeT::iterator or diff --git a/3rdParty/Boost/src/boost/algorithm/string/formatter.hpp b/3rdParty/Boost/src/boost/algorithm/string/formatter.hpp index 50006df..ab5921e 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/formatter.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/formatter.hpp @@ -36,7 +36,7 @@ namespace boost { //! Constant formatter /*! - Construct the \c const_formatter. Const formatter always returns + Constructs a \c const_formatter. Const formatter always returns the same value, regardless of the parameter. \param Format A predefined value used as a result for formating @@ -55,7 +55,7 @@ namespace boost { //! Identity formatter /*! - Construct the \c identity_formatter. Identity formatter always returns + Constructs an \c identity_formatter. Identity formatter always returns the parameter. \return An instance of the \c identity_formatter object. @@ -73,7 +73,7 @@ namespace boost { //! Empty formatter /*! - Construct the \c empty_formatter. Empty formatter always returns an empty + Constructs an \c empty_formatter. Empty formatter always returns an empty sequence. \param Input container used to select a correct value_type for the @@ -89,6 +89,22 @@ namespace boost { BOOST_STRING_TYPENAME range_value<RangeT>::type>(); } + //! Empty formatter + /*! + Constructs a \c dissect_formatter. Dissect formatter uses a specified finder + to extract a portion of the formatted sequence. The first finder's match is returned + as a result + + \param Finder a finder used to select a portion of the formated sequence + \return An instance of the \c dissect_formatter object. + */ + template<typename FinderT> + inline detail::dissect_formatF< FinderT > + dissect_formatter(const FinderT& Finder) + { + return detail::dissect_formatF<FinderT>(Finder); + } + } // namespace algorithm @@ -96,6 +112,7 @@ namespace boost { using algorithm::const_formatter; using algorithm::identity_formatter; using algorithm::empty_formatter; + using algorithm::dissect_formatter; } // namespace boost diff --git a/3rdParty/Boost/src/boost/algorithm/string/iter_find.hpp b/3rdParty/Boost/src/boost/algorithm/string/iter_find.hpp index 9e0245f..e106528 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/iter_find.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/iter_find.hpp @@ -60,7 +60,7 @@ namespace boost { a match). \param Input A container which will be searched. \param Finder A Finder object used for searching - \return A reference the result + \return A reference to the result \note Prior content of the result will be overwritten. */ @@ -122,7 +122,7 @@ namespace boost { Each match is used as a separator of segments. These segments are then returned in the result. - \param Result A 'container container' to container the result of search. + \param Result A 'container container' to contain the result of search. Both outer and inner container must have constructor taking a pair of iterators as an argument. Typical type of the result is @@ -131,7 +131,7 @@ namespace boost { a match). \param Input A container which will be searched. \param Finder A finder object used for searching - \return A reference the result + \return A reference to the result \note Prior content of the result will be overwritten. */ diff --git a/3rdParty/Boost/src/boost/array.hpp b/3rdParty/Boost/src/boost/array.hpp index 85b63a2..fa06fa9 100644 --- a/3rdParty/Boost/src/boost/array.hpp +++ b/3rdParty/Boost/src/boost/array.hpp @@ -13,6 +13,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * + * 14 Apr 2012 - (mtc) Added support for boost::hash * 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility. * 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group. * See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168 @@ -46,6 +47,7 @@ // Handles broken standard libraries better than <iterator> #include <boost/detail/iterator.hpp> #include <boost/throw_exception.hpp> +#include <boost/functional/hash_fwd.hpp> #include <algorithm> // FIXES for broken compilers @@ -118,13 +120,13 @@ namespace boost { // operator[] reference operator[](size_type i) { - BOOST_ASSERT( i < N && "out of range" ); + BOOST_ASSERT_MSG( i < N, "out of range" ); return elems[i]; } const_reference operator[](size_type i) const { - BOOST_ASSERT( i < N && "out of range" ); + BOOST_ASSERT_MSG( i < N, "out of range" ); return elems[i]; } @@ -322,7 +324,7 @@ namespace boost { static reference failed_rangecheck () { std::out_of_range e("attempt to access element of an empty array"); boost::throw_exception(e); -#if defined(BOOST_NO_EXCEPTIONS) || !defined(BOOST_MSVC) +#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__)) // // We need to return something here to keep // some compilers happy: however we will never @@ -427,6 +429,13 @@ namespace boost { } #endif + + template<class T, std::size_t N> + std::size_t hash_value(const array<T,N>& arr) + { + return boost::hash_range(arr.begin(), arr.end()); + } + } /* namespace boost */ diff --git a/3rdParty/Boost/src/boost/asio.hpp b/3rdParty/Boost/src/boost/asio.hpp index 2681806..8205c55 100644 --- a/3rdParty/Boost/src/boost/asio.hpp +++ b/3rdParty/Boost/src/boost/asio.hpp @@ -2,7 +2,7 @@ // asio.hpp // ~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -21,12 +21,15 @@ #include <boost/asio/basic_deadline_timer.hpp> #include <boost/asio/basic_io_object.hpp> #include <boost/asio/basic_raw_socket.hpp> +#include <boost/asio/basic_seq_packet_socket.hpp> #include <boost/asio/basic_serial_port.hpp> +#include <boost/asio/basic_signal_set.hpp> #include <boost/asio/basic_socket_acceptor.hpp> #include <boost/asio/basic_socket_iostream.hpp> #include <boost/asio/basic_socket_streambuf.hpp> #include <boost/asio/basic_stream_socket.hpp> #include <boost/asio/basic_streambuf.hpp> +#include <boost/asio/basic_waitable_timer.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/buffered_read_stream_fwd.hpp> #include <boost/asio/buffered_read_stream.hpp> @@ -36,6 +39,7 @@ #include <boost/asio/buffered_write_stream.hpp> #include <boost/asio/buffers_iterator.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/connect.hpp> #include <boost/asio/datagram_socket_service.hpp> #include <boost/asio/deadline_timer_service.hpp> #include <boost/asio/deadline_timer.hpp> @@ -76,9 +80,12 @@ #include <boost/asio/read.hpp> #include <boost/asio/read_at.hpp> #include <boost/asio/read_until.hpp> +#include <boost/asio/seq_packet_socket_service.hpp> #include <boost/asio/serial_port.hpp> #include <boost/asio/serial_port_base.hpp> #include <boost/asio/serial_port_service.hpp> +#include <boost/asio/signal_set.hpp> +#include <boost/asio/signal_set_service.hpp> #include <boost/asio/socket_acceptor_service.hpp> #include <boost/asio/socket_base.hpp> #include <boost/asio/strand.hpp> @@ -86,9 +93,14 @@ #include <boost/asio/streambuf.hpp> #include <boost/asio/time_traits.hpp> #include <boost/asio/version.hpp> +#include <boost/asio/wait_traits.hpp> +#include <boost/asio/waitable_timer_service.hpp> #include <boost/asio/windows/basic_handle.hpp> +#include <boost/asio/windows/basic_object_handle.hpp> #include <boost/asio/windows/basic_random_access_handle.hpp> #include <boost/asio/windows/basic_stream_handle.hpp> +#include <boost/asio/windows/object_handle.hpp> +#include <boost/asio/windows/object_handle_service.hpp> #include <boost/asio/windows/overlapped_ptr.hpp> #include <boost/asio/windows/random_access_handle.hpp> #include <boost/asio/windows/random_access_handle_service.hpp> diff --git a/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp index a79967f..a773315 100644 --- a/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp @@ -2,7 +2,7 @@ // basic_datagram_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,6 +19,7 @@ #include <cstddef> #include <boost/asio/basic_socket.hpp> #include <boost/asio/datagram_socket_service.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -42,8 +43,12 @@ class basic_datagram_socket : public basic_socket<Protocol, DatagramSocketService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename DatagramSocketService::native_handle_type native_type; + /// The native representation of a socket. - typedef typename DatagramSocketService::native_type native_type; + typedef typename DatagramSocketService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -121,12 +126,48 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_datagram_socket(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_socket) + const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket<Protocol, DatagramSocketService>( io_service, protocol, native_socket) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_datagram_socket from another. + /** + * This constructor moves a datagram socket from one object to another. + * + * @param other The other basic_datagram_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_datagram_socket(io_service&) constructor. + */ + basic_datagram_socket(basic_datagram_socket&& other) + : basic_socket<Protocol, DatagramSocketService>( + BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other)) + { + } + + /// Move-assign a basic_datagram_socket from another. + /** + * This assignment operator moves a datagram socket from one object to + * another. + * + * @param other The other basic_datagram_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_datagram_socket(io_service&) constructor. + */ + basic_datagram_socket& operator=(basic_datagram_socket&& other) + { + basic_socket<Protocol, DatagramSocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Send some data on a connected socket. /** * This function is used to send data on the datagram socket. The function @@ -153,8 +194,9 @@ public: std::size_t send(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.send(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -180,9 +222,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -207,7 +249,8 @@ public: std::size_t send(const ConstBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send(this->implementation, buffers, flags, ec); + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous send on a connected socket. @@ -247,9 +290,15 @@ public: * std::vector. */ template <typename ConstBufferSequence, typename WriteHandler> - void async_send(const ConstBufferSequence& buffers, WriteHandler handler) + void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, 0, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send on a connected socket. @@ -283,9 +332,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, flags, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Send a datagram to the specified endpoint. @@ -318,9 +373,9 @@ public: const endpoint_type& destination) { boost::system::error_code ec; - std::size_t s = this->service.send_to( - this->implementation, buffers, destination, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, 0, ec); + boost::asio::detail::throw_error(ec, "send_to"); return s; } @@ -345,9 +400,9 @@ public: const endpoint_type& destination, socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send_to( - this->implementation, buffers, destination, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, flags, ec); + boost::asio::detail::throw_error(ec, "send_to"); return s; } @@ -372,7 +427,7 @@ public: const endpoint_type& destination, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send_to(this->implementation, + return this->get_service().send_to(this->get_implementation(), buffers, destination, flags, ec); } @@ -415,10 +470,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination, WriteHandler handler) + const endpoint_type& destination, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send_to(this->implementation, buffers, destination, 0, - 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send_to(this->get_implementation(), buffers, + destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send. @@ -451,10 +511,14 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send_to(this->implementation, buffers, destination, - flags, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send_to(this->get_implementation(), buffers, + destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data on a connected socket. @@ -485,9 +549,9 @@ public: std::size_t receive(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -514,9 +578,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -542,7 +606,8 @@ public: std::size_t receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive(this->implementation, buffers, flags, ec); + return this->get_service().receive( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous receive on a connected socket. @@ -582,9 +647,15 @@ public: * std::vector. */ template <typename MutableBufferSequence, typename ReadHandler> - void async_receive(const MutableBufferSequence& buffers, ReadHandler handler) + void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, 0, 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; + + this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive on a connected socket. @@ -617,9 +688,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, flags, 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; + + this->get_service().async_receive(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Receive a datagram with the endpoint of the sender. @@ -653,9 +730,9 @@ public: endpoint_type& sender_endpoint) { boost::system::error_code ec; - std::size_t s = this->service.receive_from( - this->implementation, buffers, sender_endpoint, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, ec); + boost::asio::detail::throw_error(ec, "receive_from"); return s; } @@ -680,9 +757,9 @@ public: endpoint_type& sender_endpoint, socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive_from( - this->implementation, buffers, sender_endpoint, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, ec); + boost::asio::detail::throw_error(ec, "receive_from"); return s; } @@ -707,8 +784,8 @@ public: endpoint_type& sender_endpoint, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive_from(this->implementation, buffers, - sender_endpoint, flags, ec); + return this->get_service().receive_from(this->get_implementation(), + buffers, sender_endpoint, flags, ec); } /// Start an asynchronous receive. @@ -749,10 +826,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint, ReadHandler handler) + endpoint_type& sender_endpoint, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive_from(this->implementation, buffers, - sender_endpoint, 0, 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; + + this->get_service().async_receive_from(this->get_implementation(), buffers, + sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -787,10 +869,14 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive_from(this->implementation, buffers, - sender_endpoint, flags, 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; + + this->get_service().async_receive_from(this->get_implementation(), buffers, + sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_deadline_timer.hpp b/3rdParty/Boost/src/boost/asio/basic_deadline_timer.hpp index 452999d..6baeb7a 100644 --- a/3rdParty/Boost/src/boost/asio/basic_deadline_timer.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_deadline_timer.hpp @@ -2,7 +2,7 @@ // basic_deadline_timer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,6 +19,7 @@ #include <cstddef> #include <boost/asio/basic_io_object.hpp> #include <boost/asio/deadline_timer_service.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -161,7 +162,7 @@ public: { boost::system::error_code ec; this->service.expires_at(this->implementation, expiry_time, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "expires_at"); } /// Constructor to set a particular expiry time relative to now. @@ -180,7 +181,7 @@ public: { boost::system::error_code ec; this->service.expires_from_now(this->implementation, expiry_time, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); } /// Cancel any asynchronous operations that are waiting on the timer. @@ -209,7 +210,7 @@ public: { boost::system::error_code ec; std::size_t s = this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "cancel"); return s; } @@ -240,6 +241,67 @@ public: return this->service.cancel(this->implementation, ec); } + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when cancel_one() 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. + */ + std::size_t cancel_one() + { + boost::system::error_code ec; + std::size_t s = this->service.cancel_one(this->implementation, ec); + boost::asio::detail::throw_error(ec, "cancel_one"); + return s; + } + + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @note If the timer has already expired when cancel_one() 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. + */ + std::size_t cancel_one(boost::system::error_code& ec) + { + return this->service.cancel_one(this->implementation, ec); + } + /// Get the timer's expiry time as an absolute time. /** * This function may be used to obtain the timer's current expiry time. @@ -277,7 +339,7 @@ public: boost::system::error_code ec; std::size_t s = this->service.expires_at( this->implementation, expiry_time, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "expires_at"); return s; } @@ -346,7 +408,7 @@ public: boost::system::error_code ec; std::size_t s = this->service.expires_from_now( this->implementation, expiry_time, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); return s; } @@ -390,7 +452,7 @@ public: { boost::system::error_code ec; this->service.wait(this->implementation, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "wait"); } /// Perform a blocking wait on the timer. @@ -430,9 +492,14 @@ public: * boost::asio::io_service::post(). */ template <typename WaitHandler> - void async_wait(WaitHandler handler) + void async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { - this->service.async_wait(this->implementation, 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)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_io_object.hpp b/3rdParty/Boost/src/boost/asio/basic_io_object.hpp index 8e137e7..0464335 100644 --- a/3rdParty/Boost/src/boost/asio/basic_io_object.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_io_object.hpp @@ -2,7 +2,7 @@ // basic_io_object.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,7 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/detail/push_options.hpp> @@ -24,10 +23,42 @@ namespace boost { namespace asio { +#if defined(BOOST_ASIO_HAS_MOVE) +namespace detail +{ + // Type trait used to determine whether a service supports move. + template <typename IoObjectService> + class service_has_move + { + private: + typedef IoObjectService service_type; + typedef typename service_type::implementation_type implementation_type; + + template <typename T, typename U> + static auto eval(T* t, U* u) -> decltype(t->move_construct(*u, *u), char()); + static char (&eval(...))[2]; + + public: + static const bool value = + sizeof(service_has_move::eval( + static_cast<service_type*>(0), + static_cast<implementation_type*>(0))) == 1; + }; +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Base class for all I/O objects. +/** + * @note All I/O objects are non-copyable. However, when using C++0x, certain + * I/O objects do support move construction and move assignment. + */ +#if !defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) template <typename IoObjectService> +#else +template <typename IoObjectService, + bool Movable = detail::service_has_move<IoObjectService>::value> +#endif class basic_io_object - : private noncopyable { public: /// The type of the service that will be used to provide I/O operations. @@ -36,20 +67,6 @@ public: /// The underlying implementation type of I/O object. typedef typename service_type::implementation_type implementation_type; - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the object. - /** - * This function may be used to obtain the io_service object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_service object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_service& io_service() - { - return service.get_io_service(); - } - /// Get the io_service associated with the object. /** * This function may be used to obtain the io_service object that the I/O @@ -67,7 +84,7 @@ protected: /// Construct a basic_io_object. /** * Performs: - * @code service.construct(implementation); @endcode + * @code get_service().construct(get_implementation()); @endcode */ explicit basic_io_object(boost::asio::io_service& io_service) : service(boost::asio::use_service<IoObjectService>(io_service)) @@ -75,22 +92,147 @@ protected: service.construct(implementation); } +#if defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_io_object. + /** + * Performs: + * @code get_service().move_construct( + * get_implementation(), other.get_implementation()); @endcode + * + * @note Available only for services that support movability, + */ + basic_io_object(basic_io_object&& other); + + /// Move-assign a basic_io_object. + /** + * Performs: + * @code get_service().move_assign(get_implementation(), + * other.get_service(), other.get_implementation()); @endcode + * + * @note Available only for services that support movability, + */ + basic_io_object& operator=(basic_io_object&& other); +#endif // defined(GENERATING_DOCUMENTATION) + /// Protected destructor to prevent deletion through this type. /** * Performs: - * @code service.destroy(implementation); @endcode + * @code get_service().destroy(get_implementation()); @endcode */ ~basic_io_object() { service.destroy(implementation); } - /// The service associated with the I/O object. + /// Get the service associated with the I/O object. + service_type& get_service() + { + return service; + } + + /// Get the service associated with the I/O object. + const service_type& get_service() const + { + return service; + } + + /// (Deprecated: Use get_service().) The service associated with the I/O + /// object. + /** + * @note Available only for services that do not support movability. + */ service_type& service; - /// The underlying implementation of the I/O object. + /// Get the underlying implementation of the I/O object. + implementation_type& get_implementation() + { + return implementation; + } + + /// Get the underlying implementation of the I/O object. + const implementation_type& get_implementation() const + { + return implementation; + } + + /// (Deprecated: Use get_implementation().) The underlying implementation of + /// the I/O object. implementation_type implementation; + +private: + basic_io_object(const basic_io_object&); + basic_io_object& operator=(const basic_io_object&); +}; + +#if defined(BOOST_ASIO_HAS_MOVE) +// Specialisation for movable objects. +template <typename IoObjectService> +class basic_io_object<IoObjectService, true> +{ +public: + typedef IoObjectService service_type; + typedef typename service_type::implementation_type implementation_type; + + boost::asio::io_service& get_io_service() + { + return service_->get_io_service(); + } + +protected: + explicit basic_io_object(boost::asio::io_service& io_service) + : service_(&boost::asio::use_service<IoObjectService>(io_service)) + { + service_->construct(implementation); + } + + basic_io_object(basic_io_object&& other) + : service_(&other.get_service()) + { + service_->move_construct(implementation, other.implementation); + } + + ~basic_io_object() + { + service_->destroy(implementation); + } + + basic_io_object& operator=(basic_io_object&& other) + { + service_->move_assign(implementation, + *other.service_, other.implementation); + service_ = other.service_; + return *this; + } + + service_type& get_service() + { + return *service_; + } + + const service_type& get_service() const + { + return *service_; + } + + implementation_type& get_implementation() + { + return implementation; + } + + const implementation_type& get_implementation() const + { + return implementation; + } + + implementation_type implementation; + +private: + basic_io_object(const basic_io_object&); + void operator=(const basic_io_object&); + + IoObjectService* service_; }; +#endif // defined(BOOST_ASIO_HAS_MOVE) } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/basic_raw_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_raw_socket.hpp index 0e58e7f..90f66c0 100644 --- a/3rdParty/Boost/src/boost/asio/basic_raw_socket.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_raw_socket.hpp @@ -2,7 +2,7 @@ // basic_raw_socket.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> #include <boost/asio/basic_socket.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/raw_socket_service.hpp> @@ -42,8 +43,12 @@ class basic_raw_socket : public basic_socket<Protocol, RawSocketService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename RawSocketService::native_handle_type native_type; + /// The native representation of a socket. - typedef typename RawSocketService::native_type native_type; + typedef typename RawSocketService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -121,12 +126,47 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_raw_socket(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_socket) + const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket<Protocol, RawSocketService>( io_service, protocol, native_socket) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_raw_socket from another. + /** + * This constructor moves a raw socket from one object to another. + * + * @param other The other basic_raw_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_raw_socket(io_service&) constructor. + */ + basic_raw_socket(basic_raw_socket&& other) + : basic_socket<Protocol, RawSocketService>( + BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other)) + { + } + + /// Move-assign a basic_raw_socket from another. + /** + * This assignment operator moves a raw socket from one object to another. + * + * @param other The other basic_raw_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_raw_socket(io_service&) constructor. + */ + basic_raw_socket& operator=(basic_raw_socket&& other) + { + basic_socket<Protocol, RawSocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Send some data on a connected socket. /** * This function is used to send data on the raw socket. The function call @@ -152,8 +192,9 @@ public: std::size_t send(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.send(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -178,9 +219,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -204,7 +245,8 @@ public: std::size_t send(const ConstBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send(this->implementation, buffers, flags, ec); + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous send on a connected socket. @@ -243,9 +285,15 @@ public: * std::vector. */ template <typename ConstBufferSequence, typename WriteHandler> - void async_send(const ConstBufferSequence& buffers, WriteHandler handler) + void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, 0, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send on a connected socket. @@ -278,9 +326,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, flags, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Send raw data to the specified endpoint. @@ -313,9 +367,9 @@ public: const endpoint_type& destination) { boost::system::error_code ec; - std::size_t s = this->service.send_to( - this->implementation, buffers, destination, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, 0, ec); + boost::asio::detail::throw_error(ec, "send_to"); return s; } @@ -340,9 +394,9 @@ public: const endpoint_type& destination, socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send_to( - this->implementation, buffers, destination, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, flags, ec); + boost::asio::detail::throw_error(ec, "send_to"); return s; } @@ -367,7 +421,7 @@ public: const endpoint_type& destination, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send_to(this->implementation, + return this->get_service().send_to(this->get_implementation(), buffers, destination, flags, ec); } @@ -410,10 +464,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination, WriteHandler handler) + const endpoint_type& destination, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send_to(this->implementation, buffers, destination, 0, - 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send_to(this->get_implementation(), buffers, + destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send. @@ -446,10 +505,14 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send_to(this->implementation, buffers, destination, - flags, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send_to(this->get_implementation(), buffers, + destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data on a connected socket. @@ -480,9 +543,9 @@ public: std::size_t receive(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -509,9 +572,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -537,7 +600,8 @@ public: std::size_t receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive(this->implementation, buffers, flags, ec); + return this->get_service().receive( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous receive on a connected socket. @@ -577,9 +641,15 @@ public: * std::vector. */ template <typename MutableBufferSequence, typename ReadHandler> - void async_receive(const MutableBufferSequence& buffers, ReadHandler handler) + void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, 0, 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; + + this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive on a connected socket. @@ -612,9 +682,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, flags, 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; + + this->get_service().async_receive(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Receive raw data with the endpoint of the sender. @@ -648,9 +724,9 @@ public: endpoint_type& sender_endpoint) { boost::system::error_code ec; - std::size_t s = this->service.receive_from( - this->implementation, buffers, sender_endpoint, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, ec); + boost::asio::detail::throw_error(ec, "receive_from"); return s; } @@ -675,9 +751,9 @@ public: endpoint_type& sender_endpoint, socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive_from( - this->implementation, buffers, sender_endpoint, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, ec); + boost::asio::detail::throw_error(ec, "receive_from"); return s; } @@ -702,8 +778,8 @@ public: endpoint_type& sender_endpoint, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive_from(this->implementation, buffers, - sender_endpoint, flags, ec); + return this->get_service().receive_from(this->get_implementation(), + buffers, sender_endpoint, flags, ec); } /// Start an asynchronous receive. @@ -744,10 +820,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint, ReadHandler handler) + endpoint_type& sender_endpoint, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive_from(this->implementation, buffers, - sender_endpoint, 0, 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; + + this->get_service().async_receive_from(this->get_implementation(), buffers, + sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -782,10 +863,14 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive_from(this->implementation, buffers, - sender_endpoint, flags, 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; + + this->get_service().async_receive_from(this->get_implementation(), buffers, + sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_seq_packet_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_seq_packet_socket.hpp new file mode 100644 index 0000000..a638c71 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/basic_seq_packet_socket.hpp @@ -0,0 +1,514 @@ +// +// basic_seq_packet_socket.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP +#define BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <cstddef> +#include <boost/asio/basic_socket.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/seq_packet_socket_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Provides sequenced packet socket functionality. +/** + * The basic_seq_packet_socket class template provides asynchronous and blocking + * sequenced packet socket functionality. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template <typename Protocol, + typename SeqPacketSocketService = seq_packet_socket_service<Protocol> > +class basic_seq_packet_socket + : public basic_socket<Protocol, SeqPacketSocketService> +{ +public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename SeqPacketSocketService::native_handle_type native_type; + + /// The native representation of a socket. + typedef typename SeqPacketSocketService::native_handle_type + native_handle_type; + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// Construct a basic_seq_packet_socket without opening it. + /** + * This constructor creates a sequenced packet socket without opening it. The + * socket needs to be opened and then connected or accepted before data can + * be sent or received on it. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + */ + explicit basic_seq_packet_socket(boost::asio::io_service& io_service) + : basic_socket<Protocol, SeqPacketSocketService>(io_service) + { + } + + /// Construct and open a basic_seq_packet_socket. + /** + * This constructor creates and opens a sequenced_packet socket. The socket + * needs to be connected or accepted before data can be sent or received on + * it. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @throws boost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(boost::asio::io_service& io_service, + const protocol_type& protocol) + : basic_socket<Protocol, SeqPacketSocketService>(io_service, protocol) + { + } + + /// Construct a basic_seq_packet_socket, opening it and binding it to the + /// given local endpoint. + /** + * This constructor creates a sequenced packet socket and automatically opens + * it bound to the specified endpoint on the local machine. The protocol used + * is the protocol associated with the given endpoint. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param endpoint An endpoint on the local machine to which the sequenced + * packet socket will be bound. + * + * @throws boost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(boost::asio::io_service& io_service, + const endpoint_type& endpoint) + : basic_socket<Protocol, SeqPacketSocketService>(io_service, endpoint) + { + } + + /// Construct a basic_seq_packet_socket on an existing native socket. + /** + * This constructor creates a sequenced packet socket object to hold an + * existing native socket. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @param native_socket The new underlying socket implementation. + * + * @throws boost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(boost::asio::io_service& io_service, + const protocol_type& protocol, const native_handle_type& native_socket) + : basic_socket<Protocol, SeqPacketSocketService>( + io_service, protocol, native_socket) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_seq_packet_socket from another. + /** + * 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. + */ + basic_seq_packet_socket(basic_seq_packet_socket&& other) + : basic_socket<Protocol, SeqPacketSocketService>( + BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other)) + { + } + + /// Move-assign a basic_seq_packet_socket from another. + /** + * 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. + */ + basic_seq_packet_socket& operator=(basic_seq_packet_socket&& other) + { + basic_socket<Protocol, SeqPacketSocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Send some data on the socket. + /** + * This function is used to send data on the sequenced packet socket. The + * function call will block until the data has been sent successfully, or an + * until error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @returns The number of bytes sent. + * + * @throws boost::system::system_error Thrown on failure. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * socket.send(boost::asio::buffer(data, size), 0); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename ConstBufferSequence> + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags) + { + boost::system::error_code ec; + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "send"); + return s; + } + + /// Send some data on the socket. + /** + * This function is used to send data on the sequenced packet socket. The + * function call will block the data has been sent successfully, or an until + * error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes sent. Returns 0 if an error occurred. + * + * @note The send 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 send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, boost::system::error_code& ec) + { + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); + } + + /// Start an asynchronous send. + /** + * This function is used to asynchronously send data on the sequenced packet + * socket. The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent on the socket. 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 flags Flags specifying how the send call is to be made. + * + * @param handler The handler to be called when the send operation completes. + * 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. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @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(). + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * socket.async_send(boost::asio::buffer(data, size), 0, handler); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename ConstBufferSequence, typename WriteHandler> + void async_send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Receive some data on the socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @returns The number of bytes received. + * + * @throws boost::system::system_error Thrown on failure. An error code of + * boost::asio::error::eof indicates that the connection was closed by the + * peer. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.receive(boost::asio::buffer(data, size), out_flags); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename MutableBufferSequence> + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags& out_flags) + { + boost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, out_flags, ec); + boost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on the socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @returns The number of bytes received. + * + * @throws boost::system::system_error Thrown on failure. An error code of + * boost::asio::error::eof indicates that the connection was closed by the + * peer. + * + * @note The receive operation may not receive 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 receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.receive(boost::asio::buffer(data, size), 0, out_flags); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename MutableBufferSequence> + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags) + { + boost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, in_flags, out_flags, ec); + boost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes received. Returns 0 if an error occurred. + * + * @note The receive operation may not receive 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 receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + return this->get_service().receive(this->get_implementation(), + buffers, in_flags, out_flags, ec); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive data from the sequenced + * packet socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * 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 out_flags Once the asynchronous operation completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. The caller must guarantee that the referenced + * variable remains valid until the handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. 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. + * std::size_t bytes_transferred // Number of bytes received. + * ); @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(). + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.async_receive(boost::asio::buffer(data, size), out_flags, handler); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename MutableBufferSequence, typename ReadHandler> + void async_receive(const MutableBufferSequence& buffers, + socket_base::message_flags& out_flags, + 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; + + this->get_service().async_receive(this->get_implementation(), buffers, + 0, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive data from the sequenced + * data socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * 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 in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags Once the asynchronous operation completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. The caller must guarantee that the referenced + * variable remains valid until the handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. 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. + * std::size_t bytes_transferred // Number of bytes received. + * ); @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(). + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.async_receive( + * boost::asio::buffer(data, size), + * 0, out_flags, handler); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename MutableBufferSequence, typename ReadHandler> + void async_receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, + 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; + + this->get_service().async_receive(this->get_implementation(), buffers, + in_flags, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP diff --git a/3rdParty/Boost/src/boost/asio/basic_serial_port.hpp b/3rdParty/Boost/src/boost/asio/basic_serial_port.hpp index 744fd3b..31ee955 100644 --- a/3rdParty/Boost/src/boost/asio/basic_serial_port.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_serial_port.hpp @@ -2,7 +2,7 @@ // basic_serial_port.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -23,6 +23,7 @@ #include <string> #include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/serial_port_base.hpp> @@ -48,8 +49,12 @@ class basic_serial_port 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_type native_type; + 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; @@ -82,8 +87,8 @@ public: : basic_io_object<SerialPortService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, device, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), device, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Construct and open a basic_serial_port. @@ -102,8 +107,8 @@ public: : basic_io_object<SerialPortService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, device, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), device, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Construct a basic_serial_port on an existing native serial port. @@ -119,13 +124,49 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_serial_port(boost::asio::io_service& io_service, - const native_type& native_serial_port) + const native_handle_type& native_serial_port) : basic_io_object<SerialPortService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, native_serial_port, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + native_serial_port, ec); + boost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_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>( + BOOST_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=( + BOOST_ASIO_MOVE_CAST(basic_serial_port)(other)); + return *this; } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get a reference to the lowest layer. /** @@ -166,8 +207,8 @@ public: void open(const std::string& device) { boost::system::error_code ec; - this->service.open(this->implementation, device, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), device, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Open the serial port using the specified device name. @@ -182,7 +223,7 @@ public: boost::system::error_code open(const std::string& device, boost::system::error_code& ec) { - return this->service.open(this->implementation, device, ec); + return this->get_service().open(this->get_implementation(), device, ec); } /// Assign an existing native serial port to the serial port. @@ -193,11 +234,12 @@ public: * * @throws boost::system::system_error Thrown on failure. */ - void assign(const native_type& native_serial_port) + void assign(const native_handle_type& native_serial_port) { boost::system::error_code ec; - this->service.assign(this->implementation, native_serial_port, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + native_serial_port, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assign an existing native serial port to the serial port. @@ -208,16 +250,17 @@ public: * * @param ec Set to indicate what error occurred, if any. */ - boost::system::error_code assign(const native_type& native_serial_port, + boost::system::error_code assign(const native_handle_type& native_serial_port, boost::system::error_code& ec) { - return this->service.assign(this->implementation, native_serial_port, 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->service.is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Close the serial port. @@ -231,8 +274,8 @@ public: void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the serial port. @@ -245,10 +288,11 @@ public: */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native serial port representation. + /// (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 @@ -256,7 +300,18 @@ public: */ native_type native() { - return this->service.native(this->implementation); + 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. @@ -270,8 +325,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the serial port. @@ -284,7 +339,7 @@ public: */ boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Send a break sequence to the serial port. @@ -297,8 +352,8 @@ public: void send_break() { boost::system::error_code ec; - this->service.send_break(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().send_break(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "send_break"); } /// Send a break sequence to the serial port. @@ -310,7 +365,7 @@ public: */ boost::system::error_code send_break(boost::system::error_code& ec) { - return this->service.send_break(this->implementation, ec); + return this->get_service().send_break(this->get_implementation(), ec); } /// Set an option on the serial port. @@ -332,8 +387,8 @@ public: void set_option(const SettableSerialPortOption& option) { boost::system::error_code ec; - this->service.set_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().set_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "set_option"); } /// Set an option on the serial port. @@ -355,7 +410,8 @@ public: boost::system::error_code set_option(const SettableSerialPortOption& option, boost::system::error_code& ec) { - return this->service.set_option(this->implementation, option, ec); + return this->get_service().set_option( + this->get_implementation(), option, ec); } /// Get an option from the serial port. @@ -378,8 +434,8 @@ public: void get_option(GettableSerialPortOption& option) { boost::system::error_code ec; - this->service.get_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().get_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "get_option"); } /// Get an option from the serial port. @@ -402,7 +458,8 @@ public: boost::system::error_code get_option(GettableSerialPortOption& option, boost::system::error_code& ec) { - return this->service.get_option(this->implementation, option, ec); + return this->get_service().get_option( + this->get_implementation(), option, ec); } /// Write some data to the serial port. @@ -436,8 +493,9 @@ public: std::size_t write_some(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.write_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().write_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "write_some"); return s; } @@ -461,7 +519,8 @@ public: std::size_t write_some(const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.write_some(this->implementation, buffers, ec); + return this->get_service().write_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous write. @@ -501,9 +560,14 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_write_some(this->implementation, buffers, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_write_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the serial port. @@ -538,8 +602,9 @@ public: std::size_t read_some(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.read_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().read_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "read_some"); return s; } @@ -564,7 +629,8 @@ public: std::size_t read_some(const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.read_some(this->implementation, buffers, ec); + return this->get_service().read_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous read. @@ -605,9 +671,14 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_read_some(this->implementation, buffers, 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; + + this->get_service().async_read_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_signal_set.hpp b/3rdParty/Boost/src/boost/asio/basic_signal_set.hpp new file mode 100644 index 0000000..ddbef87 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/basic_signal_set.hpp @@ -0,0 +1,384 @@ +// +// basic_signal_set.hpp +// ~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_BASIC_SIGNAL_SET_HPP +#define BOOST_ASIO_BASIC_SIGNAL_SET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/signal_set_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +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 boost::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 boost::system::error_code& error, + * int signal_number) + * { + * if (!error) + * { + * // A signal occurred. + * } + * } + * + * ... + * + * // Construct a signal set registered for process termination. + * boost::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(boost::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 boost::asio::signal_set signals(io_service); + * signals.add(signal_number_1); @endcode + */ + basic_signal_set(boost::asio::io_service& io_service, int signal_number_1) + : basic_io_object<SignalSetService>(io_service) + { + boost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + boost::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 boost::asio::signal_set signals(io_service); + * signals.add(signal_number_1); + * signals.add(signal_number_2); @endcode + */ + basic_signal_set(boost::asio::io_service& io_service, int signal_number_1, + int signal_number_2) + : basic_io_object<SignalSetService>(io_service) + { + boost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + boost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_2, ec); + boost::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 boost::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(boost::asio::io_service& io_service, int signal_number_1, + int signal_number_2, int signal_number_3) + : basic_io_object<SignalSetService>(io_service) + { + boost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + boost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_2, ec); + boost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_3, ec); + boost::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 boost::system::system_error Thrown on failure. + */ + void add(int signal_number) + { + boost::system::error_code ec; + this->service.add(this->implementation, signal_number, ec); + boost::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. + */ + boost::system::error_code add(int signal_number, + boost::system::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 boost::system::system_error Thrown on failure. + * + * @note Removes any notifications that have been queued for the specified + * signal number. + */ + void remove(int signal_number) + { + boost::system::error_code ec; + this->service.remove(this->implementation, signal_number, ec); + boost::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. + */ + boost::system::error_code remove(int signal_number, + boost::system::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 boost::system::system_error Thrown on failure. + * + * @note Removes all queued notifications. + */ + void clear() + { + boost::system::error_code ec; + this->service.clear(this->implementation, ec); + boost::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. + */ + boost::system::error_code clear(boost::system::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 boost::asio::error::operation_aborted + * error code. + * + * Cancellation does not alter the set of registered signals. + * + * @throws boost::system::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() + { + boost::system::error_code ec; + this->service.cancel(this->implementation, ec); + boost::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 boost::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. + */ + boost::system::error_code cancel(boost::system::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 boost::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 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> + void 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; + + this->service.async_wait(this->implementation, + BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); + } +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_BASIC_SIGNAL_SET_HPP diff --git a/3rdParty/Boost/src/boost/asio/basic_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_socket.hpp index 11ce5c9..c9e2045 100644 --- a/3rdParty/Boost/src/boost/asio/basic_socket.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_socket.hpp @@ -2,7 +2,7 @@ // basic_socket.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/socket_base.hpp> @@ -41,8 +42,12 @@ class basic_socket public socket_base { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename SocketService::native_handle_type native_type; + /// The native representation of a socket. - typedef typename SocketService::native_type native_type; + typedef typename SocketService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -81,8 +86,8 @@ public: : basic_io_object<SocketService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, protocol, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Construct a basic_socket, opening it and binding it to the given local @@ -105,10 +110,11 @@ public: : basic_io_object<SocketService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, endpoint.protocol(), ec); - boost::asio::detail::throw_error(ec); - this->service.bind(this->implementation, endpoint, ec); - boost::asio::detail::throw_error(ec); + const protocol_type protocol = endpoint.protocol(); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); + this->get_service().bind(this->get_implementation(), endpoint, ec); + boost::asio::detail::throw_error(ec, "bind"); } /// Construct a basic_socket on an existing native socket. @@ -125,14 +131,50 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_socket(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_socket) + const protocol_type& protocol, const native_handle_type& native_socket) : basic_io_object<SocketService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, protocol, native_socket, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + protocol, native_socket, ec); + boost::asio::detail::throw_error(ec, "assign"); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_socket from another. + /** + * This constructor moves a socket from one object to another. + * + * @param other The other basic_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_socket(io_service&) constructor. + */ + basic_socket(basic_socket&& other) + : basic_io_object<SocketService>( + BOOST_ASIO_MOVE_CAST(basic_socket)(other)) + { + } + + /// Move-assign a basic_socket from another. + /** + * This assignment operator moves a socket from one object to another. + * + * @param other The other basic_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_socket(io_service&) constructor. + */ + basic_socket& operator=(basic_socket&& other) + { + basic_io_object<SocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket)(other)); + return *this; + } +#endif // defined(BOOST_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 @@ -178,8 +220,8 @@ public: void open(const protocol_type& protocol = protocol_type()) { boost::system::error_code ec; - this->service.open(this->implementation, protocol, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Open the socket using the specified protocol. @@ -204,7 +246,7 @@ public: boost::system::error_code open(const protocol_type& protocol, boost::system::error_code& ec) { - return this->service.open(this->implementation, protocol, ec); + return this->get_service().open(this->get_implementation(), protocol, ec); } /// Assign an existing native socket to the socket. @@ -217,11 +259,13 @@ public: * * @throws boost::system::system_error Thrown on failure. */ - void assign(const protocol_type& protocol, const native_type& native_socket) + void assign(const protocol_type& protocol, + const native_handle_type& native_socket) { boost::system::error_code ec; - this->service.assign(this->implementation, protocol, native_socket, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + protocol, native_socket, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assign an existing native socket to the socket. @@ -235,16 +279,16 @@ public: * @param ec Set to indicate what error occurred, if any. */ boost::system::error_code assign(const protocol_type& protocol, - const native_type& native_socket, boost::system::error_code& ec) + const native_handle_type& native_socket, boost::system::error_code& ec) { - return this->service.assign(this->implementation, + return this->get_service().assign(this->get_implementation(), protocol, native_socket, ec); } /// Determine whether the socket is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Close the socket. @@ -253,7 +297,8 @@ public: * or connect operations will be cancelled immediately, and will complete * with the boost::asio::error::operation_aborted error. * - * @throws boost::system::system_error Thrown on failure. + * @throws boost::system::system_error Thrown on failure. Note that, even if + * the function indicates an error, the underlying descriptor is closed. * * @note For portable behaviour with respect to graceful closure of a * connected socket, call shutdown() before closing the socket. @@ -261,8 +306,8 @@ public: void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the socket. @@ -271,7 +316,8 @@ public: * or connect operations will be cancelled immediately, and will complete * with the boost::asio::error::operation_aborted error. * - * @param ec Set to indicate what error occurred, if any. + * @param ec Set to indicate what error occurred, if any. Note that, even if + * the function indicates an error, the underlying descriptor is closed. * * @par Example * @code @@ -290,10 +336,10 @@ public: */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native socket representation. + /// (Deprecated: Use native_handle().) Get the native socket representation. /** * This function may be used to obtain the underlying representation of the * socket. This is intended to allow access to native socket functionality @@ -301,7 +347,18 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native socket representation. + /** + * This function may be used to obtain the underlying representation of the + * socket. This is intended to allow access to native socket 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 socket. @@ -348,8 +405,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the socket. @@ -395,7 +452,7 @@ public: #endif boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Determine whether the socket is at the out-of-band data mark. @@ -411,8 +468,8 @@ public: bool at_mark() const { boost::system::error_code ec; - bool b = this->service.at_mark(this->implementation, ec); - boost::asio::detail::throw_error(ec); + bool b = this->get_service().at_mark(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "at_mark"); return b; } @@ -428,7 +485,7 @@ public: */ bool at_mark(boost::system::error_code& ec) const { - return this->service.at_mark(this->implementation, ec); + return this->get_service().at_mark(this->get_implementation(), ec); } /// Determine the number of bytes available for reading. @@ -444,8 +501,9 @@ public: std::size_t available() const { boost::system::error_code ec; - std::size_t s = this->service.available(this->implementation, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().available( + this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "available"); return s; } @@ -461,7 +519,7 @@ public: */ std::size_t available(boost::system::error_code& ec) const { - return this->service.available(this->implementation, ec); + return this->get_service().available(this->get_implementation(), ec); } /// Bind the socket to the given local endpoint. @@ -485,8 +543,8 @@ public: void bind(const endpoint_type& endpoint) { boost::system::error_code ec; - this->service.bind(this->implementation, endpoint, ec); - boost::asio::detail::throw_error(ec); + this->get_service().bind(this->get_implementation(), endpoint, ec); + boost::asio::detail::throw_error(ec, "bind"); } /// Bind the socket to the given local endpoint. @@ -515,7 +573,7 @@ public: boost::system::error_code bind(const endpoint_type& endpoint, boost::system::error_code& ec) { - return this->service.bind(this->implementation, endpoint, ec); + return this->get_service().bind(this->get_implementation(), endpoint, ec); } /// Connect the socket to the specified endpoint. @@ -546,11 +604,12 @@ public: boost::system::error_code ec; if (!is_open()) { - this->service.open(this->implementation, peer_endpoint.protocol(), ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), + peer_endpoint.protocol(), ec); + boost::asio::detail::throw_error(ec, "connect"); } - this->service.connect(this->implementation, peer_endpoint, ec); - boost::asio::detail::throw_error(ec); + this->get_service().connect(this->get_implementation(), peer_endpoint, ec); + boost::asio::detail::throw_error(ec, "connect"); } /// Connect the socket to the specified endpoint. @@ -586,14 +645,15 @@ public: { if (!is_open()) { - if (this->service.open(this->implementation, + if (this->get_service().open(this->get_implementation(), peer_endpoint.protocol(), ec)) { return ec; } } - return this->service.connect(this->implementation, peer_endpoint, ec); + return this->get_service().connect( + this->get_implementation(), peer_endpoint, ec); } /// Start an asynchronous connect. @@ -638,21 +698,28 @@ public: * @endcode */ template <typename ConnectHandler> - void async_connect(const endpoint_type& peer_endpoint, ConnectHandler handler) + void async_connect(const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ConnectHandler. + BOOST_ASIO_CONNECT_HANDLER_CHECK(ConnectHandler, handler) type_check; + if (!is_open()) { boost::system::error_code ec; - if (this->service.open(this->implementation, - peer_endpoint.protocol(), ec)) + const protocol_type protocol = peer_endpoint.protocol(); + if (this->get_service().open(this->get_implementation(), protocol, ec)) { this->get_io_service().post( - boost::asio::detail::bind_handler(handler, ec)); + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler), ec)); return; } } - this->service.async_connect(this->implementation, peer_endpoint, handler); + this->get_service().async_connect(this->get_implementation(), + peer_endpoint, BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } /// Set an option on the socket. @@ -693,8 +760,8 @@ public: void set_option(const SettableSocketOption& option) { boost::system::error_code ec; - this->service.set_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().set_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "set_option"); } /// Set an option on the socket. @@ -740,7 +807,8 @@ public: boost::system::error_code set_option(const SettableSocketOption& option, boost::system::error_code& ec) { - return this->service.set_option(this->implementation, option, ec); + return this->get_service().set_option( + this->get_implementation(), option, ec); } /// Get an option from the socket. @@ -782,8 +850,8 @@ public: void get_option(GettableSocketOption& option) const { boost::system::error_code ec; - this->service.get_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().get_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "get_option"); } /// Get an option from the socket. @@ -830,7 +898,8 @@ public: boost::system::error_code get_option(GettableSocketOption& option, boost::system::error_code& ec) const { - return this->service.get_option(this->implementation, option, ec); + return this->get_service().get_option( + this->get_implementation(), option, ec); } /// Perform an IO control command on the socket. @@ -859,8 +928,8 @@ public: void io_control(IoControlCommand& command) { boost::system::error_code ec; - this->service.io_control(this->implementation, command, ec); - boost::asio::detail::throw_error(ec); + this->get_service().io_control(this->get_implementation(), command, ec); + boost::asio::detail::throw_error(ec, "io_control"); } /// Perform an IO control command on the socket. @@ -894,7 +963,338 @@ public: boost::system::error_code io_control(IoControlCommand& command, boost::system::error_code& ec) { - return this->service.io_control(this->implementation, command, ec); + return this->get_service().io_control( + this->get_implementation(), command, ec); + } + + /// Gets the non-blocking mode of the socket. + /** + * @returns @c true if the socket's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + bool non_blocking() const + { + return this->get_service().non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the socket. + /** + * @param mode If @c true, the socket's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + void non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().non_blocking(this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "non_blocking"); + } + + /// Sets the non-blocking mode of the socket. + /** + * @param mode If @c true, the socket's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + boost::system::error_code non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().non_blocking( + this->get_implementation(), mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + /** + * This function is used to retrieve the non-blocking mode of the underlying + * native socket. This mode has no effect on the behaviour of the socket + * object's synchronous operations. + * + * @returns @c true if the underlying socket is in non-blocking mode and + * direct system calls may fail with boost::asio::error::would_block (or the + * equivalent system error). + * + * @note The current non-blocking mode is cached by the socket object. + * Consequently, the return value may be incorrect if the non-blocking mode + * was set directly on the native socket. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template <typename Handler> + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(boost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = boost::system::error_code(n < 0 ? errno : 0, + * boost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == boost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == boost::asio::error::would_block + * || ec == boost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(boost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template <typename Handler> + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(boost::asio::null_buffers(), op); + * } @endcode + */ + bool native_non_blocking() const + { + return this->get_service().native_non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the native socket implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native socket. It has no effect on the behaviour of the socket object's + * synchronous operations. + * + * @param mode If @c true, the underlying socket is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @throws boost::system::system_error Thrown on failure. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template <typename Handler> + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(boost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = boost::system::error_code(n < 0 ? errno : 0, + * boost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == boost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == boost::asio::error::would_block + * || ec == boost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(boost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template <typename Handler> + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(boost::asio::null_buffers(), op); + * } @endcode + */ + void native_non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "native_non_blocking"); + } + + /// Sets the non-blocking mode of the native socket implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native socket. It has no effect on the behaviour of the socket object's + * synchronous operations. + * + * @param mode If @c true, the underlying socket is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @param ec Set to indicate what error occurred, if any. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template <typename Handler> + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(boost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = boost::system::error_code(n < 0 ? errno : 0, + * boost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == boost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == boost::asio::error::would_block + * || ec == boost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(boost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template <typename Handler> + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(boost::asio::null_buffers(), op); + * } @endcode + */ + boost::system::error_code native_non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); } /// Get the local endpoint of the socket. @@ -915,8 +1315,9 @@ public: endpoint_type local_endpoint() const { boost::system::error_code ec; - endpoint_type ep = this->service.local_endpoint(this->implementation, ec); - boost::asio::detail::throw_error(ec); + endpoint_type ep = this->get_service().local_endpoint( + this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "local_endpoint"); return ep; } @@ -943,7 +1344,7 @@ public: */ endpoint_type local_endpoint(boost::system::error_code& ec) const { - return this->service.local_endpoint(this->implementation, ec); + return this->get_service().local_endpoint(this->get_implementation(), ec); } /// Get the remote endpoint of the socket. @@ -964,8 +1365,9 @@ public: endpoint_type remote_endpoint() const { boost::system::error_code ec; - endpoint_type ep = this->service.remote_endpoint(this->implementation, ec); - boost::asio::detail::throw_error(ec); + endpoint_type ep = this->get_service().remote_endpoint( + this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "remote_endpoint"); return ep; } @@ -992,7 +1394,7 @@ public: */ endpoint_type remote_endpoint(boost::system::error_code& ec) const { - return this->service.remote_endpoint(this->implementation, ec); + return this->get_service().remote_endpoint(this->get_implementation(), ec); } /// Disable sends or receives on the socket. @@ -1015,8 +1417,8 @@ public: void shutdown(shutdown_type what) { boost::system::error_code ec; - this->service.shutdown(this->implementation, what, ec); - boost::asio::detail::throw_error(ec); + this->get_service().shutdown(this->get_implementation(), what, ec); + boost::asio::detail::throw_error(ec, "shutdown"); } /// Disable sends or receives on the socket. @@ -1044,7 +1446,7 @@ public: boost::system::error_code shutdown(shutdown_type what, boost::system::error_code& ec) { - return this->service.shutdown(this->implementation, what, ec); + return this->get_service().shutdown(this->get_implementation(), what, ec); } protected: diff --git a/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp b/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp index a877bc3..5a3b0f7 100644 --- a/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp @@ -2,7 +2,7 @@ // basic_socket_acceptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/basic_io_object.hpp> #include <boost/asio/basic_socket.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/socket_acceptor_service.hpp> @@ -55,8 +56,12 @@ class basic_socket_acceptor public socket_base { public: + /// (Deprecated: Use native_handle_type.) The native representation of an + /// acceptor. + typedef typename SocketAcceptorService::native_handle_type native_type; + /// The native representation of an acceptor. - typedef typename SocketAcceptorService::native_type native_type; + typedef typename SocketAcceptorService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -96,8 +101,8 @@ public: : basic_io_object<SocketAcceptorService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, protocol, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Construct an acceptor opened on the given endpoint. @@ -132,19 +137,20 @@ public: : basic_io_object<SocketAcceptorService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, endpoint.protocol(), ec); - boost::asio::detail::throw_error(ec); + const protocol_type protocol = endpoint.protocol(); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); if (reuse_addr) { - this->service.set_option(this->implementation, + this->get_service().set_option(this->get_implementation(), socket_base::reuse_address(true), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "set_option"); } - this->service.bind(this->implementation, endpoint, ec); - boost::asio::detail::throw_error(ec); - this->service.listen(this->implementation, + this->get_service().bind(this->get_implementation(), endpoint, ec); + boost::asio::detail::throw_error(ec, "bind"); + this->get_service().listen(this->get_implementation(), socket_base::max_connections, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "listen"); } /// Construct a basic_socket_acceptor on an existing native acceptor. @@ -163,14 +169,50 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_socket_acceptor(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_acceptor) + const protocol_type& protocol, const native_handle_type& native_acceptor) : basic_io_object<SocketAcceptorService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, protocol, native_acceptor, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + protocol, native_acceptor, ec); + boost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_socket_acceptor from another. + /** + * This constructor moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor 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_socket_acceptor(io_service&) constructor. + */ + basic_socket_acceptor(basic_socket_acceptor&& other) + : basic_io_object<SocketAcceptorService>( + BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other)) + { } + /// Move-assign a basic_socket_acceptor from another. + /** + * This assignment operator moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor 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_socket_acceptor(io_service&) constructor. + */ + basic_socket_acceptor& operator=(basic_socket_acceptor&& other) + { + basic_io_object<SocketAcceptorService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Open the acceptor using the specified protocol. /** * This function opens the socket acceptor so that it will use the specified @@ -189,8 +231,8 @@ public: void open(const protocol_type& protocol = protocol_type()) { boost::system::error_code ec; - this->service.open(this->implementation, protocol, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Open the acceptor using the specified protocol. @@ -216,7 +258,7 @@ public: boost::system::error_code open(const protocol_type& protocol, boost::system::error_code& ec) { - return this->service.open(this->implementation, protocol, ec); + return this->get_service().open(this->get_implementation(), protocol, ec); } /// Assigns an existing native acceptor to the acceptor. @@ -229,11 +271,13 @@ public: * * @throws boost::system::system_error Thrown on failure. */ - void assign(const protocol_type& protocol, const native_type& native_acceptor) + void assign(const protocol_type& protocol, + const native_handle_type& native_acceptor) { boost::system::error_code ec; - this->service.assign(this->implementation, protocol, native_acceptor, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + protocol, native_acceptor, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assigns an existing native acceptor to the acceptor. @@ -247,16 +291,16 @@ public: * @param ec Set to indicate what error occurred, if any. */ boost::system::error_code assign(const protocol_type& protocol, - const native_type& native_acceptor, boost::system::error_code& ec) + const native_handle_type& native_acceptor, boost::system::error_code& ec) { - return this->service.assign(this->implementation, + return this->get_service().assign(this->get_implementation(), protocol, native_acceptor, ec); } /// Determine whether the acceptor is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Bind the acceptor to the given local endpoint. @@ -279,8 +323,8 @@ public: void bind(const endpoint_type& endpoint) { boost::system::error_code ec; - this->service.bind(this->implementation, endpoint, ec); - boost::asio::detail::throw_error(ec); + this->get_service().bind(this->get_implementation(), endpoint, ec); + boost::asio::detail::throw_error(ec, "bind"); } /// Bind the acceptor to the given local endpoint. @@ -308,7 +352,7 @@ public: boost::system::error_code bind(const endpoint_type& endpoint, boost::system::error_code& ec) { - return this->service.bind(this->implementation, endpoint, ec); + return this->get_service().bind(this->get_implementation(), endpoint, ec); } /// Place the acceptor into the state where it will listen for new @@ -324,8 +368,8 @@ public: void listen(int backlog = socket_base::max_connections) { boost::system::error_code ec; - this->service.listen(this->implementation, backlog, ec); - boost::asio::detail::throw_error(ec); + this->get_service().listen(this->get_implementation(), backlog, ec); + boost::asio::detail::throw_error(ec, "listen"); } /// Place the acceptor into the state where it will listen for new @@ -352,7 +396,7 @@ public: */ boost::system::error_code listen(int backlog, boost::system::error_code& ec) { - return this->service.listen(this->implementation, backlog, ec); + return this->get_service().listen(this->get_implementation(), backlog, ec); } /// Close the acceptor. @@ -368,8 +412,8 @@ public: void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the acceptor. @@ -396,10 +440,10 @@ public: */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native acceptor representation. + /// (Deprecated: Use native_handle().) Get the native acceptor representation. /** * This function may be used to obtain the underlying representation of the * acceptor. This is intended to allow access to native acceptor functionality @@ -407,7 +451,18 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native acceptor representation. + /** + * This function may be used to obtain the underlying representation of the + * acceptor. This is intended to allow access to native acceptor 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 acceptor. @@ -421,8 +476,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the acceptor. @@ -435,7 +490,7 @@ public: */ boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Set an option on the acceptor. @@ -463,8 +518,8 @@ public: void set_option(const SettableSocketOption& option) { boost::system::error_code ec; - this->service.set_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().set_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "set_option"); } /// Set an option on the acceptor. @@ -497,7 +552,8 @@ public: boost::system::error_code set_option(const SettableSocketOption& option, boost::system::error_code& ec) { - return this->service.set_option(this->implementation, option, ec); + return this->get_service().set_option( + this->get_implementation(), option, ec); } /// Get an option from the acceptor. @@ -526,8 +582,8 @@ public: void get_option(GettableSocketOption& option) { boost::system::error_code ec; - this->service.get_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().get_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "get_option"); } /// Get an option from the acceptor. @@ -561,7 +617,189 @@ public: boost::system::error_code get_option(GettableSocketOption& option, boost::system::error_code& ec) { - return this->service.get_option(this->implementation, option, ec); + return this->get_service().get_option( + this->get_implementation(), option, ec); + } + + /// Perform an IO control command on the acceptor. + /** + * This function is used to execute an IO control command on the acceptor. + * + * @param command The IO control command to be performed on the acceptor. + * + * @throws boost::system::system_error Thrown on failure. + * + * @sa IoControlCommand @n + * boost::asio::socket_base::non_blocking_io + * + * @par Example + * Getting the number of bytes ready to read: + * @code + * boost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * boost::asio::ip::tcp::acceptor::non_blocking_io command(true); + * socket.io_control(command); + * @endcode + */ + template <typename IoControlCommand> + void io_control(IoControlCommand& command) + { + boost::system::error_code ec; + this->get_service().io_control(this->get_implementation(), command, ec); + boost::asio::detail::throw_error(ec, "io_control"); + } + + /// Perform an IO control command on the acceptor. + /** + * This function is used to execute an IO control command on the acceptor. + * + * @param command The IO control command to be performed on the acceptor. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa IoControlCommand @n + * boost::asio::socket_base::non_blocking_io + * + * @par Example + * Getting the number of bytes ready to read: + * @code + * boost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * boost::asio::ip::tcp::acceptor::non_blocking_io command(true); + * boost::system::error_code ec; + * socket.io_control(command, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + template <typename IoControlCommand> + boost::system::error_code io_control(IoControlCommand& command, + boost::system::error_code& ec) + { + return this->get_service().io_control( + this->get_implementation(), command, ec); + } + + /// Gets the non-blocking mode of the acceptor. + /** + * @returns @c true if the acceptor's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + bool non_blocking() const + { + return this->get_service().non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the acceptor. + /** + * @param mode If @c true, the acceptor's synchronous operations will fail + * with boost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + void non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().non_blocking(this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "non_blocking"); + } + + /// Sets the non-blocking mode of the acceptor. + /** + * @param mode If @c true, the acceptor's synchronous operations will fail + * with boost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + boost::system::error_code non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().non_blocking( + this->get_implementation(), mode, ec); + } + + /// Gets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to retrieve the non-blocking mode of the underlying + * native acceptor. This mode has no effect on the behaviour of the acceptor + * object's synchronous operations. + * + * @returns @c true if the underlying acceptor is in non-blocking mode and + * direct system calls may fail with boost::asio::error::would_block (or the + * equivalent system error). + * + * @note The current non-blocking mode is cached by the acceptor object. + * Consequently, the return value may be incorrect if the non-blocking mode + * was set directly on the native acceptor. + */ + bool native_non_blocking() const + { + return this->get_service().native_non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native acceptor. It has no effect on the behaviour of the acceptor object's + * synchronous operations. + * + * @param mode If @c true, the underlying acceptor is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @throws boost::system::system_error Thrown on failure. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + void native_non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "native_non_blocking"); + } + + /// Sets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native acceptor. It has no effect on the behaviour of the acceptor object's + * synchronous operations. + * + * @param mode If @c true, the underlying acceptor is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @param ec Set to indicate what error occurred, if any. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + boost::system::error_code native_non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); } /// Get the local endpoint of the acceptor. @@ -582,8 +820,9 @@ public: endpoint_type local_endpoint() const { boost::system::error_code ec; - endpoint_type ep = this->service.local_endpoint(this->implementation, ec); - boost::asio::detail::throw_error(ec); + endpoint_type ep = this->get_service().local_endpoint( + this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "local_endpoint"); return ep; } @@ -611,7 +850,7 @@ public: */ endpoint_type local_endpoint(boost::system::error_code& ec) const { - return this->service.local_endpoint(this->implementation, ec); + return this->get_service().local_endpoint(this->get_implementation(), ec); } /// Accept a new connection. @@ -636,8 +875,8 @@ public: void accept(basic_socket<protocol_type, SocketService>& peer) { boost::system::error_code ec; - this->service.accept(this->implementation, peer, 0, ec); - boost::asio::detail::throw_error(ec); + this->get_service().accept(this->get_implementation(), peer, 0, ec); + boost::asio::detail::throw_error(ec, "accept"); } /// Accept a new connection. @@ -668,7 +907,7 @@ public: basic_socket<protocol_type, SocketService>& peer, boost::system::error_code& ec) { - return this->service.accept(this->implementation, peer, 0, ec); + return this->get_service().accept(this->get_implementation(), peer, 0, ec); } /// Start an asynchronous accept. @@ -711,9 +950,14 @@ public: */ template <typename SocketService, typename AcceptHandler> void async_accept(basic_socket<protocol_type, SocketService>& peer, - AcceptHandler handler) + BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { - this->service.async_accept(this->implementation, peer, 0, 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 @@ -744,8 +988,9 @@ public: endpoint_type& peer_endpoint) { boost::system::error_code ec; - this->service.accept(this->implementation, peer, &peer_endpoint, ec); - boost::asio::detail::throw_error(ec); + this->get_service().accept(this->get_implementation(), + peer, &peer_endpoint, ec); + boost::asio::detail::throw_error(ec, "accept"); } /// Accept a new connection and obtain the endpoint of the peer @@ -781,7 +1026,8 @@ public: basic_socket<protocol_type, SocketService>& peer, endpoint_type& peer_endpoint, boost::system::error_code& ec) { - return this->service.accept(this->implementation, peer, &peer_endpoint, ec); + return this->get_service().accept( + this->get_implementation(), peer, &peer_endpoint, ec); } /// Start an asynchronous accept. @@ -812,10 +1058,14 @@ public: */ template <typename SocketService, typename AcceptHandler> void async_accept(basic_socket<protocol_type, SocketService>& peer, - endpoint_type& peer_endpoint, AcceptHandler handler) + endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { - this->service.async_accept(this->implementation, - peer, &peer_endpoint, 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, + &peer_endpoint, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_socket_iostream.hpp b/3rdParty/Boost/src/boost/asio/basic_socket_iostream.hpp index 142f404..6fae085 100644 --- a/3rdParty/Boost/src/boost/asio/basic_socket_iostream.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_socket_iostream.hpp @@ -2,7 +2,7 @@ // basic_socket_iostream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,36 +19,41 @@ #if !defined(BOOST_NO_IOSTREAM) -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> #include <boost/utility/base_from_member.hpp> #include <boost/asio/basic_socket_streambuf.hpp> #include <boost/asio/stream_socket_service.hpp> -#if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) -#define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5 -#endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +# include <boost/preprocessor/arithmetic/inc.hpp> +# include <boost/preprocessor/repetition/enum_binary_params.hpp> +# include <boost/preprocessor/repetition/enum_params.hpp> +# include <boost/preprocessor/repetition/repeat_from_to.hpp> + +# if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) +# define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5 +# endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) // A macro that should expand to: // template <typename T1, ..., typename Tn> // explicit basic_socket_iostream(T1 x1, ..., Tn xn) // : basic_iostream<char>(&this->boost::base_from_member< -// basic_socket_streambuf<Protocol, StreamSocketService> >::member) +// basic_socket_streambuf<Protocol, StreamSocketService, +// Time, TimeTraits, TimerService> >::member) // { // if (rdbuf()->connect(x1, ..., xn) == 0) // this->setstate(std::ios_base::failbit); // } // This macro should only persist within this file. -#define BOOST_ASIO_PRIVATE_CTR_DEF(z, n, data) \ +# define BOOST_ASIO_PRIVATE_CTR_DEF(z, n, data) \ template <BOOST_PP_ENUM_PARAMS(n, typename T)> \ explicit basic_socket_iostream(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ : std::basic_iostream<char>(&this->boost::base_from_member< \ - basic_socket_streambuf<Protocol, StreamSocketService> >::member) \ + basic_socket_streambuf<Protocol, StreamSocketService, \ + Time, TimeTraits, TimerService> >::member) \ { \ - tie(this); \ + this->setf(std::ios_base::unitbuf); \ if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \ this->setstate(std::ios_base::failbit); \ } \ @@ -63,7 +68,7 @@ // } // This macro should only persist within this file. -#define BOOST_ASIO_PRIVATE_CONNECT_DEF(z, n, data) \ +# define BOOST_ASIO_PRIVATE_CONNECT_DEF(z, n, data) \ template <BOOST_PP_ENUM_PARAMS(n, typename T)> \ void connect(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ { \ @@ -72,6 +77,8 @@ } \ /**/ +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + #include <boost/asio/detail/push_options.hpp> namespace boost { @@ -79,19 +86,33 @@ namespace asio { /// Iostream interface for a socket. template <typename Protocol, - typename StreamSocketService = stream_socket_service<Protocol> > + typename StreamSocketService = stream_socket_service<Protocol>, + typename Time = boost::posix_time::ptime, + typename TimeTraits = boost::asio::time_traits<Time>, + typename TimerService = deadline_timer_service<Time, TimeTraits> > class basic_socket_iostream : public boost::base_from_member< - basic_socket_streambuf<Protocol, StreamSocketService> >, + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService> >, public std::basic_iostream<char> { public: + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// The time type. + typedef typename TimeTraits::time_type time_type; + + /// The duration type. + typedef typename TimeTraits::duration_type duration_type; + /// Construct a basic_socket_iostream without establishing a connection. basic_socket_iostream() : std::basic_iostream<char>(&this->boost::base_from_member< - basic_socket_streambuf<Protocol, StreamSocketService> >::member) + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService> >::member) { - tie(this); + this->setf(std::ios_base::unitbuf); } #if defined(GENERATING_DOCUMENTATION) @@ -103,6 +124,17 @@ public: */ template <typename T1, ..., typename TN> explicit basic_socket_iostream(T1 t1, ..., TN tn); +#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + template <typename... T> + explicit basic_socket_iostream(T... x) + : std::basic_iostream<char>(&this->boost::base_from_member< + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService> >::member) + { + this->setf(std::ios_base::unitbuf); + if (rdbuf()->connect(x...) == 0) + this->setstate(std::ios_base::failbit); + } #else BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY), @@ -118,6 +150,13 @@ public: */ template <typename T1, ..., typename TN> void connect(T1 t1, ..., TN tn); +#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + template <typename... T> + void connect(T... x) + { + if (rdbuf()->connect(x...) == 0) + this->setstate(std::ios_base::failbit); + } #else BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY), @@ -132,11 +171,77 @@ public: } /// Return a pointer to the underlying streambuf. - basic_socket_streambuf<Protocol, StreamSocketService>* rdbuf() const + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>* rdbuf() const { - return const_cast<basic_socket_streambuf<Protocol, StreamSocketService>*>( + return const_cast<basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>*>( &this->boost::base_from_member< - basic_socket_streambuf<Protocol, StreamSocketService> >::member); + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService> >::member); + } + + /// Get the last error associated with the stream. + /** + * @return An \c error_code corresponding to the last error from the stream. + * + * @par Example + * To print the error associated with a failure to establish a connection: + * @code tcp::iostream s("www.boost.org", "http"); + * if (!s) + * { + * std::cout << "Error: " << s.error().message() << std::endl; + * } @endcode + */ + const boost::system::error_code& error() const + { + return rdbuf()->puberror(); + } + + /// Get the stream's expiry time as an absolute time. + /** + * @return An absolute time value representing the stream's expiry time. + */ + time_type expires_at() const + { + return rdbuf()->expires_at(); + } + + /// Set the stream's expiry time as an absolute time. + /** + * This function sets the expiry time associated with the stream. Stream + * operations performed after this time (where the operations cannot be + * completed using the internal buffers) will fail with the error + * boost::asio::error::operation_aborted. + * + * @param expiry_time The expiry time to be used for the stream. + */ + void expires_at(const time_type& expiry_time) + { + rdbuf()->expires_at(expiry_time); + } + + /// Get the timer's expiry time relative to now. + /** + * @return A relative time value representing the stream's expiry time. + */ + duration_type expires_from_now() const + { + return rdbuf()->expires_from_now(); + } + + /// Set the stream's expiry time relative to now. + /** + * This function sets the expiry time associated with the stream. Stream + * operations performed after this time (where the operations cannot be + * completed using the internal buffers) will fail with the error + * boost::asio::error::operation_aborted. + * + * @param expiry_time The expiry time to be used for the timer. + */ + void expires_from_now(const duration_type& expiry_time) + { + rdbuf()->expires_from_now(expiry_time); } }; @@ -145,8 +250,10 @@ public: #include <boost/asio/detail/pop_options.hpp> -#undef BOOST_ASIO_PRIVATE_CTR_DEF -#undef BOOST_ASIO_PRIVATE_CONNECT_DEF +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +# undef BOOST_ASIO_PRIVATE_CTR_DEF +# undef BOOST_ASIO_PRIVATE_CONNECT_DEF +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) #endif // defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/basic_socket_streambuf.hpp b/3rdParty/Boost/src/boost/asio/basic_socket_streambuf.hpp index c2a9a99..fb047c6 100644 --- a/3rdParty/Boost/src/boost/asio/basic_socket_streambuf.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_socket_streambuf.hpp @@ -2,7 +2,7 @@ // basic_socket_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -20,53 +20,64 @@ #if !defined(BOOST_NO_IOSTREAM) #include <streambuf> -#include <boost/array.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> #include <boost/utility/base_from_member.hpp> #include <boost/asio/basic_socket.hpp> +#include <boost/asio/deadline_timer_service.hpp> +#include <boost/asio/detail/array.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/stream_socket_service.hpp> +#include <boost/asio/time_traits.hpp> -#if !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) -#define BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY 5 -#endif // !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) +#include <boost/asio/detail/push_options.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/asio/detail/pop_options.hpp> + +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +# include <boost/preprocessor/arithmetic/inc.hpp> +# include <boost/preprocessor/repetition/enum_binary_params.hpp> +# include <boost/preprocessor/repetition/enum_params.hpp> +# include <boost/preprocessor/repetition/repeat_from_to.hpp> + +# if !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) +# define BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY 5 +# endif // !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) // A macro that should expand to: // template <typename T1, ..., typename Tn> -// basic_socket_streambuf<Protocol, StreamSocketService>* connect( +// basic_socket_streambuf<Protocol, StreamSocketService, +// Time, TimeTraits, TimerService>* connect( // T1 x1, ..., Tn xn) // { // init_buffers(); -// boost::system::error_code ec; -// this->basic_socket<Protocol, StreamSocketService>::close(ec); +// this->basic_socket<Protocol, StreamSocketService>::close(ec_); // typedef typename Protocol::resolver resolver_type; // typedef typename resolver_type::query resolver_query; // resolver_query query(x1, ..., xn); -// resolve_and_connect(query, ec); -// return !ec ? this : 0; +// resolve_and_connect(query); +// return !ec_ ? this : 0; // } // This macro should only persist within this file. -#define BOOST_ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \ +# define BOOST_ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \ template <BOOST_PP_ENUM_PARAMS(n, typename T)> \ - basic_socket_streambuf<Protocol, StreamSocketService>* connect( \ + basic_socket_streambuf<Protocol, StreamSocketService, \ + Time, TimeTraits, TimerService>* connect( \ BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ { \ init_buffers(); \ - boost::system::error_code ec; \ - this->basic_socket<Protocol, StreamSocketService>::close(ec); \ + this->basic_socket<Protocol, StreamSocketService>::close(ec_); \ typedef typename Protocol::resolver resolver_type; \ typedef typename resolver_type::query resolver_query; \ resolver_query query(BOOST_PP_ENUM_PARAMS(n, x)); \ - resolve_and_connect(query, ec); \ - return !ec ? this : 0; \ + resolve_and_connect(query); \ + return !ec_ ? this : 0; \ } \ /**/ +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + #include <boost/asio/detail/push_options.hpp> namespace boost { @@ -74,7 +85,10 @@ namespace asio { /// Iostream streambuf for a socket. template <typename Protocol, - typename StreamSocketService = stream_socket_service<Protocol> > + typename StreamSocketService = stream_socket_service<Protocol>, + typename Time = boost::posix_time::ptime, + typename TimeTraits = boost::asio::time_traits<Time>, + typename TimerService = deadline_timer_service<Time, TimeTraits> > class basic_socket_streambuf : public std::streambuf, private boost::base_from_member<io_service>, @@ -84,11 +98,19 @@ public: /// The endpoint type. typedef typename Protocol::endpoint endpoint_type; + /// The time type. + typedef typename TimeTraits::time_type time_type; + + /// The duration type. + typedef typename TimeTraits::duration_type duration_type; + /// Construct a basic_socket_streambuf without establishing a connection. basic_socket_streambuf() : basic_socket<Protocol, StreamSocketService>( boost::base_from_member<boost::asio::io_service>::member), - unbuffered_(false) + unbuffered_(false), + timer_service_(0), + timer_state_(no_timer) { init_buffers(); } @@ -98,6 +120,8 @@ public: { if (pptr() != pbase()) overflow(traits_type::eof()); + + destroy_timer(); } /// Establish a connection. @@ -107,14 +131,30 @@ public: * @return \c this if a connection was successfully established, a null * pointer otherwise. */ - basic_socket_streambuf<Protocol, StreamSocketService>* connect( + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>* connect( const endpoint_type& endpoint) { init_buffers(); - boost::system::error_code ec; - this->basic_socket<Protocol, StreamSocketService>::close(ec); - this->basic_socket<Protocol, StreamSocketService>::connect(endpoint, ec); - return !ec ? this : 0; + + this->basic_socket<Protocol, StreamSocketService>::close(ec_); + + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return 0; + } + + io_handler handler = { this }; + this->basic_socket<Protocol, StreamSocketService>::async_connect( + endpoint, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + + return !ec_ ? this : 0; } #if defined(GENERATING_DOCUMENTATION) @@ -130,6 +170,19 @@ public: template <typename T1, ..., typename TN> basic_socket_streambuf<Protocol, StreamSocketService>* connect( T1 t1, ..., TN tn); +#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + template <typename... T> + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>* connect(T... x) + { + init_buffers(); + this->basic_socket<Protocol, StreamSocketService>::close(ec_); + typedef typename Protocol::resolver resolver_type; + typedef typename resolver_type::query resolver_query; + resolver_query query(x...); + resolve_and_connect(query); + return !ec_ ? this : 0; + } #else BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY), @@ -141,14 +194,85 @@ public: * @return \c this if a connection was successfully established, a null * pointer otherwise. */ - basic_socket_streambuf<Protocol, StreamSocketService>* close() + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>* close() { - boost::system::error_code ec; sync(); - this->basic_socket<Protocol, StreamSocketService>::close(ec); - if (!ec) + this->basic_socket<Protocol, StreamSocketService>::close(ec_); + if (!ec_) init_buffers(); - return !ec ? this : 0; + return !ec_ ? this : 0; + } + + /// Get the last error associated with the stream buffer. + /** + * @return An \c error_code corresponding to the last error from the stream + * buffer. + */ + const boost::system::error_code& puberror() const + { + return error(); + } + + /// Get the stream buffer's expiry time as an absolute time. + /** + * @return An absolute time value representing the stream buffer's expiry + * time. + */ + time_type expires_at() const + { + return timer_service_ + ? timer_service_->expires_at(timer_implementation_) + : time_type(); + } + + /// Set the stream buffer's expiry time as an absolute time. + /** + * This function sets the expiry time associated with the stream. Stream + * operations performed after this time (where the operations cannot be + * completed using the internal buffers) will fail with the error + * boost::asio::error::operation_aborted. + * + * @param expiry_time The expiry time to be used for the stream. + */ + void expires_at(const time_type& expiry_time) + { + construct_timer(); + + boost::system::error_code ec; + timer_service_->expires_at(timer_implementation_, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_at"); + + start_timer(); + } + + /// Get the stream buffer's expiry time relative to now. + /** + * @return A relative time value representing the stream buffer's expiry time. + */ + duration_type expires_from_now() const + { + return TimeTraits::subtract(expires_at(), TimeTraits::now()); + } + + /// Set the stream buffer's expiry time relative to now. + /** + * This function sets the expiry time associated with the stream. Stream + * operations performed after this time (where the operations cannot be + * completed using the internal buffers) will fail with the error + * boost::asio::error::operation_aborted. + * + * @param expiry_time The expiry time to be used for the timer. + */ + void expires_from_now(const duration_type& expiry_time) + { + construct_timer(); + + boost::system::error_code ec; + timer_service_->expires_from_now(timer_implementation_, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); + + start_timer(); } protected: @@ -156,15 +280,26 @@ protected: { if (gptr() == egptr()) { - boost::system::error_code ec; - std::size_t bytes_transferred = this->service.receive( - this->implementation, + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return traits_type::eof(); + } + + io_handler handler = { this }; + this->get_service().async_receive(this->get_implementation(), boost::asio::buffer(boost::asio::buffer(get_buffer_) + putback_max), - 0, ec); - if (ec) + 0, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + if (ec_) return traits_type::eof(); - setg(get_buffer_.begin(), get_buffer_.begin() + putback_max, - get_buffer_.begin() + putback_max + bytes_transferred); + + setg(&get_buffer_[0], &get_buffer_[0] + putback_max, + &get_buffer_[0] + putback_max + bytes_transferred_); return traits_type::to_int_type(*gptr()); } else @@ -184,13 +319,25 @@ protected: } else { + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return traits_type::eof(); + } + // Send the single character immediately. - boost::system::error_code ec; char_type ch = traits_type::to_char_type(c); - this->service.send(this->implementation, - boost::asio::buffer(&ch, sizeof(char_type)), 0, ec); - if (ec) + io_handler handler = { this }; + this->get_service().async_send(this->get_implementation(), + boost::asio::buffer(&ch, sizeof(char_type)), 0, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + if (ec_) return traits_type::eof(); + return c; } } @@ -201,15 +348,26 @@ protected: boost::asio::buffer(pbase(), pptr() - pbase()); while (boost::asio::buffer_size(buffer) > 0) { - boost::system::error_code ec; - std::size_t bytes_transferred = this->service.send( - this->implementation, boost::asio::buffer(buffer), - 0, ec); - if (ec) + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return traits_type::eof(); + } + + io_handler handler = { this }; + this->get_service().async_send(this->get_implementation(), + boost::asio::buffer(buffer), 0, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + if (ec_) return traits_type::eof(); - buffer = buffer + bytes_transferred; + + buffer = buffer + bytes_transferred_; } - setp(put_buffer_.begin(), put_buffer_.end()); + setp(&put_buffer_[0], &put_buffer_[0] + put_buffer_.size()); // If the new character is eof then our work here is done. if (traits_type::eq_int_type(c, traits_type::eof())) @@ -239,45 +397,141 @@ protected: return 0; } + /// Get the last error associated with the stream buffer. + /** + * @return An \c error_code corresponding to the last error from the stream + * buffer. + */ + virtual const boost::system::error_code& error() const + { + return ec_; + } + private: void init_buffers() { - setg(get_buffer_.begin(), - get_buffer_.begin() + putback_max, - get_buffer_.begin() + putback_max); + setg(&get_buffer_[0], + &get_buffer_[0] + putback_max, + &get_buffer_[0] + putback_max); if (unbuffered_) setp(0, 0); else - setp(put_buffer_.begin(), put_buffer_.end()); + setp(&put_buffer_[0], &put_buffer_[0] + put_buffer_.size()); } template <typename ResolverQuery> - void resolve_and_connect(const ResolverQuery& query, - boost::system::error_code& ec) + void resolve_and_connect(const ResolverQuery& query) { typedef typename Protocol::resolver resolver_type; typedef typename resolver_type::iterator iterator_type; resolver_type resolver( boost::base_from_member<boost::asio::io_service>::member); - iterator_type i = resolver.resolve(query, ec); - if (!ec) + iterator_type i = resolver.resolve(query, ec_); + if (!ec_) { iterator_type end; - ec = boost::asio::error::host_not_found; - while (ec && i != end) + ec_ = boost::asio::error::host_not_found; + while (ec_ && i != end) { - this->basic_socket<Protocol, StreamSocketService>::close(); - this->basic_socket<Protocol, StreamSocketService>::connect(*i, ec); + this->basic_socket<Protocol, StreamSocketService>::close(ec_); + + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return; + } + + io_handler handler = { this }; + this->basic_socket<Protocol, StreamSocketService>::async_connect( + *i, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + ++i; } } } + struct io_handler; + friend struct io_handler; + struct io_handler + { + basic_socket_streambuf* this_; + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred = 0) + { + this_->ec_ = ec; + this_->bytes_transferred_ = bytes_transferred; + } + }; + + struct timer_handler; + friend struct timer_handler; + struct timer_handler + { + basic_socket_streambuf* this_; + + void operator()(const boost::system::error_code&) + { + time_type now = TimeTraits::now(); + + time_type expiry_time = this_->timer_service_->expires_at( + this_->timer_implementation_); + + if (TimeTraits::less_than(now, expiry_time)) + { + this_->timer_state_ = timer_is_pending; + this_->timer_service_->async_wait(this_->timer_implementation_, *this); + } + else + { + this_->timer_state_ = timer_has_expired; + boost::system::error_code ec; + this_->basic_socket<Protocol, StreamSocketService>::close(ec); + } + } + }; + + void construct_timer() + { + if (timer_service_ == 0) + { + TimerService& timer_service = use_service<TimerService>( + boost::base_from_member<boost::asio::io_service>::member); + timer_service.construct(timer_implementation_); + timer_service_ = &timer_service; + } + } + + void destroy_timer() + { + if (timer_service_) + timer_service_->destroy(timer_implementation_); + } + + void start_timer() + { + if (timer_state_ != timer_is_pending) + { + timer_handler handler = { this }; + handler(boost::system::error_code()); + } + } + enum { putback_max = 8 }; enum { buffer_size = 512 }; - boost::array<char, buffer_size> get_buffer_; - boost::array<char, buffer_size> put_buffer_; + boost::asio::detail::array<char, buffer_size> get_buffer_; + boost::asio::detail::array<char, buffer_size> put_buffer_; bool unbuffered_; + boost::system::error_code ec_; + std::size_t bytes_transferred_; + TimerService* timer_service_; + typename TimerService::implementation_type timer_implementation_; + enum state { no_timer, timer_is_pending, timer_has_expired } timer_state_; }; } // namespace asio @@ -285,7 +539,9 @@ private: #include <boost/asio/detail/pop_options.hpp> -#undef BOOST_ASIO_PRIVATE_CONNECT_DEF +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +# undef BOOST_ASIO_PRIVATE_CONNECT_DEF +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/basic_stream_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_stream_socket.hpp index 87bd035..010f0aa 100644 --- a/3rdParty/Boost/src/boost/asio/basic_stream_socket.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_stream_socket.hpp @@ -2,7 +2,7 @@ // basic_stream_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> #include <boost/asio/basic_socket.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/stream_socket_service.hpp> @@ -45,8 +46,12 @@ class basic_stream_socket : public basic_socket<Protocol, StreamSocketService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename StreamSocketService::native_handle_type native_type; + /// The native representation of a socket. - typedef typename StreamSocketService::native_type native_type; + typedef typename StreamSocketService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -122,12 +127,47 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_stream_socket(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_socket) + const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket<Protocol, StreamSocketService>( io_service, protocol, native_socket) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_stream_socket from another. + /** + * This constructor moves a stream socket from one object to another. + * + * @param other The other basic_stream_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_stream_socket(io_service&) constructor. + */ + basic_stream_socket(basic_stream_socket&& other) + : basic_socket<Protocol, StreamSocketService>( + BOOST_ASIO_MOVE_CAST(basic_stream_socket)(other)) + { + } + + /// Move-assign a basic_stream_socket from another. + /** + * This assignment operator moves a stream socket from one object to another. + * + * @param other The other basic_stream_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_stream_socket(io_service&) constructor. + */ + basic_stream_socket& operator=(basic_stream_socket&& other) + { + basic_socket<Protocol, StreamSocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_stream_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Send some data on the socket. /** * This function is used to send data on the stream socket. The function @@ -157,9 +197,9 @@ public: std::size_t send(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.send( - this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -195,9 +235,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -223,7 +263,8 @@ public: std::size_t send(const ConstBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send(this->implementation, buffers, flags, ec); + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous send. @@ -262,9 +303,15 @@ public: * std::vector. */ template <typename ConstBufferSequence, typename WriteHandler> - void async_send(const ConstBufferSequence& buffers, WriteHandler handler) + void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, 0, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), buffers, 0, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send. @@ -306,9 +353,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, flags, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data on the socket. @@ -343,8 +396,9 @@ public: std::size_t receive(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.receive(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -383,9 +437,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -411,7 +465,8 @@ public: std::size_t receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive(this->implementation, buffers, flags, ec); + return this->get_service().receive( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous receive. @@ -452,9 +507,15 @@ public: * std::vector. */ template <typename MutableBufferSequence, typename ReadHandler> - void async_receive(const MutableBufferSequence& buffers, ReadHandler handler) + void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, 0, 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; + + this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -498,9 +559,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, flags, 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; + + this->get_service().async_receive(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Write some data to the socket. @@ -534,8 +601,9 @@ public: std::size_t write_some(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.send(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "write_some"); return s; } @@ -559,7 +627,7 @@ public: std::size_t write_some(const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.send(this->implementation, buffers, 0, ec); + return this->get_service().send(this->get_implementation(), buffers, 0, ec); } /// Start an asynchronous write. @@ -599,9 +667,14 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, 0, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the socket. @@ -636,8 +709,9 @@ public: std::size_t read_some(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.receive(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "read_some"); return s; } @@ -662,7 +736,8 @@ public: std::size_t read_some(const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.receive(this->implementation, buffers, 0, ec); + return this->get_service().receive( + this->get_implementation(), buffers, 0, ec); } /// Start an asynchronous read. @@ -703,9 +778,14 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, 0, 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; + + this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp b/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp index 7a04c69..e77624b 100644 --- a/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp @@ -2,7 +2,7 @@ // basic_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -130,9 +130,9 @@ public: * of the streambuf's input sequence is 0. */ explicit basic_streambuf( - std::size_t max_size = (std::numeric_limits<std::size_t>::max)(), + std::size_t maximum_size = (std::numeric_limits<std::size_t>::max)(), const Allocator& allocator = Allocator()) - : max_size_(max_size), + : max_size_(maximum_size), buffer_(allocator) { std::size_t pend = (std::min<std::size_t>)(max_size_, buffer_delta); diff --git a/3rdParty/Boost/src/boost/asio/basic_streambuf_fwd.hpp b/3rdParty/Boost/src/boost/asio/basic_streambuf_fwd.hpp index a7d82d3..ca806ea 100644 --- a/3rdParty/Boost/src/boost/asio/basic_streambuf_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_streambuf_fwd.hpp @@ -2,7 +2,7 @@ // basic_streambuf_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/basic_waitable_timer.hpp b/3rdParty/Boost/src/boost/asio/basic_waitable_timer.hpp new file mode 100644 index 0000000..d957bde --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/basic_waitable_timer.hpp @@ -0,0 +1,518 @@ +// +// basic_waitable_timer.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP +#define BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <cstddef> +#include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/wait_traits.hpp> +#include <boost/asio/waitable_timer_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Provides waitable timer functionality. +/** + * The basic_waitable_timer class template provides the ability to perform a + * blocking or asynchronous wait for a timer to expire. + * + * A waitable timer is always in one of two states: "expired" or "not expired". + * If the wait() or async_wait() function is called on an expired timer, the + * wait operation will complete immediately. + * + * Most applications will use the boost::asio::waitable_timer typedef. + * + * @note This waitable timer functionality is for use with the C++11 standard + * library's @c <chrono> facility, or with the Boost.Chrono library. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + * + * @par Examples + * Performing a blocking wait: + * @code + * // Construct a timer without setting an expiry time. + * boost::asio::waitable_timer timer(io_service); + * + * // Set an expiry time relative to now. + * timer.expires_from_now(boost::posix_time::seconds(5)); + * + * // Wait for the timer to expire. + * timer.wait(); + * @endcode + * + * @par + * Performing an asynchronous wait: + * @code + * void handler(const boost::system::error_code& error) + * { + * if (!error) + * { + * // Timer expired. + * } + * } + * + * ... + * + * // Construct a timer with an absolute expiry time. + * boost::asio::waitable_timer timer(io_service, + * boost::posix_time::time_from_string("2005-12-07 23:59:59.000")); + * + * // Start an asynchronous wait. + * timer.async_wait(handler); + * @endcode + * + * @par Changing an active waitable_timer's expiry time + * + * Changing the expiry time of a timer while there are pending asynchronous + * waits causes those wait operations to be cancelled. To ensure that the action + * associated with the timer is performed only once, use something like this: + * used: + * + * @code + * void on_some_event() + * { + * if (my_timer.expires_from_now(seconds(5)) > 0) + * { + * // We managed to cancel the timer. Start new asynchronous wait. + * my_timer.async_wait(on_timeout); + * } + * else + * { + * // Too late, timer has already expired! + * } + * } + * + * void on_timeout(const boost::system::error_code& e) + * { + * if (e != boost::asio::error::operation_aborted) + * { + * // Timer was not cancelled, take necessary action. + * } + * } + * @endcode + * + * @li The boost::asio::basic_waitable_timer::expires_from_now() function + * cancels any pending asynchronous waits, and returns the number of + * asynchronous waits that were cancelled. If it returns 0 then you were too + * late and the wait handler has already been executed, or will soon be + * executed. If it returns 1 then the wait handler was successfully cancelled. + * + * @li If a wait handler is cancelled, the boost::system::error_code passed to + * it contains the value boost::asio::error::operation_aborted. + */ +template <typename Clock, + typename WaitTraits = boost::asio::wait_traits<Clock>, + typename WaitableTimerService = waitable_timer_service<Clock, WaitTraits> > +class basic_waitable_timer + : public basic_io_object<WaitableTimerService> +{ +public: + /// The clock type. + typedef Clock clock_type; + + /// The duration type of the clock. + typedef typename clock_type::duration duration; + + /// The time point type of the clock. + typedef typename clock_type::time_point time_point; + + /// The wait traits type. + typedef WaitTraits traits_type; + + /// Constructor. + /** + * This constructor creates a timer without setting an expiry time. The + * expires_at() or expires_from_now() functions must be called to set an + * expiry time before the timer can be waited on. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + */ + explicit basic_waitable_timer(boost::asio::io_service& io_service) + : basic_io_object<WaitableTimerService>(io_service) + { + } + + /// Constructor to set a particular expiry time as an absolute time. + /** + * This constructor creates a timer and sets the expiry time. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + * + * @param expiry_time The expiry time to be used for the timer, expressed + * as an absolute time. + */ + basic_waitable_timer(boost::asio::io_service& io_service, + const time_point& expiry_time) + : basic_io_object<WaitableTimerService>(io_service) + { + boost::system::error_code ec; + this->service.expires_at(this->implementation, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_at"); + } + + /// Constructor to set a particular expiry time relative to now. + /** + * This constructor creates a timer and sets the expiry time. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + * + * @param expiry_time The expiry time to be used for the timer, relative to + * now. + */ + basic_waitable_timer(boost::asio::io_service& io_service, + const duration& expiry_time) + : basic_io_object<WaitableTimerService>(io_service) + { + boost::system::error_code ec; + this->service.expires_from_now(this->implementation, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); + } + + /// Cancel any asynchronous operations that are waiting on the timer. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the timer. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when 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. + */ + std::size_t cancel() + { + boost::system::error_code ec; + std::size_t s = this->service.cancel(this->implementation, ec); + boost::asio::detail::throw_error(ec, "cancel"); + return s; + } + + /// Cancel any asynchronous operations that are waiting on the timer. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the timer. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when 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. + */ + std::size_t cancel(boost::system::error_code& ec) + { + return this->service.cancel(this->implementation, ec); + } + + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when cancel_one() 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. + */ + std::size_t cancel_one() + { + boost::system::error_code ec; + std::size_t s = this->service.cancel_one(this->implementation, ec); + boost::asio::detail::throw_error(ec, "cancel_one"); + return s; + } + + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @note If the timer has already expired when cancel_one() 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. + */ + std::size_t cancel_one(boost::system::error_code& ec) + { + return this->service.cancel_one(this->implementation, ec); + } + + /// Get the timer's expiry time as an absolute time. + /** + * This function may be used to obtain the timer's current expiry time. + * Whether the timer has expired or not does not affect this value. + */ + time_point expires_at() const + { + return this->service.expires_at(this->implementation); + } + + /// Set the timer's expiry time as an absolute time. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when expires_at() 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. + */ + std::size_t expires_at(const time_point& expiry_time) + { + boost::system::error_code ec; + std::size_t s = this->service.expires_at( + this->implementation, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_at"); + return s; + } + + /// Set the timer's expiry time as an absolute time. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when expires_at() 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. + */ + std::size_t expires_at(const time_point& expiry_time, + boost::system::error_code& ec) + { + return this->service.expires_at(this->implementation, expiry_time, ec); + } + + /// Get the timer's expiry time relative to now. + /** + * This function may be used to obtain the timer's current expiry time. + * Whether the timer has expired or not does not affect this value. + */ + duration expires_from_now() const + { + return this->service.expires_from_now(this->implementation); + } + + /// Set the timer's expiry time relative to now. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when expires_from_now() 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. + */ + std::size_t expires_from_now(const duration& expiry_time) + { + boost::system::error_code ec; + std::size_t s = this->service.expires_from_now( + this->implementation, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); + return s; + } + + /// Set the timer's expiry time relative to now. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when expires_from_now() 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. + */ + std::size_t expires_from_now(const duration& expiry_time, + boost::system::error_code& ec) + { + return this->service.expires_from_now( + this->implementation, expiry_time, ec); + } + + /// Perform a blocking wait on the timer. + /** + * This function is used to wait for the timer to expire. This function + * blocks and does not return until the timer has expired. + * + * @throws boost::system::system_error Thrown on failure. + */ + void wait() + { + boost::system::error_code ec; + this->service.wait(this->implementation, ec); + boost::asio::detail::throw_error(ec, "wait"); + } + + /// Perform a blocking wait on the timer. + /** + * This function is used to wait for the timer to expire. This function + * blocks and does not return until the timer has expired. + * + * @param ec Set to indicate what error occurred, if any. + */ + void wait(boost::system::error_code& ec) + { + this->service.wait(this->implementation, ec); + } + + /// Start an asynchronous wait on the timer. + /** + * This function may be used to initiate an asynchronous wait against the + * timer. 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 The timer has expired. + * + * @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> + +#endif // BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP diff --git a/3rdParty/Boost/src/boost/asio/buffer.hpp b/3rdParty/Boost/src/boost/asio/buffer.hpp index 15eaad4..532cfd1 100644 --- a/3rdParty/Boost/src/boost/asio/buffer.hpp +++ b/3rdParty/Boost/src/boost/asio/buffer.hpp @@ -2,7 +2,7 @@ // buffer.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> +#include <cstring> #include <string> #include <vector> #include <boost/detail/workaround.hpp> @@ -68,6 +69,19 @@ std::size_t buffer_size_helper(const const_buffer&); * The mutable_buffer class provides a safe representation of a buffer that can * be modified. It does not own the underlying data, and so is cheap to copy or * assign. + * + * @par Accessing Buffer Contents + * + * The contents of a buffer may be accessed using the @ref buffer_size + * and @ref buffer_cast functions: + * + * @code boost::asio::mutable_buffer b1 = ...; + * std::size_t s1 = boost::asio::buffer_size(b1); + * unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1); + * @endcode + * + * The boost::asio::buffer_cast function permits violations of type safety, so + * uses of it in application code should be carefully considered. */ class mutable_buffer { @@ -133,59 +147,6 @@ inline std::size_t buffer_size_helper(const mutable_buffer& b) } // namespace detail -/// Cast a non-modifiable buffer to a specified pointer to POD type. -/** - * @relates mutable_buffer - */ -template <typename PointerToPodType> -inline PointerToPodType buffer_cast(const mutable_buffer& b) -{ - return static_cast<PointerToPodType>(detail::buffer_cast_helper(b)); -} - -/// Get the number of bytes in a non-modifiable buffer. -/** - * @relates mutable_buffer - */ -inline std::size_t buffer_size(const mutable_buffer& b) -{ - return detail::buffer_size_helper(b); -} - -/// Create a new modifiable buffer that is offset from the start of another. -/** - * @relates mutable_buffer - */ -inline mutable_buffer operator+(const mutable_buffer& b, std::size_t start) -{ - if (start > buffer_size(b)) - return mutable_buffer(); - char* new_data = buffer_cast<char*>(b) + start; - std::size_t new_size = buffer_size(b) - start; - return mutable_buffer(new_data, new_size -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , b.get_debug_check() -#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING - ); -} - -/// Create a new modifiable buffer that is offset from the start of another. -/** - * @relates mutable_buffer - */ -inline mutable_buffer operator+(std::size_t start, const mutable_buffer& b) -{ - if (start > buffer_size(b)) - return mutable_buffer(); - char* new_data = buffer_cast<char*>(b) + start; - std::size_t new_size = buffer_size(b) - start; - return mutable_buffer(new_data, new_size -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , b.get_debug_check() -#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING - ); -} - /// Adapts a single modifiable buffer so that it meets the requirements of the /// MutableBufferSequence concept. class mutable_buffers_1 @@ -228,6 +189,19 @@ public: * The const_buffer class provides a safe representation of a buffer that cannot * be modified. It does not own the underlying data, and so is cheap to copy or * assign. + * + * @par Accessing Buffer Contents + * + * The contents of a buffer may be accessed using the @ref buffer_size + * and @ref buffer_cast functions: + * + * @code boost::asio::const_buffer b1 = ...; + * std::size_t s1 = boost::asio::buffer_size(b1); + * const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1); + * @endcode + * + * The boost::asio::buffer_cast function permits violations of type safety, so + * uses of it in application code should be carefully considered. */ class const_buffer { @@ -303,59 +277,6 @@ inline std::size_t buffer_size_helper(const const_buffer& b) } // namespace detail -/// Cast a non-modifiable buffer to a specified pointer to POD type. -/** - * @relates const_buffer - */ -template <typename PointerToPodType> -inline PointerToPodType buffer_cast(const const_buffer& b) -{ - return static_cast<PointerToPodType>(detail::buffer_cast_helper(b)); -} - -/// Get the number of bytes in a non-modifiable buffer. -/** - * @relates const_buffer - */ -inline std::size_t buffer_size(const const_buffer& b) -{ - return detail::buffer_size_helper(b); -} - -/// Create a new non-modifiable buffer that is offset from the start of another. -/** - * @relates const_buffer - */ -inline const_buffer operator+(const const_buffer& b, std::size_t start) -{ - if (start > buffer_size(b)) - return const_buffer(); - const char* new_data = buffer_cast<const char*>(b) + start; - std::size_t new_size = buffer_size(b) - start; - return const_buffer(new_data, new_size -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , b.get_debug_check() -#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING - ); -} - -/// Create a new non-modifiable buffer that is offset from the start of another. -/** - * @relates const_buffer - */ -inline const_buffer operator+(std::size_t start, const const_buffer& b) -{ - if (start > buffer_size(b)) - return const_buffer(); - const char* new_data = buffer_cast<const char*>(b) + start; - std::size_t new_size = buffer_size(b) - start; - return const_buffer(new_data, new_size -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , b.get_debug_check() -#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING - ); -} - /// Adapts a single non-modifiable buffer so that it meets the requirements of /// the ConstBufferSequence concept. class const_buffers_1 @@ -420,6 +341,163 @@ private: mutable_buffer buf_; }; +/** @defgroup buffer_size boost::asio::buffer_size + * + * @brief The boost::asio::buffer_size function determines the total number of + * bytes in a buffer or buffer sequence. + */ +/*@{*/ + +/// Get the number of bytes in a modifiable buffer. +inline std::size_t buffer_size(const mutable_buffer& b) +{ + return detail::buffer_size_helper(b); +} + +/// Get the number of bytes in a modifiable buffer. +inline std::size_t buffer_size(const mutable_buffers_1& b) +{ + return detail::buffer_size_helper(b); +} + +/// Get the number of bytes in a non-modifiable buffer. +inline std::size_t buffer_size(const const_buffer& b) +{ + return detail::buffer_size_helper(b); +} + +/// Get the number of bytes in a non-modifiable buffer. +inline std::size_t buffer_size(const const_buffers_1& b) +{ + return detail::buffer_size_helper(b); +} + +/// Get the total number of bytes in a buffer sequence. +/** + * The @c BufferSequence template parameter may meet either of the @c + * ConstBufferSequence or @c MutableBufferSequence type requirements. + */ +template <typename BufferSequence> +inline std::size_t buffer_size(const BufferSequence& b) +{ + std::size_t total_buffer_size = 0; + + typename BufferSequence::const_iterator iter = b.begin(); + typename BufferSequence::const_iterator end = b.end(); + for (; iter != end; ++iter) + total_buffer_size += detail::buffer_size_helper(*iter); + + return total_buffer_size; +} + +/*@}*/ + +/** @defgroup buffer_cast boost::asio::buffer_cast + * + * @brief The boost::asio::buffer_cast function is used to obtain a pointer to + * the underlying memory region associated with a buffer. + * + * @par Examples: + * + * To access the memory of a non-modifiable buffer, use: + * @code boost::asio::const_buffer b1 = ...; + * const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1); + * @endcode + * + * To access the memory of a modifiable buffer, use: + * @code boost::asio::mutable_buffer b2 = ...; + * unsigned char* p2 = boost::asio::buffer_cast<unsigned char*>(b2); + * @endcode + * + * The boost::asio::buffer_cast function permits violations of type safety, so + * uses of it in application code should be carefully considered. + */ +/*@{*/ + +/// Cast a non-modifiable buffer to a specified pointer to POD type. +template <typename PointerToPodType> +inline PointerToPodType buffer_cast(const mutable_buffer& b) +{ + return static_cast<PointerToPodType>(detail::buffer_cast_helper(b)); +} + +/// Cast a non-modifiable buffer to a specified pointer to POD type. +template <typename PointerToPodType> +inline PointerToPodType buffer_cast(const const_buffer& b) +{ + return static_cast<PointerToPodType>(detail::buffer_cast_helper(b)); +} + +/*@}*/ + +/// Create a new modifiable buffer that is offset from the start of another. +/** + * @relates mutable_buffer + */ +inline mutable_buffer operator+(const mutable_buffer& b, std::size_t start) +{ + if (start > buffer_size(b)) + return mutable_buffer(); + char* new_data = buffer_cast<char*>(b) + start; + std::size_t new_size = buffer_size(b) - start; + return mutable_buffer(new_data, new_size +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + , b.get_debug_check() +#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING + ); +} + +/// Create a new modifiable buffer that is offset from the start of another. +/** + * @relates mutable_buffer + */ +inline mutable_buffer operator+(std::size_t start, const mutable_buffer& b) +{ + if (start > buffer_size(b)) + return mutable_buffer(); + char* new_data = buffer_cast<char*>(b) + start; + std::size_t new_size = buffer_size(b) - start; + return mutable_buffer(new_data, new_size +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + , b.get_debug_check() +#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING + ); +} + +/// Create a new non-modifiable buffer that is offset from the start of another. +/** + * @relates const_buffer + */ +inline const_buffer operator+(const const_buffer& b, std::size_t start) +{ + if (start > buffer_size(b)) + return const_buffer(); + const char* new_data = buffer_cast<const char*>(b) + start; + std::size_t new_size = buffer_size(b) - start; + return const_buffer(new_data, new_size +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + , b.get_debug_check() +#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING + ); +} + +/// Create a new non-modifiable buffer that is offset from the start of another. +/** + * @relates const_buffer + */ +inline const_buffer operator+(std::size_t start, const const_buffer& b) +{ + if (start > buffer_size(b)) + return const_buffer(); + const char* new_data = buffer_cast<const char*>(b) + start; + std::size_t new_size = buffer_size(b) - start; + return const_buffer(new_data, new_size +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + , b.get_debug_check() +#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING + ); +} + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) namespace detail { @@ -479,9 +557,9 @@ private: * passed to the socket's write function. A buffer created for modifiable * memory also meets the requirements of the MutableBufferSequence concept. * - * An individual buffer may be created from a builtin array, std::vector or - * boost::array of POD elements. This helps prevent buffer overruns by - * automatically determining the size of the buffer: + * An individual buffer may be created from a builtin array, std::vector, + * std::array or boost::array of POD elements. This helps prevent buffer + * overruns by automatically determining the size of the buffer: * * @code char d1[128]; * size_t bytes_transferred = sock.receive(boost::asio::buffer(d1)); @@ -489,8 +567,11 @@ private: * std::vector<char> d2(128); * bytes_transferred = sock.receive(boost::asio::buffer(d2)); * - * boost::array<char, 128> d3; - * bytes_transferred = sock.receive(boost::asio::buffer(d3)); @endcode + * std::array<char, 128> d3; + * bytes_transferred = sock.receive(boost::asio::buffer(d3)); + * + * boost::array<char, 128> d4; + * bytes_transferred = sock.receive(boost::asio::buffer(d4)); @endcode * * In all three cases above, the buffers created are exactly 128 bytes long. * Note that a vector is @e never automatically resized when creating or using @@ -499,8 +580,8 @@ private: * * @par Accessing Buffer Contents * - * The contents of a buffer may be accessed using the boost::asio::buffer_size - * and boost::asio::buffer_cast functions: + * The contents of a buffer may be accessed using the @ref buffer_size and + * @ref buffer_cast functions: * * @code boost::asio::mutable_buffer b1 = ...; * std::size_t s1 = boost::asio::buffer_size(b1); @@ -513,6 +594,24 @@ private: * The boost::asio::buffer_cast function permits violations of type safety, so * uses of it in application code should be carefully considered. * + * For convenience, the @ref buffer_size function also works on buffer + * sequences (that is, types meeting the ConstBufferSequence or + * MutableBufferSequence type requirements). In this case, the function returns + * the total size of all buffers in the sequence. + * + * @par Buffer Copying + * + * The @ref buffer_copy function may be used to copy raw bytes between + * individual buffers and buffer sequences. + * + * In particular, when used with the @ref buffer_size, the @ref buffer_copy + * function can be used to linearise a sequence of buffers. For example: + * + * @code vector<const_buffer> buffers = ...; + * + * vector<unsigned char> data(boost::asio::buffer_size(buffers)); + * boost::asio::buffer_copy(boost::asio::buffer(data), buffers); @endcode + * * @par Buffer Invalidation * * A buffer object does not have any ownership of the memory it refers to. It @@ -526,8 +625,8 @@ private: * referring to the elements in the sequence (C++ Std, 23.2.4) * * For the boost::asio::buffer overloads that accept an argument of type - * std::string, the buffer objects returned are invalidated according to the - * rules defined for invalidation of references, pointers and iterators + * std::basic_string, the buffer objects returned are invalidated according to + * the rules defined for invalidation of references, pointers and iterators * referring to elements of the sequence (C++ Std, 21.3). * * @par Buffer Arithmetic @@ -896,6 +995,103 @@ inline const_buffers_1 buffer(const boost::array<PodType, N>& data, ? data.size() * sizeof(PodType) : max_size_in_bytes)); } +#if defined(BOOST_ASIO_HAS_STD_ARRAY) || defined(GENERATING_DOCUMENTATION) + +/// Create a new modifiable buffer that represents the given POD array. +/** + * @returns A mutable_buffers_1 value equivalent to: + * @code mutable_buffers_1( + * data.data(), + * data.size() * sizeof(PodType)); @endcode + */ +template <typename PodType, std::size_t N> +inline mutable_buffers_1 buffer(std::array<PodType, N>& data) +{ + return mutable_buffers_1( + mutable_buffer(data.data(), data.size() * sizeof(PodType))); +} + +/// Create a new modifiable buffer that represents the given POD array. +/** + * @returns A mutable_buffers_1 value equivalent to: + * @code mutable_buffers_1( + * data.data(), + * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode + */ +template <typename PodType, std::size_t N> +inline mutable_buffers_1 buffer(std::array<PodType, N>& data, + std::size_t max_size_in_bytes) +{ + return mutable_buffers_1( + mutable_buffer(data.data(), + data.size() * sizeof(PodType) < max_size_in_bytes + ? data.size() * sizeof(PodType) : max_size_in_bytes)); +} + +/// Create a new non-modifiable buffer that represents the given POD array. +/** + * @returns A const_buffers_1 value equivalent to: + * @code const_buffers_1( + * data.data(), + * data.size() * sizeof(PodType)); @endcode + */ +template <typename PodType, std::size_t N> +inline const_buffers_1 buffer(std::array<const PodType, N>& data) +{ + return const_buffers_1( + const_buffer(data.data(), data.size() * sizeof(PodType))); +} + +/// Create a new non-modifiable buffer that represents the given POD array. +/** + * @returns A const_buffers_1 value equivalent to: + * @code const_buffers_1( + * data.data(), + * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode + */ +template <typename PodType, std::size_t N> +inline const_buffers_1 buffer(std::array<const PodType, N>& data, + std::size_t max_size_in_bytes) +{ + return const_buffers_1( + const_buffer(data.data(), + data.size() * sizeof(PodType) < max_size_in_bytes + ? data.size() * sizeof(PodType) : max_size_in_bytes)); +} + +/// Create a new non-modifiable buffer that represents the given POD array. +/** + * @returns A const_buffers_1 value equivalent to: + * @code const_buffers_1( + * data.data(), + * data.size() * sizeof(PodType)); @endcode + */ +template <typename PodType, std::size_t N> +inline const_buffers_1 buffer(const std::array<PodType, N>& data) +{ + return const_buffers_1( + const_buffer(data.data(), data.size() * sizeof(PodType))); +} + +/// Create a new non-modifiable buffer that represents the given POD array. +/** + * @returns A const_buffers_1 value equivalent to: + * @code const_buffers_1( + * data.data(), + * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode + */ +template <typename PodType, std::size_t N> +inline const_buffers_1 buffer(const std::array<PodType, N>& data, + std::size_t max_size_in_bytes) +{ + return const_buffers_1( + const_buffer(data.data(), + data.size() * sizeof(PodType) < max_size_in_bytes + ? data.size() * sizeof(PodType) : max_size_in_bytes)); +} + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) || defined(GENERATING_DOCUMENTATION) + /// Create a new modifiable buffer that represents the given POD vector. /** * @returns A mutable_buffers_1 value equivalent to: @@ -997,16 +1193,20 @@ inline const_buffers_1 buffer( /// Create a new non-modifiable buffer that represents the given string. /** - * @returns <tt>const_buffers_1(data.data(), data.size())</tt>. + * @returns <tt>const_buffers_1(data.data(), data.size() * sizeof(Elem))</tt>. * * @note The buffer is invalidated by any non-const operation called on the * given string object. */ -inline const_buffers_1 buffer(const std::string& data) +template <typename Elem, typename Traits, typename Allocator> +inline const_buffers_1 buffer( + const std::basic_string<Elem, Traits, Allocator>& data) { - return const_buffers_1(const_buffer(data.data(), data.size() + return const_buffers_1(const_buffer(data.data(), data.size() * sizeof(Elem) #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , detail::buffer_debug_check<std::string::const_iterator>(data.begin()) + , detail::buffer_debug_check< + typename std::basic_string<Elem, Traits, Allocator>::const_iterator + >(data.begin()) #endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING )); } @@ -1016,26 +1216,924 @@ inline const_buffers_1 buffer(const std::string& data) * @returns A const_buffers_1 value equivalent to: * @code const_buffers_1( * data.data(), - * min(data.size(), max_size_in_bytes)); @endcode + * min(data.size() * sizeof(Elem), max_size_in_bytes)); @endcode * * @note The buffer is invalidated by any non-const operation called on the * given string object. */ -inline const_buffers_1 buffer(const std::string& data, +template <typename Elem, typename Traits, typename Allocator> +inline const_buffers_1 buffer( + const std::basic_string<Elem, Traits, Allocator>& data, std::size_t max_size_in_bytes) { return const_buffers_1( const_buffer(data.data(), - data.size() < max_size_in_bytes - ? data.size() : max_size_in_bytes + data.size() * sizeof(Elem) < max_size_in_bytes + ? data.size() * sizeof(Elem) : max_size_in_bytes #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , detail::buffer_debug_check<std::string::const_iterator>(data.begin()) + , detail::buffer_debug_check< + typename std::basic_string<Elem, Traits, Allocator>::const_iterator + >(data.begin()) #endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING )); } /*@}*/ +/** @defgroup buffer_copy boost::asio::buffer_copy + * + * @brief The boost::asio::buffer_copy function is used to copy bytes from a + * source buffer (or buffer sequence) to a target buffer (or buffer sequence). + * + * The @c buffer_copy function is available in two forms: + * + * @li A 2-argument form: @c buffer_copy(target, source) + * + * @li A 3-argument form: @c buffer_copy(target, source, max_bytes_to_copy) + + * Both forms return the number of bytes actually copied. The number of bytes + * copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c If specified, @c max_bytes_to_copy. + * + * This prevents buffer overflow, regardless of the buffer sizes used in the + * copy operation. + */ +/*@{*/ + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const const_buffer& source) +{ + using namespace std; // For memcpy. + std::size_t target_size = buffer_size(target); + std::size_t source_size = buffer_size(source); + std::size_t n = target_size < source_size ? target_size : source_size; + memcpy(buffer_cast<void*>(target), buffer_cast<const void*>(source), n); + return n; +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const const_buffers_1& source) +{ + return buffer_copy(target, static_cast<const const_buffer&>(source)); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const mutable_buffer& source) +{ + return buffer_copy(target, const_buffer(source)); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const mutable_buffers_1& source) +{ + return buffer_copy(target, const_buffer(source)); +} + +/// Copies bytes from a source buffer sequence to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename ConstBufferSequence> +std::size_t buffer_copy(const mutable_buffer& target, + const ConstBufferSequence& source) +{ + std::size_t total_bytes_copied = 0; + + typename ConstBufferSequence::const_iterator source_iter = source.begin(); + typename ConstBufferSequence::const_iterator source_end = source.end(); + + for (mutable_buffer target_buffer(target); + buffer_size(target_buffer) && source_iter != source_end; ++source_iter) + { + const_buffer source_buffer(*source_iter); + std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer); + total_bytes_copied += bytes_copied; + target_buffer = target_buffer + bytes_copied; + } + + return total_bytes_copied; +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const const_buffer& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), source); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const const_buffers_1& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), + static_cast<const const_buffer&>(source)); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const mutable_buffer& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), + const_buffer(source)); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const mutable_buffers_1& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), + const_buffer(source)); +} + +/// Copies bytes from a source buffer sequence to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename ConstBufferSequence> +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const ConstBufferSequence& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), source); +} + +/// Copies bytes from a source buffer to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence> +std::size_t buffer_copy(const MutableBufferSequence& target, + const const_buffer& source) +{ + std::size_t total_bytes_copied = 0; + + typename MutableBufferSequence::const_iterator target_iter = target.begin(); + typename MutableBufferSequence::const_iterator target_end = target.end(); + + for (const_buffer source_buffer(source); + buffer_size(source_buffer) && target_iter != target_end; ++target_iter) + { + mutable_buffer target_buffer(*target_iter); + std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer); + total_bytes_copied += bytes_copied; + source_buffer = source_buffer + bytes_copied; + } + + return total_bytes_copied; +} + +/// Copies bytes from a source buffer to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const const_buffers_1& source) +{ + return buffer_copy(target, static_cast<const const_buffer&>(source)); +} + +/// Copies bytes from a source buffer to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const mutable_buffer& source) +{ + return buffer_copy(target, const_buffer(source)); +} + +/// Copies bytes from a source buffer to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const mutable_buffers_1& source) +{ + return buffer_copy(target, const_buffer(source)); +} + +/// Copies bytes from a source buffer sequence to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence, typename ConstBufferSequence> +std::size_t buffer_copy(const MutableBufferSequence& target, + const ConstBufferSequence& source) +{ + std::size_t total_bytes_copied = 0; + + typename MutableBufferSequence::const_iterator target_iter = target.begin(); + typename MutableBufferSequence::const_iterator target_end = target.end(); + std::size_t target_buffer_offset = 0; + + typename ConstBufferSequence::const_iterator source_iter = source.begin(); + typename ConstBufferSequence::const_iterator source_end = source.end(); + std::size_t source_buffer_offset = 0; + + while (target_iter != target_end && source_iter != source_end) + { + mutable_buffer target_buffer = + mutable_buffer(*target_iter) + target_buffer_offset; + + const_buffer source_buffer = + const_buffer(*source_iter) + source_buffer_offset; + + std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer); + total_bytes_copied += bytes_copied; + + if (bytes_copied == buffer_size(target_buffer)) + { + ++target_iter; + target_buffer_offset = 0; + } + else + target_buffer_offset += bytes_copied; + + if (bytes_copied == buffer_size(source_buffer)) + { + ++source_iter; + source_buffer_offset = 0; + } + else + source_buffer_offset += bytes_copied; + } + + return total_bytes_copied; +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const const_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const const_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const mutable_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const mutable_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer sequence to a target +/// buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename ConstBufferSequence> +inline std::size_t buffer_copy(const mutable_buffer& target, + const ConstBufferSequence& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const const_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const const_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const mutable_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const mutable_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer sequence to a target +/// buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename ConstBufferSequence> +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const ConstBufferSequence& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer +/// sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const const_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(target, buffer(source, max_bytes_to_copy)); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer +/// sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const const_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(target, buffer(source, max_bytes_to_copy)); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer +/// sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const mutable_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(target, buffer(source, max_bytes_to_copy)); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer +/// sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const mutable_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(target, buffer(source, max_bytes_to_copy)); +} + +/// Copies a limited number of bytes from a source buffer sequence to a target +/// buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence, typename ConstBufferSequence> +std::size_t buffer_copy(const MutableBufferSequence& target, + const ConstBufferSequence& source, std::size_t max_bytes_to_copy) +{ + std::size_t total_bytes_copied = 0; + + typename MutableBufferSequence::const_iterator target_iter = target.begin(); + typename MutableBufferSequence::const_iterator target_end = target.end(); + std::size_t target_buffer_offset = 0; + + typename ConstBufferSequence::const_iterator source_iter = source.begin(); + typename ConstBufferSequence::const_iterator source_end = source.end(); + std::size_t source_buffer_offset = 0; + + while (total_bytes_copied != max_bytes_to_copy + && target_iter != target_end && source_iter != source_end) + { + mutable_buffer target_buffer = + mutable_buffer(*target_iter) + target_buffer_offset; + + const_buffer source_buffer = + const_buffer(*source_iter) + source_buffer_offset; + + std::size_t bytes_copied = buffer_copy(target_buffer, + source_buffer, max_bytes_to_copy - total_bytes_copied); + total_bytes_copied += bytes_copied; + + if (bytes_copied == buffer_size(target_buffer)) + { + ++target_iter; + target_buffer_offset = 0; + } + else + target_buffer_offset += bytes_copied; + + if (bytes_copied == buffer_size(source_buffer)) + { + ++source_iter; + source_buffer_offset = 0; + } + else + source_buffer_offset += bytes_copied; + } + + return total_bytes_copied; +} + +/*@}*/ + } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/buffered_read_stream.hpp b/3rdParty/Boost/src/boost/asio/buffered_read_stream.hpp index af24dd6..3072580 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_read_stream.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_read_stream.hpp @@ -2,7 +2,7 @@ // buffered_read_stream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,7 +17,6 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> -#include <cstring> #include <boost/type_traits/remove_reference.hpp> #include <boost/asio/buffered_read_stream_fwd.hpp> #include <boost/asio/buffer.hpp> @@ -97,13 +96,6 @@ public: return next_layer_.lowest_layer(); } - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the object. - boost::asio::io_service& io_service() - { - return next_layer_.get_io_service(); - } - /// Get the io_service associated with the object. boost::asio::io_service& get_io_service() { @@ -227,16 +219,7 @@ public: template <typename MutableBufferSequence> std::size_t read_some(const MutableBufferSequence& buffers) { - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::mutable_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) return 0; if (storage_.empty()) @@ -253,16 +236,7 @@ public: { ec = boost::system::error_code(); - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::mutable_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) return 0; if (storage_.empty() && !fill(ec)) @@ -294,24 +268,8 @@ public: } else { - using namespace std; // For memcpy. - - std::size_t bytes_avail = storage_.size(); - std::size_t bytes_copied = 0; - - typename MutableBufferSequence::const_iterator iter = buffers_.begin(); - typename MutableBufferSequence::const_iterator end = buffers_.end(); - for (; iter != end && bytes_avail > 0; ++iter) - { - std::size_t max_length = buffer_size(*iter); - std::size_t length = (max_length < bytes_avail) - ? max_length : bytes_avail; - memcpy(buffer_cast<void*>(*iter), - storage_.data() + bytes_copied, length); - bytes_copied += length; - bytes_avail -= length; - } - + std::size_t bytes_copied = boost::asio::buffer_copy( + buffers_, storage_.data(), storage_.size()); storage_.consume(bytes_copied); io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied)); } @@ -330,16 +288,7 @@ public: void async_read_some(const MutableBufferSequence& buffers, ReadHandler handler) { - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::mutable_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) { get_io_service().post(detail::bind_handler( handler, boost::system::error_code(), 0)); @@ -398,23 +347,8 @@ private: template <typename MutableBufferSequence> std::size_t copy(const MutableBufferSequence& buffers) { - using namespace std; // For memcpy. - - std::size_t bytes_avail = storage_.size(); - std::size_t bytes_copied = 0; - - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - for (; iter != end && bytes_avail > 0; ++iter) - { - std::size_t max_length = buffer_size(*iter); - std::size_t length = (max_length < bytes_avail) - ? max_length : bytes_avail; - memcpy(buffer_cast<void*>(*iter), storage_.data() + bytes_copied, length); - bytes_copied += length; - bytes_avail -= length; - } - + std::size_t bytes_copied = boost::asio::buffer_copy( + buffers, storage_.data(), storage_.size()); storage_.consume(bytes_copied); return bytes_copied; } @@ -425,24 +359,7 @@ private: template <typename MutableBufferSequence> std::size_t peek_copy(const MutableBufferSequence& buffers) { - using namespace std; // For memcpy. - - std::size_t bytes_avail = storage_.size(); - std::size_t bytes_copied = 0; - - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - for (; iter != end && bytes_avail > 0; ++iter) - { - std::size_t max_length = buffer_size(*iter); - std::size_t length = (max_length < bytes_avail) - ? max_length : bytes_avail; - memcpy(buffer_cast<void*>(*iter), storage_.data() + bytes_copied, length); - bytes_copied += length; - bytes_avail -= length; - } - - return bytes_copied; + return boost::asio::buffer_copy(buffers, storage_.data(), storage_.size()); } /// The next layer. diff --git a/3rdParty/Boost/src/boost/asio/buffered_read_stream_fwd.hpp b/3rdParty/Boost/src/boost/asio/buffered_read_stream_fwd.hpp index 9c8a1af..5c8c295 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_read_stream_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_read_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_read_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/buffered_stream.hpp b/3rdParty/Boost/src/boost/asio/buffered_stream.hpp index 43d21de..632e5ce 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_stream.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_stream.hpp @@ -2,7 +2,7 @@ // buffered_stream.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -87,13 +87,6 @@ public: return stream_impl_.lowest_layer(); } - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the object. - boost::asio::io_service& io_service() - { - return stream_impl_.get_io_service(); - } - /// Get the io_service associated with the object. boost::asio::io_service& get_io_service() { diff --git a/3rdParty/Boost/src/boost/asio/buffered_stream_fwd.hpp b/3rdParty/Boost/src/boost/asio/buffered_stream_fwd.hpp index 042b990..5241879 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_stream_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp b/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp index a163b13..11cb872 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp @@ -2,7 +2,7 @@ // buffered_write_stream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,7 +17,6 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> -#include <cstring> #include <boost/type_traits/remove_reference.hpp> #include <boost/asio/buffered_write_stream_fwd.hpp> #include <boost/asio/buffer.hpp> @@ -98,13 +97,6 @@ public: return next_layer_.lowest_layer(); } - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the object. - boost::asio::io_service& io_service() - { - return next_layer_.get_io_service(); - } - /// Get the io_service associated with the object. boost::asio::io_service& get_io_service() { @@ -184,16 +176,7 @@ public: template <typename ConstBufferSequence> std::size_t write_some(const ConstBufferSequence& buffers) { - typename ConstBufferSequence::const_iterator iter = buffers.begin(); - typename ConstBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::const_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) return 0; if (storage_.size() == storage_.capacity()) @@ -210,16 +193,7 @@ public: { ec = boost::system::error_code(); - typename ConstBufferSequence::const_iterator iter = buffers.begin(); - typename ConstBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::const_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) return 0; if (storage_.size() == storage_.capacity() && !flush(ec)) @@ -251,25 +225,14 @@ public: } else { - using namespace std; // For memcpy. - std::size_t orig_size = storage_.size(); std::size_t space_avail = storage_.capacity() - orig_size; - std::size_t bytes_copied = 0; - - typename ConstBufferSequence::const_iterator iter = buffers_.begin(); - typename ConstBufferSequence::const_iterator end = buffers_.end(); - for (; iter != end && space_avail > 0; ++iter) - { - std::size_t bytes_avail = buffer_size(*iter); - std::size_t length = (bytes_avail < space_avail) - ? bytes_avail : space_avail; - storage_.resize(orig_size + bytes_copied + length); - memcpy(storage_.data() + orig_size + bytes_copied, - buffer_cast<const void*>(*iter), length); - bytes_copied += length; - space_avail -= length; - } + std::size_t bytes_avail = boost::asio::buffer_size(buffers_); + std::size_t length = bytes_avail < space_avail + ? bytes_avail : space_avail; + storage_.resize(orig_size + length); + std::size_t bytes_copied = boost::asio::buffer_copy( + storage_.data() + orig_size, buffers_, length); io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied)); } @@ -288,16 +251,7 @@ public: void async_write_some(const ConstBufferSequence& buffers, WriteHandler handler) { - typename ConstBufferSequence::const_iterator iter = buffers.begin(); - typename ConstBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::const_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) { get_io_service().post(detail::bind_handler( handler, boost::system::error_code(), 0)); @@ -376,27 +330,13 @@ private: template <typename ConstBufferSequence> std::size_t copy(const ConstBufferSequence& buffers) { - using namespace std; // For memcpy. - std::size_t orig_size = storage_.size(); std::size_t space_avail = storage_.capacity() - orig_size; - std::size_t bytes_copied = 0; - - typename ConstBufferSequence::const_iterator iter = buffers.begin(); - typename ConstBufferSequence::const_iterator end = buffers.end(); - for (; iter != end && space_avail > 0; ++iter) - { - std::size_t bytes_avail = buffer_size(*iter); - std::size_t length = (bytes_avail < space_avail) - ? bytes_avail : space_avail; - storage_.resize(orig_size + bytes_copied + length); - memcpy(storage_.data() + orig_size + bytes_copied, - buffer_cast<const void*>(*iter), length); - bytes_copied += length; - space_avail -= length; - } - - return bytes_copied; + std::size_t bytes_avail = boost::asio::buffer_size(buffers); + std::size_t length = bytes_avail < space_avail ? bytes_avail : space_avail; + storage_.resize(orig_size + length); + return boost::asio::buffer_copy( + storage_.data() + orig_size, buffers, length); } /// The next layer. diff --git a/3rdParty/Boost/src/boost/asio/buffered_write_stream_fwd.hpp b/3rdParty/Boost/src/boost/asio/buffered_write_stream_fwd.hpp index 0590a96..2da283f 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_write_stream_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_write_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_write_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/buffers_iterator.hpp b/3rdParty/Boost/src/boost/asio/buffers_iterator.hpp index 3375361..c11e146 100644 --- a/3rdParty/Boost/src/boost/asio/buffers_iterator.hpp +++ b/3rdParty/Boost/src/boost/asio/buffers_iterator.hpp @@ -2,7 +2,7 @@ // buffers_iterator.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,9 +17,9 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> +#include <iterator> #include <boost/assert.hpp> #include <boost/detail/workaround.hpp> -#include <boost/iterator.hpp> #include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/add_const.hpp> #include <boost/asio/buffer.hpp> @@ -73,18 +73,47 @@ namespace detail /// A random access iterator over the bytes in a buffer sequence. template <typename BufferSequence, typename ByteType = char> class buffers_iterator - : public boost::iterator< - std::random_access_iterator_tag, - typename detail::buffers_iterator_types< - BufferSequence, ByteType>::byte_type> { private: typedef typename detail::buffers_iterator_types< BufferSequence, ByteType>::buffer_type buffer_type; - typedef typename detail::buffers_iterator_types< - BufferSequence, ByteType>::byte_type byte_type; public: + /// The type used for the distance between two iterators. + typedef std::ptrdiff_t difference_type; + + /// The type of the value pointed to by the iterator. + typedef ByteType value_type; + +#if defined(GENERATING_DOCUMENTATION) + /// The type of the result of applying operator->() to the iterator. + /** + * If the buffer sequence stores buffer objects that are convertible to + * mutable_buffer, this is a pointer to a non-const ByteType. Otherwise, a + * pointer to a const ByteType. + */ + typedef const_or_non_const_ByteType* pointer; +#else // defined(GENERATING_DOCUMENTATION) + typedef typename detail::buffers_iterator_types< + BufferSequence, ByteType>::byte_type* pointer; +#endif // defined(GENERATING_DOCUMENTATION) + +#if defined(GENERATING_DOCUMENTATION) + /// The type of the result of applying operator*() to the iterator. + /** + * If the buffer sequence stores buffer objects that are convertible to + * mutable_buffer, this is a reference to a non-const ByteType. Otherwise, a + * reference to a const ByteType. + */ + typedef const_or_non_const_ByteType& reference; +#else // defined(GENERATING_DOCUMENTATION) + typedef typename detail::buffers_iterator_types< + BufferSequence, ByteType>::byte_type& reference; +#endif // defined(GENERATING_DOCUMENTATION) + + /// The iterator category. + typedef std::random_access_iterator_tag iterator_category; + /// Default constructor. Creates an iterator in an undefined state. buffers_iterator() : current_buffer_(), @@ -99,7 +128,7 @@ public: /// Construct an iterator representing the beginning of the buffers' data. static buffers_iterator begin(const BufferSequence& buffers) #if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) - __attribute__ ((noinline)) + __attribute__ ((__noinline__)) #endif { buffers_iterator new_iter; @@ -119,7 +148,7 @@ public: /// Construct an iterator representing the end of the buffers' data. static buffers_iterator end(const BufferSequence& buffers) #if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) - __attribute__ ((noinline)) + __attribute__ ((__noinline__)) #endif { buffers_iterator new_iter; @@ -136,19 +165,19 @@ public: } /// Dereference an iterator. - byte_type& operator*() const + reference operator*() const { return dereference(); } /// Dereference an iterator. - byte_type* operator->() const + pointer operator->() const { return &dereference(); } /// Access an individual element. - byte_type& operator[](std::ptrdiff_t difference) const + reference operator[](std::ptrdiff_t difference) const { buffers_iterator tmp(*this); tmp.advance(difference); @@ -271,9 +300,9 @@ public: private: // Dereference the iterator. - byte_type& dereference() const + reference dereference() const { - return buffer_cast<byte_type*>(current_buffer_)[current_buffer_position_]; + return buffer_cast<pointer>(current_buffer_)[current_buffer_position_]; } // Compare two iterators for equality. diff --git a/3rdParty/Boost/src/boost/asio/completion_condition.hpp b/3rdParty/Boost/src/boost/asio/completion_condition.hpp index 7f5fc09..3d32c65 100644 --- a/3rdParty/Boost/src/boost/asio/completion_condition.hpp +++ b/3rdParty/Boost/src/boost/asio/completion_condition.hpp @@ -2,7 +2,7 @@ // completion_condition.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -76,6 +76,28 @@ private: std::size_t minimum_; }; +class transfer_exactly_t +{ +public: + typedef std::size_t result_type; + + explicit transfer_exactly_t(std::size_t size) + : size_(size) + { + } + + template <typename Error> + std::size_t operator()(const Error& err, std::size_t bytes_transferred) + { + return (!!err || bytes_transferred >= size_) ? 0 : + (size_ - bytes_transferred < default_max_transfer_size + ? size_ - bytes_transferred : std::size_t(default_max_transfer_size)); + } + +private: + std::size_t size_; +}; + } // namespace detail /** @@ -154,6 +176,40 @@ inline detail::transfer_at_least_t transfer_at_least(std::size_t minimum) } #endif +/// Return a completion condition function object that indicates that a read or +/// write operation should continue until an exact number of bytes has been +/// transferred, or until an error occurs. +/** + * This function is used to create an object, of unspecified type, that meets + * CompletionCondition requirements. + * + * @par Example + * Reading until a buffer is full or contains exactly 64 bytes: + * @code + * boost::array<char, 128> buf; + * boost::system::error_code ec; + * std::size_t n = boost::asio::read( + * sock, boost::asio::buffer(buf), + * boost::asio::transfer_exactly(64), ec); + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * // n == 64 + * } + * @endcode + */ +#if defined(GENERATING_DOCUMENTATION) +unspecified transfer_exactly(std::size_t size); +#else +inline detail::transfer_exactly_t transfer_exactly(std::size_t size) +{ + return detail::transfer_exactly_t(size); +} +#endif + /*@}*/ } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/connect.hpp b/3rdParty/Boost/src/boost/asio/connect.hpp new file mode 100644 index 0000000..e54ea08 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/connect.hpp @@ -0,0 +1,816 @@ +// +// connect.hpp +// ~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_CONNECT_HPP +#define BOOST_ASIO_CONNECT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/basic_socket.hpp> +#include <boost/asio/error.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/** + * @defgroup connect boost::asio::connect + * + * @brief Establishes a socket connection by trying each endpoint in a sequence. + */ +/*@{*/ + +/// 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 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. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @throws boost::system::system_error Thrown on failure. If the sequence is + * empty, the associated @c error_code is boost::asio::error::not_found. + * Otherwise, contains the error from the last connection attempt. + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * boost::asio::connect(s, r.resolve(q)); @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin); + +/// 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 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 ec Set to indicate what error occurred, if any. If the sequence is + * empty, set to boost::asio::error::not_found. Otherwise, contains the error + * from the last connection attempt. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * boost::system::error_code ec; + * boost::asio::connect(s, r.resolve(q), ec); + * if (ec) + * { + * // An error occurred. + * } @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, boost::system::error_code& ec); + +/// 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 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. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @throws boost::system::system_error Thrown on failure. If the sequence is + * empty, the associated @c error_code is boost::asio::error::not_found. + * Otherwise, contains the error from the last connection attempt. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::resolver::iterator i = r.resolve(q), end; + * tcp::socket s(io_service); + * boost::asio::connect(s, i, end); @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end); + +/// 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 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 ec Set to indicate what error occurred, if any. If the sequence is + * empty, set to boost::asio::error::not_found. Otherwise, contains the error + * from the last connection attempt. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::resolver::iterator i = r.resolve(q), end; + * tcp::socket s(io_service); + * boost::system::error_code ec; + * boost::asio::connect(s, i, end, ec); + * if (ec) + * { + * // An error occurred. + * } @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, boost::system::error_code& ec); + +/// 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 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 connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @throws boost::system::system_error Thrown on failure. If the sequence is + * empty, the associated @c error_code is boost::asio::error::not_found. + * Otherwise, contains the error from the last connection attempt. + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * tcp::resolver::iterator i = boost::asio::connect( + * s, r.resolve(q), my_connect_condition()); + * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, ConnectCondition connect_condition); + +/// 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 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 connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @param ec Set to indicate what error occurred, if any. If the sequence is + * empty, set to boost::asio::error::not_found. Otherwise, contains the error + * from the last connection attempt. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * boost::system::error_code ec; + * tcp::resolver::iterator i = boost::asio::connect( + * s, r.resolve(q), my_connect_condition(), ec); + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * std::cout << "Connected to: " << i->endpoint() << std::endl; + * } @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin, + ConnectCondition connect_condition, boost::system::error_code& ec); + +/// 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 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 connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @throws boost::system::system_error Thrown on failure. If the sequence is + * empty, the associated @c error_code is boost::asio::error::not_found. + * Otherwise, contains the error from the last connection attempt. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::resolver::iterator i = r.resolve(q), end; + * tcp::socket s(io_service); + * i = boost::asio::connect(s, i, end, my_connect_condition()); + * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin, + Iterator end, ConnectCondition connect_condition); + +/// 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 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 connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @param ec Set to indicate what error occurred, if any. If the sequence is + * empty, set to boost::asio::error::not_found. Otherwise, contains the error + * from the last connection attempt. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::resolver::iterator i = r.resolve(q), end; + * tcp::socket s(io_service); + * boost::system::error_code ec; + * i = boost::asio::connect(s, i, end, my_connect_condition(), ec); + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * std::cout << "Connected to: " << i->endpoint() << std::endl; + * } @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition, + boost::system::error_code& ec); + +/*@}*/ + +/** + * @defgroup async_connect boost::asio::async_connect + * + * @brief Asynchronously establishes a socket connection by trying each + * endpoint in a sequence. + */ +/*@{*/ + +/// 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 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 + * boost::asio::io_service::post(). + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @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 + * boost::asio::io_service::post(). + * + * @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) + * { + * tcp::resolver::iterator end; + * boost::asio::async_connect(s, i, end, 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, Iterator end, + 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 connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @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 + * boost::asio::io_service::post(). + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @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, + * my_connect_condition(), + * connect_handler); + * } + * } + * + * // ... + * + * void connect_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * std::cout << "Connected to: " << i->endpoint() << std::endl; + * } + * } @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> +void async_connect(basic_socket<Protocol, SocketService>& s, Iterator begin, + ConnectCondition connect_condition, + 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 connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @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 + * boost::asio::io_service::post(). + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @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) + * { + * tcp::resolver::iterator end; + * boost::asio::async_connect(s, i, end, + * my_connect_condition(), + * connect_handler); + * } + * } + * + * // ... + * + * void connect_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * std::cout << "Connected to: " << i->endpoint() << std::endl; + * } + * } @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> +void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler); + +/*@}*/ + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#include <boost/asio/impl/connect.hpp> + +#endif diff --git a/3rdParty/Boost/src/boost/asio/datagram_socket_service.hpp b/3rdParty/Boost/src/boost/asio/datagram_socket_service.hpp index 0db1f34..6e60a4f 100644 --- a/3rdParty/Boost/src/boost/asio/datagram_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/datagram_socket_service.hpp @@ -2,7 +2,7 @@ // datagram_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -68,11 +68,18 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// The native socket type. + /// (Deprecated: Use native_handle_type.) The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef typename service_impl_type::native_type native_type; + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new datagram socket service for the specified io_service. @@ -83,18 +90,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new datagram socket implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new datagram socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another datagram socket implementation. + void move_assign(implementation_type& impl, + datagram_socket_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a datagram socket implementation. void destroy(implementation_type& impl) { @@ -114,7 +132,7 @@ public: /// Assign an existing native socket to a datagram socket. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { return service_impl_.assign(impl, protocol, native_socket, ec); @@ -133,10 +151,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native socket implementation. + /// (Deprecated: Use native_handle().) Get the native socket implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native socket implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the socket. @@ -177,9 +201,11 @@ public: /// Start an asynchronous connect. template <typename ConnectHandler> void async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, ConnectHandler handler) + const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { - service_impl_.async_connect(impl, peer_endpoint, handler); + service_impl_.async_connect(impl, peer_endpoint, + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } /// Set a socket option. @@ -206,6 +232,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the socket. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, boost::system::error_code& ec) const @@ -239,9 +291,11 @@ public: /// Start an asynchronous send. template <typename ConstBufferSequence, typename WriteHandler> void async_send(implementation_type& impl, const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send(impl, buffers, flags, handler); + service_impl_.async_send(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Send a datagram to the specified endpoint. @@ -257,9 +311,11 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(implementation_type& impl, const ConstBufferSequence& buffers, const endpoint_type& destination, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send_to(impl, buffers, destination, flags, handler); + service_impl_.async_send_to(impl, buffers, destination, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data from the peer. @@ -275,9 +331,11 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive(implementation_type& impl, const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_receive(impl, buffers, flags, handler); + service_impl_.async_receive(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Receive a datagram with the endpoint of the sender. @@ -294,13 +352,20 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(implementation_type& impl, const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags, - handler); + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/deadline_timer.hpp b/3rdParty/Boost/src/boost/asio/deadline_timer.hpp index 866588b..82e65a7 100644 --- a/3rdParty/Boost/src/boost/asio/deadline_timer.hpp +++ b/3rdParty/Boost/src/boost/asio/deadline_timer.hpp @@ -2,7 +2,7 @@ // deadline_timer.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/deadline_timer_service.hpp b/3rdParty/Boost/src/boost/asio/deadline_timer_service.hpp index ce8fd13..b538307 100644 --- a/3rdParty/Boost/src/boost/asio/deadline_timer_service.hpp +++ b/3rdParty/Boost/src/boost/asio/deadline_timer_service.hpp @@ -2,7 +2,7 @@ // deadline_timer_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -20,6 +20,7 @@ #include <boost/asio/detail/deadline_timer_service.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/time_traits.hpp> +#include <boost/asio/detail/timer_queue_ptime.hpp> #include <boost/asio/detail/push_options.hpp> @@ -72,12 +73,6 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new timer implementation. void construct(implementation_type& impl) { @@ -96,6 +91,13 @@ public: return service_impl_.cancel(impl, ec); } + /// Cancels one asynchronous wait operation associated with the timer. + std::size_t cancel_one(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.cancel_one(impl, ec); + } + /// Get the expiry time for the timer as an absolute time. time_type expires_at(const implementation_type& impl) const { @@ -130,12 +132,19 @@ public: // Start an asynchronous wait on the timer. template <typename WaitHandler> - void async_wait(implementation_type& impl, WaitHandler handler) + void async_wait(implementation_type& impl, + BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { - service_impl_.async_wait(impl, handler); + service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/detail/array.hpp b/3rdParty/Boost/src/boost/asio/detail/array.hpp new file mode 100644 index 0000000..be141b1 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/array.hpp @@ -0,0 +1,40 @@ +// +// detail/array.hpp +// ~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_ARRAY_HPP +#define BOOST_ASIO_DETAIL_ARRAY_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) +# include <array> +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) +# include <boost/array.hpp> +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + +namespace boost { +namespace asio { +namespace detail { + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) +using std::array; +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) +using boost::array; +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + +} // namespace detail +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_ARRAY_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/array_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/array_fwd.hpp index b7a27bf..f97ed0b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/array_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/array_fwd.hpp @@ -2,7 +2,7 @@ // detail/array_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -15,6 +15,8 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include <boost/asio/detail/config.hpp> + namespace boost { template<class T, std::size_t N> @@ -22,4 +24,11 @@ class array; } // namespace boost +// Standard library components can't be forward declared, so we'll have to +// include the array header. Fortunately, it's fairly lightweight and doesn't +// add significantly to the compile time. +#if defined(BOOST_ASIO_HAS_STD_ARRAY) +# include <array> +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + #endif // BOOST_ASIO_DETAIL_ARRAY_FWD_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/atomic_count.hpp b/3rdParty/Boost/src/boost/asio/detail/atomic_count.hpp new file mode 100644 index 0000000..5e0051a --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/atomic_count.hpp @@ -0,0 +1,47 @@ +// +// detail/atomic_count.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP +#define BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +// Nothing to include. +#elif defined(BOOST_ASIO_HAS_STD_ATOMIC) +# include <atomic> +#else // defined(BOOST_ASIO_HAS_STD_ATOMIC) +# include <boost/detail/atomic_count.hpp> +#endif // defined(BOOST_ASIO_HAS_STD_ATOMIC) + +namespace boost { +namespace asio { +namespace detail { + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +typedef long atomic_count; +inline void increment(atomic_count& a, long b) { a += b; } +#elif defined(BOOST_ASIO_HAS_STD_ATOMIC) +typedef std::atomic<long> atomic_count; +inline void increment(atomic_count& a, long b) { a += b; } +#else // defined(BOOST_ASIO_HAS_STD_ATOMIC) +typedef boost::detail::atomic_count atomic_count; +inline void increment(atomic_count& a, long b) { while (b > 0) ++a, --b; } +#endif // defined(BOOST_ASIO_HAS_STD_ATOMIC) + +} // namespace detail +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/base_from_completion_cond.hpp b/3rdParty/Boost/src/boost/asio/detail/base_from_completion_cond.hpp index b2b76d6..635b9c1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/base_from_completion_cond.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/base_from_completion_cond.hpp @@ -2,7 +2,7 @@ // detail/base_from_completion_cond.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp index 0199643..0bd7e53 100644 --- a/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp @@ -2,7 +2,7 @@ // detail/bind_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -35,6 +35,12 @@ public: { } + binder1(Handler& handler, const Arg1& arg1) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_)); @@ -67,6 +73,14 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, } template <typename Function, typename Handler, typename Arg1> +inline void asio_handler_invoke(Function& function, + binder1<Handler, Arg1>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1> inline void asio_handler_invoke(const Function& function, binder1<Handler, Arg1>* this_handler) { @@ -75,7 +89,7 @@ inline void asio_handler_invoke(const Function& function, } template <typename Handler, typename Arg1> -inline binder1<Handler, Arg1> bind_handler(const Handler& handler, +inline binder1<Handler, Arg1> bind_handler(Handler handler, const Arg1& arg1) { return binder1<Handler, Arg1>(handler, arg1); @@ -92,6 +106,13 @@ public: { } + binder2(Handler& handler, const Arg1& arg1, const Arg2& arg2) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1), + arg2_(arg2) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_), @@ -126,6 +147,14 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, } template <typename Function, typename Handler, typename Arg1, typename Arg2> +inline void asio_handler_invoke(Function& function, + binder2<Handler, Arg1, Arg2>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1, typename Arg2> inline void asio_handler_invoke(const Function& function, binder2<Handler, Arg1, Arg2>* this_handler) { @@ -134,7 +163,7 @@ inline void asio_handler_invoke(const Function& function, } template <typename Handler, typename Arg1, typename Arg2> -inline binder2<Handler, Arg1, Arg2> bind_handler(const Handler& handler, +inline binder2<Handler, Arg1, Arg2> bind_handler(Handler handler, const Arg1& arg1, const Arg2& arg2) { return binder2<Handler, Arg1, Arg2>(handler, arg1, arg2); @@ -153,6 +182,15 @@ public: { } + binder3(Handler& handler, const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1), + arg2_(arg2), + arg3_(arg3) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_), @@ -190,6 +228,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, template <typename Function, typename Handler, typename Arg1, typename Arg2, typename Arg3> +inline void asio_handler_invoke(Function& function, + binder3<Handler, Arg1, Arg2, Arg3>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1, typename Arg2, + typename Arg3> inline void asio_handler_invoke(const Function& function, binder3<Handler, Arg1, Arg2, Arg3>* this_handler) { @@ -198,7 +245,7 @@ inline void asio_handler_invoke(const Function& function, } template <typename Handler, typename Arg1, typename Arg2, typename Arg3> -inline binder3<Handler, Arg1, Arg2, Arg3> bind_handler(const Handler& handler, +inline binder3<Handler, Arg1, Arg2, Arg3> bind_handler(Handler handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) { return binder3<Handler, Arg1, Arg2, Arg3>(handler, arg1, arg2, arg3); @@ -219,6 +266,16 @@ public: { } + binder4(Handler& handler, const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1), + arg2_(arg2), + arg3_(arg3), + arg4_(arg4) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_), @@ -260,6 +317,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, template <typename Function, typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +inline void asio_handler_invoke(Function& function, + binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1, typename Arg2, + typename Arg3, typename Arg4> inline void asio_handler_invoke(const Function& function, binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler) { @@ -270,7 +336,7 @@ inline void asio_handler_invoke(const Function& function, template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline binder4<Handler, Arg1, Arg2, Arg3, Arg4> bind_handler( - const Handler& handler, const Arg1& arg1, const Arg2& arg2, + Handler handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) { return binder4<Handler, Arg1, Arg2, Arg3, Arg4>(handler, arg1, arg2, arg3, @@ -293,6 +359,17 @@ public: { } + binder5(Handler& handler, const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1), + arg2_(arg2), + arg3_(arg3), + arg4_(arg4), + arg5_(arg5) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_), @@ -336,6 +413,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, template <typename Function, typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +inline void asio_handler_invoke(Function& function, + binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1, typename Arg2, + typename Arg3, typename Arg4, typename Arg5> inline void asio_handler_invoke(const Function& function, binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler) { @@ -346,7 +432,7 @@ inline void asio_handler_invoke(const Function& function, template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> inline binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5> bind_handler( - const Handler& handler, const Arg1& arg1, const Arg2& arg2, + Handler handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) { return binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>(handler, arg1, arg2, diff --git a/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp b/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp index 7df4128..ea78330 100644 --- a/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp @@ -2,7 +2,7 @@ // detail/buffer_resize_guard.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/buffer_sequence_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/buffer_sequence_adapter.hpp index fdda23f..562aa55 100644 --- a/3rdParty/Boost/src/boost/asio/detail/buffer_sequence_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/buffer_sequence_adapter.hpp @@ -2,7 +2,7 @@ // detail/buffer_sequence_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/buffer.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/push_options.hpp> @@ -81,11 +82,11 @@ class buffer_sequence_adapter : buffer_sequence_adapter_base { public: - explicit buffer_sequence_adapter(const Buffers& buffers) + explicit buffer_sequence_adapter(const Buffers& buffer_sequence) : count_(0), total_buffer_size_(0) { - typename Buffers::const_iterator iter = buffers.begin(); - typename Buffers::const_iterator end = buffers.end(); + typename Buffers::const_iterator iter = buffer_sequence.begin(); + typename Buffers::const_iterator end = buffer_sequence.end(); for (; iter != end && count_ < max_buffers; ++iter, ++count_) { Buffer buffer(*iter); @@ -109,10 +110,10 @@ public: return total_buffer_size_ == 0; } - static bool all_empty(const Buffers& buffers) + static bool all_empty(const Buffers& buffer_sequence) { - typename Buffers::const_iterator iter = buffers.begin(); - typename Buffers::const_iterator end = buffers.end(); + typename Buffers::const_iterator iter = buffer_sequence.begin(); + typename Buffers::const_iterator end = buffer_sequence.end(); std::size_t i = 0; for (; iter != end && i < max_buffers; ++iter, ++i) if (boost::asio::buffer_size(Buffer(*iter)) > 0) @@ -120,10 +121,10 @@ public: return true; } - static void validate(const Buffers& buffers) + static void validate(const Buffers& buffer_sequence) { - typename Buffers::const_iterator iter = buffers.begin(); - typename Buffers::const_iterator end = buffers.end(); + typename Buffers::const_iterator iter = buffer_sequence.begin(); + typename Buffers::const_iterator end = buffer_sequence.end(); for (; iter != end; ++iter) { Buffer buffer(*iter); @@ -131,10 +132,10 @@ public: } } - static Buffer first(const Buffers& buffers) + static Buffer first(const Buffers& buffer_sequence) { - typename Buffers::const_iterator iter = buffers.begin(); - typename Buffers::const_iterator end = buffers.end(); + typename Buffers::const_iterator iter = buffer_sequence.begin(); + typename Buffers::const_iterator end = buffer_sequence.end(); for (; iter != end; ++iter) { Buffer buffer(*iter); @@ -159,10 +160,10 @@ class buffer_sequence_adapter<Buffer, boost::asio::mutable_buffers_1> { public: explicit buffer_sequence_adapter( - const boost::asio::mutable_buffers_1& buffers) + const boost::asio::mutable_buffers_1& buffer_sequence) { - init_native_buffer(buffer_, Buffer(buffers)); - total_buffer_size_ = boost::asio::buffer_size(buffers); + init_native_buffer(buffer_, Buffer(buffer_sequence)); + total_buffer_size_ = boost::asio::buffer_size(buffer_sequence); } native_buffer_type* buffers() @@ -180,19 +181,19 @@ public: return total_buffer_size_ == 0; } - static bool all_empty(const boost::asio::mutable_buffers_1& buffers) + static bool all_empty(const boost::asio::mutable_buffers_1& buffer_sequence) { - return boost::asio::buffer_size(buffers) == 0; + return boost::asio::buffer_size(buffer_sequence) == 0; } - static void validate(const boost::asio::mutable_buffers_1& buffers) + static void validate(const boost::asio::mutable_buffers_1& buffer_sequence) { - boost::asio::buffer_cast<const void*>(buffers); + boost::asio::buffer_cast<const void*>(buffer_sequence); } - static Buffer first(const boost::asio::mutable_buffers_1& buffers) + static Buffer first(const boost::asio::mutable_buffers_1& buffer_sequence) { - return Buffer(buffers); + return Buffer(buffer_sequence); } private: @@ -206,10 +207,10 @@ class buffer_sequence_adapter<Buffer, boost::asio::const_buffers_1> { public: explicit buffer_sequence_adapter( - const boost::asio::const_buffers_1& buffers) + const boost::asio::const_buffers_1& buffer_sequence) { - init_native_buffer(buffer_, Buffer(buffers)); - total_buffer_size_ = boost::asio::buffer_size(buffers); + init_native_buffer(buffer_, Buffer(buffer_sequence)); + total_buffer_size_ = boost::asio::buffer_size(buffer_sequence); } native_buffer_type* buffers() @@ -227,19 +228,19 @@ public: return total_buffer_size_ == 0; } - static bool all_empty(const boost::asio::const_buffers_1& buffers) + static bool all_empty(const boost::asio::const_buffers_1& buffer_sequence) { - return boost::asio::buffer_size(buffers) == 0; + return boost::asio::buffer_size(buffer_sequence) == 0; } - static void validate(const boost::asio::const_buffers_1& buffers) + static void validate(const boost::asio::const_buffers_1& buffer_sequence) { - boost::asio::buffer_cast<const void*>(buffers); + boost::asio::buffer_cast<const void*>(buffer_sequence); } - static Buffer first(const boost::asio::const_buffers_1& buffers) + static Buffer first(const boost::asio::const_buffers_1& buffer_sequence) { - return Buffer(buffers); + return Buffer(buffer_sequence); } private: @@ -247,6 +248,114 @@ private: std::size_t total_buffer_size_; }; +template <typename Buffer, typename Elem> +class buffer_sequence_adapter<Buffer, boost::array<Elem, 2> > + : buffer_sequence_adapter_base +{ +public: + explicit buffer_sequence_adapter( + const boost::array<Elem, 2>& buffer_sequence) + { + init_native_buffer(buffers_[0], Buffer(buffer_sequence[0])); + init_native_buffer(buffers_[1], Buffer(buffer_sequence[1])); + total_buffer_size_ = boost::asio::buffer_size(buffer_sequence[0]) + + boost::asio::buffer_size(buffer_sequence[1]); + } + + native_buffer_type* buffers() + { + return buffers_; + } + + std::size_t count() const + { + return 2; + } + + bool all_empty() const + { + return total_buffer_size_ == 0; + } + + static bool all_empty(const boost::array<Elem, 2>& buffer_sequence) + { + return boost::asio::buffer_size(buffer_sequence[0]) == 0 + && boost::asio::buffer_size(buffer_sequence[1]) == 0; + } + + static void validate(const boost::array<Elem, 2>& buffer_sequence) + { + boost::asio::buffer_cast<const void*>(buffer_sequence[0]); + boost::asio::buffer_cast<const void*>(buffer_sequence[1]); + } + + static Buffer first(const boost::array<Elem, 2>& buffer_sequence) + { + return Buffer(boost::asio::buffer_size(buffer_sequence[0]) != 0 + ? buffer_sequence[0] : buffer_sequence[1]); + } + +private: + native_buffer_type buffers_[2]; + std::size_t total_buffer_size_; +}; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + +template <typename Buffer, typename Elem> +class buffer_sequence_adapter<Buffer, std::array<Elem, 2> > + : buffer_sequence_adapter_base +{ +public: + explicit buffer_sequence_adapter( + const std::array<Elem, 2>& buffer_sequence) + { + init_native_buffer(buffers_[0], Buffer(buffer_sequence[0])); + init_native_buffer(buffers_[1], Buffer(buffer_sequence[1])); + total_buffer_size_ = boost::asio::buffer_size(buffer_sequence[0]) + + boost::asio::buffer_size(buffer_sequence[1]); + } + + native_buffer_type* buffers() + { + return buffers_; + } + + std::size_t count() const + { + return 2; + } + + bool all_empty() const + { + return total_buffer_size_ == 0; + } + + static bool all_empty(const std::array<Elem, 2>& buffer_sequence) + { + return boost::asio::buffer_size(buffer_sequence[0]) == 0 + && boost::asio::buffer_size(buffer_sequence[1]) == 0; + } + + static void validate(const std::array<Elem, 2>& buffer_sequence) + { + boost::asio::buffer_cast<const void*>(buffer_sequence[0]); + boost::asio::buffer_cast<const void*>(buffer_sequence[1]); + } + + static Buffer first(const std::array<Elem, 2>& buffer_sequence) + { + return Buffer(boost::asio::buffer_size(buffer_sequence[0]) != 0 + ? buffer_sequence[0] : buffer_sequence[1]); + } + +private: + native_buffer_type buffers_[2]; + std::size_t total_buffer_size_; +}; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + } // namespace detail } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp b/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp index 86763b5..3c7ba71 100644 --- a/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp @@ -2,7 +2,7 @@ // detail/buffered_stream_storage.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,7 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <cassert> +#include <boost/asio/buffer.hpp> +#include <boost/assert.hpp> #include <cstddef> #include <cstring> #include <vector> @@ -37,10 +38,10 @@ public: typedef std::size_t size_type; // Constructor. - explicit buffered_stream_storage(std::size_t capacity) + explicit buffered_stream_storage(std::size_t buffer_capacity) : begin_offset_(0), end_offset_(0), - buffer_(capacity) + buffer_(buffer_capacity) { } @@ -52,15 +53,15 @@ public: } // Return a pointer to the beginning of the unread data. - byte_type* data() + mutable_buffer data() { - return &buffer_[0] + begin_offset_; + return boost::asio::buffer(buffer_) + begin_offset_; } // Return a pointer to the beginning of the unread data. - const byte_type* data() const + const_buffer data() const { - return &buffer_[0] + begin_offset_; + return boost::asio::buffer(buffer_) + begin_offset_; } // Is there no unread data in the buffer. @@ -78,7 +79,7 @@ public: // Resize the buffer to the specified length. void resize(size_type length) { - assert(length <= capacity()); + BOOST_ASSERT(length <= capacity()); if (begin_offset_ + length <= capacity()) { end_offset_ = begin_offset_ + length; @@ -101,7 +102,7 @@ public: // Consume multiple bytes from the beginning of the buffer. void consume(size_type count) { - assert(begin_offset_ + count <= end_offset_); + BOOST_ASSERT(begin_offset_ + count <= end_offset_); begin_offset_ += count; if (empty()) clear(); diff --git a/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp b/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp index d5f9099..db4cd1e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp @@ -2,7 +2,7 @@ // detail/call_stack.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -27,34 +27,60 @@ namespace detail { // Helper class to determine whether or not the current thread is inside an // invocation of io_service::run() for a specified io_service object. -template <typename Owner> +template <typename Key, typename Value = unsigned char> class call_stack { public: - // Context class automatically pushes an owner on to the stack. + // Context class automatically pushes the key/value pair on to the stack. class context : private noncopyable { public: - // Push the owner on to the stack. - explicit context(Owner* d) - : owner_(d), - next_(call_stack<Owner>::top_) + // Push the key on to the stack. + explicit context(Key* k) + : key_(k), + next_(call_stack<Key, Value>::top_) { - call_stack<Owner>::top_ = this; + value_ = reinterpret_cast<unsigned char*>(this); + call_stack<Key, Value>::top_ = this; } - // Pop the owner from the stack. + // Push the key/value pair on to the stack. + context(Key* k, Value& v) + : key_(k), + value_(&v), + next_(call_stack<Key, Value>::top_) + { + call_stack<Key, Value>::top_ = this; + } + + // Pop the key/value pair from the stack. ~context() { - call_stack<Owner>::top_ = next_; + call_stack<Key, Value>::top_ = next_; + } + + // Find the next context with the same key. + Value* next_by_key() const + { + context* elem = next_; + while (elem) + { + if (elem->key_ == key_) + return elem->value_; + elem = elem->next_; + } + return 0; } private: - friend class call_stack<Owner>; + friend class call_stack<Key, Value>; + + // The key associated with the context. + Key* key_; - // The owner associated with the context. - Owner* owner_; + // The value associated with the context. + Value* value_; // The next element in the stack. context* next_; @@ -62,17 +88,18 @@ public: friend class context; - // Determine whether the specified owner is on the stack. - static bool contains(Owner* d) + // Determine whether the specified owner is on the stack. Returns address of + // key if present, 0 otherwise. + static Value* contains(Key* k) { context* elem = top_; while (elem) { - if (elem->owner_ == d) - return true; + if (elem->key_ == k) + return elem->value_; elem = elem->next_; } - return false; + return 0; } private: @@ -80,9 +107,9 @@ private: static tss_ptr<context> top_; }; -template <typename Owner> -tss_ptr<typename call_stack<Owner>::context> -call_stack<Owner>::top_; +template <typename Key, typename Value> +tss_ptr<typename call_stack<Key, Value>::context> +call_stack<Key, Value>::top_; } // namespace detail } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/detail/chrono_time_traits.hpp b/3rdParty/Boost/src/boost/asio/detail/chrono_time_traits.hpp new file mode 100644 index 0000000..e56c8c3 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/chrono_time_traits.hpp @@ -0,0 +1,129 @@ +// +// detail/chrono_time_traits.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP +#define BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/cstdint.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +// Adapts std::chrono clocks for use with a deadline timer. +template <typename Clock, typename WaitTraits> +struct chrono_time_traits +{ + // The clock type. + typedef Clock clock_type; + + // The duration type of the clock. + typedef typename clock_type::duration duration_type; + + // The time point type of the clock. + typedef typename clock_type::time_point time_type; + + // The period of the clock. + typedef typename duration_type::period period_type; + + // Get the current time. + static time_type now() + { + return clock_type::now(); + } + + // Add a duration to a time. + static time_type add(const time_type& t, const duration_type& d) + { + return t + d; + } + + // Subtract one time from another. + static duration_type subtract(const time_type& t1, const time_type& t2) + { + return t1 - t2; + } + + // Test whether one time is less than another. + static bool less_than(const time_type& t1, const time_type& t2) + { + return t1 < t2; + } + + // Implement just enough of the posix_time::time_duration interface to supply + // what the timer_queue requires. + class posix_time_duration + { + public: + explicit posix_time_duration(const duration_type& d) + : d_(d) + { + } + + boost::int64_t ticks() const + { + return d_.count(); + } + + boost::int64_t total_seconds() const + { + return duration_cast<1, 1>(); + } + + boost::int64_t total_milliseconds() const + { + return duration_cast<1, 1000>(); + } + + boost::int64_t total_microseconds() const + { + return duration_cast<1, 1000000>(); + } + + private: + template <boost::int64_t Num, boost::int64_t Den> + boost::int64_t duration_cast() const + { + const boost::int64_t num = period_type::num * Den; + const boost::int64_t den = period_type::den * Num; + + if (num == 1 && den == 1) + return ticks(); + else if (num != 1 && den == 1) + return ticks() * num; + else if (num == 1 && period_type::den != 1) + return ticks() / den; + else + return ticks() * num / den; + } + + duration_type d_; + }; + + // Convert to POSIX duration type. + static posix_time_duration to_posix_duration(const duration_type& d) + { + return posix_time_duration(WaitTraits::to_wait_duration(d)); + } +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/completion_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/completion_handler.hpp index 3b023d1..19b4360 100644 --- a/3rdParty/Boost/src/boost/asio/detail/completion_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/completion_handler.hpp @@ -2,7 +2,7 @@ // detail/completion_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -33,34 +33,39 @@ class completion_handler : public operation public: BOOST_ASIO_DEFINE_HANDLER_PTR(completion_handler); - completion_handler(Handler h) + completion_handler(Handler& h) : operation(&completion_handler::do_complete), - handler_(h) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. completion_handler* h(static_cast<completion_handler*>(base)); ptr p = { boost::addressof(h->handler_), h, h }; + BOOST_ASIO_HANDLER_COMPLETION((h)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated // with the handler. Consequently, a local copy of the handler is required // to ensure that any owning sub-object remains valid until after we have // deallocated the memory here. - Handler handler(h->handler_); + Handler handler(BOOST_ASIO_MOVE_CAST(Handler)(h->handler_)); p.h = boost::addressof(handler); p.reset(); // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN(()); boost_asio_handler_invoke_helpers::invoke(handler, handler); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/config.hpp b/3rdParty/Boost/src/boost/asio/detail/config.hpp index 45c2415..c47c007 100644 --- a/3rdParty/Boost/src/boost/asio/detail/config.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/config.hpp @@ -2,7 +2,7 @@ // detail/config.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -12,6 +12,7 @@ #define BOOST_ASIO_DETAIL_CONFIG_HPP #include <boost/config.hpp> +#include <boost/version.hpp> // Default to a header-only implementation. The user must specifically request // separate compilation by defining either BOOST_ASIO_SEPARATE_COMPILATION or @@ -46,6 +47,151 @@ # define BOOST_ASIO_DECL #endif // !defined(BOOST_ASIO_DECL) +// Support move construction and assignment on compilers known to allow it. +#if !defined(BOOST_ASIO_DISABLE_MOVE) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_MOVE +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_MOVE) + +// If BOOST_ASIO_MOVE_CAST isn't defined, and move support is available, define +// BOOST_ASIO_MOVE_ARG and BOOST_ASIO_MOVE_CAST to take advantage of rvalue +// references and perfect forwarding. +#if defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST) +# define BOOST_ASIO_MOVE_ARG(type) type&& +# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&> +#endif // defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST) + +// If BOOST_ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible +// implementation. Note that older g++ and MSVC versions don't like it when you +// pass a non-member function through a const reference, so for most compilers +// we'll play it safe and stick with the old approach of passing the handler by +// value. +#if !defined(BOOST_ASIO_MOVE_CAST) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# define BOOST_ASIO_MOVE_ARG(type) const type& +# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# define BOOST_ASIO_MOVE_ARG(type) type +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# elif defined(BOOST_MSVC) +# if (_MSC_VER >= 1400) +# define BOOST_ASIO_MOVE_ARG(type) const type& +# else // (_MSC_VER >= 1400) +# define BOOST_ASIO_MOVE_ARG(type) type +# endif // (_MSC_VER >= 1400) +# else +# define BOOST_ASIO_MOVE_ARG(type) type +# endif +# define BOOST_ASIO_MOVE_CAST(type) static_cast<const type&> +#endif // !defined_BOOST_ASIO_MOVE_CAST + +// Support variadic templates on compilers known to allow it. +#if !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_VARIADIC_TEMPLATES +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES) + +// Standard library support for system errors. +#if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_SYSTEM_ERROR +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR) + +// Compliant C++11 compilers put noexcept specifiers on error_category members. +#if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT +# endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +#endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) + +// Standard library support for arrays. +#if !defined(BOOST_ASIO_DISABLE_STD_ARRAY) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_ARRAY +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(BOOST_MSVC) +# if (_MSC_VER >= 1600) +# define BOOST_ASIO_HAS_STD_ARRAY +# endif // (_MSC_VER >= 1600) +# endif // defined(BOOST_MSVC) +#endif // !defined(BOOST_ASIO_DISABLE_STD_ARRAY) + +// Standard library support for shared_ptr and weak_ptr. +#if !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_SHARED_PTR +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(BOOST_MSVC) +# if (_MSC_VER >= 1600) +# define BOOST_ASIO_HAS_STD_SHARED_PTR +# endif // (_MSC_VER >= 1600) +# endif // defined(BOOST_MSVC) +#endif // !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR) + +// Standard library support for atomic operations. +#if !defined(BOOST_ASIO_DISABLE_STD_ATOMIC) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_ATOMIC +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_STD_ATOMIC) + +// Standard library support for chrono. Some standard libraries (such as the +// libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x +// drafts, rather than the eventually standardised name of steady_clock. +#if !defined(BOOST_ASIO_DISABLE_STD_CHRONO) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_CHRONO +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) +# define BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_STD_CHRONO) + +// Boost support for chrono. +#if !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO) +# if (BOOST_VERSION >= 104700) +# define BOOST_ASIO_HAS_BOOST_CHRONO +# endif // (BOOST_VERSION >= 104700) +#endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO) + // Windows: target OS version. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS) @@ -181,6 +327,15 @@ # endif // defined(BOOST_ASIO_HAS_IOCP) #endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE) +// Windows: object handles. +#if !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE) +# if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +# if !defined(UNDER_CE) +# define BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE 1 +# endif // !defined(UNDER_CE) +# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE) + // Windows: OVERLAPPED wrapper. #if !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR) # if defined(BOOST_ASIO_HAS_IOCP) @@ -202,4 +357,33 @@ # endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) #endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS) +// Can use sigaction() instead of signal(). +#if !defined(BOOST_ASIO_DISABLE_SIGACTION) +# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +# define BOOST_ASIO_HAS_SIGACTION 1 +# endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +#endif // !defined(BOOST_ASIO_DISABLE_SIGACTION) + +// Can use signal(). +#if !defined(BOOST_ASIO_DISABLE_SIGNAL) +# if !defined(UNDER_CE) +# define BOOST_ASIO_HAS_SIGNAL 1 +# endif // !defined(UNDER_CE) +#endif // !defined(BOOST_ASIO_DISABLE_SIGNAL) + +// Support for the __thread keyword extension. +#if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) +# if defined(__linux__) +# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# if !defined(__INTEL_COMPILER) && !defined(__ICL) +# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# endif // defined(__linux__) +#endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) + #endif // BOOST_ASIO_DETAIL_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp b/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp index f50d4e0..e13403f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp @@ -2,7 +2,7 @@ // detail/consuming_buffers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/date_time_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/date_time_fwd.hpp new file mode 100644 index 0000000..162ccdc --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/date_time_fwd.hpp @@ -0,0 +1,34 @@ +// +// detail/date_time_fwd.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP +#define BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +namespace boost { +namespace date_time { + +template<class T, class TimeSystem> +class base_time; + +} // namespace date_time +namespace posix_time { + +class ptime; + +} // namespace posix_time +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp b/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp index 82e0d43..833815a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp @@ -2,7 +2,7 @@ // detail/deadline_timer_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -24,14 +24,10 @@ #include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/socket_ops.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue.hpp> #include <boost/asio/detail/timer_scheduler.hpp> #include <boost/asio/detail/wait_handler.hpp> - -#include <boost/asio/detail/push_options.hpp> -#include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/asio/detail/pop_options.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/detail/push_options.hpp> @@ -100,12 +96,35 @@ public: ec = boost::system::error_code(); return 0; } + + BOOST_ASIO_HANDLER_OPERATION(("deadline_timer", &impl, "cancel")); + std::size_t count = scheduler_.cancel_timer(timer_queue_, impl.timer_data); impl.might_have_pending_waits = false; ec = boost::system::error_code(); return count; } + // Cancels one asynchronous wait operation associated with the timer. + std::size_t cancel_one(implementation_type& impl, + boost::system::error_code& ec) + { + if (!impl.might_have_pending_waits) + { + ec = boost::system::error_code(); + return 0; + } + + BOOST_ASIO_HANDLER_OPERATION(("deadline_timer", &impl, "cancel_one")); + + std::size_t count = scheduler_.cancel_timer( + timer_queue_, impl.timer_data, 1); + if (count == 0) + impl.might_have_pending_waits = false; + ec = boost::system::error_code(); + return count; + } + // Get the expiry time for the timer as an absolute time. time_type expires_at(const implementation_type& impl) const { @@ -140,18 +159,13 @@ public: void wait(implementation_type& impl, boost::system::error_code& ec) { time_type now = Time_Traits::now(); - while (Time_Traits::less_than(now, impl.expiry)) + ec = boost::system::error_code(); + while (Time_Traits::less_than(now, impl.expiry) && !ec) { - boost::posix_time::time_duration timeout = - Time_Traits::to_posix_duration(Time_Traits::subtract(impl.expiry, now)); - ::timeval tv; - tv.tv_sec = timeout.total_seconds(); - tv.tv_usec = timeout.total_microseconds() % 1000000; - boost::system::error_code ec; - socket_ops::select(0, 0, 0, 0, &tv, ec); + this->do_wait(Time_Traits::to_posix_duration( + Time_Traits::subtract(impl.expiry, now)), ec); now = Time_Traits::now(); } - ec = boost::system::error_code(); } // Start an asynchronous wait on the timer. @@ -167,11 +181,25 @@ public: impl.might_have_pending_waits = true; + BOOST_ASIO_HANDLER_CREATION((p.p, "deadline_timer", &impl, "async_wait")); + scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p); p.v = p.p = 0; } private: + // Helper function to wait given a duration type. The duration type should + // either be of type boost::posix_time::time_duration, or implement the + // required subset of its interface. + template <typename Duration> + void do_wait(const Duration& timeout, boost::system::error_code& ec) + { + ::timeval tv; + tv.tv_sec = timeout.total_seconds(); + tv.tv_usec = timeout.total_microseconds() % 1000000; + socket_ops::select(0, 0, 0, 0, &tv, ec); + } + // The queue of timers. timer_queue<Time_Traits> timer_queue_; diff --git a/3rdParty/Boost/src/boost/asio/detail/dependent_type.hpp b/3rdParty/Boost/src/boost/asio/detail/dependent_type.hpp new file mode 100644 index 0000000..c7b1c1b --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/dependent_type.hpp @@ -0,0 +1,38 @@ +// +// detail/dependent_type.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP +#define BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename DependsOn, typename T> +struct dependent_type +{ + typedef T type; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp b/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp index f92a7b4..72ea6e2 100644 --- a/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp @@ -2,7 +2,7 @@ // detail/descriptor_ops.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -40,7 +40,10 @@ enum internal_non_blocking = 2, // Helper "state" used to determine whether the descriptor is non-blocking. - non_blocking = user_set_non_blocking | internal_non_blocking + non_blocking = user_set_non_blocking | internal_non_blocking, + + // The descriptor may have been dup()-ed. + possible_dup = 4 }; typedef unsigned char state_type; @@ -60,8 +63,11 @@ BOOST_ASIO_DECL int open(const char* path, int flags, BOOST_ASIO_DECL int close(int d, state_type& state, boost::system::error_code& ec); +BOOST_ASIO_DECL bool set_user_non_blocking(int d, + state_type& state, bool value, boost::system::error_code& ec); + BOOST_ASIO_DECL bool set_internal_non_blocking(int d, - state_type& state, boost::system::error_code& ec); + state_type& state, bool value, boost::system::error_code& ec); typedef iovec buf; @@ -87,9 +93,11 @@ BOOST_ASIO_DECL int fcntl(int d, long cmd, boost::system::error_code& ec); BOOST_ASIO_DECL int fcntl(int d, long cmd, long arg, boost::system::error_code& ec); -BOOST_ASIO_DECL int poll_read(int d, boost::system::error_code& ec); +BOOST_ASIO_DECL int poll_read(int d, + state_type state, boost::system::error_code& ec); -BOOST_ASIO_DECL int poll_write(int d, boost::system::error_code& ec); +BOOST_ASIO_DECL int poll_write(int d, + state_type state, boost::system::error_code& ec); } // namespace descriptor_ops } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/descriptor_read_op.hpp b/3rdParty/Boost/src/boost/asio/detail/descriptor_read_op.hpp index 884f8f6..9f4adff 100644 --- a/3rdParty/Boost/src/boost/asio/detail/descriptor_read_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/descriptor_read_op.hpp @@ -2,7 +2,7 @@ // detail/descriptor_read_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -68,20 +68,23 @@ public: BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_read_op); descriptor_read_op(int descriptor, - const MutableBufferSequence& buffers, Handler handler) + const MutableBufferSequence& buffers, Handler& handler) : descriptor_read_op_base<MutableBufferSequence>( descriptor, buffers, &descriptor_read_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. descriptor_read_op* o(static_cast<descriptor_read_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -96,8 +99,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/descriptor_write_op.hpp b/3rdParty/Boost/src/boost/asio/detail/descriptor_write_op.hpp index 805eb0b..88c80c8 100644 --- a/3rdParty/Boost/src/boost/asio/detail/descriptor_write_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/descriptor_write_op.hpp @@ -2,7 +2,7 @@ // detail/descriptor_write_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -68,20 +68,23 @@ public: BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_write_op); descriptor_write_op(int descriptor, - const ConstBufferSequence& buffers, Handler handler) + const ConstBufferSequence& buffers, Handler& handler) : descriptor_write_op_base<ConstBufferSequence>( descriptor, buffers, &descriptor_write_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. descriptor_write_op* o(static_cast<descriptor_write_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -96,8 +99,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp index 79c1cbb..e6b6e12 100644 --- a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp @@ -2,7 +2,7 @@ // detail/dev_poll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,6 +19,7 @@ #if defined(BOOST_ASIO_HAS_DEV_POLL) +#include <boost/limits.hpp> #include <cstddef> #include <vector> #include <sys/devpoll.h> @@ -30,10 +31,10 @@ #include <boost/asio/detail/reactor_op_queue.hpp> #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/detail/push_options.hpp> @@ -63,6 +64,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task. BOOST_ASIO_DECL void init_task(); @@ -70,6 +75,17 @@ public: // code on failure. BOOST_ASIO_DECL int register_descriptor(socket_type, per_descriptor_data&); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -88,7 +104,12 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor( + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data&, bool closing); + + // Cancel any operations that are running against the descriptor and remove + // its registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( socket_type descriptor, per_descriptor_data&); // Add a new timer queue to the reactor. @@ -104,13 +125,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run /dev/poll once until interrupted or events are ready to be dispatched. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -140,6 +162,10 @@ private: BOOST_ASIO_DECL void cancel_ops_unlocked(socket_type descriptor, const boost::system::error_code& ec); + // Helper class used to reregister descriptors after a fork. + class fork_helper; + friend class fork_helper; + // Add a pending event entry for the given descriptor. BOOST_ASIO_DECL ::pollfd& add_pending_event_change(int descriptor); diff --git a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp index c5ceab2..026f91a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/dev_poll_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp index 1889017..8f66f74 100644 --- a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp @@ -2,7 +2,7 @@ // detail/epoll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,7 +19,10 @@ #if defined(BOOST_ASIO_HAS_EPOLL) +#include <boost/cstdint.hpp> +#include <boost/limits.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/detail/atomic_count.hpp> #include <boost/asio/detail/epoll_reactor_fwd.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/object_pool.hpp> @@ -27,10 +30,10 @@ #include <boost/asio/detail/reactor_op.hpp> #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/detail/push_options.hpp> @@ -46,15 +49,27 @@ public: connect_op = 1, except_op = 2, max_ops = 3 }; // Per-descriptor queues. - class descriptor_state + class descriptor_state : operation { friend class epoll_reactor; friend class object_pool_access; + + descriptor_state* next_; + descriptor_state* prev_; + mutex mutex_; + epoll_reactor* reactor_; + int descriptor_; + boost::uint32_t registered_events_; op_queue<reactor_op> op_queue_[max_ops]; bool shutdown_; - descriptor_state* next_; - descriptor_state* prev_; + + BOOST_ASIO_DECL descriptor_state(); + void set_ready_events(uint32_t events) { task_result_ = events; } + BOOST_ASIO_DECL operation* perform_io(uint32_t events); + BOOST_ASIO_DECL static void do_complete( + io_service_impl* owner, operation* base, + const boost::system::error_code& ec, std::size_t bytes_transferred); }; // Per-descriptor data. @@ -69,6 +84,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task. BOOST_ASIO_DECL void init_task(); @@ -77,6 +96,17 @@ public: BOOST_ASIO_DECL int register_descriptor(socket_type descriptor, per_descriptor_data& descriptor_data); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -86,8 +116,8 @@ public: // Start a new operation. The reactor operation will be performed when the // given descriptor is flagged as ready, or an error has occurred. BOOST_ASIO_DECL void start_op(int op_type, socket_type descriptor, - per_descriptor_data& descriptor_data, - reactor_op* op, bool allow_speculative); + per_descriptor_data& descriptor_data, reactor_op* op, + bool allow_speculative); // Cancel all operations associated with the given descriptor. The // handlers associated with the descriptor will be invoked with the @@ -97,8 +127,12 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor(socket_type descriptor, - per_descriptor_data& descriptor_data); + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data& descriptor_data, bool closing); + + // Remote the descriptor's registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( + socket_type descriptor, per_descriptor_data& descriptor_data); // Add a new timer queue to the reactor. template <typename Time_Traits> @@ -113,13 +147,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run epoll once until interrupted or events are ready to be dispatched. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -135,6 +170,15 @@ private: // cannot be created. BOOST_ASIO_DECL static int do_epoll_create(); + // Create the timerfd file descriptor. Does not throw. + BOOST_ASIO_DECL static int do_timerfd_create(); + + // Allocate a new descriptor state object. + BOOST_ASIO_DECL descriptor_state* allocate_descriptor_state(); + + // Free an existing descriptor state object. + BOOST_ASIO_DECL void free_descriptor_state(descriptor_state* s); + // Helper function to add a new timer queue. BOOST_ASIO_DECL void do_add_timer_queue(timer_queue_base& queue); @@ -161,15 +205,15 @@ private: // Mutex to protect access to internal data. mutex mutex_; + // The interrupter is used to break a blocking epoll_wait call. + select_interrupter interrupter_; + // The epoll file descriptor. int epoll_fd_; // The timer file descriptor. int timer_fd_; - // The interrupter is used to break a blocking epoll_wait call. - select_interrupter interrupter_; - // The timer queues. timer_queue_set timer_queues_; @@ -181,6 +225,10 @@ private: // Keep track of all registered descriptors. object_pool<descriptor_state> registered_descriptors_; + + // Helper class to do post-perform_io cleanup. + struct perform_io_cleanup_on_block_exit; + friend struct perform_io_cleanup_on_block_exit; }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp index 01ee84c..aa28271 100644 --- a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/epoll_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/event.hpp b/3rdParty/Boost/src/boost/asio/detail/event.hpp index c8109d1..0ee6b6e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/event.hpp @@ -2,7 +2,7 @@ // detail/event.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp index 954fe79..cf40eee 100644 --- a/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/eventfd_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -35,6 +35,9 @@ public: // Destructor. BOOST_ASIO_DECL ~eventfd_select_interrupter(); + // Recreate the interrupter's descriptors. Used after a fork. + BOOST_ASIO_DECL void recreate(); + // Interrupt the select call. BOOST_ASIO_DECL void interrupt(); @@ -48,6 +51,12 @@ public: } private: + // Open the descriptors. Throws on error. + BOOST_ASIO_DECL void open_descriptors(); + + // Close the descriptors. + BOOST_ASIO_DECL void close_descriptors(); + // The read end of a connection used to interrupt the select call. This file // descriptor is passed to select such that when it is time to stop, a single // 64bit value will be written on the other end of the connection and this diff --git a/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp index 8df0426..51fe927 100644 --- a/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/fenced_block.hpp index 4cb27dc..d9e8a04 100644 --- a/3rdParty/Boost/src/boost/asio/detail/fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/fenced_block.hpp @@ -2,7 +2,7 @@ // detail/fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -25,17 +25,18 @@ # include <boost/asio/detail/macos_fenced_block.hpp> #elif defined(__sun) # include <boost/asio/detail/solaris_fenced_block.hpp> -#elif defined(__GNUC__) && defined(__arm__) +#elif defined(__GNUC__) && defined(__arm__) \ + && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) # include <boost/asio/detail/gcc_arm_fenced_block.hpp> #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) # include <boost/asio/detail/gcc_hppa_fenced_block.hpp> +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# include <boost/asio/detail/gcc_x86_fenced_block.hpp> #elif defined(__GNUC__) \ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ && !defined(__INTEL_COMPILER) && !defined(__ICL) \ && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) # include <boost/asio/detail/gcc_sync_fenced_block.hpp> -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -# include <boost/asio/detail/gcc_x86_fenced_block.hpp> #elif defined(BOOST_WINDOWS) && !defined(UNDER_CE) # include <boost/asio/detail/win_fenced_block.hpp> #else @@ -54,17 +55,18 @@ typedef null_fenced_block fenced_block; typedef macos_fenced_block fenced_block; #elif defined(__sun) typedef solaris_fenced_block fenced_block; -#elif defined(__GNUC__) && defined(__arm__) +#elif defined(__GNUC__) && defined(__arm__) \ + && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) typedef gcc_arm_fenced_block fenced_block; #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) typedef gcc_hppa_fenced_block fenced_block; +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +typedef gcc_x86_fenced_block fenced_block; #elif defined(__GNUC__) \ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ && !defined(__INTEL_COMPILER) && !defined(__ICL) \ && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) typedef gcc_sync_fenced_block fenced_block; -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -typedef gcc_x86_fenced_block fenced_block; #elif defined(BOOST_WINDOWS) && !defined(UNDER_CE) typedef win_fenced_block fenced_block; #else diff --git a/3rdParty/Boost/src/boost/asio/detail/gcc_arm_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/gcc_arm_fenced_block.hpp index 58cdfb4..1b3c764 100644 --- a/3rdParty/Boost/src/boost/asio/detail/gcc_arm_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/gcc_arm_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_arm_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -29,8 +29,16 @@ class gcc_arm_fenced_block : private noncopyable { public: - // Constructor. - gcc_arm_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit gcc_arm_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit gcc_arm_fenced_block(full_t) { barrier(); } @@ -57,9 +65,14 @@ private: || defined(__ARM_ARCH_6Z__) \ || defined(__ARM_ARCH_6ZK__) \ || defined(__ARM_ARCH_6T2__) +# if defined(__thumb__) + // This is just a placeholder and almost certainly not sufficient. + __asm__ __volatile__ ("" : : : "memory"); +# else // defined(__thumb__) int a = 0, b = 0; __asm__ __volatile__ ("swp %0, %1, [%2]" : "=&r"(a) : "r"(1), "r"(&b) : "memory", "cc"); +# endif // defined(__thumb__) #else // ARMv7 and later. __asm__ __volatile__ ("dmb" : : : "memory"); diff --git a/3rdParty/Boost/src/boost/asio/detail/gcc_hppa_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/gcc_hppa_fenced_block.hpp index 6c5226b..421d3a6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/gcc_hppa_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/gcc_hppa_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_hppa_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -29,8 +29,16 @@ class gcc_hppa_fenced_block : private noncopyable { public: - // Constructor. - gcc_hppa_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit gcc_hppa_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit gcc_hppa_fenced_block(full_t) { barrier(); } diff --git a/3rdParty/Boost/src/boost/asio/detail/gcc_sync_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/gcc_sync_fenced_block.hpp index 65472cc..81aaeb0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/gcc_sync_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/gcc_sync_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_sync_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -32,8 +32,10 @@ class gcc_sync_fenced_block : private noncopyable { public: + enum half_or_full_t { half, full }; + // Constructor. - gcc_sync_fenced_block() + explicit gcc_sync_fenced_block(half_or_full_t) : value_(0) { __sync_lock_test_and_set(&value_, 1); diff --git a/3rdParty/Boost/src/boost/asio/detail/gcc_x86_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/gcc_x86_fenced_block.hpp index fb8473c..973165a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/gcc_x86_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/gcc_x86_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_x86_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -29,25 +29,55 @@ class gcc_x86_fenced_block : private noncopyable { public: - // Constructor. - gcc_x86_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit gcc_x86_fenced_block(half_t) { - barrier(); + } + + // Constructor for a full fenced block. + explicit gcc_x86_fenced_block(full_t) + { + lbarrier(); } // Destructor. ~gcc_x86_fenced_block() { - barrier(); + sbarrier(); } private: static int barrier() { - int r = 0; - __asm__ __volatile__ ("xchgl %%eax, %0" : "=m" (r) : : "memory", "cc"); + int r = 0, m = 1; + __asm__ __volatile__ ( + "xchgl %0, %1" : + "=r"(r), "=m"(m) : + "0"(1), "m"(m) : + "memory", "cc"); return r; } + + static void lbarrier() + { +#if defined(__SSE2__) + __asm__ __volatile__ ("lfence" ::: "memory"); +#else // defined(__SSE2__) + barrier(); +#endif // defined(__SSE2__) + } + + static void sbarrier() + { +#if defined(__SSE2__) + __asm__ __volatile__ ("sfence" ::: "memory"); +#else // defined(__SSE2__) + barrier(); +#endif // defined(__SSE2__) + } }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp index fc3ec33..91e993c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp @@ -2,7 +2,7 @@ // detail/handler_alloc_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -35,7 +35,7 @@ inline void* allocate(std::size_t s, Handler& h) || BOOST_WORKAROUND(__GNUC__, < 3) return ::operator new(s); #else - using namespace boost::asio; + using boost::asio::asio_handler_allocate; return asio_handler_allocate(s, boost::addressof(h)); #endif } @@ -47,7 +47,7 @@ inline void deallocate(void* p, std::size_t s, Handler& h) || BOOST_WORKAROUND(__GNUC__, < 3) ::operator delete(p); #else - using namespace boost::asio; + using boost::asio::asio_handler_deallocate; asio_handler_deallocate(p, s, boost::addressof(h)); #endif } diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp index 3b44997..f6172a0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp @@ -2,7 +2,7 @@ // detail/handler_invoke_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -28,6 +28,19 @@ namespace boost_asio_handler_invoke_helpers { template <typename Function, typename Context> +inline void invoke(Function& function, Context& context) +{ +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ + || BOOST_WORKAROUND(__GNUC__, < 3) + Function tmp(function); + tmp(); +#else + using boost::asio::asio_handler_invoke; + asio_handler_invoke(function, boost::addressof(context)); +#endif +} + +template <typename Function, typename Context> inline void invoke(const Function& function, Context& context) { #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ @@ -35,7 +48,7 @@ inline void invoke(const Function& function, Context& context) Function tmp(function); tmp(); #else - using namespace boost::asio; + using boost::asio::asio_handler_invoke; asio_handler_invoke(function, boost::addressof(context)); #endif } diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_tracking.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_tracking.hpp new file mode 100644 index 0000000..9c96e18 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/handler_tracking.hpp @@ -0,0 +1,161 @@ +// +// detail/handler_tracking.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP +#define BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) +# include <boost/cstdint.hpp> +# include <boost/system/error_code.hpp> +# include <boost/asio/detail/static_mutex.hpp> +# include <boost/asio/detail/tss_ptr.hpp> +#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +class handler_tracking +{ +public: + class completion; + + // Base class for objects containing tracked handlers. + class tracked_handler + { + private: + // Only the handler_tracking class will have access to the id. + friend class handler_tracking; + friend class completion; + boost::uint64_t id_; + + protected: + // Constructor initialises with no id. + tracked_handler() : id_(0) {} + + // Prevent deletion through this type. + ~tracked_handler() {} + }; + + // Initialise the tracking system. + BOOST_ASIO_DECL static void init(); + + // Record the creation of a tracked handler. + BOOST_ASIO_DECL static void creation(tracked_handler* h, + const char* object_type, void* object, const char* op_name); + + class completion + { + public: + // Constructor records that handler is to be invoked with no arguments. + BOOST_ASIO_DECL explicit completion(tracked_handler* h); + + // Destructor records only when an exception is thrown from the handler, or + // if the memory is being freed without the handler having been invoked. + BOOST_ASIO_DECL ~completion(); + + // Records that handler is to be invoked with no arguments. + BOOST_ASIO_DECL void invocation_begin(); + + // Records that handler is to be invoked with one arguments. + BOOST_ASIO_DECL void invocation_begin(const boost::system::error_code& ec); + + // Constructor records that handler is to be invoked with two arguments. + BOOST_ASIO_DECL void invocation_begin( + const boost::system::error_code& ec, std::size_t bytes_transferred); + + // Constructor records that handler is to be invoked with two arguments. + BOOST_ASIO_DECL void invocation_begin( + const boost::system::error_code& ec, int signal_number); + + // Constructor records that handler is to be invoked with two arguments. + BOOST_ASIO_DECL void invocation_begin( + const boost::system::error_code& ec, const char* arg); + + // Record that handler invocation has ended. + BOOST_ASIO_DECL void invocation_end(); + + private: + friend class handler_tracking; + boost::uint64_t id_; + bool invoked_; + completion* next_; + }; + + // Record an operation that affects pending handlers. + BOOST_ASIO_DECL static void operation(const char* object_type, + void* object, const char* op_name); + + // Write a line of output. + BOOST_ASIO_DECL static void write_line(const char* format, ...); + +private: + struct tracking_state; + BOOST_ASIO_DECL static tracking_state* get_state(); +}; + +# define BOOST_ASIO_INHERIT_TRACKED_HANDLER \ + : public boost::asio::detail::handler_tracking::tracked_handler + +# define BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER \ + , public boost::asio::detail::handler_tracking::tracked_handler + +# define BOOST_ASIO_HANDLER_TRACKING_INIT \ + boost::asio::detail::handler_tracking::init() + +# define BOOST_ASIO_HANDLER_CREATION(args) \ + boost::asio::detail::handler_tracking::creation args + +# define BOOST_ASIO_HANDLER_COMPLETION(args) \ + boost::asio::detail::handler_tracking::completion tracked_completion args + +# define BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args) \ + tracked_completion.invocation_begin args + +# define BOOST_ASIO_HANDLER_INVOCATION_END \ + tracked_completion.invocation_end() + +# define BOOST_ASIO_HANDLER_OPERATION(args) \ + boost::asio::detail::handler_tracking::operation args + +#else // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +# define BOOST_ASIO_INHERIT_TRACKED_HANDLER +# define BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER +# define BOOST_ASIO_HANDLER_TRACKING_INIT (void)0 +# define BOOST_ASIO_HANDLER_CREATION(args) (void)0 +# define BOOST_ASIO_HANDLER_COMPLETION(args) (void)0 +# define BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args) (void)0 +# define BOOST_ASIO_HANDLER_INVOCATION_END (void)0 +# define BOOST_ASIO_HANDLER_OPERATION(args) (void)0 + +#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/handler_tracking.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_type_requirements.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_type_requirements.hpp new file mode 100644 index 0000000..a7f47c2 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/handler_type_requirements.hpp @@ -0,0 +1,362 @@ +// +// detail/handler_type_requirements.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP +#define BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +// Older versions of gcc have difficulty compiling the sizeof expressions where +// we test the handler type requirements. We'll disable checking of handler type +// requirements for those compilers, but otherwise enable it by default. +#if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS) +# if !defined(__GNUC__) || (__GNUC__ >= 4) +# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS 1 +# endif // !defined(__GNUC__) || (__GNUC__ >= 4) +#endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS) + +// With C++0x we can use a combination of enhanced SFINAE and static_assert to +// generate better template error messages. As this technique is not yet widely +// portable, we'll only enable it for tested compilers. +#if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(BOOST_MSVC) +# if (_MSC_VER >= 1600) +# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1 +# endif // (_MSC_VER >= 1600) +# endif // defined(BOOST_MSVC) +#endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS) + +namespace boost { +namespace asio { +namespace detail { + +#if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS) + +# if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT) + +template <typename Handler> +auto zero_arg_handler_test(Handler h, void*) + -> decltype( + sizeof(Handler(static_cast<const Handler&>(h))), + ((h)()), + char(0)); + +template <typename Handler> +char (&zero_arg_handler_test(Handler, ...))[2]; + +template <typename Handler, typename Arg1> +auto one_arg_handler_test(Handler h, Arg1* a1) + -> decltype( + sizeof(Handler(static_cast<const Handler&>(h))), + ((h)(*a1)), + char(0)); + +template <typename Handler> +char (&one_arg_handler_test(Handler h, ...))[2]; + +template <typename Handler, typename Arg1, typename Arg2> +auto two_arg_handler_test(Handler h, Arg1* a1, Arg2* a2) + -> decltype( + sizeof(Handler(static_cast<const Handler&>(h))), + ((h)(*a1, *a2)), + char(0)); + +template <typename Handler> +char (&two_arg_handler_test(Handler, ...))[2]; + +# define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg) \ + static_assert(expr, msg); + +# else // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT) + +# define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg) + +# endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT) + +template <typename T> T& lvref(); +template <typename T> T& lvref(T); +template <typename T> const T& clvref(T); +template <typename T> char argbyv(T); + +template <int> +struct handler_type_requirements +{ +}; + +#define BOOST_ASIO_COMPLETION_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::zero_arg_handler_test( \ + handler, 0)) == 1, \ + "CompletionHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)(), \ + char(0))> + +#define BOOST_ASIO_READ_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const std::size_t*>(0))) == 1, \ + "ReadHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const std::size_t>()), \ + char(0))> + +#define BOOST_ASIO_WRITE_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const std::size_t*>(0))) == 1, \ + "WriteHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const std::size_t>()), \ + char(0))> + +#define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "AcceptHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#define BOOST_ASIO_CONNECT_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "ConnectHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#define BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( \ + handler_type, handler, iter_type) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const iter_type*>(0))) == 1, \ + "ComposedConnectHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const iter_type>()), \ + char(0))> + +#define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \ + handler_type, handler, iter_type) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const iter_type*>(0))) == 1, \ + "ResolveHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const iter_type>()), \ + char(0))> + +#define BOOST_ASIO_WAIT_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "WaitHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const int*>(0))) == 1, \ + "SignalHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const int>()), \ + char(0))> + +#define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "HandshakeHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "ShutdownHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#else // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS) + +#define BOOST_ASIO_COMPLETION_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_READ_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_WRITE_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_CONNECT_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( \ + handler_type, handler, iter_type) \ + typedef int + +#define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \ + handler_type, handler, iter_type) \ + typedef int + +#define BOOST_ASIO_WAIT_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#endif // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS) + +} // namespace detail +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp b/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp index 4f4eed3..339ab9d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp @@ -2,7 +2,7 @@ // detail/hash_map.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <cassert> +#include <boost/assert.hpp> #include <list> #include <utility> #include <boost/asio/detail/noncopyable.hpp> @@ -117,9 +117,9 @@ public: iterator it = buckets_[bucket].first; if (it == values_.end()) return values_.end(); - iterator end = buckets_[bucket].last; - ++end; - while (it != end) + iterator end_it = buckets_[bucket].last; + ++end_it; + while (it != end_it) { if (it->first == k) return it; @@ -138,9 +138,9 @@ public: const_iterator it = buckets_[bucket].first; if (it == values_.end()) return it; - const_iterator end = buckets_[bucket].last; - ++end; - while (it != end) + const_iterator end_it = buckets_[bucket].last; + ++end_it; + while (it != end_it) { if (it->first == k) return it; @@ -164,15 +164,15 @@ public: ++size_; return std::pair<iterator, bool>(buckets_[bucket].last, true); } - iterator end = buckets_[bucket].last; - ++end; - while (it != end) + iterator end_it = buckets_[bucket].last; + ++end_it; + while (it != end_it) { if (it->first == v.first) return std::pair<iterator, bool>(it, false); ++it; } - buckets_[bucket].last = values_insert(end, v); + buckets_[bucket].last = values_insert(end_it, v); ++size_; return std::pair<iterator, bool>(buckets_[bucket].last, true); } @@ -180,7 +180,7 @@ public: // Erase an entry from the map. void erase(iterator it) { - assert(it != values_.end()); + BOOST_ASSERT(it != values_.end()); size_t bucket = calculate_hash_value(it->first) % num_buckets_; bool is_first = (it == buckets_[bucket].first); @@ -212,9 +212,9 @@ public: size_ = 0; // Initialise all buckets to empty. - iterator end = values_.end(); + iterator end_it = values_.end(); for (size_t i = 0; i < num_buckets_; ++i) - buckets_[i].first = buckets_[i].last = end; + buckets_[i].first = buckets_[i].last = end_it; } private: @@ -245,21 +245,21 @@ private: return; num_buckets_ = num_buckets; - iterator end = values_.end(); + iterator end_iter = values_.end(); // Update number of buckets and initialise all buckets to empty. bucket_type* tmp = new bucket_type[num_buckets_]; delete[] buckets_; buckets_ = tmp; for (std::size_t i = 0; i < num_buckets_; ++i) - buckets_[i].first = buckets_[i].last = end; + buckets_[i].first = buckets_[i].last = end_iter; // Put all values back into the hash. iterator iter = values_.begin(); - while (iter != end) + while (iter != end_iter) { std::size_t bucket = calculate_hash_value(iter->first) % num_buckets_; - if (buckets_[bucket].last == end) + if (buckets_[bucket].last == end_iter) { buckets_[bucket].first = buckets_[bucket].last = iter++; } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/descriptor_ops.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/descriptor_ops.ipp index 9a2bb3b..6c3528f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/descriptor_ops.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/descriptor_ops.ipp @@ -2,7 +2,7 @@ // detail/impl/descriptor_ops.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -43,8 +43,19 @@ int close(int d, state_type& state, boost::system::error_code& ec) int result = 0; if (d != -1) { - if (state & internal_non_blocking) + errno = 0; + result = error_wrapper(::close(d), ec); + + if (result != 0 + && (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again)) { + // According to UNIX Network Programming Vol. 1, it is possible for + // close() to fail with EWOULDBLOCK under certain circumstances. What + // isn't clear is the state of the descriptor after this error. The one + // current OS where this behaviour is seen, Windows, says that the socket + // remains open. Therefore we'll put the descriptor back into blocking + // mode and have another attempt at closing it. #if defined(__SYMBIAN32__) int flags = ::fcntl(d, F_GETFL, 0); if (flags >= 0) @@ -53,11 +64,11 @@ int close(int d, state_type& state, boost::system::error_code& ec) ioctl_arg_type arg = 0; ::ioctl(d, FIONBIO, &arg); #endif // defined(__SYMBIAN32__) - state &= ~internal_non_blocking; - } + state &= ~non_blocking; - errno = 0; - result = error_wrapper(::close(d), ec); + errno = 0; + result = error_wrapper(::close(d), ec); + } } if (result == 0) @@ -65,8 +76,49 @@ int close(int d, state_type& state, boost::system::error_code& ec) return result; } -bool set_internal_non_blocking(int d, - state_type& state, boost::system::error_code& ec) +bool set_user_non_blocking(int d, state_type& state, + bool value, boost::system::error_code& ec) +{ + if (d == -1) + { + ec = boost::asio::error::bad_descriptor; + return false; + } + + errno = 0; +#if defined(__SYMBIAN32__) + int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec); + if (result >= 0) + { + errno = 0; + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = error_wrapper(::fcntl(d, F_SETFL, flag), ec); + } +#else // defined(__SYMBIAN32__) + ioctl_arg_type arg = (value ? 1 : 0); + int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec); +#endif // defined(__SYMBIAN32__) + + if (result >= 0) + { + ec = boost::system::error_code(); + if (value) + state |= user_set_non_blocking; + else + { + // Clearing the user-set non-blocking mode always overrides any + // internally-set non-blocking flag. Any subsequent asynchronous + // operations will need to re-enable non-blocking I/O. + state &= ~(user_set_non_blocking | internal_non_blocking); + } + return true; + } + + return false; +} + +bool set_internal_non_blocking(int d, state_type& state, + bool value, boost::system::error_code& ec) { if (d == -1) { @@ -74,23 +126,36 @@ bool set_internal_non_blocking(int d, return false; } + if (!value && (state & user_set_non_blocking)) + { + // It does not make sense to clear the internal non-blocking flag if the + // user still wants non-blocking behaviour. Return an error and let the + // caller figure out whether to update the user-set non-blocking flag. + ec = boost::asio::error::invalid_argument; + return false; + } + errno = 0; #if defined(__SYMBIAN32__) int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec); if (result >= 0) { errno = 0; - result = error_wrapper(::fcntl(d, F_SETFL, result | O_NONBLOCK), ec); + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = error_wrapper(::fcntl(d, F_SETFL, flag), ec); } #else // defined(__SYMBIAN32__) - ioctl_arg_type arg = 1; + ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec); #endif // defined(__SYMBIAN32__) if (result >= 0) { ec = boost::system::error_code(); - state |= internal_non_blocking; + if (value) + state |= internal_non_blocking; + else + state &= ~internal_non_blocking; return true; } @@ -138,7 +203,7 @@ std::size_t sync_read(int d, state_type state, buf* bufs, return 0; // Wait for descriptor to become ready. - if (descriptor_ops::poll_read(d, ec) < 0) + if (descriptor_ops::poll_read(d, 0, ec) < 0) return 0; } } @@ -215,7 +280,7 @@ std::size_t sync_write(int d, state_type state, const buf* bufs, return 0; // Wait for descriptor to become ready. - if (descriptor_ops::poll_write(d, ec) < 0) + if (descriptor_ops::poll_write(d, 0, ec) < 0) return 0; } } @@ -322,7 +387,7 @@ int fcntl(int d, long cmd, long arg, boost::system::error_code& ec) return result; } -int poll_read(int d, boost::system::error_code& ec) +int poll_read(int d, state_type state, boost::system::error_code& ec) { if (d == -1) { @@ -334,14 +399,18 @@ int poll_read(int d, boost::system::error_code& ec) fds.fd = d; fds.events = POLLIN; fds.revents = 0; + int timeout = (state & user_set_non_blocking) ? 0 : -1; errno = 0; - int result = error_wrapper(::poll(&fds, 1, -1), ec); - if (result >= 0) + int result = error_wrapper(::poll(&fds, 1, timeout), ec); + if (result == 0) + ec = (state & user_set_non_blocking) + ? boost::asio::error::would_block : boost::system::error_code(); + else if (result > 0) ec = boost::system::error_code(); return result; } -int poll_write(int d, boost::system::error_code& ec) +int poll_write(int d, state_type state, boost::system::error_code& ec) { if (d == -1) { @@ -353,9 +422,13 @@ int poll_write(int d, boost::system::error_code& ec) fds.fd = d; fds.events = POLLOUT; fds.revents = 0; + int timeout = (state & user_set_non_blocking) ? 0 : -1; errno = 0; - int result = error_wrapper(::poll(&fds, 1, -1), ec); - if (result >= 0) + int result = error_wrapper(::poll(&fds, 1, timeout), ec); + if (result == 0) + ec = (state & user_set_non_blocking) + ? boost::asio::error::would_block : boost::system::error_code(); + else if (result > 0) ec = boost::system::error_code(); return result; } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.hpp index a6b7078..12860af 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/dev_poll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -40,7 +40,7 @@ void dev_poll_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue) template <typename Time_Traits> void dev_poll_reactor::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -58,11 +58,12 @@ void dev_poll_reactor::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t dev_poll_reactor::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { boost::asio::detail::mutex::scoped_lock lock(mutex_); op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); io_service_.post_deferred_completions(ops); return n; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.ipp index b9d5e61..a648bf1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/dev_poll_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,6 +19,7 @@ #if defined(BOOST_ASIO_HAS_DEV_POLL) +#include <boost/assert.hpp> #include <boost/asio/detail/dev_poll_reactor.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -38,7 +39,7 @@ dev_poll_reactor::dev_poll_reactor(boost::asio::io_service& io_service) shutdown_(false) { // Add the interrupter's descriptor to /dev/poll. - ::pollfd ev = { 0 }; + ::pollfd ev = { 0, 0, 0 }; ev.fd = interrupter_.read_descriptor(); ev.events = POLLIN | POLLERR; ev.revents = 0; @@ -63,8 +64,68 @@ void dev_poll_reactor::shutdown_service() op_queue_[i].get_all_operations(ops); timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); } +// Helper class to re-register all descriptors with /dev/poll. +class dev_poll_reactor::fork_helper +{ +public: + fork_helper(dev_poll_reactor* reactor, short events) + : reactor_(reactor), events_(events) + { + } + + bool set(int descriptor) + { + ::pollfd& ev = reactor_->add_pending_event_change(descriptor); + ev.events = events_; + return true; + } + +private: + dev_poll_reactor* reactor_; + short events_; +}; + +void dev_poll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + { + detail::mutex::scoped_lock lock(mutex_); + + if (dev_poll_fd_ != -1) + ::close(dev_poll_fd_); + dev_poll_fd_ = -1; + dev_poll_fd_ = do_dev_poll_create(); + + interrupter_.recreate(); + + // Add the interrupter's descriptor to /dev/poll. + ::pollfd ev = { 0, 0, 0 }; + ev.fd = interrupter_.read_descriptor(); + ev.events = POLLIN | POLLERR; + ev.revents = 0; + ::write(dev_poll_fd_, &ev, sizeof(ev)); + + // Re-register all descriptors with /dev/poll. The changes will be written + // to the /dev/poll descriptor the next time the reactor is run. + op_queue<operation> ops; + fork_helper read_op_helper(this, POLLERR | POLLHUP | POLLIN); + op_queue_[read_op].get_descriptors(read_op_helper, ops); + fork_helper write_op_helper(this, POLLERR | POLLHUP | POLLOUT); + op_queue_[write_op].get_descriptors(write_op_helper, ops); + fork_helper except_op_helper(this, POLLERR | POLLHUP | POLLPRI); + op_queue_[except_op].get_descriptors(except_op_helper, ops); + interrupter_.interrupt(); + + // The ops op_queue will always be empty because the fork_helper's set() + // member function never returns false. + BOOST_ASSERT(ops.empty()); + } +} + void dev_poll_reactor::init_task() { io_service_.init_task(); @@ -75,6 +136,32 @@ int dev_poll_reactor::register_descriptor(socket_type, per_descriptor_data&) return 0; } +int dev_poll_reactor::register_internal_descriptor(int op_type, + socket_type descriptor, per_descriptor_data&, reactor_op* op) +{ + boost::asio::detail::mutex::scoped_lock lock(mutex_); + + op_queue_[op_type].enqueue_operation(descriptor, op); + ::pollfd& ev = add_pending_event_change(descriptor); + ev.events = POLLERR | POLLHUP; + switch (op_type) + { + case read_op: ev.events |= POLLIN; break; + case write_op: ev.events |= POLLOUT; break; + case except_op: ev.events |= POLLPRI; break; + default: break; + } + interrupter_.interrupt(); + + return 0; +} + +void dev_poll_reactor::move_descriptor(socket_type, + dev_poll_reactor::per_descriptor_data&, + dev_poll_reactor::per_descriptor_data&) +{ +} + void dev_poll_reactor::start_op(int op_type, socket_type descriptor, dev_poll_reactor::per_descriptor_data&, reactor_op* op, bool allow_speculative) @@ -129,8 +216,8 @@ void dev_poll_reactor::cancel_ops(socket_type descriptor, cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted); } -void dev_poll_reactor::close_descriptor(socket_type descriptor, - dev_poll_reactor::per_descriptor_data&) +void dev_poll_reactor::deregister_descriptor(socket_type descriptor, + dev_poll_reactor::per_descriptor_data&, bool) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -143,6 +230,26 @@ void dev_poll_reactor::close_descriptor(socket_type descriptor, cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted); } +void dev_poll_reactor::deregister_internal_descriptor( + socket_type descriptor, dev_poll_reactor::per_descriptor_data&) +{ + boost::asio::detail::mutex::scoped_lock lock(mutex_); + + // Remove the descriptor from /dev/poll. Since this function is only called + // during a fork, we can apply the change immediately. + ::pollfd ev = { 0, 0, 0 }; + ev.fd = descriptor; + ev.events = POLLREMOVE; + ev.revents = 0; + ::write(dev_poll_fd_, &ev, sizeof(ev)); + + // Destroy all operations associated with the descriptor. + op_queue<operation> ops; + boost::system::error_code ec; + for (int i = 0; i < max_ops; ++i) + op_queue_[i].cancel_operations(descriptor, ops, ec); +} + void dev_poll_reactor::run(bool block, op_queue<operation>& ops) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -179,8 +286,8 @@ void dev_poll_reactor::run(bool block, op_queue<operation>& ops) lock.unlock(); // Block on the /dev/poll descriptor. - ::pollfd events[128] = { { 0 } }; - ::dvpoll dp = { 0 }; + ::pollfd events[128] = { { 0, 0, 0 } }; + ::dvpoll dp = { 0, 0, 0 }; dp.dp_fds = events; dp.dp_nfds = 128; dp.dp_timeout = timeout; @@ -228,7 +335,7 @@ void dev_poll_reactor::run(bool block, op_queue<operation>& ops) // The poll operation can produce POLLHUP or POLLERR events when there // is no operation pending, so if we do not remove the descriptor we // can end up in a tight polling loop. - ::pollfd ev = { 0 }; + ::pollfd ev = { 0, 0, 0 }; ev.fd = descriptor; ev.events = POLLREMOVE; ev.revents = 0; @@ -236,7 +343,7 @@ void dev_poll_reactor::run(bool block, op_queue<operation>& ops) } else { - ::pollfd ev = { 0 }; + ::pollfd ev = { 0, 0, 0 }; ev.fd = descriptor; ev.events = POLLERR | POLLHUP; if (more_reads) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.hpp index 0339cfd..215f484 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/epoll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -38,7 +38,7 @@ void epoll_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue) template <typename Time_Traits> void epoll_reactor::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { mutex::scoped_lock lock(mutex_); @@ -56,11 +56,12 @@ void epoll_reactor::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t epoll_reactor::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { mutex::scoped_lock lock(mutex_); op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); io_service_.post_deferred_completions(ops); return n; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.ipp index 5afb891..073bd08 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/epoll_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -39,13 +39,9 @@ epoll_reactor::epoll_reactor(boost::asio::io_service& io_service) : boost::asio::detail::service_base<epoll_reactor>(io_service), io_service_(use_service<io_service_impl>(io_service)), mutex_(), - epoll_fd_(do_epoll_create()), -#if defined(BOOST_ASIO_HAS_TIMERFD) - timer_fd_(timerfd_create(CLOCK_MONOTONIC, 0)), -#else // defined(BOOST_ASIO_HAS_TIMERFD) - timer_fd_(-1), -#endif // defined(BOOST_ASIO_HAS_TIMERFD) interrupter_(), + epoll_fd_(do_epoll_create()), + timer_fd_(do_timerfd_create()), shutdown_(false) { // Add the interrupter's descriptor to epoll. @@ -66,7 +62,8 @@ epoll_reactor::epoll_reactor(boost::asio::io_service& io_service) epoll_reactor::~epoll_reactor() { - close(epoll_fd_); + if (epoll_fd_ != -1) + close(epoll_fd_); if (timer_fd_ != -1) close(timer_fd_); } @@ -88,6 +85,59 @@ void epoll_reactor::shutdown_service() } timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); +} + +void epoll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + { + if (epoll_fd_ != -1) + ::close(epoll_fd_); + epoll_fd_ = -1; + epoll_fd_ = do_epoll_create(); + + if (timer_fd_ != -1) + ::close(timer_fd_); + timer_fd_ = -1; + timer_fd_ = do_timerfd_create(); + + interrupter_.recreate(); + + // Add the interrupter's descriptor to epoll. + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLET; + ev.data.ptr = &interrupter_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &ev); + interrupter_.interrupt(); + + // Add the timer descriptor to epoll. + if (timer_fd_ != -1) + { + ev.events = EPOLLIN | EPOLLERR; + ev.data.ptr = &timer_fd_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev); + } + + update_timeout(); + + // Re-register all descriptors with epoll. + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + for (descriptor_state* state = registered_descriptors_.first(); + state != 0; state = state->next_) + { + ev.events = state->registered_events_; + ev.data.ptr = state; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, state->descriptor_, &ev); + if (result != 0) + { + boost::system::error_code ec(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "epoll re-registration"); + } + } + } } void epoll_reactor::init_task() @@ -98,15 +148,19 @@ void epoll_reactor::init_task() int epoll_reactor::register_descriptor(socket_type descriptor, epoll_reactor::per_descriptor_data& descriptor_data) { - mutex::scoped_lock lock(registered_descriptors_mutex_); + descriptor_data = allocate_descriptor_state(); - descriptor_data = registered_descriptors_.alloc(); - descriptor_data->shutdown_ = false; + { + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); - lock.unlock(); + descriptor_data->reactor_ = this; + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + } epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; ev.data.ptr = descriptor_data; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); if (result != 0) @@ -115,6 +169,40 @@ int epoll_reactor::register_descriptor(socket_type descriptor, return 0; } +int epoll_reactor::register_internal_descriptor( + int op_type, socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op) +{ + descriptor_data = allocate_descriptor_state(); + + { + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + descriptor_data->reactor_ = this; + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + descriptor_data->op_queue_[op_type].push(op); + } + + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; + ev.data.ptr = descriptor_data; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); + if (result != 0) + return errno; + + return 0; +} + +void epoll_reactor::move_descriptor(socket_type, + epoll_reactor::per_descriptor_data& target_descriptor_data, + epoll_reactor::per_descriptor_data& source_descriptor_data) +{ + target_descriptor_data = source_descriptor_data; + source_descriptor_data = 0; +} + void epoll_reactor::start_op(int op_type, socket_type descriptor, epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op, bool allow_speculative) @@ -146,12 +234,37 @@ void epoll_reactor::start_op(int op_type, socket_type descriptor, io_service_.post_immediate_completion(op); return; } + + if (op_type == write_op) + { + if ((descriptor_data->registered_events_ & EPOLLOUT) == 0) + { + epoll_event ev = { 0, { 0 } }; + ev.events = descriptor_data->registered_events_ | EPOLLOUT; + ev.data.ptr = descriptor_data; + if (epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev) == 0) + { + descriptor_data->registered_events_ |= ev.events; + } + else + { + op->ec_ = boost::system::error_code(errno, + boost::asio::error::get_system_category()); + io_service_.post_immediate_completion(op); + return; + } + } + } } else { + if (op_type == write_op) + { + descriptor_data->registered_events_ |= EPOLLOUT; + } + epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP - | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = descriptor_data->registered_events_; ev.data.ptr = descriptor_data; epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev); } @@ -185,19 +298,26 @@ void epoll_reactor::cancel_ops(socket_type, io_service_.post_deferred_completions(ops); } -void epoll_reactor::close_descriptor(socket_type, - epoll_reactor::per_descriptor_data& descriptor_data) +void epoll_reactor::deregister_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, bool closing) { if (!descriptor_data) return; mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); - mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); if (!descriptor_data->shutdown_) { - // Remove the descriptor from the set of known descriptors. The descriptor - // will be automatically removed from the epoll set when it is closed. + if (closing) + { + // The descriptor will be automatically removed from the epoll set when + // it is closed. + } + else + { + epoll_event ev = { 0, { 0 } }; + epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); + } op_queue<operation> ops; for (int i = 0; i < max_ops; ++i) @@ -210,21 +330,53 @@ void epoll_reactor::close_descriptor(socket_type, } } + descriptor_data->descriptor_ = -1; descriptor_data->shutdown_ = true; descriptor_lock.unlock(); - registered_descriptors_.free(descriptor_data); + free_descriptor_state(descriptor_data); descriptor_data = 0; - descriptors_lock.unlock(); - io_service_.post_deferred_completions(ops); } } +void epoll_reactor::deregister_internal_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (!descriptor_data->shutdown_) + { + epoll_event ev = { 0, { 0 } }; + epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); + + op_queue<operation> ops; + for (int i = 0; i < max_ops; ++i) + ops.push(descriptor_data->op_queue_[i]); + + descriptor_data->descriptor_ = -1; + descriptor_data->shutdown_ = true; + + descriptor_lock.unlock(); + + free_descriptor_state(descriptor_data); + descriptor_data = 0; + } +} + void epoll_reactor::run(bool block, op_queue<operation>& ops) { + // This code relies on the fact that the task_io_service queues the reactor + // task behind all descriptor operations generated by this function. This + // means, that by the time we reach this point, any previously returned + // descriptor operations have already been dequeued. Therefore it is now safe + // for us to reuse and return them for the task_io_service to queue again. + // Calculate a timeout only if timerfd is not used. int timeout; if (timer_fd_ != -1) @@ -271,28 +423,12 @@ void epoll_reactor::run(bool block, op_queue<operation>& ops) #endif // defined(BOOST_ASIO_HAS_TIMERFD) else { + // The descriptor operation doesn't count as work in and of itself, so we + // don't call work_started() here. This still allows the io_service to + // stop if the only remaining operations are descriptor operations. descriptor_state* descriptor_data = static_cast<descriptor_state*>(ptr); - mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); - - // Exception operations must be processed first to ensure that any - // out-of-band data is read before normal data. - static const int flag[max_ops] = { EPOLLIN, EPOLLOUT, EPOLLPRI }; - for (int j = max_ops - 1; j >= 0; --j) - { - if (events[i].events & (flag[j] | EPOLLERR | EPOLLHUP)) - { - while (reactor_op* op = descriptor_data->op_queue_[j].front()) - { - if (op->perform()) - { - descriptor_data->op_queue_[j].pop(); - ops.push(op); - } - else - break; - } - } - } + descriptor_data->set_ready_events(events[i].events); + ops.push(descriptor_data); } } @@ -323,16 +459,65 @@ void epoll_reactor::interrupt() int epoll_reactor::do_epoll_create() { - int fd = epoll_create(epoll_size); +#if defined(EPOLL_CLOEXEC) + int fd = epoll_create1(EPOLL_CLOEXEC); +#else // defined(EPOLL_CLOEXEC) + int fd = -1; + errno = EINVAL; +#endif // defined(EPOLL_CLOEXEC) + + if (fd == -1 && (errno == EINVAL || errno == ENOSYS)) + { + fd = epoll_create(epoll_size); + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } + if (fd == -1) { boost::system::error_code ec(errno, boost::asio::error::get_system_category()); boost::asio::detail::throw_error(ec, "epoll"); } + return fd; } +int epoll_reactor::do_timerfd_create() +{ +#if defined(BOOST_ASIO_HAS_TIMERFD) +# if defined(TFD_CLOEXEC) + int fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); +# else // defined(TFD_CLOEXEC) + int fd = -1; + errno = EINVAL; +# endif // defined(TFD_CLOEXEC) + + if (fd == -1 && errno == EINVAL) + { + fd = timerfd_create(CLOCK_MONOTONIC, 0); + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } + + return fd; +#else // defined(BOOST_ASIO_HAS_TIMERFD) + return -1; +#endif // defined(BOOST_ASIO_HAS_TIMERFD) +} + +epoll_reactor::descriptor_state* epoll_reactor::allocate_descriptor_state() +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + return registered_descriptors_.alloc(); +} + +void epoll_reactor::free_descriptor_state(epoll_reactor::descriptor_state* s) +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + registered_descriptors_.free(s); +} + void epoll_reactor::do_add_timer_queue(timer_queue_base& queue) { mutex::scoped_lock lock(mutex_); @@ -381,6 +566,92 @@ int epoll_reactor::get_timeout(itimerspec& ts) } #endif // defined(BOOST_ASIO_HAS_TIMERFD) +struct epoll_reactor::perform_io_cleanup_on_block_exit +{ + explicit perform_io_cleanup_on_block_exit(epoll_reactor* r) + : reactor_(r), first_op_(0) + { + } + + ~perform_io_cleanup_on_block_exit() + { + if (first_op_) + { + // Post the remaining completed operations for invocation. + if (!ops_.empty()) + reactor_->io_service_.post_deferred_completions(ops_); + + // A user-initiated operation has completed, but there's no need to + // explicitly call work_finished() here. Instead, we'll take advantage of + // the fact that the task_io_service will call work_finished() once we + // return. + } + else + { + // No user-initiated operations have completed, so we need to compensate + // for the work_finished() call that the task_io_service will make once + // this operation returns. + reactor_->io_service_.work_started(); + } + } + + epoll_reactor* reactor_; + op_queue<operation> ops_; + operation* first_op_; +}; + +epoll_reactor::descriptor_state::descriptor_state() + : operation(&epoll_reactor::descriptor_state::do_complete) +{ +} + +operation* epoll_reactor::descriptor_state::perform_io(uint32_t events) +{ + perform_io_cleanup_on_block_exit io_cleanup(reactor_); + mutex::scoped_lock descriptor_lock(mutex_); + + // Exception operations must be processed first to ensure that any + // out-of-band data is read before normal data. + static const int flag[max_ops] = { EPOLLIN, EPOLLOUT, EPOLLPRI }; + for (int j = max_ops - 1; j >= 0; --j) + { + if (events & (flag[j] | EPOLLERR | EPOLLHUP)) + { + while (reactor_op* op = op_queue_[j].front()) + { + if (op->perform()) + { + op_queue_[j].pop(); + io_cleanup.ops_.push(op); + } + else + break; + } + } + } + + // The first operation will be returned for completion now. The others will + // be posted for later by the io_cleanup object's destructor. + io_cleanup.first_op_ = io_cleanup.ops_.front(); + io_cleanup.ops_.pop(); + return io_cleanup.first_op_; +} + +void epoll_reactor::descriptor_state::do_complete( + io_service_impl* owner, operation* base, + const boost::system::error_code& ec, std::size_t bytes_transferred) +{ + if (owner) + { + descriptor_state* descriptor_data = static_cast<descriptor_state*>(base); + uint32_t events = static_cast<uint32_t>(bytes_transferred); + if (operation* op = descriptor_data->perform_io(events)) + { + op->complete(*owner, ec, 0); + } + } +} + } // namespace detail } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/eventfd_select_interrupter.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/eventfd_select_interrupter.ipp index d270b31..22154bb 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/eventfd_select_interrupter.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/eventfd_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/eventfd_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -40,24 +40,48 @@ namespace detail { eventfd_select_interrupter::eventfd_select_interrupter() { + open_descriptors(); +} + +void eventfd_select_interrupter::open_descriptors() +{ #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 write_descriptor_ = read_descriptor_ = syscall(__NR_eventfd, 0); -#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 - write_descriptor_ = read_descriptor_ = ::eventfd(0, 0); -#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 if (read_descriptor_ != -1) { ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK); + ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); } - else +#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 +# if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK) + write_descriptor_ = read_descriptor_ = + ::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); +# else // defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK) + errno = EINVAL; + write_descriptor_ = read_descriptor_ = -1; +# endif // defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK) + if (read_descriptor_ == -1 && errno == EINVAL) + { + write_descriptor_ = read_descriptor_ = ::eventfd(0, 0); + if (read_descriptor_ != -1) + { + ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK); + ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); + } + } +#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 + + if (read_descriptor_ == -1) { int pipe_fds[2]; if (pipe(pipe_fds) == 0) { read_descriptor_ = pipe_fds[0]; ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK); + ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); write_descriptor_ = pipe_fds[1]; ::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK); + ::fcntl(write_descriptor_, F_SETFD, FD_CLOEXEC); } else { @@ -70,12 +94,27 @@ eventfd_select_interrupter::eventfd_select_interrupter() eventfd_select_interrupter::~eventfd_select_interrupter() { + close_descriptors(); +} + +void eventfd_select_interrupter::close_descriptors() +{ if (write_descriptor_ != -1 && write_descriptor_ != read_descriptor_) ::close(write_descriptor_); if (read_descriptor_ != -1) ::close(read_descriptor_); } +void eventfd_select_interrupter::recreate() +{ + close_descriptors(); + + write_descriptor_ = -1; + read_descriptor_ = -1; + + open_descriptors(); +} + void eventfd_select_interrupter::interrupt() { uint64_t counter(1UL); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp new file mode 100644 index 0000000..70342e3 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp @@ -0,0 +1,299 @@ +// +// detail/impl/handler_tracking.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP +#define BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +#include <cstdarg> +#include <cstdio> +#include <boost/asio/detail/handler_tracking.hpp> + +#include <boost/asio/detail/push_options.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/asio/detail/pop_options.hpp> + +#if !defined(BOOST_WINDOWS) +# include <unistd.h> +#endif // !defined(BOOST_WINDOWS) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct handler_tracking::tracking_state +{ + static_mutex mutex_; + boost::uint64_t next_id_; + tss_ptr<completion>* current_completion_; +}; + +handler_tracking::tracking_state* handler_tracking::get_state() +{ + static tracking_state state = { BOOST_ASIO_STATIC_MUTEX_INIT, 1, 0 }; + return &state; +} + +void handler_tracking::init() +{ + static tracking_state* state = get_state(); + + state->mutex_.init(); + + static_mutex::scoped_lock lock(state->mutex_); + if (state->current_completion_ == 0) + state->current_completion_ = new tss_ptr<completion>; +} + +void handler_tracking::creation(handler_tracking::tracked_handler* h, + const char* object_type, void* object, const char* op_name) +{ + static tracking_state* state = get_state(); + + static_mutex::scoped_lock lock(state->mutex_); + h->id_ = state->next_id_++; + lock.unlock(); + + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + boost::uint64_t current_id = 0; + if (completion* current_completion = *state->current_completion_) + current_id = current_completion->id_; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|%I64u*%I64u|%.20s@%p.%.50s\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|%llu*%llu|%.20s@%p.%.50s\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + current_id, h->id_, object_type, object, op_name); +} + +handler_tracking::completion::completion(handler_tracking::tracked_handler* h) + : id_(h->id_), + invoked_(false), + next_(*get_state()->current_completion_) +{ + *get_state()->current_completion_ = this; +} + +handler_tracking::completion::~completion() +{ + if (id_) + { + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|%c%I64u|\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|%c%llu|\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + invoked_ ? '!' : '~', id_); + } + + *get_state()->current_completion_ = next_; +} + +void handler_tracking::completion::invocation_begin() +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), id_); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_begin( + const boost::system::error_code& ec) +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|ec=%.20s:%d\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + id_, ec.category().name(), ec.value()); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_begin( + const boost::system::error_code& ec, std::size_t bytes_transferred) +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,bytes_transferred=%I64u\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,bytes_transferred=%llu\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + id_, ec.category().name(), ec.value(), + static_cast<boost::uint64_t>(bytes_transferred)); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_begin( + const boost::system::error_code& ec, int signal_number) +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,signal_number=%d\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,signal_number=%d\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + id_, ec.category().name(), ec.value(), signal_number); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_begin( + const boost::system::error_code& ec, const char* arg) +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,%.50s\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,%.50s\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + id_, ec.category().name(), ec.value(), arg); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_end() +{ + if (id_) + { + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|<%I64u|\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|<%llu|\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), id_); + + id_ = 0; + } +} + +void handler_tracking::operation(const char* object_type, + void* object, const char* op_name) +{ + static tracking_state* state = get_state(); + + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + unsigned long long current_id = 0; + if (completion* current_completion = *state->current_completion_) + current_id = current_completion->id_; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|%I64u|%.20s@%p.%.50s\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|%llu|%.20s@%p.%.50s\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + current_id, object_type, object, op_name); +} + +void handler_tracking::write_line(const char* format, ...) +{ + using namespace std; // For sprintf (or equivalent). + + va_list args; + va_start(args, format); + + char line[256] = ""; +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + int length = vsprintf_s(line, sizeof(line), format, args); +#else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + int length = vsprintf(line, format, args); +#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + + va_end(args); + +#if defined(BOOST_WINDOWS) + HANDLE stderr_handle = ::GetStdHandle(STD_ERROR_HANDLE); + DWORD bytes_written = 0; + ::WriteFile(stderr_handle, line, length, &bytes_written, 0); +#else // defined(BOOST_WINDOWS) + ::write(STDERR_FILENO, line, length); +#endif // defined(BOOST_WINDOWS) +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +#endif // BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.hpp index 779f272..d3445cd 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/kqueue_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -42,7 +42,7 @@ void kqueue_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue) template <typename Time_Traits> void kqueue_reactor::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -60,11 +60,12 @@ void kqueue_reactor::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t kqueue_reactor::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { boost::asio::detail::mutex::scoped_lock lock(mutex_); op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); io_service_.post_deferred_completions(ops); return n; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.ipp index 3ac9eae..a819eb9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/kqueue_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -28,8 +28,8 @@ #if defined(__NetBSD__) # define BOOST_ASIO_KQUEUE_EV_SET(ev, ident, filt, flags, fflags, data, udata) \ - EV_SET(ev, ident, filt, flags, fflags, \ - data, reinterpret_cast<intptr_t>(udata)) + EV_SET(ev, ident, filt, flags, fflags, data, \ + reinterpret_cast<intptr_t>(static_cast<void*>(udata))) #else # define BOOST_ASIO_KQUEUE_EV_SET(ev, ident, filt, flags, fflags, data, udata) \ EV_SET(ev, ident, filt, flags, fflags, data, udata) @@ -75,6 +75,47 @@ void kqueue_reactor::shutdown_service() } timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); +} + +void kqueue_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + { + // The kqueue descriptor is automatically closed in the child. + kqueue_fd_ = -1; + kqueue_fd_ = do_kqueue_create(); + + interrupter_.recreate(); + + // Re-register all descriptors with kqueue. + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + for (descriptor_state* state = registered_descriptors_.first(); + state != 0; state = state->next_) + { + struct kevent events[2]; + int num_events = 0; + + if (!state->op_queue_[read_op].empty()) + BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_, + EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, state); + else if (!state->op_queue_[except_op].empty()) + BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_, + EVFILT_READ, EV_ADD | EV_CLEAR, EV_OOBAND, 0, state); + + if (!state->op_queue_[write_op].empty()) + BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_, + EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, state); + + if (num_events && ::kevent(kqueue_fd_, events, num_events, 0, 0, 0) == -1) + { + boost::system::error_code error(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(error); + } + } + } } void kqueue_reactor::init_task() @@ -82,17 +123,60 @@ void kqueue_reactor::init_task() io_service_.init_task(); } -int kqueue_reactor::register_descriptor(socket_type, +int kqueue_reactor::register_descriptor(socket_type descriptor, kqueue_reactor::per_descriptor_data& descriptor_data) { - mutex::scoped_lock lock(registered_descriptors_mutex_); + descriptor_data = allocate_descriptor_state(); + + mutex::scoped_lock lock(descriptor_data->mutex_); + + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + + return 0; +} + +int kqueue_reactor::register_internal_descriptor( + int op_type, socket_type descriptor, + kqueue_reactor::per_descriptor_data& descriptor_data, reactor_op* op) +{ + descriptor_data = allocate_descriptor_state(); - descriptor_data = registered_descriptors_.alloc(); + mutex::scoped_lock lock(descriptor_data->mutex_); + + descriptor_data->descriptor_ = descriptor; descriptor_data->shutdown_ = false; + descriptor_data->op_queue_[op_type].push(op); + + struct kevent event; + switch (op_type) + { + case read_op: + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ, + EV_ADD | EV_CLEAR, 0, 0, descriptor_data); + break; + case write_op: + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_WRITE, + EV_ADD | EV_CLEAR, 0, 0, descriptor_data); + break; + case except_op: + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ, + EV_ADD | EV_CLEAR, EV_OOBAND, 0, descriptor_data); + break; + } + ::kevent(kqueue_fd_, &event, 1, 0, 0, 0); return 0; } +void kqueue_reactor::move_descriptor(socket_type, + kqueue_reactor::per_descriptor_data& target_descriptor_data, + kqueue_reactor::per_descriptor_data& source_descriptor_data) +{ + target_descriptor_data = source_descriptor_data; + source_descriptor_data = 0; +} + void kqueue_reactor::start_op(int op_type, socket_type descriptor, kqueue_reactor::per_descriptor_data& descriptor_data, reactor_op* op, bool allow_speculative) @@ -187,19 +271,30 @@ void kqueue_reactor::cancel_ops(socket_type, io_service_.post_deferred_completions(ops); } -void kqueue_reactor::close_descriptor(socket_type, - kqueue_reactor::per_descriptor_data& descriptor_data) +void kqueue_reactor::deregister_descriptor(socket_type descriptor, + kqueue_reactor::per_descriptor_data& descriptor_data, bool closing) { if (!descriptor_data) return; mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); - mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); if (!descriptor_data->shutdown_) { - // Remove the descriptor from the set of known descriptors. The descriptor - // will be automatically removed from the kqueue set when it is closed. + if (closing) + { + // The descriptor will be automatically removed from the kqueue when it + // is closed. + } + else + { + struct kevent events[2]; + BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor, + EVFILT_READ, EV_DELETE, 0, 0, 0); + BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor, + EVFILT_WRITE, EV_DELETE, 0, 0, 0); + ::kevent(kqueue_fd_, events, 2, 0, 0, 0); + } op_queue<operation> ops; for (int i = 0; i < max_ops; ++i) @@ -212,19 +307,49 @@ void kqueue_reactor::close_descriptor(socket_type, } } + descriptor_data->descriptor_ = -1; descriptor_data->shutdown_ = true; descriptor_lock.unlock(); - registered_descriptors_.free(descriptor_data); + free_descriptor_state(descriptor_data); descriptor_data = 0; - descriptors_lock.unlock(); - io_service_.post_deferred_completions(ops); } } +void kqueue_reactor::deregister_internal_descriptor(socket_type descriptor, + kqueue_reactor::per_descriptor_data& descriptor_data) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (!descriptor_data->shutdown_) + { + struct kevent events[2]; + BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor, + EVFILT_READ, EV_DELETE, 0, 0, 0); + BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor, + EVFILT_WRITE, EV_DELETE, 0, 0, 0); + ::kevent(kqueue_fd_, events, 2, 0, 0, 0); + + op_queue<operation> ops; + for (int i = 0; i < max_ops; ++i) + ops.push(descriptor_data->op_queue_[i]); + + descriptor_data->descriptor_ = -1; + descriptor_data->shutdown_ = true; + + descriptor_lock.unlock(); + + free_descriptor_state(descriptor_data); + descriptor_data = 0; + } +} + void kqueue_reactor::run(bool block, op_queue<operation>& ops) { mutex::scoped_lock lock(mutex_); @@ -354,6 +479,18 @@ int kqueue_reactor::do_kqueue_create() return fd; } +kqueue_reactor::descriptor_state* kqueue_reactor::allocate_descriptor_state() +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + return registered_descriptors_.alloc(); +} + +void kqueue_reactor::free_descriptor_state(kqueue_reactor::descriptor_state* s) +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + registered_descriptors_.free(s); +} + void kqueue_reactor::do_add_timer_queue(timer_queue_base& queue) { mutex::scoped_lock lock(mutex_); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp index 9a0a872..75a8d16 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/pipe_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -38,6 +38,11 @@ namespace detail { pipe_select_interrupter::pipe_select_interrupter() { + open_descriptors(); +} + +void pipe_select_interrupter::open_descriptors() +{ int pipe_fds[2]; if (pipe(pipe_fds) == 0) { @@ -45,6 +50,11 @@ pipe_select_interrupter::pipe_select_interrupter() ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK); write_descriptor_ = pipe_fds[1]; ::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK); + +#if defined(FD_CLOEXEC) + ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); + ::fcntl(write_descriptor_, F_SETFD, FD_CLOEXEC); +#endif // defined(FD_CLOEXEC) } else { @@ -56,12 +66,27 @@ pipe_select_interrupter::pipe_select_interrupter() pipe_select_interrupter::~pipe_select_interrupter() { + close_descriptors(); +} + +void pipe_select_interrupter::close_descriptors() +{ if (read_descriptor_ != -1) ::close(read_descriptor_); if (write_descriptor_ != -1) ::close(write_descriptor_); } +void pipe_select_interrupter::recreate() +{ + close_descriptors(); + + write_descriptor_ = -1; + read_descriptor_ = -1; + + open_descriptors(); +} + void pipe_select_interrupter::interrupt() { char byte = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/posix_event.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/posix_event.ipp index 893e8cc..08eae05 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/posix_event.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/posix_event.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_event.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/posix_mutex.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/posix_mutex.ipp index 908bfab..94b9bf4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/posix_mutex.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/posix_mutex.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_mutex.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/posix_thread.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/posix_thread.ipp index feb6dd1..0c52971 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/posix_thread.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/posix_thread.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_thread.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/posix_tss_ptr.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/posix_tss_ptr.ipp index 89c1bf5..5124c5f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/posix_tss_ptr.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/posix_tss_ptr.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_tss_ptr.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_descriptor_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_descriptor_service.ipp index a1ee09a..dff0a82 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_descriptor_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_descriptor_service.ipp @@ -2,7 +2,7 @@ // detail/impl/reactive_descriptor_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -46,11 +46,47 @@ void reactive_descriptor_service::construct( impl.state_ = 0; } +void reactive_descriptor_service::move_construct( + reactive_descriptor_service::implementation_type& impl, + reactive_descriptor_service::implementation_type& other_impl) +{ + impl.descriptor_ = other_impl.descriptor_; + other_impl.descriptor_ = -1; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + reactor_.move_descriptor(impl.descriptor_, + impl.reactor_data_, other_impl.reactor_data_); +} + +void reactive_descriptor_service::move_assign( + reactive_descriptor_service::implementation_type& impl, + reactive_descriptor_service& other_service, + reactive_descriptor_service::implementation_type& other_impl) +{ + destroy(impl); + + impl.descriptor_ = other_impl.descriptor_; + other_impl.descriptor_ = -1; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + other_service.reactor_.move_descriptor(impl.descriptor_, + impl.reactor_data_, other_impl.reactor_data_); +} + void reactive_descriptor_service::destroy( reactive_descriptor_service::implementation_type& impl) { if (is_open(impl)) - reactor_.close_descriptor(impl.descriptor_, impl.reactor_data_); + { + BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "close")); + + reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, + (impl.state_ & descriptor_ops::possible_dup) == 0); + } boost::system::error_code ignored_ec; descriptor_ops::close(impl.descriptor_, impl.state_, ignored_ec); @@ -58,7 +94,7 @@ void reactive_descriptor_service::destroy( boost::system::error_code reactive_descriptor_service::assign( reactive_descriptor_service::implementation_type& impl, - const native_type& native_descriptor, boost::system::error_code& ec) + const native_handle_type& native_descriptor, boost::system::error_code& ec) { if (is_open(impl)) { @@ -75,7 +111,7 @@ boost::system::error_code reactive_descriptor_service::assign( } impl.descriptor_ = native_descriptor; - impl.state_ = 0; + impl.state_ = descriptor_ops::possible_dup; ec = boost::system::error_code(); return ec; } @@ -85,14 +121,43 @@ boost::system::error_code reactive_descriptor_service::close( boost::system::error_code& ec) { if (is_open(impl)) - reactor_.close_descriptor(impl.descriptor_, impl.reactor_data_); + { + BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "close")); - if (descriptor_ops::close(impl.descriptor_, impl.state_, ec) == 0) - construct(impl); + reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, + (impl.state_ & descriptor_ops::possible_dup) == 0); + } + + descriptor_ops::close(impl.descriptor_, impl.state_, ec); + + // The descriptor is closed by the OS even if close() returns an error. + // + // (Actually, POSIX says the state of the descriptor is unspecified. On + // Linux the descriptor is apparently closed anyway; e.g. see + // http://lkml.org/lkml/2005/9/10/129 + // We'll just have to assume that other OSes follow the same behaviour.) + construct(impl); return ec; } +reactive_descriptor_service::native_handle_type +reactive_descriptor_service::release( + reactive_descriptor_service::implementation_type& impl) +{ + native_handle_type descriptor = impl.descriptor_; + + if (is_open(impl)) + { + BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "release")); + + reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, false); + construct(impl); + } + + return descriptor; +} + boost::system::error_code reactive_descriptor_service::cancel( reactive_descriptor_service::implementation_type& impl, boost::system::error_code& ec) @@ -103,6 +168,8 @@ boost::system::error_code reactive_descriptor_service::cancel( return ec; } + BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "cancel")); + reactor_.cancel_ops(impl.descriptor_, impl.reactor_data_); ec = boost::system::error_code(); return ec; @@ -110,16 +177,16 @@ boost::system::error_code reactive_descriptor_service::cancel( void reactive_descriptor_service::start_op( reactive_descriptor_service::implementation_type& impl, - int op_type, reactor_op* op, bool non_blocking, bool noop) + int op_type, reactor_op* op, bool is_non_blocking, bool noop) { if (!noop) { if ((impl.state_ & descriptor_ops::non_blocking) || descriptor_ops::set_internal_non_blocking( - impl.descriptor_, impl.state_, op->ec_)) + impl.descriptor_, impl.state_, true, op->ec_)) { reactor_.start_op(op_type, impl.descriptor_, - impl.reactor_data_, op, non_blocking); + impl.reactor_data_, op, is_non_blocking); return; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_serial_port_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_serial_port_service.ipp index ece61d3..0f530d7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_serial_port_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_serial_port_service.ipp @@ -2,7 +2,7 @@ // detail/impl/reactive_serial_port_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -113,7 +113,7 @@ boost::system::error_code reactive_serial_port_service::do_set_option( termios ios; errno = 0; descriptor_ops::error_wrapper(::tcgetattr( - descriptor_service_.native(impl), &ios), ec); + descriptor_service_.native_handle(impl), &ios), ec); if (ec) return ec; @@ -122,7 +122,7 @@ boost::system::error_code reactive_serial_port_service::do_set_option( errno = 0; descriptor_ops::error_wrapper(::tcsetattr( - descriptor_service_.native(impl), TCSANOW, &ios), ec); + descriptor_service_.native_handle(impl), TCSANOW, &ios), ec); return ec; } @@ -134,7 +134,7 @@ boost::system::error_code reactive_serial_port_service::do_get_option( termios ios; errno = 0; descriptor_ops::error_wrapper(::tcgetattr( - descriptor_service_.native(impl), &ios), ec); + descriptor_service_.native_handle(impl), &ios), ec); if (ec) return ec; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_socket_service_base.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_socket_service_base.ipp index 31f5bc4..93277e0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_socket_service_base.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_socket_service_base.ipp @@ -2,7 +2,7 @@ // detail/reactive_socket_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -45,12 +45,46 @@ void reactive_socket_service_base::construct( impl.state_ = 0; } +void reactive_socket_service_base::base_move_construct( + reactive_socket_service_base::base_implementation_type& impl, + reactive_socket_service_base::base_implementation_type& other_impl) +{ + impl.socket_ = other_impl.socket_; + other_impl.socket_ = invalid_socket; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + reactor_.move_descriptor(impl.socket_, + impl.reactor_data_, other_impl.reactor_data_); +} + +void reactive_socket_service_base::base_move_assign( + reactive_socket_service_base::base_implementation_type& impl, + reactive_socket_service_base& other_service, + reactive_socket_service_base::base_implementation_type& other_impl) +{ + destroy(impl); + + impl.socket_ = other_impl.socket_; + other_impl.socket_ = invalid_socket; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + other_service.reactor_.move_descriptor(impl.socket_, + impl.reactor_data_, other_impl.reactor_data_); +} + void reactive_socket_service_base::destroy( reactive_socket_service_base::base_implementation_type& impl) { if (impl.socket_ != invalid_socket) { - reactor_.close_descriptor(impl.socket_, impl.reactor_data_); + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close")); + + reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_, + (impl.state_ & socket_ops::possible_dup) == 0); boost::system::error_code ignored_ec; socket_ops::close(impl.socket_, impl.state_, true, ignored_ec); @@ -62,10 +96,24 @@ boost::system::error_code reactive_socket_service_base::close( boost::system::error_code& ec) { if (is_open(impl)) - reactor_.close_descriptor(impl.socket_, impl.reactor_data_); + { + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close")); - if (socket_ops::close(impl.socket_, impl.state_, false, ec) == 0) - construct(impl); + reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_, + (impl.state_ & socket_ops::possible_dup) == 0); + } + + socket_ops::close(impl.socket_, impl.state_, false, ec); + + // The descriptor is closed by the OS even if close() returns an error. + // + // (Actually, POSIX says the state of the descriptor is unspecified. On + // Linux the descriptor is apparently closed anyway; e.g. see + // http://lkml.org/lkml/2005/9/10/129 + // We'll just have to assume that other OSes follow the same behaviour. The + // known exception is when Windows's closesocket() function fails with + // WSAEWOULDBLOCK, but this case is handled inside socket_ops::close(). + construct(impl); return ec; } @@ -80,6 +128,8 @@ boost::system::error_code reactive_socket_service_base::cancel( return ec; } + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "cancel")); + reactor_.cancel_ops(impl.socket_, impl.reactor_data_); ec = boost::system::error_code(); return ec; @@ -119,7 +169,7 @@ boost::system::error_code reactive_socket_service_base::do_open( boost::system::error_code reactive_socket_service_base::do_assign( reactive_socket_service_base::base_implementation_type& impl, int type, - const reactive_socket_service_base::native_type& native_socket, + const reactive_socket_service_base::native_handle_type& native_socket, boost::system::error_code& ec) { if (is_open(impl)) @@ -143,22 +193,23 @@ boost::system::error_code reactive_socket_service_base::do_assign( case SOCK_DGRAM: impl.state_ = socket_ops::datagram_oriented; break; default: impl.state_ = 0; break; } + impl.state_ |= socket_ops::possible_dup; ec = boost::system::error_code(); return ec; } void reactive_socket_service_base::start_op( reactive_socket_service_base::base_implementation_type& impl, - int op_type, reactor_op* op, bool non_blocking, bool noop) + int op_type, reactor_op* op, bool is_non_blocking, bool noop) { if (!noop) { if ((impl.state_ & socket_ops::non_blocking) || socket_ops::set_internal_non_blocking( - impl.socket_, impl.state_, op->ec_)) + impl.socket_, impl.state_, true, op->ec_)) { reactor_.start_op(op_type, impl.socket_, - impl.reactor_data_, op, non_blocking); + impl.reactor_data_, op, is_non_blocking); return; } } @@ -185,7 +236,7 @@ void reactive_socket_service_base::start_connect_op( { if ((impl.state_ & socket_ops::non_blocking) || socket_ops::set_internal_non_blocking( - impl.socket_, impl.state_, op->ec_)) + impl.socket_, impl.state_, true, op->ec_)) { if (socket_ops::connect(impl.socket_, addr, addrlen, op->ec_) != 0) { diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/resolver_service_base.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/resolver_service_base.ipp index e456bb9..6a384e4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/resolver_service_base.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/resolver_service_base.ipp @@ -2,7 +2,7 @@ // detail/impl/resolver_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -53,10 +53,10 @@ resolver_service_base::~resolver_service_base() void resolver_service_base::shutdown_service() { work_.reset(); - if (work_io_service_) + if (work_io_service_.get()) { work_io_service_->stop(); - if (work_thread_) + if (work_thread_.get()) { work_thread_->join(); work_thread_.reset(); @@ -65,6 +65,25 @@ void resolver_service_base::shutdown_service() } } +void resolver_service_base::fork_service( + boost::asio::io_service::fork_event fork_ev) +{ + if (work_thread_.get()) + { + if (fork_ev == boost::asio::io_service::fork_prepare) + { + work_io_service_->stop(); + work_thread_->join(); + } + else + { + work_io_service_->reset(); + work_thread_.reset(new boost::asio::detail::thread( + work_io_service_runner(*work_io_service_))); + } + } +} + void resolver_service_base::construct( resolver_service_base::implementation_type& impl) { @@ -72,13 +91,18 @@ void resolver_service_base::construct( } void resolver_service_base::destroy( - resolver_service_base::implementation_type&) + resolver_service_base::implementation_type& impl) { + BOOST_ASIO_HANDLER_OPERATION(("resolver", &impl, "cancel")); + + impl.reset(); } void resolver_service_base::cancel( resolver_service_base::implementation_type& impl) { + BOOST_ASIO_HANDLER_OPERATION(("resolver", &impl, "cancel")); + impl.reset(static_cast<void*>(0), socket_ops::noop_deleter()); } @@ -92,7 +116,7 @@ void resolver_service_base::start_resolve_op(operation* op) void resolver_service_base::start_work_thread() { boost::asio::detail::mutex::scoped_lock lock(mutex_); - if (!work_thread_) + if (!work_thread_.get()) { work_thread_.reset(new boost::asio::detail::thread( work_io_service_runner(*work_io_service_))); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.hpp index 3773bfb..0d4097e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/select_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -44,7 +44,7 @@ void select_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue) template <typename Time_Traits> void select_reactor::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -62,11 +62,12 @@ void select_reactor::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t select_reactor::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { boost::asio::detail::mutex::scoped_lock lock(mutex_); op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); io_service_.post_deferred_completions(ops); return n; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.ipp index 8fcf68e..d11904e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/select_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -82,6 +82,14 @@ void select_reactor::shutdown_service() op_queue_[i].get_all_operations(ops); timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); +} + +void select_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + interrupter_.recreate(); } void select_reactor::init_task() @@ -95,6 +103,24 @@ int select_reactor::register_descriptor(socket_type, return 0; } +int select_reactor::register_internal_descriptor( + int op_type, socket_type descriptor, + select_reactor::per_descriptor_data&, reactor_op* op) +{ + boost::asio::detail::mutex::scoped_lock lock(mutex_); + + op_queue_[op_type].enqueue_operation(descriptor, op); + interrupter_.interrupt(); + + return 0; +} + +void select_reactor::move_descriptor(socket_type, + select_reactor::per_descriptor_data&, + select_reactor::per_descriptor_data&) +{ +} + void select_reactor::start_op(int op_type, socket_type descriptor, select_reactor::per_descriptor_data&, reactor_op* op, bool) { @@ -119,13 +145,22 @@ void select_reactor::cancel_ops(socket_type descriptor, cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted); } -void select_reactor::close_descriptor(socket_type descriptor, - select_reactor::per_descriptor_data&) +void select_reactor::deregister_descriptor(socket_type descriptor, + select_reactor::per_descriptor_data&, bool) { boost::asio::detail::mutex::scoped_lock lock(mutex_); cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted); } +void select_reactor::deregister_internal_descriptor( + socket_type descriptor, select_reactor::per_descriptor_data&) +{ + boost::asio::detail::mutex::scoped_lock lock(mutex_); + op_queue<operation> ops; + for (int i = 0; i < max_ops; ++i) + op_queue_[i].cancel_operations(descriptor, ops); +} + void select_reactor::run(bool block, op_queue<operation>& ops) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -137,27 +172,28 @@ void select_reactor::run(bool block, op_queue<operation>& ops) #endif // defined(BOOST_ASIO_HAS_IOCP) // Set up the descriptor sets. - fd_set_adapter fds[max_select_ops]; - fds[read_op].set(interrupter_.read_descriptor()); + for (int i = 0; i < max_select_ops; ++i) + fd_sets_[i].reset(); + fd_sets_[read_op].set(interrupter_.read_descriptor()); socket_type max_fd = 0; bool have_work_to_do = !timer_queues_.all_empty(); for (int i = 0; i < max_select_ops; ++i) { have_work_to_do = have_work_to_do || !op_queue_[i].empty(); - op_queue_[i].get_descriptors(fds[i], ops); - if (fds[i].max_descriptor() > max_fd) - max_fd = fds[i].max_descriptor(); + op_queue_[i].get_descriptors(fd_sets_[i], ops); + if (fd_sets_[i].max_descriptor() > max_fd) + max_fd = fd_sets_[i].max_descriptor(); } #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) // Connection operations on Windows use both except and write fd_sets. have_work_to_do = have_work_to_do || !op_queue_[connect_op].empty(); - op_queue_[connect_op].get_descriptors(fds[write_op], ops); - if (fds[write_op].max_descriptor() > max_fd) - max_fd = fds[write_op].max_descriptor(); - op_queue_[connect_op].get_descriptors(fds[except_op], ops); - if (fds[except_op].max_descriptor() > max_fd) - max_fd = fds[except_op].max_descriptor(); + op_queue_[connect_op].get_descriptors(fd_sets_[write_op], ops); + if (fd_sets_[write_op].max_descriptor() > max_fd) + max_fd = fd_sets_[write_op].max_descriptor(); + op_queue_[connect_op].get_descriptors(fd_sets_[except_op], ops); + if (fd_sets_[except_op].max_descriptor() > max_fd) + max_fd = fd_sets_[except_op].max_descriptor(); #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) // We can return immediately if there's no work to do and the reactor is @@ -174,11 +210,14 @@ void select_reactor::run(bool block, op_queue<operation>& ops) // Block on the select call until descriptors become ready. boost::system::error_code ec; int retval = socket_ops::select(static_cast<int>(max_fd + 1), - fds[read_op], fds[write_op], fds[except_op], tv, ec); + fd_sets_[read_op], fd_sets_[write_op], fd_sets_[except_op], tv, ec); // Reset the interrupter. - if (retval > 0 && fds[read_op].is_set(interrupter_.read_descriptor())) + if (retval > 0 && fd_sets_[read_op].is_set(interrupter_.read_descriptor())) + { interrupter_.reset(); + --retval; + } lock.lock(); @@ -188,15 +227,15 @@ void select_reactor::run(bool block, op_queue<operation>& ops) #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) // Connection operations on Windows use both except and write fd_sets. op_queue_[connect_op].perform_operations_for_descriptors( - fds[except_op], ops); + fd_sets_[except_op], ops); op_queue_[connect_op].perform_operations_for_descriptors( - fds[write_op], ops); + fd_sets_[write_op], ops); #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) // Exception operations must be processed first to ensure that any // out-of-band data is read before normal data. for (int i = max_select_ops - 1; i >= 0; --i) - op_queue_[i].perform_operations_for_descriptors(fds[i], ops); + op_queue_[i].perform_operations_for_descriptors(fd_sets_[i], ops); } timer_queues_.get_ready_timers(ops); } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.hpp index 97f5771..eef25ac 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.hpp @@ -2,7 +2,7 @@ // detail/impl/service_registry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -21,6 +21,24 @@ namespace boost { namespace asio { namespace detail { +template <typename Service, typename Arg> +service_registry::service_registry( + boost::asio::io_service& o, Service*, Arg arg) + : owner_(o), + first_service_(new Service(o, arg)) +{ + boost::asio::io_service::service::key key; + init_key(key, Service::id); + first_service_->key_ = key; + first_service_->next_ = 0; +} + +template <typename Service> +Service& service_registry::first_service() +{ + return *static_cast<Service*>(first_service_); +} + template <typename Service> Service& service_registry::use_service() { diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.ipp index c2f07ec..6715010 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.ipp @@ -2,7 +2,7 @@ // detail/impl/service_registry.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/throw_exception.hpp> +#include <vector> #include <boost/asio/detail/service_registry.hpp> #include <boost/asio/detail/push_options.hpp> @@ -25,12 +26,6 @@ namespace boost { namespace asio { namespace detail { -service_registry::service_registry(boost::asio::io_service& o) - : owner_(o), - first_service_(0) -{ -} - service_registry::~service_registry() { // Shutdown all services. This must be done in a separate loop before the @@ -52,6 +47,35 @@ service_registry::~service_registry() } } +void service_registry::notify_fork(boost::asio::io_service::fork_event fork_ev) +{ + // Make a copy of all of the services while holding the lock. We don't want + // to hold the lock while calling into each service, as it may try to call + // back into this class. + std::vector<boost::asio::io_service::service*> services; + { + boost::asio::detail::mutex::scoped_lock lock(mutex_); + boost::asio::io_service::service* service = first_service_; + while (service) + { + services.push_back(service); + service = service->next_; + } + } + + // If processing the fork_prepare event, we want to go in reverse order of + // service registration, which happens to be the existing order of the + // services in the vector. For the other events we want to go in the other + // direction. + std::size_t num_services = services.size(); + if (fork_ev == boost::asio::io_service::fork_prepare) + for (std::size_t i = 0; i < num_services; ++i) + services[i]->fork_service(fork_ev); + else + for (std::size_t i = num_services; i > 0; --i) + services[i - 1]->fork_service(fork_ev); +} + void service_registry::init_key(boost::asio::io_service::service::key& key, const boost::asio::io_service::id& id) { @@ -121,7 +145,7 @@ void service_registry::do_add_service( const boost::asio::io_service::service::key& key, boost::asio::io_service::service* new_service) { - if (&owner_ != &new_service->io_service()) + if (&owner_ != &new_service->get_io_service()) boost::throw_exception(invalid_service_owner()); boost::asio::detail::mutex::scoped_lock lock(mutex_); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/signal_set_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/signal_set_service.ipp new file mode 100644 index 0000000..0b57007 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/signal_set_service.ipp @@ -0,0 +1,593 @@ +// +// detail/impl/signal_set_service.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP +#define BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <cstring> +#include <boost/asio/detail/reactor.hpp> +#include <boost/asio/detail/signal_blocker.hpp> +#include <boost/asio/detail/signal_set_service.hpp> +#include <boost/asio/detail/static_mutex.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct signal_state +{ + // Mutex used for protecting global state. + static_mutex mutex_; + + // The read end of the pipe used for signal notifications. + int read_descriptor_; + + // The write end of the pipe used for signal notifications. + int write_descriptor_; + + // Whether the signal state has been prepared for a fork. + bool fork_prepared_; + + // The head of a linked list of all signal_set_service instances. + class signal_set_service* service_list_; + + // A count of the number of objects that are registered for each signal. + std::size_t registration_count_[max_signal_number]; +}; + +signal_state* get_signal_state() +{ + static signal_state state = { + BOOST_ASIO_STATIC_MUTEX_INIT, -1, -1, false, 0, { 0 } }; + return &state; +} + +void asio_signal_handler(int signal_number) +{ +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + signal_set_service::deliver_signal(signal_number); +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + int saved_errno = errno; + signal_state* state = get_signal_state(); + int result = ::write(state->write_descriptor_, + &signal_number, sizeof(signal_number)); + (void)result; + errno = saved_errno; +#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + +#if defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION) + ::signal(signal_number, asio_signal_handler); +#endif // defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION) +} + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +class signal_set_service::pipe_read_op : public reactor_op +{ +public: + pipe_read_op() + : reactor_op(&pipe_read_op::do_perform, pipe_read_op::do_complete) + { + } + + static bool do_perform(reactor_op*) + { + signal_state* state = get_signal_state(); + + int fd = state->read_descriptor_; + int signal_number = 0; + while (::read(fd, &signal_number, sizeof(int)) == sizeof(int)) + if (signal_number >= 0 && signal_number < max_signal_number) + signal_set_service::deliver_signal(signal_number); + + return false; + } + + static void do_complete(io_service_impl* /*owner*/, operation* base, + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) + { + pipe_read_op* o(static_cast<pipe_read_op*>(base)); + delete o; + } +}; +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + +signal_set_service::signal_set_service( + boost::asio::io_service& io_service) + : io_service_(boost::asio::use_service<io_service_impl>(io_service)), +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + reactor_(boost::asio::use_service<reactor>(io_service)), +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + next_(0), + prev_(0) +{ + get_signal_state()->mutex_.init(); + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + reactor_.init_task(); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + + for (int i = 0; i < max_signal_number; ++i) + registrations_[i] = 0; + + add_service(this); +} + +signal_set_service::~signal_set_service() +{ + remove_service(this); +} + +void signal_set_service::shutdown_service() +{ + remove_service(this); + + op_queue<operation> ops; + + for (int i = 0; i < max_signal_number; ++i) + { + registration* reg = registrations_[i]; + while (reg) + { + ops.push(*reg->queue_); + reg = reg->next_in_table_; + } + } + + io_service_.abandon_operations(ops); +} + +void signal_set_service::fork_service( + boost::asio::io_service::fork_event fork_ev) +{ +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + switch (fork_ev) + { + case boost::asio::io_service::fork_prepare: + reactor_.deregister_internal_descriptor( + state->read_descriptor_, reactor_data_); + state->fork_prepared_ = true; + break; + case boost::asio::io_service::fork_parent: + state->fork_prepared_ = false; + reactor_.register_internal_descriptor(reactor::read_op, + state->read_descriptor_, reactor_data_, new pipe_read_op); + break; + case boost::asio::io_service::fork_child: + if (state->fork_prepared_) + { + boost::asio::detail::signal_blocker blocker; + close_descriptors(); + open_descriptors(); + state->fork_prepared_ = false; + } + reactor_.register_internal_descriptor(reactor::read_op, + state->read_descriptor_, reactor_data_, new pipe_read_op); + break; + default: + break; + } +#else // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + (void)fork_ev; +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +} + +void signal_set_service::construct( + signal_set_service::implementation_type& impl) +{ + impl.signals_ = 0; +} + +void signal_set_service::destroy( + signal_set_service::implementation_type& impl) +{ + boost::system::error_code ignored_ec; + clear(impl, ignored_ec); + cancel(impl, ignored_ec); +} + +boost::system::error_code signal_set_service::add( + signal_set_service::implementation_type& impl, + int signal_number, boost::system::error_code& ec) +{ + // Check that the signal number is valid. + if (signal_number < 0 || signal_number > max_signal_number) + { + ec = boost::asio::error::invalid_argument; + return ec; + } + + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + // Find the appropriate place to insert the registration. + registration** insertion_point = &impl.signals_; + registration* next = impl.signals_; + while (next && next->signal_number_ < signal_number) + { + insertion_point = &next->next_in_set_; + next = next->next_in_set_; + } + + // Only do something if the signal is not already registered. + if (next == 0 || next->signal_number_ != signal_number) + { + registration* new_registration = new registration; + +#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + // Register for the signal if we're the first. + if (state->registration_count_[signal_number] == 0) + { +# if defined(BOOST_ASIO_HAS_SIGACTION) + using namespace std; // For memset. + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = asio_signal_handler; + sigfillset(&sa.sa_mask); + if (::sigaction(signal_number, &sa, 0) == -1) +# else // defined(BOOST_ASIO_HAS_SIGACTION) + if (::signal(signal_number, asio_signal_handler) == SIG_ERR) +# endif // defined(BOOST_ASIO_HAS_SIGACTION) + { +# if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::asio::error::invalid_argument; +# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::system::error_code(errno, + boost::asio::error::get_system_category()); +# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + delete new_registration; + return ec; + } + } +#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + + // Record the new registration in the set. + new_registration->signal_number_ = signal_number; + new_registration->queue_ = &impl.queue_; + new_registration->next_in_set_ = next; + *insertion_point = new_registration; + + // Insert registration into the registration table. + new_registration->next_in_table_ = registrations_[signal_number]; + if (registrations_[signal_number]) + registrations_[signal_number]->prev_in_table_ = new_registration; + registrations_[signal_number] = new_registration; + + ++state->registration_count_[signal_number]; + } + + ec = boost::system::error_code(); + return ec; +} + +boost::system::error_code signal_set_service::remove( + signal_set_service::implementation_type& impl, + int signal_number, boost::system::error_code& ec) +{ + // Check that the signal number is valid. + if (signal_number < 0 || signal_number > max_signal_number) + { + ec = boost::asio::error::invalid_argument; + return ec; + } + + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + // Find the signal number in the list of registrations. + registration** deletion_point = &impl.signals_; + registration* reg = impl.signals_; + while (reg && reg->signal_number_ < signal_number) + { + deletion_point = ®->next_in_set_; + reg = reg->next_in_set_; + } + + if (reg != 0 && reg->signal_number_ == signal_number) + { +#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + // Set signal handler back to the default if we're the last. + if (state->registration_count_[signal_number] == 1) + { +# if defined(BOOST_ASIO_HAS_SIGACTION) + using namespace std; // For memset. + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_DFL; + if (::sigaction(signal_number, &sa, 0) == -1) +# else // defined(BOOST_ASIO_HAS_SIGACTION) + if (::signal(signal_number, SIG_DFL) == SIG_ERR) +# endif // defined(BOOST_ASIO_HAS_SIGACTION) + { +# if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::asio::error::invalid_argument; +# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::system::error_code(errno, + boost::asio::error::get_system_category()); +# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + return ec; + } + } +#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + + // Remove the registration from the set. + *deletion_point = reg->next_in_set_; + + // Remove the registration from the registration table. + if (registrations_[signal_number] == reg) + registrations_[signal_number] = reg->next_in_table_; + if (reg->prev_in_table_) + reg->prev_in_table_->next_in_table_ = reg->next_in_table_; + if (reg->next_in_table_) + reg->next_in_table_->prev_in_table_ = reg->prev_in_table_; + + --state->registration_count_[signal_number]; + + delete reg; + } + + ec = boost::system::error_code(); + return ec; +} + +boost::system::error_code signal_set_service::clear( + signal_set_service::implementation_type& impl, + boost::system::error_code& ec) +{ + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + while (registration* reg = impl.signals_) + { +#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + // Set signal handler back to the default if we're the last. + if (state->registration_count_[reg->signal_number_] == 1) + { +# if defined(BOOST_ASIO_HAS_SIGACTION) + using namespace std; // For memset. + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_DFL; + if (::sigaction(reg->signal_number_, &sa, 0) == -1) +# else // defined(BOOST_ASIO_HAS_SIGACTION) + if (::signal(reg->signal_number_, SIG_DFL) == SIG_ERR) +# endif // defined(BOOST_ASIO_HAS_SIGACTION) + { +# if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::asio::error::invalid_argument; +# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::system::error_code(errno, + boost::asio::error::get_system_category()); +# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + return ec; + } + } +#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + + // Remove the registration from the registration table. + if (registrations_[reg->signal_number_] == reg) + registrations_[reg->signal_number_] = reg->next_in_table_; + if (reg->prev_in_table_) + reg->prev_in_table_->next_in_table_ = reg->next_in_table_; + if (reg->next_in_table_) + reg->next_in_table_->prev_in_table_ = reg->prev_in_table_; + + --state->registration_count_[reg->signal_number_]; + + impl.signals_ = reg->next_in_set_; + delete reg; + } + + ec = boost::system::error_code(); + return ec; +} + +boost::system::error_code signal_set_service::cancel( + signal_set_service::implementation_type& impl, + boost::system::error_code& ec) +{ + BOOST_ASIO_HANDLER_OPERATION(("signal_set", &impl, "cancel")); + + op_queue<operation> ops; + { + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + while (signal_op* op = impl.queue_.front()) + { + op->ec_ = boost::asio::error::operation_aborted; + impl.queue_.pop(); + ops.push(op); + } + } + + io_service_.post_deferred_completions(ops); + + ec = boost::system::error_code(); + return ec; +} + +void signal_set_service::deliver_signal(int signal_number) +{ + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + signal_set_service* service = state->service_list_; + while (service) + { + op_queue<operation> ops; + + registration* reg = service->registrations_[signal_number]; + while (reg) + { + if (reg->queue_->empty()) + { + ++reg->undelivered_; + } + else + { + while (signal_op* op = reg->queue_->front()) + { + op->signal_number_ = signal_number; + reg->queue_->pop(); + ops.push(op); + } + } + + reg = reg->next_in_table_; + } + + service->io_service_.post_deferred_completions(ops); + + service = service->next_; + } +} + +void signal_set_service::add_service(signal_set_service* service) +{ + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // If this is the first service to be created, open a new pipe. + if (state->service_list_ == 0) + open_descriptors(); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + + // Insert service into linked list of all services. + service->next_ = state->service_list_; + service->prev_ = 0; + if (state->service_list_) + state->service_list_->prev_ = service; + state->service_list_ = service; + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // Register for pipe readiness notifications. + service->reactor_.register_internal_descriptor(reactor::read_op, + state->read_descriptor_, service->reactor_data_, new pipe_read_op); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +} + +void signal_set_service::remove_service(signal_set_service* service) +{ + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + if (service->next_ || service->prev_ || state->service_list_ == service) + { +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // Disable the pipe readiness notifications. + service->reactor_.deregister_descriptor( + state->read_descriptor_, service->reactor_data_, false); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + + // Remove service from linked list of all services. + if (state->service_list_ == service) + state->service_list_ = service->next_; + if (service->prev_) + service->prev_->next_ = service->next_; + if (service->next_) + service->next_->prev_= service->prev_; + service->next_ = 0; + service->prev_ = 0; + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // If this is the last service to be removed, close the pipe. + if (state->service_list_ == 0) + close_descriptors(); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + } +} + +void signal_set_service::open_descriptors() +{ +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + signal_state* state = get_signal_state(); + + int pipe_fds[2]; + if (::pipe(pipe_fds) == 0) + { + state->read_descriptor_ = pipe_fds[0]; + ::fcntl(state->read_descriptor_, F_SETFL, O_NONBLOCK); + + state->write_descriptor_ = pipe_fds[1]; + ::fcntl(state->write_descriptor_, F_SETFL, O_NONBLOCK); + +#if defined(FD_CLOEXEC) + ::fcntl(state->read_descriptor_, F_SETFD, FD_CLOEXEC); + ::fcntl(state->write_descriptor_, F_SETFD, FD_CLOEXEC); +#endif // defined(FD_CLOEXEC) + } + else + { + boost::system::error_code ec(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "signal_set_service pipe"); + } +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +} + +void signal_set_service::close_descriptors() +{ +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + signal_state* state = get_signal_state(); + + if (state->read_descriptor_ != -1) + ::close(state->read_descriptor_); + state->read_descriptor_ = -1; + + if (state->write_descriptor_ != -1) + ::close(state->write_descriptor_); + state->write_descriptor_ = -1; +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +} + +void signal_set_service::start_wait_op( + signal_set_service::implementation_type& impl, signal_op* op) +{ + io_service_.work_started(); + + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + registration* reg = impl.signals_; + while (reg) + { + if (reg->undelivered_ > 0) + { + --reg->undelivered_; + io_service_.post_deferred_completion(op); + return; + } + + reg = reg->next_in_set_; + } + + impl.queue_.push(op); +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/socket_ops.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/socket_ops.ipp index e240acd..16e9536 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/socket_ops.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/socket_ops.ipp @@ -2,7 +2,7 @@ // detail/impl/socket_ops.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/assert.hpp> #include <boost/detail/workaround.hpp> +#include <cctype> #include <cstdio> #include <cstdlib> #include <cstring> @@ -148,7 +149,7 @@ socket_type sync_accept(socket_type s, state_type state, return invalid_socket; // Wait for socket to become ready. - if (socket_ops::poll_read(s, ec) < 0) + if (socket_ops::poll_read(s, 0, ec) < 0) return invalid_socket; } } @@ -278,28 +279,9 @@ int close(socket_type s, state_type& state, int result = 0; if (s != invalid_socket) { -#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) - if ((state & non_blocking) && (state & user_set_linger)) - { - ioctl_arg_type arg = 0; - ::ioctlsocket(s, FIONBIO, &arg); - state &= ~non_blocking; - } -#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) - if (state & non_blocking) - { -#if defined(__SYMBIAN32__) - int flags = ::fcntl(s, F_GETFL, 0); - if (flags >= 0) - ::fcntl(s, F_SETFL, flags & ~O_NONBLOCK); -#else // defined(__SYMBIAN32__) - ioctl_arg_type arg = 0; - ::ioctl(s, FIONBIO, &arg); -#endif // defined(__SYMBIAN32__) - state &= ~non_blocking; - } -#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) - + // We don't want the destructor to block, so set the socket to linger in + // the background. If the user doesn't like this behaviour then they need + // to explicitly close the socket. if (destruction && (state & user_set_linger)) { ::linger opt; @@ -316,6 +298,39 @@ int close(socket_type s, state_type& state, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) result = error_wrapper(::close(s), ec); #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + + if (result != 0 + && (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again)) + { + // According to UNIX Network Programming Vol. 1, it is possible for + // close() to fail with EWOULDBLOCK under certain circumstances. What + // isn't clear is the state of the descriptor after this error. The one + // current OS where this behaviour is seen, Windows, says that the socket + // remains open. Therefore we'll put the descriptor back into blocking + // mode and have another attempt at closing it. +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ioctl_arg_type arg = 0; + ::ioctlsocket(s, FIONBIO, &arg); +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +# if defined(__SYMBIAN32__) + int flags = ::fcntl(s, F_GETFL, 0); + if (flags >= 0) + ::fcntl(s, F_SETFL, flags & ~O_NONBLOCK); +# else // defined(__SYMBIAN32__) + ioctl_arg_type arg = 0; + ::ioctl(s, FIONBIO, &arg); +# endif // defined(__SYMBIAN32__) +#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + state &= ~non_blocking; + + clear_last_error(); +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + result = error_wrapper(::closesocket(s), ec); +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + result = error_wrapper(::close(s), ec); +#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + } } if (result == 0) @@ -323,8 +338,52 @@ int close(socket_type s, state_type& state, return result; } +bool set_user_non_blocking(socket_type s, + state_type& state, bool value, boost::system::error_code& ec) +{ + if (s == invalid_socket) + { + ec = boost::asio::error::bad_descriptor; + return false; + } + + clear_last_error(); +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ioctl_arg_type arg = (value ? 1 : 0); + int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec); +#elif defined(__SYMBIAN32__) + int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec); + if (result >= 0) + { + clear_last_error(); + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = error_wrapper(::fcntl(s, F_SETFL, flag), ec); + } +#else + ioctl_arg_type arg = (value ? 1 : 0); + int result = error_wrapper(::ioctl(s, FIONBIO, &arg), ec); +#endif + + if (result >= 0) + { + ec = boost::system::error_code(); + if (value) + state |= user_set_non_blocking; + else + { + // Clearing the user-set non-blocking mode always overrides any + // internally-set non-blocking flag. Any subsequent asynchronous + // operations will need to re-enable non-blocking I/O. + state &= ~(user_set_non_blocking | internal_non_blocking); + } + return true; + } + + return false; +} + bool set_internal_non_blocking(socket_type s, - state_type& state, boost::system::error_code& ec) + state_type& state, bool value, boost::system::error_code& ec) { if (s == invalid_socket) { @@ -332,26 +391,39 @@ bool set_internal_non_blocking(socket_type s, return false; } + if (!value && (state & user_set_non_blocking)) + { + // It does not make sense to clear the internal non-blocking flag if the + // user still wants non-blocking behaviour. Return an error and let the + // caller figure out whether to update the user-set non-blocking flag. + ec = boost::asio::error::invalid_argument; + return false; + } + clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) - ioctl_arg_type arg = 1; + ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec); #elif defined(__SYMBIAN32__) int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec); if (result >= 0) { clear_last_error(); - result = error_wrapper(::fcntl(s, F_SETFL, result | O_NONBLOCK), ec); + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = error_wrapper(::fcntl(s, F_SETFL, flag), ec); } #else - ioctl_arg_type arg = 1; + ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctl(s, FIONBIO, &arg), ec); #endif if (result >= 0) { ec = boost::system::error_code(); - state |= internal_non_blocking; + if (value) + state |= internal_non_blocking; + else + state &= ~internal_non_blocking; return true; } @@ -394,6 +466,10 @@ int connect(socket_type s, const socket_addr_type* addr, &msghdr::msg_namelen, s, addr, addrlen), ec); if (result == 0) ec = boost::system::error_code(); +#if defined(__linux__) + else if (ec == boost::asio::error::try_again) + ec = boost::asio::error::no_buffer_space; +#endif // defined(__linux__) return result; } @@ -664,7 +740,7 @@ size_t sync_recv(socket_type s, state_type state, buf* bufs, return 0; // Wait for socket to become ready. - if (socket_ops::poll_read(s, ec) < 0) + if (socket_ops::poll_read(s, 0, ec) < 0) return 0; } } @@ -802,7 +878,7 @@ size_t sync_recvfrom(socket_type s, state_type state, buf* bufs, return 0; // Wait for socket to become ready. - if (socket_ops::poll_read(s, ec) < 0) + if (socket_ops::poll_read(s, 0, ec) < 0) return 0; } } @@ -863,6 +939,116 @@ bool non_blocking_recvfrom(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) +int recvmsg(socket_type s, buf* bufs, size_t count, + int in_flags, int& out_flags, boost::system::error_code& ec) +{ + clear_last_error(); +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + out_flags = 0; + return socket_ops::recv(s, bufs, count, in_flags, ec); +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + msghdr msg = msghdr(); + msg.msg_iov = bufs; + msg.msg_iovlen = count; + int result = error_wrapper(::recvmsg(s, &msg, in_flags), ec); + if (result >= 0) + { + ec = boost::system::error_code(); + out_flags = msg.msg_flags; + } + else + out_flags = 0; + return result; +#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +} + +size_t sync_recvmsg(socket_type s, state_type state, + buf* bufs, size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec) +{ + if (s == invalid_socket) + { + ec = boost::asio::error::bad_descriptor; + return 0; + } + + // Read some data. + for (;;) + { + // Try to complete the operation without blocking. + int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec); + + // Check if operation succeeded. + if (bytes >= 0) + return bytes; + + // Operation failed. + if ((state & user_set_non_blocking) + || (ec != boost::asio::error::would_block + && ec != boost::asio::error::try_again)) + return 0; + + // Wait for socket to become ready. + if (socket_ops::poll_read(s, 0, ec) < 0) + return 0; + } +} + +#if defined(BOOST_ASIO_HAS_IOCP) + +void complete_iocp_recvmsg( + const weak_cancel_token_type& cancel_token, + boost::system::error_code& ec) +{ + // Map non-portable errors to their portable counterparts. + if (ec.value() == ERROR_NETNAME_DELETED) + { + if (cancel_token.expired()) + ec = boost::asio::error::operation_aborted; + else + ec = boost::asio::error::connection_reset; + } + else if (ec.value() == ERROR_PORT_UNREACHABLE) + { + ec = boost::asio::error::connection_refused; + } +} + +#else // defined(BOOST_ASIO_HAS_IOCP) + +bool non_blocking_recvmsg(socket_type s, + buf* bufs, size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec, size_t& bytes_transferred) +{ + for (;;) + { + // Read some data. + int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec); + + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; + + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + // Operation is complete. + if (bytes >= 0) + { + ec = boost::system::error_code(); + bytes_transferred = bytes; + } + else + bytes_transferred = 0; + + return true; + } +} + +#endif // defined(BOOST_ASIO_HAS_IOCP) + int send(socket_type s, const buf* bufs, size_t count, int flags, boost::system::error_code& ec) { @@ -929,7 +1115,7 @@ size_t sync_send(socket_type s, state_type state, const buf* bufs, return 0; // Wait for socket to become ready. - if (socket_ops::poll_write(s, ec) < 0) + if (socket_ops::poll_write(s, 0, ec) < 0) return 0; } } @@ -1052,7 +1238,7 @@ size_t sync_sendto(socket_type s, state_type state, const buf* bufs, return 0; // Wait for socket to become ready. - if (socket_ops::poll_write(s, ec) < 0) + if (socket_ops::poll_write(s, 0, ec) < 0) return 0; } } @@ -1502,7 +1688,7 @@ int select(int nfds, fd_set* readfds, fd_set* writefds, #endif } -int poll_read(socket_type s, boost::system::error_code& ec) +int poll_read(socket_type s, state_type state, boost::system::error_code& ec) { if (s == invalid_socket) { @@ -1516,11 +1702,12 @@ int poll_read(socket_type s, boost::system::error_code& ec) fd_set fds; FD_ZERO(&fds); FD_SET(s, &fds); + timeval zero_timeout; + zero_timeout.tv_sec = 0; + zero_timeout.tv_usec = 0; + timeval* timeout = (state & user_set_non_blocking) ? &zero_timeout : 0; clear_last_error(); - int result = error_wrapper(::select(s, &fds, 0, 0, 0), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; + int result = error_wrapper(::select(s, &fds, 0, 0, timeout), ec); #else // defined(BOOST_WINDOWS) // || defined(__CYGWIN__) // || defined(__SYMBIAN32__) @@ -1528,17 +1715,21 @@ int poll_read(socket_type s, boost::system::error_code& ec) fds.fd = s; fds.events = POLLIN; fds.revents = 0; + int timeout = (state & user_set_non_blocking) ? 0 : -1; clear_last_error(); - int result = error_wrapper(::poll(&fds, 1, -1), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; + int result = error_wrapper(::poll(&fds, 1, timeout), ec); #endif // defined(BOOST_WINDOWS) // || defined(__CYGWIN__) // || defined(__SYMBIAN32__) + if (result == 0) + ec = (state & user_set_non_blocking) + ? boost::asio::error::would_block : boost::system::error_code(); + else if (result > 0) + ec = boost::system::error_code(); + return result; } -int poll_write(socket_type s, boost::system::error_code& ec) +int poll_write(socket_type s, state_type state, boost::system::error_code& ec) { if (s == invalid_socket) { @@ -1552,11 +1743,12 @@ int poll_write(socket_type s, boost::system::error_code& ec) fd_set fds; FD_ZERO(&fds); FD_SET(s, &fds); + timeval zero_timeout; + zero_timeout.tv_sec = 0; + zero_timeout.tv_usec = 0; + timeval* timeout = (state & user_set_non_blocking) ? &zero_timeout : 0; clear_last_error(); - int result = error_wrapper(::select(s, 0, &fds, 0, 0), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; + int result = error_wrapper(::select(s, 0, &fds, 0, timeout), ec); #else // defined(BOOST_WINDOWS) // || defined(__CYGWIN__) // || defined(__SYMBIAN32__) @@ -1564,14 +1756,18 @@ int poll_write(socket_type s, boost::system::error_code& ec) fds.fd = s; fds.events = POLLOUT; fds.revents = 0; + int timeout = (state & user_set_non_blocking) ? 0 : -1; clear_last_error(); - int result = error_wrapper(::poll(&fds, 1, -1), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; + int result = error_wrapper(::poll(&fds, 1, timeout), ec); #endif // defined(BOOST_WINDOWS) // || defined(__CYGWIN__) // || defined(__SYMBIAN32__) + if (result == 0) + ec = (state & user_set_non_blocking) + ? boost::asio::error::would_block : boost::system::error_code(); + else if (result > 0) + ec = boost::system::error_code(); + return result; } int poll_connect(socket_type s, boost::system::error_code& ec) @@ -1680,7 +1876,8 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length, using namespace std; // For strcat and sprintf. char if_name[IF_NAMESIZE + 1] = "%"; const in6_addr_type* ipv6_address = static_cast<const in6_addr_type*>(src); - bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address); + bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe) + && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80)); if (!is_link_local || if_indextoname(scope_id, if_name + 1) == 0) sprintf(if_name + 1, "%lu", scope_id); strcat(dest, if_name); @@ -1764,7 +1961,8 @@ int inet_pton(int af, const char* src, void* dest, if (const char* if_name = strchr(src, '%')) { in6_addr_type* ipv6_address = static_cast<in6_addr_type*>(dest); - bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address); + bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe) + && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80)); if (is_link_local) *scope_id = if_nametoindex(if_name + 1); if (*scope_id == 0) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/socket_select_interrupter.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/socket_select_interrupter.ipp index 3b64771..6005f12 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/socket_select_interrupter.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/socket_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/socket_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -36,6 +36,11 @@ namespace detail { socket_select_interrupter::socket_select_interrupter() { + open_descriptors(); +} + +void socket_select_interrupter::open_descriptors() +{ boost::system::error_code ec; socket_holder acceptor(socket_ops::socket( AF_INET, SOCK_STREAM, IPPROTO_TCP, ec)); @@ -110,6 +115,11 @@ socket_select_interrupter::socket_select_interrupter() socket_select_interrupter::~socket_select_interrupter() { + close_descriptors(); +} + +void socket_select_interrupter::close_descriptors() +{ boost::system::error_code ec; socket_ops::state_type state = socket_ops::internal_non_blocking; if (read_descriptor_ != invalid_socket) @@ -118,6 +128,16 @@ socket_select_interrupter::~socket_select_interrupter() socket_ops::close(write_descriptor_, state, true, ec); } +void socket_select_interrupter::recreate() +{ + close_descriptors(); + + write_descriptor_ = invalid_socket; + read_descriptor_ = invalid_socket; + + open_descriptors(); +} + void socket_select_interrupter::interrupt() { char byte = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.hpp index 5cb320d..7581852 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.hpp @@ -2,7 +2,7 @@ // detail/impl/strand_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -29,7 +29,7 @@ namespace detail { inline strand_service::strand_impl::strand_impl() : operation(&strand_service::do_complete), - count_(0) + locked_(false) { } @@ -41,7 +41,8 @@ struct strand_service::on_dispatch_exit ~on_dispatch_exit() { impl_->mutex_.lock(); - bool more_handlers = (--impl_->count_ > 0); + impl_->ready_queue_.push(impl_->waiting_queue_); + bool more_handlers = impl_->locked_ = !impl_->ready_queue_.empty(); impl_->mutex_.unlock(); if (more_handlers) @@ -49,11 +50,6 @@ struct strand_service::on_dispatch_exit } }; -inline void strand_service::destroy(strand_service::implementation_type& impl) -{ - impl = 0; -} - template <typename Handler> void strand_service::dispatch(strand_service::implementation_type& impl, Handler handler) @@ -61,7 +57,7 @@ void strand_service::dispatch(strand_service::implementation_type& impl, // If we are already in the strand then the handler can run immediately. if (call_stack<strand_impl>::contains(impl)) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); return; } @@ -73,19 +69,14 @@ void strand_service::dispatch(strand_service::implementation_type& impl, sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); - // If we are running inside the io_service, and no other handler is queued - // or running, then the handler can run immediately. - bool can_dispatch = call_stack<io_service_impl>::contains(&io_service_); - impl->mutex_.lock(); - bool first = (++impl->count_ == 1); - if (can_dispatch && first) - { - // Immediate invocation is allowed. - impl->mutex_.unlock(); + BOOST_ASIO_HANDLER_CREATION((p.p, "strand", impl, "dispatch")); - // Memory must be releaesed before any upcall is made. - p.reset(); + bool dispatch_immediately = do_dispatch(impl, p.p); + operation* o = p.p; + p.v = p.p = 0; + if (dispatch_immediately) + { // Indicate that this strand is executing on the current thread. call_stack<strand_impl>::context ctx(impl); @@ -93,20 +84,9 @@ void strand_service::dispatch(strand_service::implementation_type& impl, on_dispatch_exit on_exit = { &io_service_, impl }; (void)on_exit; - boost::asio::detail::fenced_block b; - boost_asio_handler_invoke_helpers::invoke(handler, handler); - return; + completion_handler<Handler>::do_complete( + &io_service_, o, boost::system::error_code(), 0); } - - // Immediate invocation is not allowed, so enqueue for later. - impl->queue_.push(p.p); - impl->mutex_.unlock(); - p.v = p.p = 0; - - // The first handler to be enqueued is responsible for scheduling the - // strand. - if (first) - io_service_.post_immediate_completion(impl); } // Request the io_service to invoke the given handler and return immediately. @@ -121,16 +101,10 @@ void strand_service::post(strand_service::implementation_type& impl, sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); - // Add the handler to the queue. - impl->mutex_.lock(); - bool first = (++impl->count_ == 1); - impl->queue_.push(p.p); - impl->mutex_.unlock(); - p.v = p.p = 0; + BOOST_ASIO_HANDLER_CREATION((p.p, "strand", impl, "post")); - // The first handler to be enqueue is responsible for scheduling the strand. - if (first) - io_service_.post_immediate_completion(impl); + do_post(impl, p.p); + p.v = p.p = 0; } } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.ipp index 6a42146..1912d80 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.ipp @@ -2,7 +2,7 @@ // detail/impl/strand_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -33,11 +33,12 @@ struct strand_service::on_do_complete_exit ~on_do_complete_exit() { impl_->mutex_.lock(); - bool more_handlers = (--impl_->count_ > 0); + impl_->ready_queue_.push(impl_->waiting_queue_); + bool more_handlers = impl_->locked_ = !impl_->ready_queue_.empty(); impl_->mutex_.unlock(); if (more_handlers) - owner_->post_immediate_completion(impl_); + owner_->post_private_immediate_completion(impl_); } }; @@ -56,38 +57,94 @@ void strand_service::shutdown_service() boost::asio::detail::mutex::scoped_lock lock(mutex_); for (std::size_t i = 0; i < num_implementations; ++i) + { if (strand_impl* impl = implementations_[i].get()) - ops.push(impl->queue_); + { + ops.push(impl->waiting_queue_); + ops.push(impl->ready_queue_); + } + } } void strand_service::construct(strand_service::implementation_type& impl) { + boost::asio::detail::mutex::scoped_lock lock(mutex_); + std::size_t salt = salt_++; +#if defined(BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION) + std::size_t index = salt; +#else // defined(BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION) std::size_t index = reinterpret_cast<std::size_t>(&impl); index += (reinterpret_cast<std::size_t>(&impl) >> 3); index ^= salt + 0x9e3779b9 + (index << 6) + (index >> 2); +#endif // defined(BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION) index = index % num_implementations; - boost::asio::detail::mutex::scoped_lock lock(mutex_); - - if (!implementations_[index]) + if (!implementations_[index].get()) implementations_[index].reset(new strand_impl); impl = implementations_[index].get(); } +bool strand_service::do_dispatch(implementation_type& impl, operation* op) +{ + // If we are running inside the io_service, and no other handler already + // holds the strand lock, then the handler can run immediately. + bool can_dispatch = io_service_.can_dispatch(); + impl->mutex_.lock(); + if (can_dispatch && !impl->locked_) + { + // Immediate invocation is allowed. + impl->locked_ = true; + impl->mutex_.unlock(); + return true; + } + + if (impl->locked_) + { + // Some other handler already holds the strand lock. Enqueue for later. + impl->waiting_queue_.push(op); + impl->mutex_.unlock(); + } + else + { + // The handler is acquiring the strand lock and so is responsible for + // scheduling the strand. + impl->locked_ = true; + impl->mutex_.unlock(); + impl->ready_queue_.push(op); + io_service_.post_immediate_completion(impl); + } + + return false; +} + +void strand_service::do_post(implementation_type& impl, operation* op) +{ + impl->mutex_.lock(); + if (impl->locked_) + { + // Some other handler already holds the strand lock. Enqueue for later. + impl->waiting_queue_.push(op); + impl->mutex_.unlock(); + } + else + { + // The handler is acquiring the strand lock and so is responsible for + // scheduling the strand. + impl->locked_ = true; + impl->mutex_.unlock(); + impl->ready_queue_.push(op); + io_service_.post_immediate_completion(impl); + } +} + void strand_service::do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& ec, std::size_t /*bytes_transferred*/) { if (owner) { strand_impl* impl = static_cast<strand_impl*>(base); - // Get the next handler to be executed. - impl->mutex_.lock(); - operation* o = impl->queue_.front(); - impl->queue_.pop(); - impl->mutex_.unlock(); - // Indicate that this strand is executing on the current thread. call_stack<strand_impl>::context ctx(impl); @@ -95,7 +152,13 @@ void strand_service::do_complete(io_service_impl* owner, operation* base, on_do_complete_exit on_exit = { owner, impl }; (void)on_exit; - o->complete(*owner); + // Run all ready handlers. No lock is required since the ready queue is + // accessed only within the strand. + while (operation* o = impl->ready_queue_.front()) + { + impl->ready_queue_.pop(); + o->complete(*owner, ec, 0); + } } } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.hpp index a002189..2cc7b7e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.hpp @@ -2,7 +2,7 @@ // detail/impl/task_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -15,7 +15,6 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/completion_handler.hpp> #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> @@ -30,13 +29,25 @@ namespace detail { template <typename Handler> void task_io_service::dispatch(Handler handler) { - if (call_stack<task_io_service>::contains(this)) + if (thread_call_stack::contains(this)) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); } else - post(handler); + { + // Allocate and construct an operation to wrap the handler. + typedef completion_handler<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch")); + + post_non_private_immediate_completion(p.p); + p.v = p.p = 0; + } } template <typename Handler> @@ -49,6 +60,8 @@ void task_io_service::post(Handler handler) sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "post")); + post_immediate_completion(p.p); p.v = p.p = 0; } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.ipp index babfa7b..674df63 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.ipp @@ -2,7 +2,7 @@ // detail/impl/task_io_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -20,7 +20,6 @@ #if !defined(BOOST_ASIO_HAS_IOCP) #include <boost/limits.hpp> -#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/event.hpp> #include <boost/asio/detail/reactor.hpp> #include <boost/asio/detail/task_io_service.hpp> @@ -31,41 +30,73 @@ namespace boost { namespace asio { namespace detail { +struct task_io_service::thread_info +{ + event* wakeup_event; + op_queue<operation> private_op_queue; + long private_outstanding_work; + thread_info* next; +}; + struct task_io_service::task_cleanup { ~task_cleanup() { + if (this_thread_->private_outstanding_work > 0) + { + boost::asio::detail::increment( + task_io_service_->outstanding_work_, + this_thread_->private_outstanding_work); + } + this_thread_->private_outstanding_work = 0; + // Enqueue the completed operations and reinsert the task at the end of // the operation queue. lock_->lock(); task_io_service_->task_interrupted_ = true; - task_io_service_->op_queue_.push(*ops_); + task_io_service_->op_queue_.push(this_thread_->private_op_queue); task_io_service_->op_queue_.push(&task_io_service_->task_operation_); } task_io_service* task_io_service_; mutex::scoped_lock* lock_; - op_queue<operation>* ops_; + thread_info* this_thread_; }; -struct task_io_service::work_finished_on_block_exit +struct task_io_service::work_cleanup { - ~work_finished_on_block_exit() + ~work_cleanup() { - task_io_service_->work_finished(); + if (this_thread_->private_outstanding_work > 1) + { + boost::asio::detail::increment( + task_io_service_->outstanding_work_, + this_thread_->private_outstanding_work - 1); + } + else if (this_thread_->private_outstanding_work < 1) + { + task_io_service_->work_finished(); + } + this_thread_->private_outstanding_work = 0; + +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (!this_thread_->private_op_queue.empty()) + { + lock_->lock(); + task_io_service_->op_queue_.push(this_thread_->private_op_queue); + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) } task_io_service* task_io_service_; + mutex::scoped_lock* lock_; + thread_info* this_thread_; }; -struct task_io_service::idle_thread_info -{ - event wakeup_event; - idle_thread_info* next; -}; - -task_io_service::task_io_service(boost::asio::io_service& io_service) +task_io_service::task_io_service( + boost::asio::io_service& io_service, std::size_t concurrency_hint) : boost::asio::detail::service_base<task_io_service>(io_service), + one_thread_(concurrency_hint == 1), mutex_(), task_(0), task_interrupted_(true), @@ -74,10 +105,7 @@ task_io_service::task_io_service(boost::asio::io_service& io_service) shutdown_(false), first_idle_thread_(0) { -} - -void task_io_service::init(std::size_t /*concurrency_hint*/) -{ + BOOST_ASIO_HANDLER_TRACKING_INIT; } void task_io_service::shutdown_service() @@ -119,15 +147,17 @@ std::size_t task_io_service::run(boost::system::error_code& ec) return 0; } - call_stack<task_io_service>::context ctx(this); - - idle_thread_info this_idle_thread; - this_idle_thread.next = 0; + thread_info this_thread; + event wakeup_event; + this_thread.wakeup_event = &wakeup_event; + this_thread.private_outstanding_work = 0; + this_thread.next = 0; + thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); std::size_t n = 0; - for (; do_one(lock, &this_idle_thread); lock.lock()) + for (; do_run_one(lock, this_thread, ec); lock.lock()) if (n != (std::numeric_limits<std::size_t>::max)()) ++n; return n; @@ -142,31 +172,46 @@ std::size_t task_io_service::run_one(boost::system::error_code& ec) return 0; } - call_stack<task_io_service>::context ctx(this); - - idle_thread_info this_idle_thread; - this_idle_thread.next = 0; + thread_info this_thread; + event wakeup_event; + this_thread.wakeup_event = &wakeup_event; + this_thread.private_outstanding_work = 0; + this_thread.next = 0; + thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); - return do_one(lock, &this_idle_thread); + return do_run_one(lock, this_thread, ec); } std::size_t task_io_service::poll(boost::system::error_code& ec) { + ec = boost::system::error_code(); if (outstanding_work_ == 0) { stop(); - ec = boost::system::error_code(); return 0; } - call_stack<task_io_service>::context ctx(this); + thread_info this_thread; + this_thread.wakeup_event = 0; + this_thread.private_outstanding_work = 0; + this_thread.next = 0; + thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + // We want to support nested calls to poll() and poll_one(), so any handlers + // that are already on a thread-private queue need to be put on to the main + // queue now. + if (one_thread_) + if (thread_info* outer_thread_info = ctx.next_by_key()) + op_queue_.push(outer_thread_info->private_op_queue); +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + std::size_t n = 0; - for (; do_one(lock, 0); lock.lock()) + for (; do_poll_one(lock, this_thread, ec); lock.lock()) if (n != (std::numeric_limits<std::size_t>::max)()) ++n; return n; @@ -181,11 +226,24 @@ std::size_t task_io_service::poll_one(boost::system::error_code& ec) return 0; } - call_stack<task_io_service>::context ctx(this); + thread_info this_thread; + this_thread.wakeup_event = 0; + this_thread.private_outstanding_work = 0; + this_thread.next = 0; + thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); - return do_one(lock, 0); +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + // We want to support nested calls to poll() and poll_one(), so any handlers + // that are already on a thread-private queue need to be put on to the main + // queue now. + if (one_thread_) + if (thread_info* outer_thread_info = ctx.next_by_key()) + op_queue_.push(outer_thread_info->private_op_queue); +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + + return do_poll_one(lock, this_thread, ec); } void task_io_service::stop() @@ -194,6 +252,12 @@ void task_io_service::stop() stop_all_threads(lock); } +bool task_io_service::stopped() const +{ + mutex::scoped_lock lock(mutex_); + return stopped_; +} + void task_io_service::reset() { mutex::scoped_lock lock(mutex_); @@ -202,12 +266,37 @@ void task_io_service::reset() void task_io_service::post_immediate_completion(task_io_service::operation* op) { +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (one_thread_) + { + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + ++this_thread->private_outstanding_work; + this_thread->private_op_queue.push(op); + return; + } + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + work_started(); - post_deferred_completion(op); + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); } void task_io_service::post_deferred_completion(task_io_service::operation* op) { +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (one_thread_) + { + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(op); + return; + } + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + mutex::scoped_lock lock(mutex_); op_queue_.push(op); wake_one_thread_and_unlock(lock); @@ -218,17 +307,72 @@ void task_io_service::post_deferred_completions( { if (!ops.empty()) { +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (one_thread_) + { + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(ops); + return; + } + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + mutex::scoped_lock lock(mutex_); op_queue_.push(ops); wake_one_thread_and_unlock(lock); } } -std::size_t task_io_service::do_one(mutex::scoped_lock& lock, - task_io_service::idle_thread_info* this_idle_thread) +void task_io_service::post_private_immediate_completion( + task_io_service::operation* op) +{ + work_started(); + post_private_deferred_completion(op); +} + +void task_io_service::post_private_deferred_completion( + task_io_service::operation* op) +{ +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(op); + return; + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + +void task_io_service::post_non_private_immediate_completion( + task_io_service::operation* op) +{ + work_started(); + post_non_private_deferred_completion(op); +} + +void task_io_service::post_non_private_deferred_completion( + task_io_service::operation* op) +{ + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + +void task_io_service::abandon_operations( + op_queue<task_io_service::operation>& ops) +{ + op_queue<task_io_service::operation> ops2; + ops2.push(ops); +} + +std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, + task_io_service::thread_info& this_thread, + const boost::system::error_code& ec) { - bool polling = !this_idle_thread; - bool task_has_run = false; while (!stopped_) { if (!op_queue_.empty()) @@ -240,61 +384,105 @@ std::size_t task_io_service::do_one(mutex::scoped_lock& lock, if (o == &task_operation_) { - task_interrupted_ = more_handlers || polling; + task_interrupted_ = more_handlers; - // If the task has already run and we're polling then we're done. - if (task_has_run && polling) + if (more_handlers && !one_thread_) { - task_interrupted_ = true; - op_queue_.push(&task_operation_); - return 0; + if (!wake_one_idle_thread_and_unlock(lock)) + lock.unlock(); } - task_has_run = true; - - if (!more_handlers || !wake_one_idle_thread_and_unlock(lock)) + else lock.unlock(); - op_queue<operation> completed_ops; - task_cleanup c = { this, &lock, &completed_ops }; - (void)c; + task_cleanup on_exit = { this, &lock, &this_thread }; + (void)on_exit; // Run the task. May throw an exception. Only block if the operation // queue is empty and we're not polling, otherwise we want to return // as soon as possible. - task_->run(!more_handlers && !polling, completed_ops); + task_->run(!more_handlers, this_thread.private_op_queue); } else { - if (more_handlers) + std::size_t task_result = o->task_result_; + + if (more_handlers && !one_thread_) wake_one_thread_and_unlock(lock); else lock.unlock(); // Ensure the count of outstanding work is decremented on block exit. - work_finished_on_block_exit on_exit = { this }; + work_cleanup on_exit = { this, &lock, &this_thread }; (void)on_exit; - // Complete the operation. May throw an exception. - o->complete(*this); // deletes the operation object + // Complete the operation. May throw an exception. Deletes the object. + o->complete(*this, ec, task_result); return 1; } } - else if (this_idle_thread) + else { // Nothing to run right now, so just wait for work to do. - this_idle_thread->next = first_idle_thread_; - first_idle_thread_ = this_idle_thread; - this_idle_thread->wakeup_event.clear(lock); - this_idle_thread->wakeup_event.wait(lock); + this_thread.next = first_idle_thread_; + first_idle_thread_ = &this_thread; + this_thread.wakeup_event->clear(lock); + this_thread.wakeup_event->wait(lock); } - else + } + + return 0; +} + +std::size_t task_io_service::do_poll_one(mutex::scoped_lock& lock, + task_io_service::thread_info& this_thread, + const boost::system::error_code& ec) +{ + if (stopped_) + return 0; + + operation* o = op_queue_.front(); + if (o == &task_operation_) + { + op_queue_.pop(); + lock.unlock(); + { - return 0; + task_cleanup c = { this, &lock, &this_thread }; + (void)c; + + // Run the task. May throw an exception. Only block if the operation + // queue is empty and we're not polling, otherwise we want to return + // as soon as possible. + task_->run(false, this_thread.private_op_queue); } + + o = op_queue_.front(); + if (o == &task_operation_) + return 0; } - return 0; + if (o == 0) + return 0; + + op_queue_.pop(); + bool more_handlers = (!op_queue_.empty()); + + std::size_t task_result = o->task_result_; + + if (more_handlers && !one_thread_) + wake_one_thread_and_unlock(lock); + else + lock.unlock(); + + // Ensure the count of outstanding work is decremented on block exit. + work_cleanup on_exit = { this, &lock, &this_thread }; + (void)on_exit; + + // Complete the operation. May throw an exception. Deletes the object. + o->complete(*this, ec, task_result); + + return 1; } void task_io_service::stop_all_threads( @@ -304,10 +492,10 @@ void task_io_service::stop_all_threads( while (first_idle_thread_) { - idle_thread_info* idle_thread = first_idle_thread_; + thread_info* idle_thread = first_idle_thread_; first_idle_thread_ = idle_thread->next; idle_thread->next = 0; - idle_thread->wakeup_event.signal(lock); + idle_thread->wakeup_event->signal(lock); } if (!task_interrupted_ && task_) @@ -322,10 +510,10 @@ bool task_io_service::wake_one_idle_thread_and_unlock( { if (first_idle_thread_) { - idle_thread_info* idle_thread = first_idle_thread_; + thread_info* idle_thread = first_idle_thread_; first_idle_thread_ = idle_thread->next; idle_thread->next = 0; - idle_thread->wakeup_event.signal_and_unlock(lock); + idle_thread->wakeup_event->signal_and_unlock(lock); return true; } return false; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/throw_error.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/throw_error.ipp index 5ba6b9c..dbe6112 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/throw_error.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/throw_error.ipp @@ -2,7 +2,7 @@ // detail/impl/throw_error.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_ptime.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_ptime.ipp new file mode 100644 index 0000000..c72d885 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_ptime.ipp @@ -0,0 +1,82 @@ +// +// detail/impl/timer_queue_ptime.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP +#define BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/timer_queue_ptime.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +timer_queue<time_traits<boost::posix_time::ptime> >::timer_queue() +{ +} + +timer_queue<time_traits<boost::posix_time::ptime> >::~timer_queue() +{ +} + +bool timer_queue<time_traits<boost::posix_time::ptime> >::enqueue_timer( + const time_type& time, per_timer_data& timer, wait_op* op) +{ + return impl_.enqueue_timer(time, timer, op); +} + +bool timer_queue<time_traits<boost::posix_time::ptime> >::empty() const +{ + return impl_.empty(); +} + +long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_msec( + long max_duration) const +{ + return impl_.wait_duration_msec(max_duration); +} + +long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_usec( + long max_duration) const +{ + return impl_.wait_duration_usec(max_duration); +} + +void timer_queue<time_traits<boost::posix_time::ptime> >::get_ready_timers( + op_queue<operation>& ops) +{ + impl_.get_ready_timers(ops); +} + +void timer_queue<time_traits<boost::posix_time::ptime> >::get_all_timers( + op_queue<operation>& ops) +{ + impl_.get_all_timers(ops); +} + +std::size_t timer_queue<time_traits<boost::posix_time::ptime> >::cancel_timer( + per_timer_data& timer, op_queue<operation>& ops, std::size_t max_cancelled) +{ + return impl_.cancel_timer(timer, ops, max_cancelled); +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_set.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_set.ipp index d1027e6..7f9a662 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_set.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_set.ipp @@ -2,7 +2,7 @@ // detail/impl/timer_queue_set.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_event.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_event.ipp index fe904fb..252242c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_event.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_event.ipp @@ -2,7 +2,7 @@ // detail/win_event.ipp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_handle_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_handle_service.ipp index eb6643a..ecd45c0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_handle_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_handle_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_handle_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -100,6 +100,64 @@ void win_iocp_handle_service::construct( impl_list_ = &impl; } +void win_iocp_handle_service::move_construct( + win_iocp_handle_service::implementation_type& impl, + win_iocp_handle_service::implementation_type& other_impl) +{ + impl.handle_ = other_impl.handle_; + other_impl.handle_ = INVALID_HANDLE_VALUE; + + impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; + other_impl.safe_cancellation_thread_id_ = 0; + + // Insert implementation into linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(mutex_); + impl.next_ = impl_list_; + impl.prev_ = 0; + if (impl_list_) + impl_list_->prev_ = &impl; + impl_list_ = &impl; +} + +void win_iocp_handle_service::move_assign( + win_iocp_handle_service::implementation_type& impl, + win_iocp_handle_service& other_service, + win_iocp_handle_service::implementation_type& other_impl) +{ + close_for_destruction(impl); + + if (this != &other_service) + { + // Remove implementation from linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(mutex_); + if (impl_list_ == &impl) + impl_list_ = impl.next_; + if (impl.prev_) + impl.prev_->next_ = impl.next_; + if (impl.next_) + impl.next_->prev_= impl.prev_; + impl.next_ = 0; + impl.prev_ = 0; + } + + impl.handle_ = other_impl.handle_; + other_impl.handle_ = INVALID_HANDLE_VALUE; + + impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; + other_impl.safe_cancellation_thread_id_ = 0; + + if (this != &other_service) + { + // Insert implementation into linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(other_service.mutex_); + impl.next_ = other_service.impl_list_; + impl.prev_ = 0; + if (other_service.impl_list_) + other_service.impl_list_->prev_ = &impl; + other_service.impl_list_ = &impl; + } +} + void win_iocp_handle_service::destroy( win_iocp_handle_service::implementation_type& impl) { @@ -119,7 +177,7 @@ void win_iocp_handle_service::destroy( boost::system::error_code win_iocp_handle_service::assign( win_iocp_handle_service::implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { if (is_open(impl)) { @@ -127,10 +185,10 @@ boost::system::error_code win_iocp_handle_service::assign( return ec; } - if (iocp_service_.register_handle(native_handle, ec)) + if (iocp_service_.register_handle(handle, ec)) return ec; - impl.handle_ = native_handle; + impl.handle_ = handle; ec = boost::system::error_code(); return ec; } @@ -141,19 +199,27 @@ boost::system::error_code win_iocp_handle_service::close( { if (is_open(impl)) { + BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "close")); + if (!::CloseHandle(impl.handle_)) { DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, boost::asio::error::get_system_category()); - return ec; + } + else + { + ec = boost::system::error_code(); } impl.handle_ = INVALID_HANDLE_VALUE; impl.safe_cancellation_thread_id_ = 0; } + else + { + ec = boost::system::error_code(); + } - ec = boost::system::error_code(); return ec; } @@ -164,8 +230,12 @@ boost::system::error_code win_iocp_handle_service::cancel( if (!is_open(impl)) { ec = boost::asio::error::bad_descriptor; + return ec; } - else if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( + + BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "cancel")); + + if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( ::GetModuleHandleA("KERNEL32"), "CancelIoEx")) { // The version of Windows supports cancellation from any thread. @@ -437,6 +507,8 @@ void win_iocp_handle_service::close_for_destruction(implementation_type& impl) { if (is_open(impl)) { + BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "close")); + ::CloseHandle(impl.handle_); impl.handle_ = INVALID_HANDLE_VALUE; impl.safe_cancellation_thread_id_ = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.hpp index 18b9413..871f6fa 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.hpp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,7 +19,6 @@ #if defined(BOOST_ASIO_HAS_IOCP) -#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/completion_handler.hpp> #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> @@ -36,11 +35,23 @@ void win_iocp_io_service::dispatch(Handler handler) { if (call_stack<win_iocp_io_service>::contains(this)) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); } else - post(handler); + { + // Allocate and construct an operation to wrap the handler. + typedef completion_handler<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch")); + + post_immediate_completion(p.p); + p.v = p.p = 0; + } } template <typename Handler> @@ -53,6 +64,8 @@ void win_iocp_io_service::post(Handler handler) sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "post")); + post_immediate_completion(p.p); p.v = p.p = 0; } @@ -74,7 +87,7 @@ void win_iocp_io_service::remove_timer_queue( template <typename Time_Traits> void win_iocp_io_service::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { // If the service has been shut down we silently discard the timer. if (::InterlockedExchangeAdd(&shutdown_, 0) != 0) @@ -93,7 +106,8 @@ void win_iocp_io_service::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t win_iocp_io_service::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { // If the service has been shut down we silently ignore the cancellation. if (::InterlockedExchangeAdd(&shutdown_, 0) != 0) @@ -101,7 +115,7 @@ std::size_t win_iocp_io_service::cancel_timer(timer_queue<Time_Traits>& queue, mutex::scoped_lock lock(dispatch_mutex_); op_queue<win_iocp_operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); post_deferred_completions(ops); return n; } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.ipp index 9711702..72f4af7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_io_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -62,7 +62,8 @@ struct win_iocp_io_service::timer_thread_function win_iocp_io_service* io_service_; }; -win_iocp_io_service::win_iocp_io_service(boost::asio::io_service& io_service) +win_iocp_io_service::win_iocp_io_service( + boost::asio::io_service& io_service, size_t concurrency_hint) : boost::asio::detail::service_base<win_iocp_io_service>(io_service), iocp_(), outstanding_work_(0), @@ -70,10 +71,8 @@ win_iocp_io_service::win_iocp_io_service(boost::asio::io_service& io_service) shutdown_(0), dispatch_required_(0) { -} + BOOST_ASIO_HANDLER_TRACKING_INIT; -void win_iocp_io_service::init(size_t concurrency_hint) -{ iocp_.handle = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, static_cast<DWORD>((std::min<size_t>)(concurrency_hint, DWORD(~0)))); if (!iocp_.handle) @@ -89,7 +88,7 @@ void win_iocp_io_service::shutdown_service() { ::InterlockedExchange(&shutdown_, 1); - if (timer_thread_) + if (timer_thread_.get()) { LARGE_INTEGER timeout; timeout.QuadPart = 1; @@ -125,7 +124,7 @@ void win_iocp_io_service::shutdown_service() } } - if (timer_thread_) + if (timer_thread_.get()) timer_thread_->join(); } @@ -149,7 +148,7 @@ size_t win_iocp_io_service::run(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - stop(); + InterlockedExchange(&stopped_, 1); ec = boost::system::error_code(); return 0; } @@ -167,7 +166,7 @@ size_t win_iocp_io_service::run_one(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - stop(); + InterlockedExchange(&stopped_, 1); ec = boost::system::error_code(); return 0; } @@ -181,7 +180,7 @@ size_t win_iocp_io_service::poll(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - stop(); + InterlockedExchange(&stopped_, 1); ec = boost::system::error_code(); return 0; } @@ -199,7 +198,7 @@ size_t win_iocp_io_service::poll_one(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - stop(); + InterlockedExchange(&stopped_, 1); ec = boost::system::error_code(); return 0; } @@ -262,6 +261,17 @@ void win_iocp_io_service::post_deferred_completions( } } +void win_iocp_io_service::abandon_operations( + op_queue<win_iocp_operation>& ops) +{ + while (win_iocp_operation* op = ops.front()) + { + ops.pop(); + ::InterlockedDecrement(&outstanding_work_); + op->destroy(); + } +} + void win_iocp_io_service::on_pending(win_iocp_operation* op) { if (::InterlockedCompareExchange(&op->ready_, 1, 0) == 1) @@ -455,7 +465,7 @@ void win_iocp_io_service::do_add_timer_queue(timer_queue_base& queue) &timeout, max_timeout_msec, 0, 0, FALSE); } - if (!timer_thread_) + if (!timer_thread_.get()) { timer_thread_function thread_function = { this }; timer_thread_.reset(new thread(thread_function, 65536)); @@ -471,7 +481,7 @@ void win_iocp_io_service::do_remove_timer_queue(timer_queue_base& queue) void win_iocp_io_service::update_timeout() { - if (timer_thread_) + if (timer_thread_.get()) { // There's no point updating the waitable timer if the new timeout period // exceeds the maximum timeout. In that case, we might as well wait for the diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_serial_port_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_serial_port_service.ipp index 32ab6d1..e98ad87 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_serial_port_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_serial_port_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_serial_port_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -127,7 +127,7 @@ boost::system::error_code win_iocp_serial_port_service::do_set_option( ::DCB dcb; memset(&dcb, 0, sizeof(DCB)); dcb.DCBlength = sizeof(DCB); - if (!::GetCommState(handle_service_.native(impl), &dcb)) + if (!::GetCommState(handle_service_.native_handle(impl), &dcb)) { DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, @@ -138,7 +138,7 @@ boost::system::error_code win_iocp_serial_port_service::do_set_option( if (store(option, dcb, ec)) return ec; - if (!::SetCommState(handle_service_.native(impl), &dcb)) + if (!::SetCommState(handle_service_.native_handle(impl), &dcb)) { DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, @@ -160,7 +160,7 @@ boost::system::error_code win_iocp_serial_port_service::do_get_option( ::DCB dcb; memset(&dcb, 0, sizeof(DCB)); dcb.DCBlength = sizeof(DCB); - if (!::GetCommState(handle_service_.native(impl), &dcb)) + if (!::GetCommState(handle_service_.native_handle(impl), &dcb)) { DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_socket_service_base.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_socket_service_base.ipp index 0a2825b..0466e33 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_socket_service_base.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_socket_service_base.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_socket_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -69,6 +69,80 @@ void win_iocp_socket_service_base::construct( impl_list_ = &impl; } +void win_iocp_socket_service_base::base_move_construct( + win_iocp_socket_service_base::base_implementation_type& impl, + win_iocp_socket_service_base::base_implementation_type& other_impl) +{ + impl.socket_ = other_impl.socket_; + other_impl.socket_ = invalid_socket; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + impl.cancel_token_ = other_impl.cancel_token_; + other_impl.cancel_token_.reset(); + +#if defined(BOOST_ASIO_ENABLE_CANCELIO) + impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; + other_impl.safe_cancellation_thread_id_ = 0; +#endif // defined(BOOST_ASIO_ENABLE_CANCELIO) + + // Insert implementation into linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(mutex_); + impl.next_ = impl_list_; + impl.prev_ = 0; + if (impl_list_) + impl_list_->prev_ = &impl; + impl_list_ = &impl; +} + +void win_iocp_socket_service_base::base_move_assign( + win_iocp_socket_service_base::base_implementation_type& impl, + win_iocp_socket_service_base& other_service, + win_iocp_socket_service_base::base_implementation_type& other_impl) +{ + close_for_destruction(impl); + + if (this != &other_service) + { + // Remove implementation from linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(mutex_); + if (impl_list_ == &impl) + impl_list_ = impl.next_; + if (impl.prev_) + impl.prev_->next_ = impl.next_; + if (impl.next_) + impl.next_->prev_= impl.prev_; + impl.next_ = 0; + impl.prev_ = 0; + } + + impl.socket_ = other_impl.socket_; + other_impl.socket_ = invalid_socket; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + impl.cancel_token_ = other_impl.cancel_token_; + other_impl.cancel_token_.reset(); + +#if defined(BOOST_ASIO_ENABLE_CANCELIO) + impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; + other_impl.safe_cancellation_thread_id_ = 0; +#endif // defined(BOOST_ASIO_ENABLE_CANCELIO) + + if (this != &other_service) + { + // Insert implementation into linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(other_service.mutex_); + impl.next_ = other_service.impl_list_; + impl.prev_ = 0; + if (other_service.impl_list_) + other_service.impl_list_->prev_ = &impl; + other_service.impl_list_ = &impl; + } +} + void win_iocp_socket_service_base::destroy( win_iocp_socket_service_base::base_implementation_type& impl) { @@ -92,6 +166,8 @@ boost::system::error_code win_iocp_socket_service_base::close( { if (is_open(impl)) { + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close")); + // Check if the reactor was created, in which case we need to close the // socket on the reactor as well to cancel any operations that might be // running there. @@ -99,18 +175,17 @@ boost::system::error_code win_iocp_socket_service_base::close( interlocked_compare_exchange_pointer( reinterpret_cast<void**>(&reactor_), 0, 0)); if (r) - r->close_descriptor(impl.socket_, impl.reactor_data_); + r->deregister_descriptor(impl.socket_, impl.reactor_data_, true); } - if (socket_ops::close(impl.socket_, impl.state_, false, ec) == 0) - { - impl.socket_ = invalid_socket; - impl.state_ = 0; - impl.cancel_token_.reset(); + socket_ops::close(impl.socket_, impl.state_, false, ec); + + impl.socket_ = invalid_socket; + impl.state_ = 0; + impl.cancel_token_.reset(); #if defined(BOOST_ASIO_ENABLE_CANCELIO) - impl.safe_cancellation_thread_id_ = 0; + impl.safe_cancellation_thread_id_ = 0; #endif // defined(BOOST_ASIO_ENABLE_CANCELIO) - } return ec; } @@ -124,7 +199,10 @@ boost::system::error_code win_iocp_socket_service_base::cancel( ec = boost::asio::error::bad_descriptor; return ec; } - else if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( + + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "cancel")); + + if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( ::GetModuleHandleA("KERNEL32"), "CancelIoEx")) { // The version of Windows supports cancellation from any thread. @@ -474,7 +552,7 @@ void win_iocp_socket_service_base::start_connect_op( if ((impl.state_ & socket_ops::non_blocking) != 0 || socket_ops::set_internal_non_blocking( - impl.socket_, impl.state_, op->ec_)) + impl.socket_, impl.state_, true, op->ec_)) { if (socket_ops::connect(impl.socket_, addr, addrlen, op->ec_) != 0) { @@ -497,6 +575,8 @@ void win_iocp_socket_service_base::close_for_destruction( { if (is_open(impl)) { + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close")); + // Check if the reactor was created, in which case we need to close the // socket on the reactor as well to cancel any operations that might be // running there. @@ -504,7 +584,7 @@ void win_iocp_socket_service_base::close_for_destruction( interlocked_compare_exchange_pointer( reinterpret_cast<void**>(&reactor_), 0, 0)); if (r) - r->close_descriptor(impl.socket_, impl.reactor_data_); + r->deregister_descriptor(impl.socket_, impl.reactor_data_, true); } boost::system::error_code ignored_ec; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_mutex.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_mutex.ipp index af0d20e..05a7492 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_mutex.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_mutex.ipp @@ -2,7 +2,7 @@ // detail/impl/win_mutex.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_object_handle_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_object_handle_service.ipp new file mode 100644 index 0000000..d91ccac --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_object_handle_service.ipp @@ -0,0 +1,446 @@ +// +// detail/impl/win_object_handle_service.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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 BOOST_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP +#define BOOST_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +#include <boost/asio/detail/win_object_handle_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +win_object_handle_service::win_object_handle_service( + boost::asio::io_service& io_service) + : io_service_(boost::asio::use_service<io_service_impl>(io_service)), + mutex_(), + impl_list_(0), + shutdown_(false) +{ +} + +void win_object_handle_service::shutdown_service() +{ + mutex::scoped_lock lock(mutex_); + + // Setting this flag to true prevents new objects from being registered, and + // new asynchronous wait operations from being started. We only need to worry + // about cleaning up the operations that are currently in progress. + shutdown_ = true; + + op_queue<operation> ops; + for (implementation_type* impl = impl_list_; impl; impl = impl->next_) + ops.push(impl->op_queue_); + + lock.unlock(); + + io_service_.abandon_operations(ops); +} + +void win_object_handle_service::construct( + win_object_handle_service::implementation_type& impl) +{ + impl.handle_ = INVALID_HANDLE_VALUE; + impl.wait_handle_ = INVALID_HANDLE_VALUE; + impl.owner_ = this; + + // Insert implementation into linked list of all implementations. + mutex::scoped_lock lock(mutex_); + if (!shutdown_) + { + impl.next_ = impl_list_; + impl.prev_ = 0; + if (impl_list_) + impl_list_->prev_ = &impl; + impl_list_ = &impl; + } +} + +void win_object_handle_service::move_construct( + win_object_handle_service::implementation_type& impl, + win_object_handle_service::implementation_type& other_impl) +{ + mutex::scoped_lock lock(mutex_); + + // Insert implementation into linked list of all implementations. + if (!shutdown_) + { + impl.next_ = impl_list_; + impl.prev_ = 0; + if (impl_list_) + impl_list_->prev_ = &impl; + impl_list_ = &impl; + } + + impl.handle_ = other_impl.handle_; + other_impl.handle_ = INVALID_HANDLE_VALUE; + impl.wait_handle_ = other_impl.wait_handle_; + other_impl.wait_handle_ = INVALID_HANDLE_VALUE; + impl.op_queue_.push(other_impl.op_queue_); + impl.owner_ = this; + + // We must not hold the lock while calling UnregisterWaitEx. This is because + // the registered callback function might be invoked while we are waiting for + // UnregisterWaitEx to complete. + lock.unlock(); + + if (impl.wait_handle_ != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(impl.wait_handle_, INVALID_HANDLE_VALUE); + + if (!impl.op_queue_.empty()) + register_wait_callback(impl, lock); +} + +void win_object_handle_service::move_assign( + win_object_handle_service::implementation_type& impl, + win_object_handle_service& other_service, + win_object_handle_service::implementation_type& other_impl) +{ + boost::system::error_code ignored_ec; + close(impl, ignored_ec); + + mutex::scoped_lock lock(mutex_); + + if (this != &other_service) + { + // Remove implementation from linked list of all implementations. + if (impl_list_ == &impl) + impl_list_ = impl.next_; + if (impl.prev_) + impl.prev_->next_ = impl.next_; + if (impl.next_) + impl.next_->prev_= impl.prev_; + impl.next_ = 0; + impl.prev_ = 0; + } + + impl.handle_ = other_impl.handle_; + other_impl.handle_ = INVALID_HANDLE_VALUE; + impl.wait_handle_ = other_impl.wait_handle_; + other_impl.wait_handle_ = INVALID_HANDLE_VALUE; + impl.op_queue_.push(other_impl.op_queue_); + impl.owner_ = this; + + if (this != &other_service) + { + // Insert implementation into linked list of all implementations. + impl.next_ = other_service.impl_list_; + impl.prev_ = 0; + if (other_service.impl_list_) + other_service.impl_list_->prev_ = &impl; + other_service.impl_list_ = &impl; + } + + // We must not hold the lock while calling UnregisterWaitEx. This is because + // the registered callback function might be invoked while we are waiting for + // UnregisterWaitEx to complete. + lock.unlock(); + + if (impl.wait_handle_ != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(impl.wait_handle_, INVALID_HANDLE_VALUE); + + if (!impl.op_queue_.empty()) + register_wait_callback(impl, lock); +} + +void win_object_handle_service::destroy( + win_object_handle_service::implementation_type& impl) +{ + mutex::scoped_lock lock(mutex_); + + // Remove implementation from linked list of all implementations. + if (impl_list_ == &impl) + impl_list_ = impl.next_; + if (impl.prev_) + impl.prev_->next_ = impl.next_; + if (impl.next_) + impl.next_->prev_= impl.prev_; + impl.next_ = 0; + impl.prev_ = 0; + + if (is_open(impl)) + { + BOOST_ASIO_HANDLER_OPERATION(("object_handle", &impl, "close")); + + HANDLE wait_handle = impl.wait_handle_; + impl.wait_handle_ = INVALID_HANDLE_VALUE; + + op_queue<operation> ops; + while (wait_op* op = impl.op_queue_.front()) + { + op->ec_ = boost::asio::error::operation_aborted; + impl.op_queue_.pop(); + ops.push(op); + } + + // We must not hold the lock while calling UnregisterWaitEx. This is + // because the registered callback function might be invoked while we are + // waiting for UnregisterWaitEx to complete. + lock.unlock(); + + if (wait_handle != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); + + ::CloseHandle(impl.handle_); + impl.handle_ = INVALID_HANDLE_VALUE; + + io_service_.post_deferred_completions(ops); + } +} + +boost::system::error_code win_object_handle_service::assign( + win_object_handle_service::implementation_type& impl, + const native_handle_type& handle, boost::system::error_code& ec) +{ + if (is_open(impl)) + { + ec = boost::asio::error::already_open; + return ec; + } + + impl.handle_ = handle; + ec = boost::system::error_code(); + return ec; +} + +boost::system::error_code win_object_handle_service::close( + win_object_handle_service::implementation_type& impl, + boost::system::error_code& ec) +{ + if (is_open(impl)) + { + BOOST_ASIO_HANDLER_OPERATION(("object_handle", &impl, "close")); + + mutex::scoped_lock lock(mutex_); + + HANDLE wait_handle = impl.wait_handle_; + impl.wait_handle_ = INVALID_HANDLE_VALUE; + + op_queue<operation> completed_ops; + while (wait_op* op = impl.op_queue_.front()) + { + impl.op_queue_.pop(); + op->ec_ = boost::asio::error::operation_aborted; + completed_ops.push(op); + } + + // We must not hold the lock while calling UnregisterWaitEx. This is + // because the registered callback function might be invoked while we are + // waiting for UnregisterWaitEx to complete. + lock.unlock(); + + if (wait_handle != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); + + if (::CloseHandle(impl.handle_)) + { + impl.handle_ = INVALID_HANDLE_VALUE; + ec = boost::system::error_code(); + } + else + { + DWORD last_error = ::GetLastError(); + ec = boost::system::error_code(last_error, + boost::asio::error::get_system_category()); + } + + io_service_.post_deferred_completions(completed_ops); + } + else + { + ec = boost::system::error_code(); + } + + return ec; +} + +boost::system::error_code win_object_handle_service::cancel( + win_object_handle_service::implementation_type& impl, + boost::system::error_code& ec) +{ + if (is_open(impl)) + { + BOOST_ASIO_HANDLER_OPERATION(("object_handle", &impl, "cancel")); + + mutex::scoped_lock lock(mutex_); + + HANDLE wait_handle = impl.wait_handle_; + impl.wait_handle_ = INVALID_HANDLE_VALUE; + + op_queue<operation> completed_ops; + while (wait_op* op = impl.op_queue_.front()) + { + op->ec_ = boost::asio::error::operation_aborted; + impl.op_queue_.pop(); + completed_ops.push(op); + } + + // We must not hold the lock while calling UnregisterWaitEx. This is + // because the registered callback function might be invoked while we are + // waiting for UnregisterWaitEx to complete. + lock.unlock(); + + if (wait_handle != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); + + ec = boost::system::error_code(); + + io_service_.post_deferred_completions(completed_ops); + } + else + { + ec = boost::asio::error::bad_descriptor; + } + + return ec; +} + +void win_object_handle_service::wait( + win_object_handle_service::implementation_type& impl, + boost::system::error_code& ec) +{ + switch (::WaitForSingleObject(impl.handle_, INFINITE)) + { + case WAIT_FAILED: + { + DWORD last_error = ::GetLastError(); + ec = boost::system::error_code(last_error, + boost::asio::error::get_system_category()); + break; + } + case WAIT_OBJECT_0: + case WAIT_ABANDONED: + default: + ec = boost::system::error_code(); + break; + } +} + +void win_object_handle_service::start_wait_op( + win_object_handle_service::implementation_type& impl, wait_op* op) +{ + io_service_.work_started(); + + if (is_open(impl)) + { + mutex::scoped_lock lock(mutex_); + + if (!shutdown_) + { + impl.op_queue_.push(op); + + // Only the first operation to be queued gets to register a wait callback. + // Subsequent operations have to wait for the first to finish. + if (impl.op_queue_.front() == op) + register_wait_callback(impl, lock); + } + else + { + lock.unlock(); + io_service_.post_deferred_completion(op); + } + } + else + { + op->ec_ = boost::asio::error::bad_descriptor; + io_service_.post_deferred_completion(op); + } +} + +void win_object_handle_service::register_wait_callback( + win_object_handle_service::implementation_type& impl, + mutex::scoped_lock& lock) +{ + lock.lock(); + + if (!RegisterWaitForSingleObject(&impl.wait_handle_, + impl.handle_, &win_object_handle_service::wait_callback, + &impl, INFINITE, WT_EXECUTEONLYONCE)) + { + DWORD last_error = ::GetLastError(); + boost::system::error_code ec(last_error, + boost::asio::error::get_system_category()); + + op_queue<operation> completed_ops; + while (wait_op* op = impl.op_queue_.front()) + { + op->ec_ = ec; + impl.op_queue_.pop(); + completed_ops.push(op); + } + + lock.unlock(); + io_service_.post_deferred_completions(completed_ops); + } +} + +void win_object_handle_service::wait_callback(PVOID param, BOOLEAN) +{ + implementation_type* impl = static_cast<implementation_type*>(param); + mutex::scoped_lock lock(impl->owner_->mutex_); + + if (impl->wait_handle_ != INVALID_HANDLE_VALUE) + { + ::UnregisterWaitEx(impl->wait_handle_, NULL); + impl->wait_handle_ = INVALID_HANDLE_VALUE; + } + + if (wait_op* op = impl->op_queue_.front()) + { + op_queue<operation> completed_ops; + + op->ec_ = boost::system::error_code(); + impl->op_queue_.pop(); + completed_ops.push(op); + + if (!impl->op_queue_.empty()) + { + if (!RegisterWaitForSingleObject(&impl->wait_handle_, + impl->handle_, &win_object_handle_service::wait_callback, + param, INFINITE, WT_EXECUTEONLYONCE)) + { + DWORD last_error = ::GetLastError(); + boost::system::error_code ec(last_error, + boost::asio::error::get_system_category()); + + while (wait_op* op = impl->op_queue_.front()) + { + op->ec_ = ec; + impl->op_queue_.pop(); + completed_ops.push(op); + } + } + } + + lock.unlock(); + impl->owner_->io_service_.post_deferred_completions(completed_ops); + } +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +#endif // BOOST_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_static_mutex.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_static_mutex.ipp new file mode 100644 index 0000000..3ec104d --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_static_mutex.ipp @@ -0,0 +1,120 @@ +// +// detail/impl/win_static_mutex.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP +#define BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_WINDOWS) + +#include <cstdio> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/detail/win_static_mutex.hpp> +#include <boost/asio/error.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +void win_static_mutex::init() +{ + int error = do_init(); + boost::system::error_code ec(error, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "static_mutex"); +} + +int win_static_mutex::do_init() +{ + using namespace std; // For sprintf. + wchar_t mutex_name[128]; +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + swprintf_s(mutex_name, 128, +#else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + swprintf(mutex_name, +#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p", + static_cast<unsigned int>(::GetCurrentProcessId()), this); + + HANDLE mutex = ::CreateMutexW(0, TRUE, mutex_name); + DWORD last_error = ::GetLastError(); + if (mutex == 0) + return ::GetLastError(); + + if (last_error == ERROR_ALREADY_EXISTS) + ::WaitForSingleObject(mutex, INFINITE); + + if (initialised_) + { + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return 0; + } + +#if defined(__MINGW32__) + // Not sure if MinGW supports structured exception handling, so for now + // we'll just call the Windows API and hope. +# if defined(UNDER_CE) + ::InitializeCriticalSection(&crit_section_); +# else + if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) + { + last_error = ::GetLastError(); + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return last_error; + } +# endif +#else + __try + { +# if defined(UNDER_CE) + ::InitializeCriticalSection(&crit_section_); +# else + if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) + { + last_error = ::GetLastError(); + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return last_error; + } +# endif + } + __except(GetExceptionCode() == STATUS_NO_MEMORY + ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) + { + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return ERROR_OUTOFMEMORY; + } +#endif + + initialised_ = true; + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return 0; +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_WINDOWS) + +#endif // BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_thread.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_thread.ipp index 07cc5c2..744990d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_thread.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_thread.ipp @@ -2,7 +2,7 @@ // detail/impl/win_thread.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -102,12 +102,12 @@ void win_thread::start_thread(func_base* arg, unsigned int stack_size) unsigned int __stdcall win_thread_function(void* arg) { - std::auto_ptr<win_thread::func_base> func( - static_cast<win_thread::func_base*>(arg)); + win_thread::auto_func_base_ptr func = { + static_cast<win_thread::func_base*>(arg) }; - ::SetEvent(func->entry_event_); + ::SetEvent(func.ptr->entry_event_); - func->run(); + func.ptr->run(); // Signal that the thread has finished its work, but rather than returning go // to sleep to put the thread into a well known state. If the thread is being @@ -115,8 +115,9 @@ unsigned int __stdcall win_thread_function(void* arg) // TerminateThread (to avoid a deadlock in DllMain). Otherwise, the SleepEx // call will be interrupted using QueueUserAPC and the thread will shut down // cleanly. - HANDLE exit_event = func->exit_event_; - func.reset(); + HANDLE exit_event = func.ptr->exit_event_; + delete func.ptr; + func.ptr = 0; ::SetEvent(exit_event); ::SleepEx(INFINITE, TRUE); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_tss_ptr.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_tss_ptr.ipp index 02abd55..9da761c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_tss_ptr.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_tss_ptr.ipp @@ -2,7 +2,7 @@ // detail/impl/win_tss_ptr.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/winsock_init.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/winsock_init.ipp index e8fd647..8916934 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/winsock_init.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/winsock_init.ipp @@ -2,7 +2,7 @@ // detail/impl/winsock_init.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/io_control.hpp b/3rdParty/Boost/src/boost/asio/detail/io_control.hpp index c63e6e5..e08a4fc 100644 --- a/3rdParty/Boost/src/boost/asio/detail/io_control.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/io_control.hpp @@ -2,7 +2,7 @@ // detail/io_control.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -46,7 +46,7 @@ public: // Get the name of the IO control command. int name() const { - return FIONBIO; + return static_cast<int>(FIONBIO); } // Set the value of the I/O control command. @@ -96,7 +96,7 @@ public: // Get the name of the IO control command. int name() const { - return FIONREAD; + return static_cast<int>(FIONREAD); } // Set the value of the I/O control command. diff --git a/3rdParty/Boost/src/boost/asio/detail/keyword_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/keyword_tss_ptr.hpp new file mode 100644 index 0000000..10dd01a --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/keyword_tss_ptr.hpp @@ -0,0 +1,72 @@ +// +// detail/keyword_tss_ptr.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP +#define BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#include <boost/asio/detail/noncopyable.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename T> +class keyword_tss_ptr + : private noncopyable +{ +public: + // Constructor. + keyword_tss_ptr() + { + } + + // Destructor. + ~keyword_tss_ptr() + { + } + + // Get the value. + operator T*() const + { + return value_; + } + + // Set the value. + void operator=(T* value) + { + value_ = value; + } + +private: + static __thread T* value_; +}; + +template <typename T> +__thread T* keyword_tss_ptr<T>::value_; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#endif // BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp index 80f7ca3..b3e111d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp @@ -2,7 +2,7 @@ // detail/kqueue_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -20,6 +20,7 @@ #if defined(BOOST_ASIO_HAS_KQUEUE) +#include <boost/limits.hpp> #include <cstddef> #include <sys/types.h> #include <sys/event.h> @@ -31,10 +32,10 @@ #include <boost/asio/detail/reactor_op.hpp> #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/error.hpp> #include <boost/asio/io_service.hpp> @@ -61,11 +62,14 @@ public: { friend class kqueue_reactor; friend class object_pool_access; + + descriptor_state* next_; + descriptor_state* prev_; + mutex mutex_; + int descriptor_; op_queue<reactor_op> op_queue_[max_ops]; bool shutdown_; - descriptor_state* next_; - descriptor_state* prev_; }; // Per-descriptor data. @@ -80,6 +84,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task. BOOST_ASIO_DECL void init_task(); @@ -88,6 +96,17 @@ public: BOOST_ASIO_DECL int register_descriptor(socket_type descriptor, per_descriptor_data& descriptor_data); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -108,8 +127,12 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor(socket_type descriptor, - per_descriptor_data& descriptor_data); + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data& descriptor_data, bool closing); + + // Remote the descriptor's registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( + socket_type descriptor, per_descriptor_data& descriptor_data); // Add a new timer queue to the reactor. template <typename Time_Traits> @@ -124,13 +147,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run the kqueue loop. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -143,6 +167,12 @@ private: // cannot be created. BOOST_ASIO_DECL static int do_kqueue_create(); + // Allocate a new descriptor state object. + BOOST_ASIO_DECL descriptor_state* allocate_descriptor_state(); + + // Free an existing descriptor state object. + BOOST_ASIO_DECL void free_descriptor_state(descriptor_state* s); + // Helper function to add a new timer queue. BOOST_ASIO_DECL void do_add_timer_queue(timer_queue_base& queue); diff --git a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp index 1bceb30..517a307 100644 --- a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/kqueue_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3rdParty/Boost/src/boost/asio/detail/macos_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/macos_fenced_block.hpp index d37eea6..dc3b47d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/macos_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/macos_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/macos_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -31,8 +31,16 @@ class macos_fenced_block : private noncopyable { public: - // Constructor. - macos_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit macos_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit macos_fenced_block(full_t) { OSMemoryBarrier(); } diff --git a/3rdParty/Boost/src/boost/asio/detail/mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/mutex.hpp index 988dd3a..bd3e0c6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/mutex.hpp @@ -2,7 +2,7 @@ // detail/mutex.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp b/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp index 234ce93..5f7e8cc 100644 --- a/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp @@ -2,7 +2,7 @@ // detail/noncopyable.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_event.hpp b/3rdParty/Boost/src/boost/asio/detail/null_event.hpp index 7f079ae..1130d18 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_event.hpp @@ -2,7 +2,7 @@ // detail/null_event.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/null_fenced_block.hpp index 70680c5..64bedec 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/null_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -25,8 +25,10 @@ class null_fenced_block : private noncopyable { public: + enum half_or_full_t { half, full }; + // Constructor. - null_fenced_block() + explicit null_fenced_block(half_or_full_t) { } diff --git a/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp index e095e01..5d810bb 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp @@ -2,7 +2,7 @@ // detail/null_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp index bcf813b..5eeb293 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/null_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_static_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/null_static_mutex.hpp new file mode 100644 index 0000000..3032896 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/null_static_mutex.hpp @@ -0,0 +1,62 @@ +// +// detail/null_static_mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP +#define BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) + +#include <boost/asio/detail/scoped_lock.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct null_static_mutex +{ + typedef boost::asio::detail::scoped_lock<null_static_mutex> scoped_lock; + + // Initialise the mutex. + void init() + { + } + + // Lock the mutex. + void lock() + { + } + + // Unlock the mutex. + void unlock() + { + } + + int unused_; +}; + +#define BOOST_ASIO_NULL_STATIC_MUTEX_INIT { 0 } + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) + +#endif // BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp index ae32014..0212dbe 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp @@ -2,7 +2,7 @@ // detail/null_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp index c44b4de..07be3e6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/null_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/object_pool.hpp b/3rdParty/Boost/src/boost/asio/detail/object_pool.hpp index 69790a0..d315236 100644 --- a/3rdParty/Boost/src/boost/asio/detail/object_pool.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/object_pool.hpp @@ -2,7 +2,7 @@ // detail/object_pool.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp b/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp index d385d3e..fcc27cf 100644 --- a/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp @@ -2,7 +2,7 @@ // detail/old_win_sdk_compat.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -85,14 +85,6 @@ struct ipv6_mreq_emulation unsigned int ipv6mr_interface; }; -#if !defined(IN6ADDR_ANY_INIT) -# define IN6ADDR_ANY_INIT { 0 } -#endif - -#if !defined(IN6ADDR_LOOPBACK_INIT) -# define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } -#endif - struct addrinfo_emulation { int ai_flags; @@ -201,122 +193,6 @@ struct addrinfo_emulation # define IPV6_LEAVE_GROUP 13 #endif -inline int IN6_IS_ADDR_UNSPECIFIED(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0) - && (a->s6_addr[1] == 0) - && (a->s6_addr[2] == 0) - && (a->s6_addr[3] == 0) - && (a->s6_addr[4] == 0) - && (a->s6_addr[5] == 0) - && (a->s6_addr[6] == 0) - && (a->s6_addr[7] == 0) - && (a->s6_addr[8] == 0) - && (a->s6_addr[9] == 0) - && (a->s6_addr[10] == 0) - && (a->s6_addr[11] == 0) - && (a->s6_addr[12] == 0) - && (a->s6_addr[13] == 0) - && (a->s6_addr[14] == 0) - && (a->s6_addr[15] == 0)); -} - -inline int IN6_IS_ADDR_LOOPBACK(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0) - && (a->s6_addr[1] == 0) - && (a->s6_addr[2] == 0) - && (a->s6_addr[3] == 0) - && (a->s6_addr[4] == 0) - && (a->s6_addr[5] == 0) - && (a->s6_addr[6] == 0) - && (a->s6_addr[7] == 0) - && (a->s6_addr[8] == 0) - && (a->s6_addr[9] == 0) - && (a->s6_addr[10] == 0) - && (a->s6_addr[11] == 0) - && (a->s6_addr[12] == 0) - && (a->s6_addr[13] == 0) - && (a->s6_addr[14] == 0) - && (a->s6_addr[15] == 1)); -} - -inline int IN6_IS_ADDR_MULTICAST(const in6_addr_emulation* a) -{ - return (a->s6_addr[0] == 0xff); -} - -inline int IN6_IS_ADDR_LINKLOCAL(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0xfe) && ((a->s6_addr[1] & 0xc0) == 0x80)); -} - -inline int IN6_IS_ADDR_SITELOCAL(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0xfe) && ((a->s6_addr[1] & 0xc0) == 0xc0)); -} - -inline int IN6_IS_ADDR_V4MAPPED(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0) - && (a->s6_addr[1] == 0) - && (a->s6_addr[2] == 0) - && (a->s6_addr[3] == 0) - && (a->s6_addr[4] == 0) - && (a->s6_addr[5] == 0) - && (a->s6_addr[6] == 0) - && (a->s6_addr[7] == 0) - && (a->s6_addr[8] == 0) - && (a->s6_addr[9] == 0) - && (a->s6_addr[10] == 0xff) - && (a->s6_addr[11] == 0xff)); -} - -inline int IN6_IS_ADDR_V4COMPAT(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0) - && (a->s6_addr[1] == 0) - && (a->s6_addr[2] == 0) - && (a->s6_addr[3] == 0) - && (a->s6_addr[4] == 0) - && (a->s6_addr[5] == 0) - && (a->s6_addr[6] == 0) - && (a->s6_addr[7] == 0) - && (a->s6_addr[8] == 0) - && (a->s6_addr[9] == 0) - && (a->s6_addr[10] == 0xff) - && (a->s6_addr[11] == 0xff) - && !((a->s6_addr[12] == 0) - && (a->s6_addr[13] == 0) - && (a->s6_addr[14] == 0) - && ((a->s6_addr[15] == 0) || (a->s6_addr[15] == 1)))); -} - -inline int IN6_IS_ADDR_MC_NODELOCAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 1); -} - -inline int IN6_IS_ADDR_MC_LINKLOCAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 2); -} - -inline int IN6_IS_ADDR_MC_SITELOCAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 5); -} - -inline int IN6_IS_ADDR_MC_ORGLOCAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 8); -} - -inline int IN6_IS_ADDR_MC_GLOBAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 0xe); -} - } // namespace detail } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/detail/op_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/op_queue.hpp index d508e9d..ad61910 100644 --- a/3rdParty/Boost/src/boost/asio/detail/op_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/op_queue.hpp @@ -2,7 +2,7 @@ // detail/op_queue.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/operation.hpp b/3rdParty/Boost/src/boost/asio/detail/operation.hpp index d2015e7..99371a9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/operation.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/operation.hpp @@ -2,7 +2,7 @@ // detail/operation.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp index ad32736..0aee2a2 100644 --- a/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/pipe_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -37,6 +37,9 @@ public: // Destructor. BOOST_ASIO_DECL ~pipe_select_interrupter(); + // Recreate the interrupter's descriptors. Used after a fork. + BOOST_ASIO_DECL void recreate(); + // Interrupt the select call. BOOST_ASIO_DECL void interrupt(); @@ -50,6 +53,12 @@ public: } private: + // Open the descriptors. Throws on error. + BOOST_ASIO_DECL void open_descriptors(); + + // Close the descriptors. + BOOST_ASIO_DECL void close_descriptors(); + // The read end of a connection used to interrupt the select call. This file // descriptor is passed to select such that when it is time to stop, a single // byte will be written on the other end of the connection and this diff --git a/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp b/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp index 75afc2b..6e78ddf 100644 --- a/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp @@ -2,7 +2,7 @@ // detail/pop_options.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp index dc2ed31..b77f384 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp @@ -2,7 +2,7 @@ // detail/posix_event.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp index b8be596..f6476e6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/posix_fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -20,6 +20,7 @@ #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) #include <cstring> +#include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/push_options.hpp> @@ -29,7 +30,7 @@ namespace asio { namespace detail { // Adapts the FD_SET type to meet the Descriptor_Set concept's requirements. -class posix_fd_set_adapter +class posix_fd_set_adapter : noncopyable { public: posix_fd_set_adapter() @@ -39,6 +40,12 @@ public: FD_ZERO(&fd_set_); } + void reset() + { + using namespace std; // Needed for memset on Solaris. + FD_ZERO(&fd_set_); + } + bool set(socket_type descriptor) { if (descriptor < (socket_type)FD_SETSIZE) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp index 5f5fd83..a456c2a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp @@ -2,7 +2,7 @@ // detail/posix_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp index 88fa330..0347778 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/posix_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_static_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_static_mutex.hpp new file mode 100644 index 0000000..a27d9d8 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/posix_static_mutex.hpp @@ -0,0 +1,66 @@ +// +// detail/posix_static_mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP +#define BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_HAS_PTHREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + +#include <pthread.h> +#include <boost/asio/detail/scoped_lock.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct posix_static_mutex +{ + typedef boost::asio::detail::scoped_lock<posix_static_mutex> scoped_lock; + + // Initialise the mutex. + void init() + { + // Nothing to do. + } + + // Lock the mutex. + void lock() + { + (void)::pthread_mutex_lock(&mutex_); // Ignore EINVAL. + } + + // Unlock the mutex. + void unlock() + { + (void)::pthread_mutex_unlock(&mutex_); // Ignore EINVAL. + } + + ::pthread_mutex_t mutex_; +}; + +#define BOOST_ASIO_POSIX_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER } + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_HAS_PTHREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + +#endif // BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp index 5d8b684..44bf62c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp @@ -2,7 +2,7 @@ // detail/posix_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -39,7 +39,7 @@ class posix_thread public: // Constructor. template <typename Function> - posix_thread(Function f) + posix_thread(Function f, unsigned int = 0) : joined_(false) { start_thread(new func<Function>(f)); diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp index 2edcbc1..33ac502 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/posix_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/push_options.hpp b/3rdParty/Boost/src/boost/asio/detail/push_options.hpp index 050549d..fef517d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/push_options.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/push_options.hpp @@ -2,7 +2,7 @@ // detail/push_options.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -100,6 +100,7 @@ # pragma warning (disable:4103) # pragma warning (push) # pragma warning (disable:4127) +# pragma warning (disable:4180) # pragma warning (disable:4244) # pragma warning (disable:4355) # pragma warning (disable:4512) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp index 510c505..5efb24b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_descriptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -42,7 +42,7 @@ class reactive_descriptor_service { public: // The native type of a descriptor. - typedef int native_type; + typedef int native_handle_type; // The implementation type of the descriptor. class implementation_type @@ -80,12 +80,22 @@ public: // Construct a new descriptor implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); + // Move-construct a new descriptor implementation. + BOOST_ASIO_DECL void move_construct(implementation_type& impl, + implementation_type& other_impl); + + // Move-assign from another descriptor implementation. + BOOST_ASIO_DECL void move_assign(implementation_type& impl, + reactive_descriptor_service& other_service, + implementation_type& other_impl); + // Destroy a descriptor implementation. BOOST_ASIO_DECL void destroy(implementation_type& impl); // Assign a native descriptor to a descriptor implementation. BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, - const native_type& native_descriptor, boost::system::error_code& ec); + const native_handle_type& native_descriptor, + boost::system::error_code& ec); // Determine whether the descriptor is open. bool is_open(const implementation_type& impl) const @@ -98,11 +108,14 @@ public: boost::system::error_code& ec); // Get the native descriptor representation. - native_type native(const implementation_type& impl) const + native_handle_type native_handle(const implementation_type& impl) const { return impl.descriptor_; } + // Release ownership of the native descriptor representation. + BOOST_ASIO_DECL native_handle_type release(implementation_type& impl); + // Cancel all operations associated with the descriptor. BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, boost::system::error_code& ec); @@ -117,6 +130,36 @@ public: return ec; } + // Gets the non-blocking mode of the descriptor. + bool non_blocking(const implementation_type& impl) const + { + return (impl.state_ & descriptor_ops::user_set_non_blocking) != 0; + } + + // Sets the non-blocking mode of the descriptor. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + descriptor_ops::set_user_non_blocking( + impl.descriptor_, impl.state_, mode, ec); + return ec; + } + + // Gets the non-blocking mode of the native descriptor implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return (impl.state_ & descriptor_ops::internal_non_blocking) != 0; + } + + // Sets the non-blocking mode of the native descriptor implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + descriptor_ops::set_internal_non_blocking( + impl.descriptor_, impl.state_, mode, ec); + return ec; + } + // Write some data to the descriptor. template <typename ConstBufferSequence> size_t write_some(implementation_type& impl, @@ -134,7 +177,7 @@ public: const null_buffers&, boost::system::error_code& ec) { // Wait for descriptor to become ready. - descriptor_ops::poll_write(impl.descriptor_, ec); + descriptor_ops::poll_write(impl.descriptor_, impl.state_, ec); return 0; } @@ -152,6 +195,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.descriptor_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_write_some")); + start_op(impl, reactor::write_op, p.p, true, buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence>::all_empty(buffers)); @@ -170,6 +215,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", + &impl, "async_write_some(null_buffers)")); + start_op(impl, reactor::write_op, p.p, false, false); p.v = p.p = 0; } @@ -191,7 +239,7 @@ public: const null_buffers&, boost::system::error_code& ec) { // Wait for descriptor to become ready. - descriptor_ops::poll_read(impl.descriptor_, ec); + descriptor_ops::poll_read(impl.descriptor_, impl.state_, ec); return 0; } @@ -209,6 +257,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.descriptor_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_read_some")); + start_op(impl, reactor::read_op, p.p, true, buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence>::all_empty(buffers)); @@ -227,6 +277,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", + &impl, "async_read_some(null_buffers)")); + start_op(impl, reactor::read_op, p.p, false, false); p.v = p.p = 0; } @@ -234,7 +287,7 @@ public: private: // Start the asynchronous operation. BOOST_ASIO_DECL void start_op(implementation_type& impl, int op_type, - reactor_op* op, bool non_blocking, bool noop); + reactor_op* op, bool is_non_blocking, bool noop); // The selector that performs event demultiplexing for the service. reactor& reactor_; diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_null_buffers_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_null_buffers_op.hpp index 6ccc19e..3881e96 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_null_buffers_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_null_buffers_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_null_buffers_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -34,10 +34,10 @@ class reactive_null_buffers_op : public reactor_op public: BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_null_buffers_op); - reactive_null_buffers_op(Handler handler) + reactive_null_buffers_op(Handler& handler) : reactor_op(&reactive_null_buffers_op::do_perform, &reactive_null_buffers_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -47,12 +47,15 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_null_buffers_op* o(static_cast<reactive_null_buffers_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -67,8 +70,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp index 303c1f0..a32088f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -39,7 +39,7 @@ class reactive_serial_port_service { public: // The native type of a serial port. - typedef reactive_descriptor_service::native_type native_type; + typedef reactive_descriptor_service::native_handle_type native_handle_type; // The implementation type of the serial port. typedef reactive_descriptor_service::implementation_type implementation_type; @@ -56,6 +56,22 @@ public: descriptor_service_.construct(impl); } + // Move-construct a new serial port implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + descriptor_service_.move_construct(impl, other_impl); + } + + // Move-assign from another serial port implementation. + void move_assign(implementation_type& impl, + reactive_serial_port_service& other_service, + implementation_type& other_impl) + { + descriptor_service_.move_assign(impl, + other_service.descriptor_service_, other_impl); + } + // Destroy a serial port implementation. void destroy(implementation_type& impl) { @@ -68,7 +84,8 @@ public: // Assign a native descriptor to a serial port implementation. boost::system::error_code assign(implementation_type& impl, - const native_type& native_descriptor, boost::system::error_code& ec) + const native_handle_type& native_descriptor, + boost::system::error_code& ec) { return descriptor_service_.assign(impl, native_descriptor, ec); } @@ -87,9 +104,9 @@ public: } // Get the native serial port representation. - native_type native(implementation_type& impl) + native_handle_type native_handle(implementation_type& impl) { - return descriptor_service_.native(impl); + return descriptor_service_.native_handle(impl); } // Cancel all operations associated with the serial port. @@ -125,7 +142,7 @@ public: { errno = 0; descriptor_ops::error_wrapper(::tcsendbreak( - descriptor_service_.native(impl), 0), ec); + descriptor_service_.native_handle(impl), 0), ec); return ec; } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_accept_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_accept_op.hpp index 3805c9f..d80bdea 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_accept_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_accept_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_accept_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -87,20 +87,23 @@ public: reactive_socket_accept_op(socket_type socket, socket_ops::state_type state, Socket& peer, const Protocol& protocol, - typename Protocol::endpoint* peer_endpoint, Handler handler) + typename Protocol::endpoint* peer_endpoint, Handler& handler) : reactive_socket_accept_op_base<Socket, Protocol>(socket, state, peer, protocol, peer_endpoint, &reactive_socket_accept_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_accept_op* o(static_cast<reactive_socket_accept_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -115,8 +118,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_connect_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_connect_op.hpp index 6de7474..6463a03 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_connect_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_connect_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_connect_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -56,21 +56,24 @@ class reactive_socket_connect_op : public reactive_socket_connect_op_base public: BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_connect_op); - reactive_socket_connect_op(socket_type socket, Handler handler) + reactive_socket_connect_op(socket_type socket, Handler& handler) : reactive_socket_connect_op_base(socket, &reactive_socket_connect_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_connect_op* o (static_cast<reactive_socket_connect_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -85,8 +88,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); boost_asio_handler_invoke_helpers::invoke(handler, handler); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recv_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recv_op.hpp index 75ce44f..8814c1e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recv_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recv_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_recv_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -54,7 +54,7 @@ public: return socket_ops::non_blocking_recv(o->socket_, bufs.buffers(), bufs.count(), o->flags_, - (o->state_ & socket_ops::stream_oriented), + (o->state_ & socket_ops::stream_oriented) != 0, o->ec_, o->bytes_transferred_); } @@ -74,20 +74,23 @@ public: reactive_socket_recv_op(socket_type socket, socket_ops::state_type state, const MutableBufferSequence& buffers, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) : reactive_socket_recv_op_base<MutableBufferSequence>(socket, state, buffers, flags, &reactive_socket_recv_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_recv_op* o(static_cast<reactive_socket_recv_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -102,8 +105,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvfrom_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvfrom_op.hpp index b496ea0..a6b37e4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvfrom_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvfrom_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_recvfrom_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -82,22 +82,25 @@ public: reactive_socket_recvfrom_op(socket_type socket, int protocol_type, const MutableBufferSequence& buffers, Endpoint& endpoint, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) : reactive_socket_recvfrom_op_base<MutableBufferSequence, Endpoint>( socket, protocol_type, buffers, endpoint, flags, &reactive_socket_recvfrom_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_recvfrom_op* o( static_cast<reactive_socket_recvfrom_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -112,8 +115,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvmsg_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvmsg_op.hpp new file mode 100644 index 0000000..e9c2483 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvmsg_op.hpp @@ -0,0 +1,127 @@ +// +// detail/reactive_socket_recvmsg_op.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP +#define BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/utility/addressof.hpp> +#include <boost/asio/detail/bind_handler.hpp> +#include <boost/asio/detail/buffer_sequence_adapter.hpp> +#include <boost/asio/detail/fenced_block.hpp> +#include <boost/asio/detail/reactor_op.hpp> +#include <boost/asio/detail/socket_ops.hpp> +#include <boost/asio/socket_base.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename MutableBufferSequence> +class reactive_socket_recvmsg_op_base : public reactor_op +{ +public: + reactive_socket_recvmsg_op_base(socket_type socket, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, func_type complete_func) + : reactor_op(&reactive_socket_recvmsg_op_base::do_perform, complete_func), + socket_(socket), + buffers_(buffers), + in_flags_(in_flags), + out_flags_(out_flags) + { + } + + static bool do_perform(reactor_op* base) + { + reactive_socket_recvmsg_op_base* o( + static_cast<reactive_socket_recvmsg_op_base*>(base)); + + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence> bufs(o->buffers_); + + return socket_ops::non_blocking_recvmsg(o->socket_, + bufs.buffers(), bufs.count(), + o->in_flags_, o->out_flags_, + o->ec_, o->bytes_transferred_); + } + +private: + socket_type socket_; + MutableBufferSequence buffers_; + socket_base::message_flags in_flags_; + socket_base::message_flags& out_flags_; +}; + +template <typename MutableBufferSequence, typename Handler> +class reactive_socket_recvmsg_op : + public reactive_socket_recvmsg_op_base<MutableBufferSequence> +{ +public: + BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_recvmsg_op); + + reactive_socket_recvmsg_op(socket_type socket, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler& handler) + : reactive_socket_recvmsg_op_base<MutableBufferSequence>(socket, buffers, + in_flags, out_flags, &reactive_socket_recvmsg_op::do_complete), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) + { + } + + static void do_complete(io_service_impl* owner, operation* base, + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) + { + // Take ownership of the handler object. + reactive_socket_recvmsg_op* o( + static_cast<reactive_socket_recvmsg_op*>(base)); + ptr p = { boost::addressof(o->handler_), o, o }; + + BOOST_ASIO_HANDLER_COMPLETION((o)); + + // Make a copy of the handler so that the memory can be deallocated before + // the upcall is made. Even if we're not about to make an upcall, a + // sub-object of the handler may be the true owner of the memory associated + // with the handler. Consequently, a local copy of the handler is required + // to ensure that any owning sub-object remains valid until after we have + // deallocated the memory here. + detail::binder2<Handler, boost::system::error_code, std::size_t> + handler(o->handler_, o->ec_, o->bytes_transferred_); + p.h = boost::addressof(handler.handler_); + p.reset(); + + // Make the upcall if required. + if (owner) + { + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); + boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; + } + } + +private: + Handler handler_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_send_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_send_op.hpp index 2fe195e..b1c3f65 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_send_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_send_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_send_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -71,20 +71,23 @@ public: reactive_socket_send_op(socket_type socket, const ConstBufferSequence& buffers, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) : reactive_socket_send_op_base<ConstBufferSequence>(socket, buffers, flags, &reactive_socket_send_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_send_op* o(static_cast<reactive_socket_send_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -99,8 +102,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_sendto_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_sendto_op.hpp index 12046c3..08396a0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_sendto_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_sendto_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_sendto_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -74,20 +74,23 @@ public: reactive_socket_sendto_op(socket_type socket, const ConstBufferSequence& buffers, const Endpoint& endpoint, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) : reactive_socket_sendto_op_base<ConstBufferSequence, Endpoint>(socket, buffers, endpoint, flags, &reactive_socket_sendto_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_sendto_op* o(static_cast<reactive_socket_sendto_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -102,8 +105,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp index 92eef4a..f66e25f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -56,7 +56,7 @@ public: typedef typename Protocol::endpoint endpoint_type; // The native type of a socket. - typedef socket_type native_type; + typedef socket_type native_handle_type; // The implementation type of the socket. struct implementation_type : @@ -78,6 +78,27 @@ public: { } + // Move-construct a new socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + this->base_move_construct(impl, other_impl); + + impl.protocol_ = other_impl.protocol_; + other_impl.protocol_ = endpoint_type().protocol(); + } + + // Move-assign from another socket implementation. + void move_assign(implementation_type& impl, + reactive_socket_service_base& other_service, + implementation_type& other_impl) + { + this->base_move_assign(impl, other_service, other_impl); + + impl.protocol_ = other_impl.protocol_; + other_impl.protocol_ = endpoint_type().protocol(); + } + // Open a new socket implementation. boost::system::error_code open(implementation_type& impl, const protocol_type& protocol, boost::system::error_code& ec) @@ -90,7 +111,7 @@ public: // Assign a native socket to a socket implementation. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { if (!do_assign(impl, protocol.type(), native_socket, ec)) @@ -99,7 +120,7 @@ public: } // Get the native socket representation. - native_type native(implementation_type& impl) + native_handle_type native_handle(implementation_type& impl) { return impl.socket_; } @@ -183,7 +204,7 @@ public: boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_write(impl.socket_, ec); + socket_ops::poll_write(impl.socket_, impl.state_, ec); return 0; } @@ -204,6 +225,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, buffers, destination, flags, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to")); + start_op(impl, reactor::write_op, p.p, true, false); p.v = p.p = 0; } @@ -220,6 +243,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_send_to(null_buffers)")); + start_op(impl, reactor::write_op, p.p, false, false); p.v = p.p = 0; } @@ -252,7 +278,7 @@ public: boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_read(impl.socket_, ec); + socket_ops::poll_read(impl.socket_, impl.state_, ec); // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); @@ -274,10 +300,13 @@ public: typename op::ptr p = { boost::addressof(handler), boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; - int protocol_type = impl.protocol_.type(); - p.p = new (p.v) op(impl.socket_, protocol_type, + int protocol = impl.protocol_.type(); + p.p = new (p.v) op(impl.socket_, protocol, buffers, sender_endpoint, flags, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive_from")); + start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, @@ -298,6 +327,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive_from(null_buffers)")); + // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); @@ -351,6 +383,8 @@ public: p.p = new (p.v) op(impl.socket_, impl.state_, peer, impl.protocol_, peer_endpoint, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept")); + start_accept_op(impl, p.p, peer.is_open()); p.v = p.p = 0; } @@ -376,6 +410,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect")); + start_connect_op(impl, p.p, peer_endpoint.data(), peer_endpoint.size()); p.v = p.p = 0; } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp index df87ddb..0180435 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -27,6 +27,7 @@ #include <boost/asio/detail/buffer_sequence_adapter.hpp> #include <boost/asio/detail/reactive_null_buffers_op.hpp> #include <boost/asio/detail/reactive_socket_recv_op.hpp> +#include <boost/asio/detail/reactive_socket_recvmsg_op.hpp> #include <boost/asio/detail/reactive_socket_send_op.hpp> #include <boost/asio/detail/reactor.hpp> #include <boost/asio/detail/reactor_op.hpp> @@ -44,7 +45,7 @@ class reactive_socket_service_base { public: // The native type of a socket. - typedef socket_type native_type; + typedef socket_type native_handle_type; // The implementation type of the socket. struct base_implementation_type @@ -69,6 +70,15 @@ public: // Construct a new socket implementation. BOOST_ASIO_DECL void construct(base_implementation_type& impl); + // Move-construct a new socket implementation. + BOOST_ASIO_DECL void base_move_construct(base_implementation_type& impl, + base_implementation_type& other_impl); + + // Move-assign from another socket implementation. + BOOST_ASIO_DECL void base_move_assign(base_implementation_type& impl, + reactive_socket_service_base& other_service, + base_implementation_type& other_impl); + // Destroy a socket implementation. BOOST_ASIO_DECL void destroy(base_implementation_type& impl); @@ -83,7 +93,7 @@ public: base_implementation_type& impl, boost::system::error_code& ec); // Get the native socket representation. - native_type native(base_implementation_type& impl) + native_handle_type native_handle(base_implementation_type& impl) { return impl.socket_; } @@ -124,7 +134,35 @@ public: return ec; } - /// Disable sends or receives on the socket. + // Gets the non-blocking mode of the socket. + bool non_blocking(const base_implementation_type& impl) const + { + return (impl.state_ & socket_ops::user_set_non_blocking) != 0; + } + + // Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(base_implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + socket_ops::set_user_non_blocking(impl.socket_, impl.state_, mode, ec); + return ec; + } + + // Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const base_implementation_type& impl) const + { + return (impl.state_ & socket_ops::internal_non_blocking) != 0; + } + + // Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(base_implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + socket_ops::set_internal_non_blocking(impl.socket_, impl.state_, mode, ec); + return ec; + } + + // Disable sends or receives on the socket. boost::system::error_code shutdown(base_implementation_type& impl, socket_base::shutdown_type what, boost::system::error_code& ec) { @@ -150,7 +188,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_write(impl.socket_, ec); + socket_ops::poll_write(impl.socket_, impl.state_, ec); return 0; } @@ -169,6 +207,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, buffers, flags, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send")); + start_op(impl, reactor::write_op, p.p, true, ((impl.state_ & socket_ops::stream_oriented) && buffer_sequence_adapter<boost::asio::const_buffer, @@ -188,6 +228,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_send(null_buffers)")); + start_op(impl, reactor::write_op, p.p, false, false); p.v = p.p = 0; } @@ -210,7 +253,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_read(impl.socket_, ec); + socket_ops::poll_read(impl.socket_, impl.state_, ec); return 0; } @@ -229,6 +272,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, impl.state_, buffers, flags, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive")); + start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, @@ -251,6 +296,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive(null_buffers)")); + start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, @@ -258,6 +306,87 @@ public: p.v = p.p = 0; } + // Receive some data with associated flags. Returns the number of bytes + // received. + template <typename MutableBufferSequence> + size_t receive_with_flags(base_implementation_type& impl, + const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence> bufs(buffers); + + return socket_ops::sync_recvmsg(impl.socket_, impl.state_, + bufs.buffers(), bufs.count(), in_flags, out_flags, ec); + } + + // Wait until data can be received without blocking. + size_t receive_with_flags(base_implementation_type& impl, + const null_buffers&, socket_base::message_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + // Wait for socket to become ready. + socket_ops::poll_read(impl.socket_, impl.state_, ec); + + // Clear out_flags, since we cannot give it any other sensible value when + // performing a null_buffers operation. + out_flags = 0; + + return 0; + } + + // Start an asynchronous receive. The buffer for the data being received + // must be valid for the lifetime of the asynchronous operation. + template <typename MutableBufferSequence, typename Handler> + void async_receive_with_flags(base_implementation_type& impl, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef reactive_socket_recvmsg_op<MutableBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(impl.socket_, buffers, in_flags, out_flags, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive_with_flags")); + + start_op(impl, + (in_flags & socket_base::message_out_of_band) + ? reactor::except_op : reactor::read_op, + p.p, (in_flags & socket_base::message_out_of_band) == 0, false); + p.v = p.p = 0; + } + + // Wait until data can be received without blocking. + template <typename Handler> + void async_receive_with_flags(base_implementation_type& impl, + const null_buffers&, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef reactive_null_buffers_op<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, + "async_receive_with_flags(null_buffers)")); + + // Clear out_flags, since we cannot give it any other sensible value when + // performing a null_buffers operation. + out_flags = 0; + + start_op(impl, + (in_flags & socket_base::message_out_of_band) + ? reactor::except_op : reactor::read_op, + p.p, false, false); + p.v = p.p = 0; + } + protected: // Open a new socket implementation. BOOST_ASIO_DECL boost::system::error_code do_open( @@ -267,11 +396,11 @@ protected: // Assign a native socket to a socket implementation. BOOST_ASIO_DECL boost::system::error_code do_assign( base_implementation_type& impl, int type, - const native_type& native_socket, boost::system::error_code& ec); + const native_handle_type& native_socket, boost::system::error_code& ec); // Start the asynchronous read or write operation. BOOST_ASIO_DECL void start_op(base_implementation_type& impl, int op_type, - reactor_op* op, bool non_blocking, bool noop); + reactor_op* op, bool is_non_blocking, bool noop); // Start the asynchronous accept operation. BOOST_ASIO_DECL void start_accept_op(base_implementation_type& impl, diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor.hpp index f225ea0..7e28679 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor.hpp @@ -2,7 +2,7 @@ // detail/reactor.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor_fwd.hpp index a4ff94a..7ea119e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor_op.hpp index 0c8271c..3b8e7f9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor_op.hpp @@ -2,7 +2,7 @@ // detail/reactor_op.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp index 02b8ea2..692a2ee 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp @@ -2,7 +2,7 @@ // detail/reactor_op_queue.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/regex_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/regex_fwd.hpp index d61ad61..679146e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/regex_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/regex_fwd.hpp @@ -2,7 +2,7 @@ // detail/regex_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/resolve_endpoint_op.hpp b/3rdParty/Boost/src/boost/asio/detail/resolve_endpoint_op.hpp index 46acda3..e6c901a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolve_endpoint_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolve_endpoint_op.hpp @@ -2,7 +2,7 @@ // detail/resolve_endpoint_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -43,17 +43,18 @@ public: typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type; resolve_endpoint_op(socket_ops::weak_cancel_token_type cancel_token, - const endpoint_type& endpoint, io_service_impl& ios, Handler handler) + const endpoint_type& endpoint, io_service_impl& ios, Handler& handler) : operation(&resolve_endpoint_op::do_complete), cancel_token_(cancel_token), endpoint_(endpoint), io_service_impl_(ios), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the operation object. resolve_endpoint_op* o(static_cast<resolve_endpoint_op*>(base)); @@ -81,6 +82,8 @@ public: // The operation has been returned to the main io_service. The completion // handler is ready to be delivered. + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated // before the upcall is made. Even if we're not about to make an upcall, // a sub-object of the handler may be the true owner of the memory @@ -94,8 +97,10 @@ public: if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, "...")); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } } diff --git a/3rdParty/Boost/src/boost/asio/detail/resolve_op.hpp b/3rdParty/Boost/src/boost/asio/detail/resolve_op.hpp index 379ec39..b640979 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolve_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolve_op.hpp @@ -2,7 +2,7 @@ // detail/resolve_op.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -44,12 +44,12 @@ public: typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type; resolve_op(socket_ops::weak_cancel_token_type cancel_token, - const query_type& query, io_service_impl& ios, Handler handler) + const query_type& query, io_service_impl& ios, Handler& handler) : operation(&resolve_op::do_complete), cancel_token_(cancel_token), query_(query), io_service_impl_(ios), - handler_(handler), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), addrinfo_(0) { } @@ -61,7 +61,8 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the operation object. resolve_op* o(static_cast<resolve_op*>(base)); @@ -86,6 +87,8 @@ public: // The operation has been returned to the main io_service. The completion // handler is ready to be delivered. + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated // before the upcall is made. Even if we're not about to make an upcall, // a sub-object of the handler may be the true owner of the memory @@ -104,8 +107,10 @@ public: if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, "...")); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } } diff --git a/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp b/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp index 1c343cb..8225844 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp @@ -2,7 +2,7 @@ // detail/resolver_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -67,8 +67,8 @@ public: // Asynchronously resolve a query to a list of entries. template <typename Handler> - void async_resolve(implementation_type& impl, const query_type& query, - Handler handler) + void async_resolve(implementation_type& impl, + const query_type& query, Handler handler) { // Allocate and construct an operation to wrap the handler. typedef resolve_op<Protocol, Handler> op; @@ -77,6 +77,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl, query, io_service_impl_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve")); + start_resolve_op(p.p); p.v = p.p = 0; } @@ -97,8 +99,8 @@ public: // Asynchronously resolve an endpoint to a list of entries. template <typename Handler> - void async_resolve(implementation_type& impl, const endpoint_type& endpoint, - Handler handler) + void async_resolve(implementation_type& impl, + const endpoint_type& endpoint, Handler handler) { // Allocate and construct an operation to wrap the handler. typedef resolve_endpoint_op<Protocol, Handler> op; @@ -107,6 +109,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl, endpoint, io_service_impl_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve")); + start_resolve_op(p.p); p.v = p.p = 0; } diff --git a/3rdParty/Boost/src/boost/asio/detail/resolver_service_base.hpp b/3rdParty/Boost/src/boost/asio/detail/resolver_service_base.hpp index 60e9e09..3a48d06 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolver_service_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolver_service_base.hpp @@ -2,7 +2,7 @@ // detail/resolver_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,7 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/scoped_ptr.hpp> #include <boost/asio/error.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/detail/mutex.hpp> @@ -24,6 +23,7 @@ #include <boost/asio/detail/operation.hpp> #include <boost/asio/detail/socket_ops.hpp> #include <boost/asio/detail/socket_types.hpp> +#include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/thread.hpp> #include <boost/asio/detail/push_options.hpp> @@ -48,6 +48,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Perform any fork-related housekeeping. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Construct a new resolver implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); @@ -100,16 +104,16 @@ private: boost::asio::detail::mutex mutex_; // Private io_service used for performing asynchronous host resolution. - boost::scoped_ptr<boost::asio::io_service> work_io_service_; + boost::asio::detail::scoped_ptr<boost::asio::io_service> work_io_service_; // The work io_service implementation used to post completions. io_service_impl& work_io_service_impl_; // Work for the private io_service to perform. - boost::scoped_ptr<boost::asio::io_service::work> work_; + boost::asio::detail::scoped_ptr<boost::asio::io_service::work> work_; // Thread used for running the work io_service's run loop. - boost::scoped_ptr<boost::asio::detail::thread> work_thread_; + boost::asio::detail::scoped_ptr<boost::asio::detail::thread> work_thread_; }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp b/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp index b523ae5..a2e6fd4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp @@ -2,7 +2,7 @@ // detail/scoped_lock.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/scoped_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/scoped_ptr.hpp new file mode 100644 index 0000000..16436dd --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/scoped_ptr.hpp @@ -0,0 +1,81 @@ +// +// detail/scoped_ptr.hpp +// ~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_SCOPED_PTR_HPP +#define BOOST_ASIO_DETAIL_SCOPED_PTR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename T> +class scoped_ptr +{ +public: + // Constructor. + explicit scoped_ptr(T* p = 0) + : p_(p) + { + } + + // Destructor. + ~scoped_ptr() + { + delete p_; + } + + // Access. + T* get() + { + return p_; + } + + // Access. + T* operator->() + { + return p_; + } + + // Dereference. + T& operator*() + { + return *p_; + } + + // Reset pointer. + void reset(T* p = 0) + { + delete p_; + p_ = p; + } + +private: + // Disallow copying and assignment. + scoped_ptr(const scoped_ptr&); + scoped_ptr& operator=(const scoped_ptr&); + + T* p_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_SCOPED_PTR_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp index f0a1275..11a4967 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp index f4f8bdf..a434546 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp @@ -2,7 +2,7 @@ // detail/select_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -22,7 +22,9 @@ && !defined(BOOST_ASIO_HAS_EPOLL) \ && !defined(BOOST_ASIO_HAS_KQUEUE)) +#include <boost/limits.hpp> #include <cstddef> +#include <boost/asio/detail/fd_set_adapter.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/reactor_op.hpp> @@ -30,10 +32,10 @@ #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/select_reactor_fwd.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/io_service.hpp> #if defined(BOOST_ASIO_HAS_IOCP) @@ -72,6 +74,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task, but only if the reactor is not in its own thread. BOOST_ASIO_DECL void init_task(); @@ -79,6 +85,12 @@ public: // code on failure. BOOST_ASIO_DECL int register_descriptor(socket_type, per_descriptor_data&); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -97,8 +109,17 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor(socket_type descriptor, - per_descriptor_data&); + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data&, bool closing); + + // Remote the descriptor's registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( + socket_type descriptor, per_descriptor_data& descriptor_data); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); // Add a new timer queue to the reactor. template <typename Time_Traits> @@ -113,13 +134,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run select once until interrupted or events are ready to be dispatched. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -162,6 +184,9 @@ private: // The queues of read, write and except operations. reactor_op_queue<socket_type> op_queue_[max_ops]; + // The file descriptor sets to be passed to the select system call. + fd_set_adapter fd_sets_[max_select_ops]; + // The timer queues. timer_queue_set timer_queues_; diff --git a/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp index 78ff61b..1337969 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/select_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp b/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp index a247ea8..458f271 100644 --- a/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp @@ -2,7 +2,7 @@ // detail/service_registry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -52,12 +52,22 @@ class service_registry : private noncopyable { public: - // Constructor. - BOOST_ASIO_DECL service_registry(boost::asio::io_service& o); + // Constructor. Adds the initial service. + template <typename Service, typename Arg> + service_registry(boost::asio::io_service& o, + Service* initial_service, Arg arg); // Destructor. BOOST_ASIO_DECL ~service_registry(); + // Notify all services of a fork event. + BOOST_ASIO_DECL void notify_fork(boost::asio::io_service::fork_event fork_ev); + + // Get the first service object cast to the specified type. Called during + // io_service construction and so performs no locking or type checking. + template <typename Service> + Service& first_service(); + // Get the service object corresponding to the specified service type. Will // create a new service object automatically if no such object already // exists. Ownership of the service object is not transferred to the caller. @@ -120,8 +130,8 @@ private: const boost::asio::io_service::service::key& key, factory_type factory); - // Add a service object. Returns false on error, in which case ownership of - // the object is retained by the caller. + // Add a service object. Throws on error, in which case ownership of the + // object is retained by the caller. BOOST_ASIO_DECL void do_add_service( const boost::asio::io_service::service::key& key, boost::asio::io_service::service* new_service); diff --git a/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp index a6bb25e..3157574 100644 --- a/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp @@ -2,7 +2,7 @@ // detail/service_registry_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/shared_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/shared_ptr.hpp index fe497b7..5f0da22 100644 --- a/3rdParty/Boost/src/boost/asio/detail/shared_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/shared_ptr.hpp @@ -2,7 +2,7 @@ // detail/shared_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,21 +17,21 @@ #include <boost/asio/detail/config.hpp> -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) # include <memory> -#else +#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) # include <boost/shared_ptr.hpp> -#endif +#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) namespace boost { namespace asio { namespace detail { -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) using std::shared_ptr; -#else +#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) using boost::shared_ptr; -#endif +#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) } // namespace detail } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp index cc00482..fe859b4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_handler.hpp new file mode 100644 index 0000000..bd1c727 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/signal_handler.hpp @@ -0,0 +1,83 @@ +// +// detail/signal_handler.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP +#define BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/fenced_block.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/signal_op.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename Handler> +class signal_handler : public signal_op +{ +public: + BOOST_ASIO_DEFINE_HANDLER_PTR(signal_handler); + + signal_handler(Handler& h) + : signal_op(&signal_handler::do_complete), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)) + { + } + + static void do_complete(io_service_impl* owner, operation* base, + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) + { + // Take ownership of the handler object. + signal_handler* h(static_cast<signal_handler*>(base)); + ptr p = { boost::addressof(h->handler_), h, h }; + + BOOST_ASIO_HANDLER_COMPLETION((h)); + + // Make a copy of the handler so that the memory can be deallocated before + // the upcall is made. Even if we're not about to make an upcall, a + // sub-object of the handler may be the true owner of the memory associated + // with the handler. Consequently, a local copy of the handler is required + // to ensure that any owning sub-object remains valid until after we have + // deallocated the memory here. + detail::binder2<Handler, boost::system::error_code, int> + handler(h->handler_, h->ec_, h->signal_number_); + p.h = boost::addressof(handler.handler_); + p.reset(); + + // Make the upcall if required. + if (owner) + { + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); + boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; + } + } + +private: + Handler handler_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp index f346956..e038a88 100644 --- a/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp @@ -2,7 +2,7 @@ // detail/signal_init.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_op.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_op.hpp new file mode 100644 index 0000000..706691b --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/signal_op.hpp @@ -0,0 +1,51 @@ +// +// detail/signal_op.hpp +// ~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_SIGNAL_OP_HPP +#define BOOST_ASIO_DETAIL_SIGNAL_OP_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/operation.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +class signal_op + : public operation +{ +public: + // The error code to be passed to the completion handler. + boost::system::error_code ec_; + + // The signal number to be passed to the completion handler. + int signal_number_; + +protected: + signal_op(func_type func) + : operation(func), + signal_number_(0) + { + } +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_SIGNAL_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_set_service.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_set_service.hpp new file mode 100644 index 0000000..afa67fe --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/signal_set_service.hpp @@ -0,0 +1,213 @@ +// +// detail/signal_set_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP +#define BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <cstddef> +#include <signal.h> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/op_queue.hpp> +#include <boost/asio/detail/signal_handler.hpp> +#include <boost/asio/detail/signal_op.hpp> +#include <boost/asio/detail/socket_types.hpp> + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +# include <boost/asio/detail/reactor.hpp> +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +#if defined(NSIG) && (NSIG > 0) +enum { max_signal_number = NSIG }; +#else +enum { max_signal_number = 128 }; +#endif + +extern BOOST_ASIO_DECL struct signal_state* get_signal_state(); + +extern "C" BOOST_ASIO_DECL void asio_signal_handler(int signal_number); + +class signal_set_service +{ +public: + // Type used for tracking an individual signal registration. + class registration + { + public: + // Default constructor. + registration() + : signal_number_(0), + queue_(0), + undelivered_(0), + next_in_table_(0), + prev_in_table_(0), + next_in_set_(0) + { + } + + private: + // Only this service will have access to the internal values. + friend class signal_set_service; + + // The signal number that is registered. + int signal_number_; + + // The waiting signal handlers. + op_queue<signal_op>* queue_; + + // The number of undelivered signals. + std::size_t undelivered_; + + // Pointers to adjacent registrations in the registrations_ table. + registration* next_in_table_; + registration* prev_in_table_; + + // Link to next registration in the signal set. + registration* next_in_set_; + }; + + // The implementation type of the signal_set. + class implementation_type + { + public: + // Default constructor. + implementation_type() + : signals_(0) + { + } + + private: + // Only this service will have access to the internal values. + friend class signal_set_service; + + // The pending signal handlers. + op_queue<signal_op> queue_; + + // Linked list of registered signals. + registration* signals_; + }; + + // Constructor. + BOOST_ASIO_DECL signal_set_service(boost::asio::io_service& io_service); + + // Destructor. + BOOST_ASIO_DECL ~signal_set_service(); + + // Destroy all user-defined handler objects owned by the service. + BOOST_ASIO_DECL void shutdown_service(); + + // Perform fork-related housekeeping. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + + // Construct a new signal_set implementation. + BOOST_ASIO_DECL void construct(implementation_type& impl); + + // Destroy a signal_set implementation. + BOOST_ASIO_DECL void destroy(implementation_type& impl); + + // Add a signal to a signal_set. + BOOST_ASIO_DECL boost::system::error_code add(implementation_type& impl, + int signal_number, boost::system::error_code& ec); + + // Remove a signal to a signal_set. + BOOST_ASIO_DECL boost::system::error_code remove(implementation_type& impl, + int signal_number, boost::system::error_code& ec); + + // Remove all signals from a signal_set. + BOOST_ASIO_DECL boost::system::error_code clear(implementation_type& impl, + boost::system::error_code& ec); + + // Cancel all operations associated with the signal set. + BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec); + + // Start an asynchronous operation to wait for a signal to be delivered. + template <typename Handler> + void async_wait(implementation_type& impl, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef signal_handler<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "signal_set", &impl, "async_wait")); + + start_wait_op(impl, p.p); + p.v = p.p = 0; + } + + // Deliver notification that a particular signal occurred. + BOOST_ASIO_DECL static void deliver_signal(int signal_number); + +private: + // Helper function to add a service to the global signal state. + BOOST_ASIO_DECL static void add_service(signal_set_service* service); + + // Helper function to remove a service from the global signal state. + BOOST_ASIO_DECL static void remove_service(signal_set_service* service); + + // Helper function to create the pipe descriptors. + BOOST_ASIO_DECL static void open_descriptors(); + + // Helper function to close the pipe descriptors. + BOOST_ASIO_DECL static void close_descriptors(); + + // Helper function to start a wait operation. + BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, signal_op* op); + + // The io_service instance used for dispatching handlers. + io_service_impl& io_service_; + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // The type used for registering for pipe reactor notifications. + class pipe_read_op; + + // The reactor used for waiting for pipe readiness. + reactor& reactor_; + + // The per-descriptor reactor data used for the pipe. + reactor::per_descriptor_data reactor_data_; +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + + // A mapping from signal number to the registered signal sets. + registration* registrations_[max_signal_number]; + + // Pointers to adjacent services in linked list. + signal_set_service* next_; + signal_set_service* prev_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/signal_set_service.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp index 52d2e4d..d299859 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp @@ -2,7 +2,7 @@ // detail/socket_holder.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp index 18a8131..b353316 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp @@ -2,7 +2,7 @@ // detail/socket_ops.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -51,7 +51,10 @@ enum stream_oriented = 16, // The socket is datagram-oriented. - datagram_oriented = 32 + datagram_oriented = 32, + + // The socket may have been dup()-ed. + possible_dup = 64 }; typedef unsigned char state_type; @@ -88,8 +91,11 @@ BOOST_ASIO_DECL int bind(socket_type s, const socket_addr_type* addr, BOOST_ASIO_DECL int close(socket_type s, state_type& state, bool destruction, boost::system::error_code& ec); +BOOST_ASIO_DECL bool set_user_non_blocking(socket_type s, + state_type& state, bool value, boost::system::error_code& ec); + BOOST_ASIO_DECL bool set_internal_non_blocking(socket_type s, - state_type& state, boost::system::error_code& ec); + state_type& state, bool value, boost::system::error_code& ec); BOOST_ASIO_DECL int shutdown(socket_type s, int what, boost::system::error_code& ec); @@ -166,6 +172,27 @@ BOOST_ASIO_DECL bool non_blocking_recvfrom(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) +BOOST_ASIO_DECL int recvmsg(socket_type s, buf* bufs, size_t count, + int in_flags, int& out_flags, boost::system::error_code& ec); + +BOOST_ASIO_DECL size_t sync_recvmsg(socket_type s, state_type state, + buf* bufs, size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec); + +#if defined(BOOST_ASIO_HAS_IOCP) + +BOOST_ASIO_DECL void complete_iocp_recvmsg( + const weak_cancel_token_type& cancel_token, + boost::system::error_code& ec); + +#else // defined(BOOST_ASIO_HAS_IOCP) + +BOOST_ASIO_DECL bool non_blocking_recvmsg(socket_type s, + buf* bufs, size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec, size_t& bytes_transferred); + +#endif // defined(BOOST_ASIO_HAS_IOCP) + BOOST_ASIO_DECL int send(socket_type s, const buf* bufs, size_t count, int flags, boost::system::error_code& ec); @@ -227,9 +254,11 @@ BOOST_ASIO_DECL int ioctl(socket_type s, state_type& state, BOOST_ASIO_DECL int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout, boost::system::error_code& ec); -BOOST_ASIO_DECL int poll_read(socket_type s, boost::system::error_code& ec); +BOOST_ASIO_DECL int poll_read(socket_type s, + state_type state, boost::system::error_code& ec); -BOOST_ASIO_DECL int poll_write(socket_type s, boost::system::error_code& ec); +BOOST_ASIO_DECL int poll_write(socket_type s, + state_type state, boost::system::error_code& ec); BOOST_ASIO_DECL int poll_connect(socket_type s, boost::system::error_code& ec); diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp index c841033..5d3a514 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp @@ -2,7 +2,7 @@ // detail/socket_option.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp index 6d68d5a..eb8c7d0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/socket_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -38,6 +38,9 @@ public: // Destructor. BOOST_ASIO_DECL ~socket_select_interrupter(); + // Recreate the interrupter's descriptors. Used after a fork. + BOOST_ASIO_DECL void recreate(); + // Interrupt the select call. BOOST_ASIO_DECL void interrupt(); @@ -51,6 +54,12 @@ public: } private: + // Open the descriptors. Throws on error. + BOOST_ASIO_DECL void open_descriptors(); + + // Close the descriptors. + BOOST_ASIO_DECL void close_descriptors(); + // The read end of a connection used to interrupt the select call. This file // descriptor is passed to select such that when it is time to stop, a single // byte will be written on the other end of the connection and this diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp index f0679b6..3754592 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp @@ -2,7 +2,7 @@ // detail/socket_types.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -113,6 +113,7 @@ const int shutdown_both = SD_BOTH; const int message_peek = MSG_PEEK; const int message_out_of_band = MSG_OOB; const int message_do_not_route = MSG_DONTROUTE; +const int message_end_of_record = 0; // Not supported on Windows. # if defined (_WIN32_WINNT) const int max_iov_len = 64; # else @@ -156,6 +157,7 @@ const int shutdown_both = SHUT_RDWR; const int message_peek = MSG_PEEK; const int message_out_of_band = MSG_OOB; const int message_do_not_route = MSG_DONTROUTE; +const int message_end_of_record = MSG_EOR; # if defined(IOV_MAX) const int max_iov_len = IOV_MAX; # else diff --git a/3rdParty/Boost/src/boost/asio/detail/solaris_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/solaris_fenced_block.hpp index 0b117ad..ab6f730 100644 --- a/3rdParty/Boost/src/boost/asio/detail/solaris_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/solaris_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/solaris_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -31,8 +31,16 @@ class solaris_fenced_block : private noncopyable { public: - // Constructor. - solaris_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit solaris_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit solaris_fenced_block(full_t) { membar_consumer(); } diff --git a/3rdParty/Boost/src/boost/asio/detail/static_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/static_mutex.hpp new file mode 100644 index 0000000..fbac3ed --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/static_mutex.hpp @@ -0,0 +1,49 @@ +// +// detail/static_mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP +#define BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +# include <boost/asio/detail/null_static_mutex.hpp> +#elif defined(BOOST_WINDOWS) +# include <boost/asio/detail/win_static_mutex.hpp> +#elif defined(BOOST_HAS_PTHREADS) +# include <boost/asio/detail/posix_static_mutex.hpp> +#else +# error Only Windows and POSIX are supported! +#endif + +namespace boost { +namespace asio { +namespace detail { + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +typedef null_static_mutex static_mutex; +# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_NULL_STATIC_MUTEX_INIT +#elif defined(BOOST_WINDOWS) +typedef win_static_mutex static_mutex; +# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_WIN_STATIC_MUTEX_INIT +#elif defined(BOOST_HAS_PTHREADS) +typedef posix_static_mutex static_mutex; +# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_POSIX_STATIC_MUTEX_INIT +#endif + +} // namespace detail +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp b/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp index 0783ac4..3a271b5 100644 --- a/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp @@ -2,7 +2,7 @@ // detail/strand_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,11 +16,11 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/scoped_ptr.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/operation.hpp> +#include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/push_options.hpp> @@ -57,11 +57,20 @@ public: // Mutex to protect access to internal data. boost::asio::detail::mutex mutex_; - // The count of handlers in the strand, including the upcall (if any). - std::size_t count_; + // Indicates whether the strand is currently "locked" by a handler. This + // means that there is a handler upcall in progress, or that the strand + // itself has been scheduled in order to invoke some pending handlers. + bool locked_; - // The handlers waiting on the strand. - op_queue<operation> queue_; + // The handlers that are waiting on the strand but should not be run until + // after the next time the strand is scheduled. This queue must only be + // modified while the mutex is locked. + op_queue<operation> waiting_queue_; + + // The handlers that are ready to be run. Logically speaking, these are the + // handlers that hold the strand's lock. The ready queue is only modified + // from within the strand and so may be accessed without locking the mutex. + op_queue<operation> ready_queue_; }; typedef strand_impl* implementation_type; @@ -75,9 +84,6 @@ public: // Construct a new strand implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); - // Destroy a strand implementation. - void destroy(implementation_type& impl); - // Request the io_service to invoke the given handler. template <typename Handler> void dispatch(implementation_type& impl, Handler handler); @@ -87,8 +93,15 @@ public: void post(implementation_type& impl, Handler handler); private: + // Helper function to dispatch a handler. Returns true if the handler should + // be dispatched immediately. + BOOST_ASIO_DECL bool do_dispatch(implementation_type& impl, operation* op); + + // Helper fiunction to post a handler. + BOOST_ASIO_DECL void do_post(implementation_type& impl, operation* op); + BOOST_ASIO_DECL static void do_complete(io_service_impl* owner, - operation* base, boost::system::error_code ec, + operation* base, const boost::system::error_code& ec, std::size_t bytes_transferred); // The io_service implementation used to post completions. @@ -98,10 +111,14 @@ private: boost::asio::detail::mutex mutex_; // Number of implementations shared between all strand objects. +#if defined(BOOST_ASIO_STRAND_IMPLEMENTATIONS) + enum { num_implementations = BOOST_ASIO_STRAND_IMPLEMENTATIONS }; +#else // defined(BOOST_ASIO_STRAND_IMPLEMENTATIONS) enum { num_implementations = 193 }; +#endif // defined(BOOST_ASIO_STRAND_IMPLEMENTATIONS) - // The head of a linked list of all implementations. - boost::scoped_ptr<strand_impl> implementations_[num_implementations]; + // Pool of implementations. + scoped_ptr<strand_impl> implementations_[num_implementations]; // Extra value used when hashing to prevent recycled memory locations from // getting the same strand implementation. diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp index c014855..e05c3a7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp @@ -2,7 +2,7 @@ // detail/task_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,9 +19,10 @@ #if !defined(BOOST_ASIO_HAS_IOCP) -#include <boost/detail/atomic_count.hpp> #include <boost/system/error_code.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/detail/atomic_count.hpp> +#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/reactor_fwd.hpp> @@ -40,11 +41,10 @@ class task_io_service public: typedef task_io_service_operation operation; - // Constructor. - BOOST_ASIO_DECL task_io_service(boost::asio::io_service& io_service); - - // How many concurrent threads are likely to run the io_service. - BOOST_ASIO_DECL void init(std::size_t concurrency_hint); + // Constructor. Specifies the number of concurrent threads that are likely to + // run the io_service. If set to 1 certain optimisation are performed. + BOOST_ASIO_DECL task_io_service(boost::asio::io_service& io_service, + std::size_t concurrency_hint = 0); // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); @@ -67,6 +67,9 @@ public: // Interrupt the event processing loop. BOOST_ASIO_DECL void stop(); + // Determine whether the io_service is stopped. + BOOST_ASIO_DECL bool stopped() const; + // Reset in preparation for a subsequent run invocation. BOOST_ASIO_DECL void reset(); @@ -83,6 +86,12 @@ public: stop(); } + // Return whether a handler can be dispatched immediately. + bool can_dispatch() + { + return thread_call_stack::contains(this) != 0; + } + // Request invocation of the given handler. template <typename Handler> void dispatch(Handler handler); @@ -103,13 +112,41 @@ public: // that work_started() was previously called for each operation. BOOST_ASIO_DECL void post_deferred_completions(op_queue<operation>& ops); + // Request invocation of the given operation, preferring the thread-private + // queue if available, and return immediately. Assumes that work_started() + // has not yet been called for the operation. + BOOST_ASIO_DECL void post_private_immediate_completion(operation* op); + + // Request invocation of the given operation, preferring the thread-private + // queue if available, and return immediately. Assumes that work_started() + // was previously called for the operation. + BOOST_ASIO_DECL void post_private_deferred_completion(operation* op); + + // Process unfinished operations as part of a shutdown_service operation. + // Assumes that work_started() was previously called for the operations. + BOOST_ASIO_DECL void abandon_operations(op_queue<operation>& ops); + private: // Structure containing information about an idle thread. - struct idle_thread_info; + struct thread_info; + + // Request invocation of the given operation, avoiding the thread-private + // queue, and return immediately. Assumes that work_started() has not yet + // been called for the operation. + BOOST_ASIO_DECL void post_non_private_immediate_completion(operation* op); + + // Request invocation of the given operation, avoiding the thread-private + // queue, and return immediately. Assumes that work_started() was previously + // called for the operation. + BOOST_ASIO_DECL void post_non_private_deferred_completion(operation* op); - // Run at most one operation. Blocks only if this_idle_thread is non-null. - BOOST_ASIO_DECL std::size_t do_one(mutex::scoped_lock& lock, - idle_thread_info* this_idle_thread); + // Run at most one operation. May block. + BOOST_ASIO_DECL std::size_t do_run_one(mutex::scoped_lock& lock, + thread_info& this_thread, const boost::system::error_code& ec); + + // Poll for at most one operation. + BOOST_ASIO_DECL std::size_t do_poll_one(mutex::scoped_lock& lock, + thread_info& this_thread, const boost::system::error_code& ec); // Stop the task and all idle threads. BOOST_ASIO_DECL void stop_all_threads(mutex::scoped_lock& lock); @@ -128,11 +165,15 @@ private: struct task_cleanup; friend struct task_cleanup; - // Helper class to call work_finished() on block exit. - struct work_finished_on_block_exit; + // Helper class to call work-related operations on block exit. + struct work_cleanup; + friend struct work_cleanup; + + // Whether to optimise for single-threaded use cases. + const bool one_thread_; // Mutex to protect access to internal data. - mutex mutex_; + mutable mutex mutex_; // The task to be run by this service. reactor* task_; @@ -147,7 +188,7 @@ private: bool task_interrupted_; // The count of unfinished work. - boost::detail::atomic_count outstanding_work_; + atomic_count outstanding_work_; // The queue of handlers that are ready to be delivered. op_queue<operation> op_queue_; @@ -158,8 +199,11 @@ private: // Flag to indicate that the dispatcher has been shut down. bool shutdown_; + // Per-thread call stack to track the state of each thread in the io_service. + typedef call_stack<task_io_service, thread_info> thread_call_stack; + // The threads that are currently idle. - idle_thread_info* first_idle_thread_; + thread_info* first_idle_thread_; }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp index b3243b7..4aa0ec3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp @@ -2,7 +2,7 @@ // detail/task_io_service_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service_operation.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service_operation.hpp index 08164fa..1bf1301 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service_operation.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service_operation.hpp @@ -2,7 +2,7 @@ // detail/task_io_service_operation.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,6 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/system/error_code.hpp> +#include <boost/asio/detail/handler_tracking.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/task_io_service_fwd.hpp> @@ -27,12 +28,13 @@ namespace detail { // Base class for all operations. A function pointer is used instead of virtual // functions to avoid the associated overhead. -class task_io_service_operation +class task_io_service_operation BOOST_ASIO_INHERIT_TRACKED_HANDLER { public: - void complete(task_io_service& owner) + void complete(task_io_service& owner, + const boost::system::error_code& ec, std::size_t bytes_transferred) { - func_(&owner, this, boost::system::error_code(), 0); + func_(&owner, this, ec, bytes_transferred); } void destroy() @@ -43,11 +45,12 @@ public: protected: typedef void (*func_type)(task_io_service*, task_io_service_operation*, - boost::system::error_code, std::size_t); + const boost::system::error_code&, std::size_t); task_io_service_operation(func_type func) : next_(0), - func_(func) + func_(func), + task_result_(0) { } @@ -60,6 +63,9 @@ private: friend class op_queue_access; task_io_service_operation* next_; func_type func_; +protected: + friend class task_io_service; + unsigned int task_result_; // Passed into bytes transferred. }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/thread.hpp b/3rdParty/Boost/src/boost/asio/detail/thread.hpp index 48cffb1..5b452cf 100644 --- a/3rdParty/Boost/src/boost/asio/detail/thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/thread.hpp @@ -2,7 +2,7 @@ // detail/thread.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp b/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp index 43bc9c3..bfb545a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp @@ -2,7 +2,7 @@ // detail/throw_error.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp index 328a9ed..d14ba7c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp @@ -2,7 +2,7 @@ // detail/timer_queue.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -20,15 +20,12 @@ #include <vector> #include <boost/config.hpp> #include <boost/limits.hpp> +#include <boost/cstdint.hpp> +#include <boost/asio/detail/date_time_fwd.hpp> #include <boost/asio/detail/op_queue.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/error.hpp> -#include <boost/asio/time_traits.hpp> - -#include <boost/asio/detail/push_options.hpp> -#include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/asio/detail/pop_options.hpp> #include <boost/asio/detail/push_options.hpp> @@ -57,7 +54,7 @@ public: friend class timer_queue; // The operations waiting on the timer. - op_queue<timer_op> op_queue_; + op_queue<wait_op> op_queue_; // The index of the timer in the heap. std::size_t heap_index_; @@ -77,7 +74,7 @@ public: // Add a new timer to the queue. Returns true if this is the timer that is // earliest in the queue, in which case the reactor's event demultiplexing // function call may need to be interrupted and restarted. - bool enqueue_timer(const time_type& time, per_timer_data& timer, timer_op* op) + bool enqueue_timer(const time_type& time, per_timer_data& timer, wait_op* op) { // Enqueue the timer object. if (timer.prev_ == 0 && &timer != timers_) @@ -124,17 +121,10 @@ public: if (heap_.empty()) return max_duration; - boost::posix_time::time_duration duration = Time_Traits::to_posix_duration( - Time_Traits::subtract(heap_[0].time_, Time_Traits::now())); - - if (duration > boost::posix_time::milliseconds(max_duration)) - duration = boost::posix_time::milliseconds(max_duration); - else if (duration <= boost::posix_time::milliseconds(0)) - duration = boost::posix_time::milliseconds(0); - else if (duration < boost::posix_time::milliseconds(1)) - duration = boost::posix_time::milliseconds(1); - - return duration.total_milliseconds(); + return this->to_msec( + Time_Traits::to_posix_duration( + Time_Traits::subtract(heap_[0].time_, Time_Traits::now())), + max_duration); } // Get the time for the timer that is earliest in the queue. @@ -143,28 +133,24 @@ public: if (heap_.empty()) return max_duration; - boost::posix_time::time_duration duration = Time_Traits::to_posix_duration( - Time_Traits::subtract(heap_[0].time_, Time_Traits::now())); - - if (duration > boost::posix_time::microseconds(max_duration)) - duration = boost::posix_time::microseconds(max_duration); - else if (duration <= boost::posix_time::microseconds(0)) - duration = boost::posix_time::microseconds(0); - else if (duration < boost::posix_time::microseconds(1)) - duration = boost::posix_time::microseconds(1); - - return duration.total_microseconds(); + return this->to_usec( + Time_Traits::to_posix_duration( + Time_Traits::subtract(heap_[0].time_, Time_Traits::now())), + max_duration); } // Dequeue all timers not later than the current time. virtual void get_ready_timers(op_queue<operation>& ops) { - const time_type now = Time_Traits::now(); - while (!heap_.empty() && !Time_Traits::less_than(now, heap_[0].time_)) + if (!heap_.empty()) { - per_timer_data* timer = heap_[0].timer_; - ops.push(timer->op_queue_); - remove_timer(*timer); + const time_type now = Time_Traits::now(); + while (!heap_.empty() && !Time_Traits::less_than(now, heap_[0].time_)) + { + per_timer_data* timer = heap_[0].timer_; + ops.push(timer->op_queue_); + remove_timer(*timer); + } } } @@ -183,20 +169,23 @@ public: heap_.clear(); } - // Cancel and dequeue the timers with the given token. - std::size_t cancel_timer(per_timer_data& timer, op_queue<operation>& ops) + // Cancel and dequeue operations for the given timer. + std::size_t cancel_timer(per_timer_data& timer, op_queue<operation>& ops, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()) { std::size_t num_cancelled = 0; if (timer.prev_ != 0 || &timer == timers_) { - while (timer_op* op = timer.op_queue_.front()) + while (wait_op* op = (num_cancelled != max_cancelled) + ? timer.op_queue_.front() : 0) { op->ec_ = boost::asio::error::operation_aborted; timer.op_queue_.pop(); ops.push(op); ++num_cancelled; } - remove_timer(timer); + if (timer.op_queue_.empty()) + remove_timer(timer); } return num_cancelled; } @@ -286,9 +275,39 @@ private: } // Determine if the specified absolute time is positive infinity. - static bool is_positive_infinity(const boost::posix_time::ptime& time) + template <typename T, typename TimeSystem> + static bool is_positive_infinity( + const boost::date_time::base_time<T, TimeSystem>& time) + { + return time.is_pos_infinity(); + } + + // Helper function to convert a duration into milliseconds. + template <typename Duration> + long to_msec(const Duration& d, long max_duration) const { - return time == boost::posix_time::pos_infin; + if (d.ticks() <= 0) + return 0; + boost::int64_t msec = d.total_milliseconds(); + if (msec == 0) + return 1; + if (msec > max_duration) + return max_duration; + return static_cast<long>(msec); + } + + // Helper function to convert a duration into microseconds. + template <typename Duration> + long to_usec(const Duration& d, long max_duration) const + { + if (d.ticks() <= 0) + return 0; + boost::int64_t usec = d.total_microseconds(); + if (usec == 0) + return 1; + if (usec > max_duration) + return max_duration; + return static_cast<long>(usec); } // The head of a linked list of all active timers. @@ -307,63 +326,6 @@ private: std::vector<heap_entry> heap_; }; -#if !defined(BOOST_ASIO_HEADER_ONLY) - -struct forwarding_posix_time_traits : time_traits<boost::posix_time::ptime> {}; - -// Template specialisation for the commonly used instantation. -template <> -class timer_queue<time_traits<boost::posix_time::ptime> > - : public timer_queue_base -{ -public: - // The time type. - typedef boost::posix_time::ptime time_type; - - // The duration type. - typedef boost::posix_time::time_duration duration_type; - - // Per-timer data. - typedef timer_queue<forwarding_posix_time_traits>::per_timer_data - per_timer_data; - - // Constructor. - BOOST_ASIO_DECL timer_queue(); - - // Destructor. - BOOST_ASIO_DECL virtual ~timer_queue(); - - // Add a new timer to the queue. Returns true if this is the timer that is - // earliest in the queue, in which case the reactor's event demultiplexing - // function call may need to be interrupted and restarted. - BOOST_ASIO_DECL bool enqueue_timer(const time_type& time, - per_timer_data& timer, timer_op* op); - - // Whether there are no timers in the queue. - BOOST_ASIO_DECL virtual bool empty() const; - - // Get the time for the timer that is earliest in the queue. - BOOST_ASIO_DECL virtual long wait_duration_msec(long max_duration) const; - - // Get the time for the timer that is earliest in the queue. - BOOST_ASIO_DECL virtual long wait_duration_usec(long max_duration) const; - - // Dequeue all timers not later than the current time. - BOOST_ASIO_DECL virtual void get_ready_timers(op_queue<operation>& ops); - - // Dequeue all timers. - BOOST_ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops); - - // Cancel and dequeue the timers with the given token. - BOOST_ASIO_DECL std::size_t cancel_timer( - per_timer_data& timer, op_queue<operation>& ops); - -private: - timer_queue<forwarding_posix_time_traits> impl_; -}; - -#endif // !defined(BOOST_ASIO_HEADER_ONLY) - } // namespace detail } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp index d493871..cc7ef34 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_fwd.hpp index 14c6319..c97753f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_fwd.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_ptime.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_ptime.hpp new file mode 100644 index 0000000..4c32ece --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_ptime.hpp @@ -0,0 +1,91 @@ +// +// detail/timer_queue_ptime.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP +#define BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/time_traits.hpp> +#include <boost/asio/detail/timer_queue.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct forwarding_posix_time_traits : time_traits<boost::posix_time::ptime> {}; + +// Template specialisation for the commonly used instantation. +template <> +class timer_queue<time_traits<boost::posix_time::ptime> > + : public timer_queue_base +{ +public: + // The time type. + typedef boost::posix_time::ptime time_type; + + // The duration type. + typedef boost::posix_time::time_duration duration_type; + + // Per-timer data. + typedef timer_queue<forwarding_posix_time_traits>::per_timer_data + per_timer_data; + + // Constructor. + BOOST_ASIO_DECL timer_queue(); + + // Destructor. + BOOST_ASIO_DECL virtual ~timer_queue(); + + // Add a new timer to the queue. Returns true if this is the timer that is + // earliest in the queue, in which case the reactor's event demultiplexing + // function call may need to be interrupted and restarted. + BOOST_ASIO_DECL bool enqueue_timer(const time_type& time, + per_timer_data& timer, wait_op* op); + + // Whether there are no timers in the queue. + BOOST_ASIO_DECL virtual bool empty() const; + + // Get the time for the timer that is earliest in the queue. + BOOST_ASIO_DECL virtual long wait_duration_msec(long max_duration) const; + + // Get the time for the timer that is earliest in the queue. + BOOST_ASIO_DECL virtual long wait_duration_usec(long max_duration) const; + + // Dequeue all timers not later than the current time. + BOOST_ASIO_DECL virtual void get_ready_timers(op_queue<operation>& ops); + + // Dequeue all timers. + BOOST_ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops); + + // Cancel and dequeue operations for the given timer. + BOOST_ASIO_DECL std::size_t cancel_timer( + per_timer_data& timer, op_queue<operation>& ops, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); + +private: + timer_queue<forwarding_posix_time_traits> impl_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/timer_queue_ptime.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_set.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_set.hpp index 549d7e6..0289259 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue_set.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_set.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_set.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_scheduler.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_scheduler.hpp index 2edc0c8..8feea78 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_scheduler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_scheduler.hpp @@ -2,7 +2,7 @@ // detail/timer_scheduler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_scheduler_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_scheduler_fwd.hpp index e01b657..a72e256 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_scheduler_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_scheduler_fwd.hpp @@ -2,7 +2,7 @@ // detail/timer_scheduler_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp index 35ed8e2..d14a959 100644 --- a/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,6 +19,8 @@ #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) # include <boost/asio/detail/null_tss_ptr.hpp> +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) +# include <boost/asio/detail/keyword_tss_ptr.hpp> #elif defined(BOOST_WINDOWS) # include <boost/asio/detail/win_tss_ptr.hpp> #elif defined(BOOST_HAS_PTHREADS) @@ -37,6 +39,8 @@ template <typename T> class tss_ptr #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) : public null_tss_ptr<T> +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + : public keyword_tss_ptr<T> #elif defined(BOOST_WINDOWS) : public win_tss_ptr<T> #elif defined(BOOST_HAS_PTHREADS) @@ -48,6 +52,8 @@ public: { #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) null_tss_ptr<T>::operator=(value); +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + keyword_tss_ptr<T>::operator=(value); #elif defined(BOOST_WINDOWS) win_tss_ptr<T>::operator=(value); #elif defined(BOOST_HAS_PTHREADS) diff --git a/3rdParty/Boost/src/boost/asio/detail/wait_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/wait_handler.hpp index 95be6bd..b511be8 100644 --- a/3rdParty/Boost/src/boost/asio/detail/wait_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wait_handler.hpp @@ -2,7 +2,7 @@ // detail/wait_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,7 +19,8 @@ #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/timer_op.hpp> +#include <boost/asio/detail/wait_op.hpp> +#include <boost/asio/io_service.hpp> #include <boost/asio/detail/push_options.hpp> @@ -28,24 +29,27 @@ namespace asio { namespace detail { template <typename Handler> -class wait_handler : public timer_op +class wait_handler : public wait_op { public: BOOST_ASIO_DEFINE_HANDLER_PTR(wait_handler); - wait_handler(Handler h) - : timer_op(&wait_handler::do_complete), - handler_(h) + wait_handler(Handler& h) + : wait_op(&wait_handler::do_complete), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. wait_handler* h(static_cast<wait_handler*>(base)); ptr p = { boost::addressof(h->handler_), h, h }; + BOOST_ASIO_HANDLER_COMPLETION((h)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -60,8 +64,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_op.hpp b/3rdParty/Boost/src/boost/asio/detail/wait_op.hpp index 24a536c..0209eb0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wait_op.hpp @@ -1,15 +1,15 @@ // -// detail/timer_op.hpp -// ~~~~~~~~~~~~~~~~~~~ +// detail/wait_op.hpp +// ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_TIMER_OP_HPP -#define BOOST_ASIO_DETAIL_TIMER_OP_HPP +#ifndef BOOST_ASIO_DETAIL_WAIT_OP_HPP +#define BOOST_ASIO_DETAIL_WAIT_OP_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once @@ -24,7 +24,7 @@ namespace boost { namespace asio { namespace detail { -class timer_op +class wait_op : public operation { public: @@ -32,7 +32,7 @@ public: boost::system::error_code ec_; protected: - timer_op(func_type func) + wait_op(func_type func) : operation(func) { } @@ -44,4 +44,4 @@ protected: #include <boost/asio/detail/pop_options.hpp> -#endif // BOOST_ASIO_DETAIL_TIMER_OP_HPP +#endif // BOOST_ASIO_DETAIL_WAIT_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/weak_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/weak_ptr.hpp index 81a8b06..af9a08d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/weak_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/weak_ptr.hpp @@ -2,7 +2,7 @@ // detail/weak_ptr.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,23 +16,22 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/version.hpp> -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) # include <memory> -#else +#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) # include <boost/weak_ptr.hpp> -#endif +#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) namespace boost { namespace asio { namespace detail { -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) using std::weak_ptr; -#else +#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) using boost::weak_ptr; -#endif +#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) } // namespace detail } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/detail/win_event.hpp b/3rdParty/Boost/src/boost/asio/detail/win_event.hpp index 63c25c4..6314048 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_event.hpp @@ -2,7 +2,7 @@ // detail/win_event.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp index 8636a91..afb40d0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/win_fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,6 +19,7 @@ #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/push_options.hpp> @@ -28,39 +29,67 @@ namespace asio { namespace detail { // Adapts the FD_SET type to meet the Descriptor_Set concept's requirements. -class win_fd_set_adapter +class win_fd_set_adapter : noncopyable { public: - enum { win_fd_set_size = 1024 }; + enum { default_fd_set_size = 1024 }; win_fd_set_adapter() - : max_descriptor_(invalid_socket) + : capacity_(default_fd_set_size), + max_descriptor_(invalid_socket) { - fd_set_.fd_count = 0; + fd_set_ = static_cast<win_fd_set*>(::operator new( + sizeof(win_fd_set) - sizeof(SOCKET) + + sizeof(SOCKET) * (capacity_))); + fd_set_->fd_count = 0; + } + + ~win_fd_set_adapter() + { + ::operator delete(fd_set_); + } + + void reset() + { + fd_set_->fd_count = 0; + max_descriptor_ = invalid_socket; } bool set(socket_type descriptor) { - for (u_int i = 0; i < fd_set_.fd_count; ++i) - if (fd_set_.fd_array[i] == descriptor) + for (u_int i = 0; i < fd_set_->fd_count; ++i) + if (fd_set_->fd_array[i] == descriptor) return true; - if (fd_set_.fd_count < win_fd_set_size) + + if (fd_set_->fd_count == capacity_) { - fd_set_.fd_array[fd_set_.fd_count++] = descriptor; - return true; + u_int new_capacity = capacity_ + capacity_ / 2; + win_fd_set* new_fd_set = static_cast<win_fd_set*>(::operator new( + sizeof(win_fd_set) - sizeof(SOCKET) + + sizeof(SOCKET) * (new_capacity))); + + new_fd_set->fd_count = fd_set_->fd_count; + for (u_int i = 0; i < fd_set_->fd_count; ++i) + new_fd_set->fd_array[i] = fd_set_->fd_array[i]; + + ::operator delete(fd_set_); + fd_set_ = new_fd_set; + capacity_ = new_capacity; } - return false; + + fd_set_->fd_array[fd_set_->fd_count++] = descriptor; + return true; } bool is_set(socket_type descriptor) const { return !!__WSAFDIsSet(descriptor, - const_cast<fd_set*>(reinterpret_cast<const fd_set*>(&fd_set_))); + const_cast<fd_set*>(reinterpret_cast<const fd_set*>(fd_set_))); } operator fd_set*() { - return reinterpret_cast<fd_set*>(&fd_set_); + return reinterpret_cast<fd_set*>(fd_set_); } socket_type max_descriptor() const @@ -69,15 +98,19 @@ public: } private: + // This structure is defined to be compatible with the Windows API fd_set - // structure, but without being dependent on the value of FD_SETSIZE. + // structure, but without being dependent on the value of FD_SETSIZE. We use + // the "struct hack" to allow the number of descriptors to be varied at + // runtime. struct win_fd_set { u_int fd_count; - SOCKET fd_array[win_fd_set_size]; + SOCKET fd_array[1]; }; - win_fd_set fd_set_; + win_fd_set* fd_set_; + u_int capacity_; socket_type max_descriptor_; }; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/win_fenced_block.hpp index 769db2e..5e56aa3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/win_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -31,8 +31,16 @@ class win_fenced_block : private noncopyable { public: - // Constructor. - win_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit win_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit win_fenced_block(full_t) { #if defined(__BORLANDC__) LONG barrier = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_read_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_read_op.hpp index 5edffa3..8b41ab4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_read_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_read_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_read_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -41,20 +41,26 @@ class win_iocp_handle_read_op : public operation public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_read_op); - win_iocp_handle_read_op(const MutableBufferSequence& buffers, Handler handler) + win_iocp_handle_read_op( + const MutableBufferSequence& buffers, Handler& handler) : operation(&win_iocp_handle_read_op::do_complete), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_handle_read_op* o(static_cast<win_iocp_handle_read_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) if (owner) { @@ -82,8 +88,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp index 86c4391..68a9f90 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -41,7 +41,7 @@ class win_iocp_handle_service { public: // The native type of a stream handle. - typedef HANDLE native_type; + typedef HANDLE native_handle_type; // The implementation type of the stream handle. class implementation_type @@ -61,7 +61,7 @@ public: friend class win_iocp_handle_service; // The native stream handle representation. - native_type handle_; + native_handle_type handle_; // The ID of the thread from which it is safe to cancel asynchronous // operations. 0 means no asynchronous operations have been started yet. @@ -82,12 +82,21 @@ public: // Construct a new handle implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); + // Move-construct a new handle implementation. + BOOST_ASIO_DECL void move_construct(implementation_type& impl, + implementation_type& other_impl); + + // Move-assign from another handle implementation. + BOOST_ASIO_DECL void move_assign(implementation_type& impl, + win_iocp_handle_service& other_service, + implementation_type& other_impl); + // Destroy a handle implementation. BOOST_ASIO_DECL void destroy(implementation_type& impl); // Assign a native handle to a handle implementation. BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec); + const native_handle_type& handle, boost::system::error_code& ec); // Determine whether the handle is open. bool is_open(const implementation_type& impl) const @@ -100,7 +109,7 @@ public: boost::system::error_code& ec); // Get the native handle representation. - native_type native(const implementation_type& impl) const + native_handle_type native_handle(const implementation_type& impl) const { return impl.handle_; } @@ -136,7 +145,19 @@ public: void async_write_some(implementation_type& impl, const ConstBufferSequence& buffers, Handler handler) { - async_write_some_at(impl, 0, buffers, handler); + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(buffers, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_write_some")); + + start_write_op(impl, 0, + buffer_sequence_adapter<boost::asio::const_buffer, + ConstBufferSequence>::first(buffers), p.p); + p.v = p.p = 0; } // Start an asynchronous write at a specified offset. The data being written @@ -152,6 +173,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_write_some_at")); + start_write_op(impl, offset, buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence>::first(buffers), p.p); @@ -184,7 +207,19 @@ public: void async_read_some(implementation_type& impl, const MutableBufferSequence& buffers, Handler handler) { - async_read_some_at(impl, 0, buffers, handler); + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(buffers, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_read_some")); + + start_read_op(impl, 0, + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence>::first(buffers), p.p); + p.v = p.p = 0; } // Start an asynchronous read at a specified offset. The buffer for the data @@ -201,6 +236,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_read_some_at")); + start_read_op(impl, offset, buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence>::first(buffers), p.p); diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_write_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_write_op.hpp index 574dc22..c87cd60 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_write_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_write_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_write_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -41,20 +41,22 @@ class win_iocp_handle_write_op : public operation public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_write_op); - win_iocp_handle_write_op(const ConstBufferSequence& buffers, Handler handler) + win_iocp_handle_write_op(const ConstBufferSequence& buffers, Handler& handler) : operation(&win_iocp_handle_write_op::do_complete), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& ec, std::size_t bytes_transferred) { // Take ownership of the operation object. win_iocp_handle_write_op* o(static_cast<win_iocp_handle_write_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) if (owner) { @@ -78,8 +80,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp index 4c88e7b..0e3bb0b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,18 +19,20 @@ #if defined(BOOST_ASIO_HAS_IOCP) -#include <boost/scoped_ptr.hpp> +#include <boost/limits.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> +#include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> +#include <boost/asio/detail/thread.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/detail/win_iocp_io_service_fwd.hpp> #include <boost/asio/detail/win_iocp_operation.hpp> -#include <boost/asio/detail/thread.hpp> #include <boost/asio/detail/push_options.hpp> @@ -38,16 +40,17 @@ namespace boost { namespace asio { namespace detail { -class timer_op; +class wait_op; class win_iocp_io_service : public boost::asio::detail::service_base<win_iocp_io_service> { public: - // Constructor. - BOOST_ASIO_DECL win_iocp_io_service(boost::asio::io_service& io_service); - BOOST_ASIO_DECL void init(size_t concurrency_hint); + // Constructor. Specifies a concurrency hint that is passed through to the + // underlying I/O completion port. + BOOST_ASIO_DECL win_iocp_io_service(boost::asio::io_service& io_service, + size_t concurrency_hint = 0); // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); @@ -76,6 +79,12 @@ public: // Stop the event processing loop. BOOST_ASIO_DECL void stop(); + // Determine whether the io_service is stopped. + bool stopped() const + { + return ::InterlockedExchangeAdd(&stopped_, 0) != 0; + } + // Reset in preparation for a subsequent run invocation. void reset() { @@ -95,6 +104,12 @@ public: stop(); } + // Return whether a handler can be dispatched immediately. + bool can_dispatch() + { + return call_stack<win_iocp_io_service>::contains(this) != 0; + } + // Request invocation of the given handler. template <typename Handler> void dispatch(Handler handler); @@ -120,6 +135,26 @@ public: BOOST_ASIO_DECL void post_deferred_completions( op_queue<win_iocp_operation>& ops); + // Request invocation of the given operation using the thread-private queue + // and return immediately. Assumes that work_started() has not yet been + // called for the operation. + void post_private_immediate_completion(win_iocp_operation* op) + { + post_immediate_completion(op); + } + + // Request invocation of the given operation using the thread-private queue + // and return immediately. Assumes that work_started() was previously called + // for the operation. + void post_private_deferred_completion(win_iocp_operation* op) + { + post_deferred_completion(op); + } + + // Process unfinished operations as part of a shutdown_service operation. + // Assumes that work_started() was previously called for the operations. + BOOST_ASIO_DECL void abandon_operations(op_queue<operation>& ops); + // Called after starting an overlapped I/O operation that did not complete // immediately. The caller must have already called work_started() prior to // starting the operation. @@ -150,13 +185,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer associated with the given token. Returns the number of // handlers that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); private: #if defined(WINVER) && (WINVER < 0x0500) @@ -199,7 +235,7 @@ private: long outstanding_work_; // Flag to indicate whether the event loop has been stopped. - long stopped_; + mutable long stopped_; // Flag to indicate whether the service has been shut down. long shutdown_; @@ -233,7 +269,7 @@ private: friend struct timer_thread_function; // Background thread used for processing timeouts. - boost::scoped_ptr<thread> timer_thread_; + scoped_ptr<thread> timer_thread_; // A waitable timer object used for waiting for timeouts. auto_handle waitable_timer_; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp index b6da9ec..ec31fa1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_io_service_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_null_buffers_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_null_buffers_op.hpp index b3ecbbd..021dfdb 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_null_buffers_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_null_buffers_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_null_buffers_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -42,11 +42,11 @@ public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_null_buffers_op); win_iocp_null_buffers_op(socket_ops::weak_cancel_token_type cancel_token, - Handler handler) + Handler& handler) : reactor_op(&win_iocp_null_buffers_op::do_perform, &win_iocp_null_buffers_op::do_complete), cancel_token_(cancel_token), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -56,12 +56,17 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_null_buffers_op* o(static_cast<win_iocp_null_buffers_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // The reactor may have stored a result in the operation object. if (o->ec_) ec = o->ec_; @@ -93,8 +98,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_operation.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_operation.hpp index 3963479..67b5466 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_operation.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_operation.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_operation.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,7 +19,9 @@ #if defined(BOOST_ASIO_HAS_IOCP) +#include <boost/asio/detail/handler_tracking.hpp> #include <boost/asio/detail/op_queue.hpp> +#include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/win_iocp_io_service_fwd.hpp> #include <boost/system/error_code.hpp> @@ -33,11 +35,12 @@ namespace detail { // functions to avoid the associated overhead. class win_iocp_operation : public OVERLAPPED + BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER { public: void complete(win_iocp_io_service& owner, - const boost::system::error_code& ec = boost::system::error_code(), - std::size_t bytes_transferred = 0) + const boost::system::error_code& ec, + std::size_t bytes_transferred) { func_(&owner, this, ec, bytes_transferred); } @@ -48,8 +51,9 @@ public: } protected: - typedef void (*func_type)(win_iocp_io_service*, - win_iocp_operation*, boost::system::error_code, std::size_t); + typedef void (*func_type)( + win_iocp_io_service*, win_iocp_operation*, + const boost::system::error_code&, std::size_t); win_iocp_operation(func_type func) : next_(0), diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_op.hpp index 149eaa5..235f48e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_overlapped_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -39,19 +39,21 @@ class win_iocp_overlapped_op : public operation public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_overlapped_op); - win_iocp_overlapped_op(Handler handler) + win_iocp_overlapped_op(Handler& handler) : operation(&win_iocp_overlapped_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& ec, std::size_t bytes_transferred) { // Take ownership of the operation object. win_iocp_overlapped_op* o(static_cast<win_iocp_overlapped_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -66,8 +68,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp index c560bc3..a6df254 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -47,11 +47,11 @@ public: // Construct an win_iocp_overlapped_ptr to contain the specified handler. template <typename Handler> explicit win_iocp_overlapped_ptr( - boost::asio::io_service& io_service, Handler handler) + boost::asio::io_service& io_service, BOOST_ASIO_MOVE_ARG(Handler) handler) : ptr_(0), iocp_service_(0) { - this->reset(io_service, handler); + this->reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler)); } // Destructor automatically frees the OVERLAPPED object unless released. @@ -82,6 +82,10 @@ public: boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", + &io_service.impl_, "overlapped")); + io_service.impl_.work_started(); reset(); ptr_ = p.p; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp index 8b543d2..7d96f6d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 @@ -36,7 +36,7 @@ class win_iocp_serial_port_service { public: // The native type of a serial port. - typedef win_iocp_handle_service::native_type native_type; + typedef win_iocp_handle_service::native_handle_type native_handle_type; // The implementation type of the serial port. typedef win_iocp_handle_service::implementation_type implementation_type; @@ -54,6 +54,22 @@ public: handle_service_.construct(impl); } + // Move-construct a new serial port implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + handle_service_.move_construct(impl, other_impl); + } + + // Move-assign from another serial port implementation. + void move_assign(implementation_type& impl, + win_iocp_serial_port_service& other_service, + implementation_type& other_impl) + { + handle_service_.move_assign(impl, + other_service.handle_service_, other_impl); + } + // Destroy a serial port implementation. void destroy(implementation_type& impl) { @@ -66,9 +82,9 @@ public: // Assign a native handle to a serial port implementation. boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { - return handle_service_.assign(impl, native_handle, ec); + return handle_service_.assign(impl, handle, ec); } // Determine whether the serial port is open. @@ -85,9 +101,9 @@ public: } // Get the native serial port representation. - native_type native(implementation_type& impl) + native_handle_type native_handle(implementation_type& impl) { - return handle_service_.native(impl); + return handle_service_.native_handle(impl); } // Cancel all operations associated with the handle. diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_accept_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_accept_op.hpp index ecc1f2d..18db3b4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_accept_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_accept_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_accept_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -45,7 +45,7 @@ public: win_iocp_socket_accept_op(win_iocp_socket_service_base& socket_service, socket_type socket, Socket& peer, const Protocol& protocol, typename Protocol::endpoint* peer_endpoint, - bool enable_connection_aborted, Handler handler) + bool enable_connection_aborted, Handler& handler) : operation(&win_iocp_socket_accept_op::do_complete), socket_service_(socket_service), socket_(socket), @@ -53,7 +53,7 @@ public: protocol_(protocol), peer_endpoint_(peer_endpoint), enable_connection_aborted_(enable_connection_aborted), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -73,8 +73,11 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t /*bytes_transferred*/) + const boost::system::error_code& result_ec, + std::size_t /*bytes_transferred*/) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_socket_accept_op* o(static_cast<win_iocp_socket_accept_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; @@ -107,7 +110,7 @@ public: if (!ec) { o->peer_.assign(o->protocol_, - typename Socket::native_type( + typename Socket::native_handle_type( o->new_socket_.get(), peer_endpoint), ec); if (!ec) o->new_socket_.release(); @@ -118,6 +121,8 @@ public: *o->peer_endpoint_ = peer_endpoint; } + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -132,8 +137,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recv_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recv_op.hpp index 61d053c..b50b742 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recv_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recv_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_recv_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -43,22 +43,27 @@ public: win_iocp_socket_recv_op(socket_ops::state_type state, socket_ops::weak_cancel_token_type cancel_token, - const MutableBufferSequence& buffers, Handler handler) + const MutableBufferSequence& buffers, Handler& handler) : operation(&win_iocp_socket_recv_op::do_complete), state_(state), cancel_token_(cancel_token), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_socket_recv_op* o(static_cast<win_iocp_socket_recv_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) // Check whether buffers are still valid. if (owner) @@ -87,8 +92,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp index 6b364ee..798921d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_recvfrom_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -43,13 +43,13 @@ public: win_iocp_socket_recvfrom_op(Endpoint& endpoint, socket_ops::weak_cancel_token_type cancel_token, - const MutableBufferSequence& buffers, Handler handler) + const MutableBufferSequence& buffers, Handler& handler) : operation(&win_iocp_socket_recvfrom_op::do_complete), endpoint_(endpoint), endpoint_size_(static_cast<int>(endpoint.capacity())), cancel_token_(cancel_token), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -59,13 +59,18 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_socket_recvfrom_op* o( static_cast<win_iocp_socket_recvfrom_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) // Check whether buffers are still valid. if (owner) @@ -94,8 +99,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp new file mode 100644 index 0000000..db13fb8 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp @@ -0,0 +1,118 @@ +// +// detail/win_iocp_socket_recvmsg_op.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP +#define BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_IOCP) + +#include <boost/utility/addressof.hpp> +#include <boost/asio/detail/bind_handler.hpp> +#include <boost/asio/detail/buffer_sequence_adapter.hpp> +#include <boost/asio/detail/fenced_block.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/operation.hpp> +#include <boost/asio/detail/socket_ops.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/socket_base.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename MutableBufferSequence, typename Handler> +class win_iocp_socket_recvmsg_op : public operation +{ +public: + BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_recvmsg_op); + + win_iocp_socket_recvmsg_op( + socket_ops::weak_cancel_token_type cancel_token, + const MutableBufferSequence& buffers, + socket_base::message_flags& out_flags, Handler& handler) + : operation(&win_iocp_socket_recvmsg_op::do_complete), + cancel_token_(cancel_token), + buffers_(buffers), + out_flags_(out_flags), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) + { + } + + static void do_complete(io_service_impl* owner, operation* base, + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) + { + boost::system::error_code ec(result_ec); + + // Take ownership of the operation object. + win_iocp_socket_recvmsg_op* o( + static_cast<win_iocp_socket_recvmsg_op*>(base)); + ptr p = { boost::addressof(o->handler_), o, o }; + + BOOST_ASIO_HANDLER_COMPLETION((o)); + +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + // Check whether buffers are still valid. + if (owner) + { + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence>::validate(o->buffers_); + } +#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + + socket_ops::complete_iocp_recvmsg(o->cancel_token_, ec); + o->out_flags_ = 0; + + // Make a copy of the handler so that the memory can be deallocated before + // the upcall is made. Even if we're not about to make an upcall, a + // sub-object of the handler may be the true owner of the memory associated + // with the handler. Consequently, a local copy of the handler is required + // to ensure that any owning sub-object remains valid until after we have + // deallocated the memory here. + detail::binder2<Handler, boost::system::error_code, std::size_t> + handler(o->handler_, ec, bytes_transferred); + p.h = boost::addressof(handler.handler_); + p.reset(); + + // Make the upcall if required. + if (owner) + { + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); + boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; + } + } + +private: + socket_ops::weak_cancel_token_type cancel_token_; + MutableBufferSequence buffers_; + socket_base::message_flags& out_flags_; + Handler handler_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_IOCP) + +#endif // BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_send_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_send_op.hpp index 33bd380..fbd00ca 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_send_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_send_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_send_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -42,21 +42,26 @@ public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_send_op); win_iocp_socket_send_op(socket_ops::weak_cancel_token_type cancel_token, - const ConstBufferSequence& buffers, Handler handler) + const ConstBufferSequence& buffers, Handler& handler) : operation(&win_iocp_socket_send_op::do_complete), cancel_token_(cancel_token), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_socket_send_op* o(static_cast<win_iocp_socket_send_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) // Check whether buffers are still valid. if (owner) @@ -82,8 +87,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp index 183b74b..d6dc98b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -61,16 +61,16 @@ public: typedef typename Protocol::endpoint endpoint_type; // The native type of a socket. - class native_type + class native_handle_type { public: - native_type(socket_type s) + native_handle_type(socket_type s) : socket_(s), have_remote_endpoint_(false) { } - native_type(socket_type s, const endpoint_type& ep) + native_handle_type(socket_type s, const endpoint_type& ep) : socket_(s), have_remote_endpoint_(true), remote_endpoint_(ep) @@ -133,6 +133,39 @@ public: { } + // Move-construct a new socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + this->base_move_construct(impl, other_impl); + + impl.protocol_ = other_impl.protocol_; + other_impl.protocol_ = endpoint_type().protocol(); + + impl.have_remote_endpoint_ = other_impl.have_remote_endpoint_; + other_impl.have_remote_endpoint_ = false; + + impl.remote_endpoint_ = other_impl.remote_endpoint_; + other_impl.remote_endpoint_ = endpoint_type(); + } + + // Move-assign from another socket implementation. + void move_assign(implementation_type& impl, + win_iocp_socket_service_base& other_service, + implementation_type& other_impl) + { + this->base_move_assign(impl, other_service, other_impl); + + impl.protocol_ = other_impl.protocol_; + other_impl.protocol_ = endpoint_type().protocol(); + + impl.have_remote_endpoint_ = other_impl.have_remote_endpoint_; + other_impl.have_remote_endpoint_ = false; + + impl.remote_endpoint_ = other_impl.remote_endpoint_; + other_impl.remote_endpoint_ = endpoint_type(); + } + // Open a new socket implementation. boost::system::error_code open(implementation_type& impl, const protocol_type& protocol, boost::system::error_code& ec) @@ -149,7 +182,7 @@ public: // Assign a native socket to a socket implementation. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { if (!do_assign(impl, protocol.type(), native_socket, ec)) @@ -162,11 +195,11 @@ public: } // Get the native socket representation. - native_type native(implementation_type& impl) + native_handle_type native_handle(implementation_type& impl) { if (impl.have_remote_endpoint_) - return native_type(impl.socket_, impl.remote_endpoint_); - return native_type(impl.socket_); + return native_handle_type(impl.socket_, impl.remote_endpoint_); + return native_handle_type(impl.socket_); } // Bind the socket to the specified local endpoint. @@ -248,7 +281,7 @@ public: boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_write(impl.socket_, ec); + socket_ops::poll_write(impl.socket_, impl.state_, ec); return 0; } @@ -267,6 +300,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to")); + buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence> bufs(buffers); @@ -288,6 +323,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_send_to(null_buffers)")); + start_reactor_op(impl, reactor::write_op, p.p); p.v = p.p = 0; } @@ -320,7 +358,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_read(impl.socket_, ec); + socket_ops::poll_read(impl.socket_, impl.state_, ec); // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); @@ -344,6 +382,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(sender_endp, impl.cancel_token_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive_from")); + buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence> bufs(buffers); @@ -365,6 +405,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, + "async_receive_from(null_buffers)")); + // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); @@ -417,6 +460,8 @@ public: p.p = new (p.v) op(*this, impl.socket_, peer, impl.protocol_, peer_endpoint, enable_connection_aborted, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept")); + start_accept_op(impl, peer.is_open(), p.p->new_socket(), impl.protocol_.family(), impl.protocol_.type(), impl.protocol_.protocol(), p.p->output_buffer(), @@ -445,6 +490,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect")); + start_connect_op(impl, p.p, peer_endpoint.data(), static_cast<int>(peer_endpoint.size())); p.v = p.p = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service_base.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service_base.hpp index 32532f9..79580de 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service_base.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -40,6 +40,7 @@ #include <boost/asio/detail/win_iocp_null_buffers_op.hpp> #include <boost/asio/detail/win_iocp_socket_send_op.hpp> #include <boost/asio/detail/win_iocp_socket_recv_op.hpp> +#include <boost/asio/detail/win_iocp_socket_recvmsg_op.hpp> #include <boost/asio/detail/push_options.hpp> @@ -93,6 +94,15 @@ public: // Construct a new socket implementation. BOOST_ASIO_DECL void construct(base_implementation_type& impl); + // Move-construct a new socket implementation. + BOOST_ASIO_DECL void base_move_construct(base_implementation_type& impl, + base_implementation_type& other_impl); + + // Move-assign from another socket implementation. + BOOST_ASIO_DECL void base_move_assign(base_implementation_type& impl, + win_iocp_socket_service_base& other_service, + base_implementation_type& other_impl); + // Destroy a socket implementation. BOOST_ASIO_DECL void destroy(base_implementation_type& impl); @@ -142,7 +152,35 @@ public: return ec; } - /// Disable sends or receives on the socket. + // Gets the non-blocking mode of the socket. + bool non_blocking(const base_implementation_type& impl) const + { + return (impl.state_ & socket_ops::user_set_non_blocking) != 0; + } + + // Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(base_implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + socket_ops::set_user_non_blocking(impl.socket_, impl.state_, mode, ec); + return ec; + } + + // Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const base_implementation_type& impl) const + { + return (impl.state_ & socket_ops::internal_non_blocking) != 0; + } + + // Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(base_implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + socket_ops::set_internal_non_blocking(impl.socket_, impl.state_, mode, ec); + return ec; + } + + // Disable sends or receives on the socket. boost::system::error_code shutdown(base_implementation_type& impl, socket_base::shutdown_type what, boost::system::error_code& ec) { @@ -168,7 +206,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_write(impl.socket_, ec); + socket_ops::poll_write(impl.socket_, impl.state_, ec); return 0; } @@ -187,6 +225,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send")); + buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence> bufs(buffers); @@ -208,6 +248,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_send(null_buffers)")); + start_reactor_op(impl, reactor::write_op, p.p); p.v = p.p = 0; } @@ -230,7 +273,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_read(impl.socket_, ec); + socket_ops::poll_read(impl.socket_, impl.state_, ec); return 0; } @@ -249,6 +292,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.state_, impl.cancel_token_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive")); + buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence> bufs(buffers); @@ -270,10 +315,90 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive(null_buffers)")); + start_null_buffers_receive_op(impl, flags, p.p); p.v = p.p = 0; } + // Receive some data with associated flags. Returns the number of bytes + // received. + template <typename MutableBufferSequence> + size_t receive_with_flags(base_implementation_type& impl, + const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence> bufs(buffers); + + return socket_ops::sync_recvmsg(impl.socket_, impl.state_, + bufs.buffers(), bufs.count(), in_flags, out_flags, ec); + } + + // Wait until data can be received without blocking. + size_t receive_with_flags(base_implementation_type& impl, + const null_buffers&, socket_base::message_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + // Wait for socket to become ready. + socket_ops::poll_read(impl.socket_, impl.state_, ec); + + // Clear out_flags, since we cannot give it any other sensible value when + // performing a null_buffers operation. + out_flags = 0; + + return 0; + } + + // Start an asynchronous receive. The buffer for the data being received + // must be valid for the lifetime of the asynchronous operation. + template <typename MutableBufferSequence, typename Handler> + void async_receive_with_flags(base_implementation_type& impl, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_socket_recvmsg_op<MutableBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(impl.cancel_token_, buffers, out_flags, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive_with_flags")); + + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence> bufs(buffers); + + start_receive_op(impl, bufs.buffers(), bufs.count(), in_flags, false, p.p); + p.v = p.p = 0; + } + + // Wait until data can be received without blocking. + template <typename Handler> + void async_receive_with_flags(base_implementation_type& impl, + const null_buffers&, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_null_buffers_op<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(impl.cancel_token_, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, + "async_receive_with_flags(null_buffers)")); + + // Reset out_flags since it can be given no sensible value at this time. + out_flags = 0; + + start_null_buffers_receive_op(impl, in_flags, p.p); + p.v = p.p = 0; + } + // Helper function to restart an asynchronous accept operation. BOOST_ASIO_DECL void restart_accept_op(socket_type s, socket_holder& new_socket, int family, int type, int protocol, diff --git a/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp index 0c5dc26..930d01f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp @@ -2,7 +2,7 @@ // detail/win_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_object_handle_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_object_handle_service.hpp new file mode 100644 index 0000000..52a972d --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/win_object_handle_service.hpp @@ -0,0 +1,185 @@ +// +// detail/win_object_handle_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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 BOOST_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP +#define BOOST_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +#include <boost/utility/addressof.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/wait_handler.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +class win_object_handle_service +{ +public: + // The native type of an object handle. + typedef HANDLE native_handle_type; + + // The implementation type of the object handle. + class implementation_type + { + public: + // Default constructor. + implementation_type() + : handle_(INVALID_HANDLE_VALUE), + wait_handle_(INVALID_HANDLE_VALUE), + owner_(0), + next_(0), + prev_(0) + { + } + + private: + // Only this service will have access to the internal values. + friend class win_object_handle_service; + + // The native object handle representation. May be accessed or modified + // without locking the mutex. + native_handle_type handle_; + + // The handle used to unregister the wait operation. The mutex must be + // locked when accessing or modifying this member. + HANDLE wait_handle_; + + // The operations waiting on the object handle. If there is a registered + // wait then the mutex must be locked when accessing or modifying this + // member + op_queue<wait_op> op_queue_; + + // The service instance that owns the object handle implementation. + win_object_handle_service* owner_; + + // Pointers to adjacent handle implementations in linked list. The mutex + // must be locked when accessing or modifying these members. + implementation_type* next_; + implementation_type* prev_; + }; + + // Constructor. + BOOST_ASIO_DECL win_object_handle_service( + boost::asio::io_service& io_service); + + // Destroy all user-defined handler objects owned by the service. + BOOST_ASIO_DECL void shutdown_service(); + + // Construct a new handle implementation. + BOOST_ASIO_DECL void construct(implementation_type& impl); + + // Move-construct a new handle implementation. + BOOST_ASIO_DECL void move_construct(implementation_type& impl, + implementation_type& other_impl); + + // Move-assign from another handle implementation. + BOOST_ASIO_DECL void move_assign(implementation_type& impl, + win_object_handle_service& other_service, + implementation_type& other_impl); + + // Destroy a handle implementation. + BOOST_ASIO_DECL void destroy(implementation_type& impl); + + // Assign a native handle to a handle implementation. + BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, + const native_handle_type& handle, boost::system::error_code& ec); + + // Determine whether the handle is open. + bool is_open(const implementation_type& impl) const + { + return impl.handle_ != INVALID_HANDLE_VALUE && impl.handle_ != 0; + } + + // Destroy a handle implementation. + BOOST_ASIO_DECL boost::system::error_code close(implementation_type& impl, + boost::system::error_code& ec); + + // Get the native handle representation. + native_handle_type native_handle(const implementation_type& impl) const + { + return impl.handle_; + } + + // Cancel all operations associated with the handle. + BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec); + + // Perform a synchronous wait for the object to enter a signalled state. + BOOST_ASIO_DECL void wait(implementation_type& impl, + boost::system::error_code& ec); + + /// Start an asynchronous wait. + template <typename Handler> + void async_wait(implementation_type& impl, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef wait_handler<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "object_handle", &impl, "async_wait")); + + start_wait_op(impl, p.p); + p.v = p.p = 0; + } + +private: + // Helper function to start an asynchronous wait operation. + BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, wait_op* op); + + // Helper function to register a wait operation. + BOOST_ASIO_DECL void register_wait_callback( + implementation_type& impl, mutex::scoped_lock& lock); + + // Callback function invoked when the registered wait completes. + static BOOST_ASIO_DECL VOID CALLBACK wait_callback( + PVOID param, BOOLEAN timeout); + + // The io_service implementation used to post completions. + io_service_impl& io_service_; + + // Mutex to protect access to internal state. + mutex mutex_; + + // The head of a linked list of all implementations. + implementation_type* impl_list_; + + // Flag to indicate that the dispatcher has been shut down. + bool shutdown_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/win_object_handle_service.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +#endif // BOOST_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/win_static_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/win_static_mutex.hpp new file mode 100644 index 0000000..a54b36b --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/win_static_mutex.hpp @@ -0,0 +1,76 @@ +// +// detail/win_static_mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP +#define BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_WINDOWS) + +#include <boost/asio/detail/scoped_lock.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct win_static_mutex +{ + typedef boost::asio::detail::scoped_lock<win_static_mutex> scoped_lock; + + // Initialise the mutex. + BOOST_ASIO_DECL void init(); + + // Initialisation must be performed in a separate function to the "public" + // init() function since the compiler does not support the use of structured + // exceptions and C++ exceptions in the same function. + BOOST_ASIO_DECL int do_init(); + + // Lock the mutex. + void lock() + { + ::EnterCriticalSection(&crit_section_); + } + + // Unlock the mutex. + void unlock() + { + ::LeaveCriticalSection(&crit_section_); + } + + bool initialised_; + ::CRITICAL_SECTION crit_section_; +}; + +#if defined(UNDER_CE) +# define BOOST_ASIO_WIN_STATIC_MUTEX_INIT { false, { 0, 0, 0, 0, 0 } } +#else // defined(UNDER_CE) +# define BOOST_ASIO_WIN_STATIC_MUTEX_INIT { false, { 0, 0, 0, 0, 0, 0 } } +#endif // defined(UNDER_CE) + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/win_static_mutex.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // defined(BOOST_WINDOWS) + +#endif // BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp index 4e33bd9..754786e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp @@ -2,7 +2,7 @@ // detail/win_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp index 75811c1..44cacc6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/win_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp index 7f7b1e4..389cb9d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp @@ -2,7 +2,7 @@ // detail/wince_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -39,7 +39,7 @@ class wince_thread public: // Constructor. template <typename Function> - wince_thread(Function f) + wince_thread(Function f, unsigned int = 0) { std::auto_ptr<func_base> arg(new func<Function>(f)); DWORD thread_id = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp b/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp index dc50fbf..702ba71 100644 --- a/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp @@ -2,7 +2,7 @@ // detail/winsock_init.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp index b326847..d82da22 100644 --- a/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp @@ -2,7 +2,7 @@ // detail/wrapped_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -31,12 +31,26 @@ class wrapped_handler public: typedef void result_type; - wrapped_handler(Dispatcher dispatcher, Handler handler) + wrapped_handler(Dispatcher dispatcher, Handler& handler) : dispatcher_(dispatcher), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + wrapped_handler(const wrapped_handler& other) + : dispatcher_(other.dispatcher_), + handler_(other.handler_) + { + } + + wrapped_handler(wrapped_handler&& other) + : dispatcher_(other.dispatcher_), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()() { dispatcher_.dispatch(handler_); @@ -126,11 +140,31 @@ template <typename Handler, typename Context> class rewrapped_handler { public: + explicit rewrapped_handler(Handler& handler, const Context& context) + : context_(context), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) + { + } + explicit rewrapped_handler(const Handler& handler, const Context& context) - : handler_(handler), - context_(context) + : context_(context), + handler_(handler) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + rewrapped_handler(const rewrapped_handler& other) + : context_(other.context_), + handler_(other.handler_) + { + } + + rewrapped_handler(rewrapped_handler&& other) + : context_(BOOST_ASIO_MOVE_CAST(Context)(other.context_)), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()() { @@ -143,8 +177,8 @@ public: } //private: - Handler handler_; Context context_; + Handler handler_; }; template <typename Dispatcher, typename Handler> @@ -164,6 +198,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, } template <typename Function, typename Dispatcher, typename Handler> +inline void asio_handler_invoke(Function& function, + wrapped_handler<Dispatcher, Handler>* this_handler) +{ + this_handler->dispatcher_.dispatch( + rewrapped_handler<Function, Handler>( + function, this_handler->handler_)); +} + +template <typename Function, typename Dispatcher, typename Handler> inline void asio_handler_invoke(const Function& function, wrapped_handler<Dispatcher, Handler>* this_handler) { @@ -189,6 +232,14 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, } template <typename Function, typename Handler, typename Context> +inline void asio_handler_invoke(Function& function, + rewrapped_handler<Handler, Context>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->context_); +} + +template <typename Function, typename Handler, typename Context> inline void asio_handler_invoke(const Function& function, rewrapped_handler<Handler, Context>* this_handler) { diff --git a/3rdParty/Boost/src/boost/asio/error.hpp b/3rdParty/Boost/src/boost/asio/error.hpp index d0287a0..331297b 100644 --- a/3rdParty/Boost/src/boost/asio/error.hpp +++ b/3rdParty/Boost/src/boost/asio/error.hpp @@ -2,7 +2,7 @@ // error.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -211,10 +211,6 @@ enum misc_errors fd_set_failure }; -enum ssl_errors -{ -}; - inline const boost::system::error_category& get_system_category() { return boost::system::system_category(); @@ -245,9 +241,6 @@ inline const boost::system::error_category& get_addrinfo_category() extern BOOST_ASIO_DECL const boost::system::error_category& get_misc_category(); -extern BOOST_ASIO_DECL -const boost::system::error_category& get_ssl_category(); - static const boost::system::error_category& system_category = boost::asio::error::get_system_category(); static const boost::system::error_category& netdb_category @@ -256,12 +249,12 @@ static const boost::system::error_category& addrinfo_category = boost::asio::error::get_addrinfo_category(); static const boost::system::error_category& misc_category = boost::asio::error::get_misc_category(); -static const boost::system::error_category& ssl_category - = boost::asio::error::get_ssl_category(); } // namespace error } // namespace asio +} // namespace boost +namespace boost { namespace system { template<> struct is_error_code_enum<boost::asio::error::basic_errors> @@ -284,13 +277,10 @@ template<> struct is_error_code_enum<boost::asio::error::misc_errors> static const bool value = true; }; -template<> struct is_error_code_enum<boost::asio::error::ssl_errors> -{ - static const bool value = true; -}; - } // namespace system +} // namespace boost +namespace boost { namespace asio { namespace error { @@ -318,12 +308,6 @@ inline boost::system::error_code make_error_code(misc_errors e) static_cast<int>(e), get_misc_category()); } -inline boost::system::error_code make_error_code(ssl_errors e) -{ - return boost::system::error_code( - static_cast<int>(e), get_ssl_category()); -} - } // namespace error } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/handler_alloc_hook.hpp b/3rdParty/Boost/src/boost/asio/handler_alloc_hook.hpp index ca56871..6bef151 100644 --- a/3rdParty/Boost/src/boost/asio/handler_alloc_hook.hpp +++ b/3rdParty/Boost/src/boost/asio/handler_alloc_hook.hpp @@ -2,7 +2,7 @@ // handler_alloc_hook.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/handler_invoke_hook.hpp b/3rdParty/Boost/src/boost/asio/handler_invoke_hook.hpp index f4f6831..6f03888 100644 --- a/3rdParty/Boost/src/boost/asio/handler_invoke_hook.hpp +++ b/3rdParty/Boost/src/boost/asio/handler_invoke_hook.hpp @@ -2,7 +2,7 @@ // handler_invoke_hook.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/impl/connect.hpp b/3rdParty/Boost/src/boost/asio/impl/connect.hpp new file mode 100644 index 0000000..a21bb2d --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/impl/connect.hpp @@ -0,0 +1,391 @@ +// +// impl/connect.hpp +// ~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_IMPL_CONNECT_HPP +#define BOOST_ASIO_IMPL_CONNECT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/bind_handler.hpp> +#include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +namespace detail +{ + struct default_connect_condition + { + template <typename Iterator> + Iterator operator()(const boost::system::error_code&, Iterator next) + { + return next; + } + }; +} + +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin) +{ + boost::system::error_code ec; + Iterator result = connect(s, begin, ec); + boost::asio::detail::throw_error(ec, "connect"); + return result; +} + +template <typename Protocol, typename SocketService, typename Iterator> +inline Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, boost::system::error_code& ec) +{ + return connect(s, begin, Iterator(), detail::default_connect_condition(), ec); +} + +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end) +{ + boost::system::error_code ec; + Iterator result = connect(s, begin, end, ec); + boost::asio::detail::throw_error(ec, "connect"); + return result; +} + +template <typename Protocol, typename SocketService, typename Iterator> +inline Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, boost::system::error_code& ec) +{ + return connect(s, begin, end, detail::default_connect_condition(), ec); +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, ConnectCondition connect_condition) +{ + boost::system::error_code ec; + Iterator result = connect(s, begin, connect_condition, ec); + boost::asio::detail::throw_error(ec, "connect"); + return result; +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +inline Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, ConnectCondition connect_condition, + boost::system::error_code& ec) +{ + return connect(s, begin, Iterator(), connect_condition, ec); +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition) +{ + boost::system::error_code ec; + Iterator result = connect(s, begin, end, connect_condition, ec); + boost::asio::detail::throw_error(ec, "connect"); + return result; +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition, + boost::system::error_code& ec) +{ + ec = boost::system::error_code(); + + for (Iterator iter = begin; iter != end; ++iter) + { + iter = connect_condition(ec, iter); + if (iter != end) + { + s.close(ec); + s.connect(*iter, ec); + if (!ec) + return iter; + } + } + + if (!ec) + ec = boost::asio::error::not_found; + + return end; +} + +namespace detail +{ + // Enable the empty base class optimisation for the connect condition. + template <typename ConnectCondition> + class base_from_connect_condition + { + protected: + explicit base_from_connect_condition( + const ConnectCondition& connect_condition) + : connect_condition_(connect_condition) + { + } + + template <typename Iterator> + void check_condition(const boost::system::error_code& ec, + Iterator& iter, Iterator& end) + { + if (iter != end) + iter = connect_condition_(ec, static_cast<const Iterator&>(iter)); + } + + private: + ConnectCondition connect_condition_; + }; + + // The default_connect_condition implementation is essentially a no-op. This + // template specialisation lets us eliminate all costs associated with it. + template <> + class base_from_connect_condition<default_connect_condition> + { + protected: + explicit base_from_connect_condition(const default_connect_condition&) + { + } + + template <typename Iterator> + void check_condition(const boost::system::error_code&, Iterator&, Iterator&) + { + } + }; + + template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + class connect_op : base_from_connect_condition<ConnectCondition> + { + public: + connect_op(basic_socket<Protocol, SocketService>& sock, + const Iterator& begin, const Iterator& end, + const ConnectCondition& connect_condition, + ComposedConnectHandler& handler) + : base_from_connect_condition<ConnectCondition>(connect_condition), + socket_(sock), + iter_(begin), + end_(end), + handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + connect_op(const connect_op& other) + : base_from_connect_condition<ConnectCondition>(other), + socket_(other.socket_), + iter_(other.iter_), + end_(other.end_), + handler_(other.handler_) + { + } + + connect_op(connect_op&& other) + : base_from_connect_condition<ConnectCondition>(other), + socket_(other.socket_), + iter_(other.iter_), + end_(other.end_), + handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(boost::system::error_code ec, int start = 0) + { + switch (start) + { + case 1: + for (;;) + { + this->check_condition(ec, iter_, end_); + + if (iter_ != end_) + { + socket_.close(ec); + socket_.async_connect(*iter_, + BOOST_ASIO_MOVE_CAST(connect_op)(*this)); + return; + } + + if (start) + { + ec = boost::asio::error::not_found; + socket_.get_io_service().post(detail::bind_handler(*this, ec)); + return; + } + + default: + + if (iter_ == end_) + break; + + if (!socket_.is_open()) + { + ec = boost::asio::error::operation_aborted; + break; + } + + if (!ec) + break; + + ++iter_; + } + + handler_(static_cast<const boost::system::error_code&>(ec), + static_cast<const Iterator&>(iter_)); + } + } + + //private: + basic_socket<Protocol, SocketService>& socket_; + Iterator iter_; + Iterator end_; + ComposedConnectHandler handler_; + }; + + template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline void* asio_handler_allocate(std::size_t size, + connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>* this_handler) + { + return boost_asio_handler_alloc_helpers::allocate( + size, this_handler->handler_); + } + + template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline void asio_handler_deallocate(void* pointer, std::size_t size, + connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>* this_handler) + { + boost_asio_handler_alloc_helpers::deallocate( + pointer, size, this_handler->handler_); + } + + template <typename Function, typename Protocol, + typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline void asio_handler_invoke(Function& function, + connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename Protocol, + typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline void asio_handler_invoke(const Function& function, + connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler> + make_connect_op(basic_socket<Protocol, SocketService>& sock, + const Iterator& begin, const Iterator& end, + const ConnectCondition& connect_condition, + ComposedConnectHandler handler) + { + return connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>( + sock, begin, end, connect_condition, handler); + } +} // namespace detail + +template <typename Protocol, typename SocketService, + typename Iterator, typename ComposedConnectHandler> +inline void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler) +{ + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ComposedConnectHandler. + BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( + ComposedConnectHandler, handler, Iterator) type_check; + + detail::make_connect_op(s, begin, Iterator(), + detail::default_connect_condition(), + BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))( + boost::system::error_code(), 1); +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ComposedConnectHandler> +inline void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler) +{ + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ComposedConnectHandler. + BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( + ComposedConnectHandler, handler, Iterator) type_check; + + detail::make_connect_op(s, begin, end, + detail::default_connect_condition(), + BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))( + boost::system::error_code(), 1); +} + +template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> +inline void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, ConnectCondition connect_condition, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler) +{ + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ComposedConnectHandler. + BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( + ComposedConnectHandler, handler, Iterator) type_check; + + detail::make_connect_op(s, begin, Iterator(), connect_condition, + BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))( + boost::system::error_code(), 1); +} + +template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> +void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler) +{ + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ComposedConnectHandler. + BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( + ComposedConnectHandler, handler, Iterator) type_check; + + detail::make_connect_op(s, begin, end, connect_condition, + BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))( + boost::system::error_code(), 1); +} + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_IMPL_CONNECT_HPP diff --git a/3rdParty/Boost/src/boost/asio/impl/error.ipp b/3rdParty/Boost/src/boost/asio/impl/error.ipp index 7c045c0..cfb7a99 100644 --- a/3rdParty/Boost/src/boost/asio/impl/error.ipp +++ b/3rdParty/Boost/src/boost/asio/impl/error.ipp @@ -2,7 +2,7 @@ // impl/error.ipp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,8 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/cerrno.hpp> -#include <boost/system/error_code.hpp> #include <boost/asio/error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -122,30 +120,6 @@ const boost::system::error_category& get_misc_category() return instance; } -namespace detail { - -class ssl_category : public boost::system::error_category -{ -public: - const char* name() const - { - return "asio.ssl"; - } - - std::string message(int) const - { - return "asio.ssl error"; - } -}; - -} // namespace detail - -const boost::system::error_category& get_ssl_category() -{ - static detail::ssl_category instance; - return instance; -} - } // namespace error } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/impl/io_service.hpp b/3rdParty/Boost/src/boost/asio/impl/io_service.hpp index 152f983..510de0e 100644 --- a/3rdParty/Boost/src/boost/asio/impl/io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/io_service.hpp @@ -2,7 +2,7 @@ // impl/io_service.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -15,6 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/service_registry.hpp> #include <boost/asio/detail/push_options.hpp> @@ -32,6 +33,13 @@ inline Service& use_service(io_service& ios) return ios.service_registry_->template use_service<Service>(); } +template <> +inline detail::io_service_impl& use_service<detail::io_service_impl>( + io_service& ios) +{ + return ios.impl_; +} + template <typename Service> inline void add_service(io_service& ios, Service* svc) { @@ -68,16 +76,25 @@ inline bool has_service(io_service& ios) namespace boost { namespace asio { -template <typename Handler> -inline void io_service::dispatch(Handler handler) +template <typename CompletionHandler> +inline void io_service::dispatch( + BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { - impl_.dispatch(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; + + impl_.dispatch(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); } -template <typename Handler> -inline void io_service::post(Handler handler) +template <typename CompletionHandler> +inline void io_service::post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { - impl_.post(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; + + impl_.post(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); } template <typename Handler> @@ -92,35 +109,25 @@ io_service::wrap(Handler handler) } inline io_service::work::work(boost::asio::io_service& io_service) - : io_service_(io_service) + : io_service_impl_(io_service.impl_) { - io_service_.impl_.work_started(); + io_service_impl_.work_started(); } inline io_service::work::work(const work& other) - : io_service_(other.io_service_) + : io_service_impl_(other.io_service_impl_) { - io_service_.impl_.work_started(); + io_service_impl_.work_started(); } inline io_service::work::~work() { - io_service_.impl_.work_finished(); -} - -inline boost::asio::io_service& io_service::work::io_service() -{ - return io_service_; + io_service_impl_.work_finished(); } inline boost::asio::io_service& io_service::work::get_io_service() { - return io_service_; -} - -inline boost::asio::io_service& io_service::service::io_service() -{ - return owner_; + return io_service_impl_.get_io_service(); } inline boost::asio::io_service& io_service::service::get_io_service() diff --git a/3rdParty/Boost/src/boost/asio/impl/io_service.ipp b/3rdParty/Boost/src/boost/asio/impl/io_service.ipp index a0b34af..1e3af48 100644 --- a/3rdParty/Boost/src/boost/asio/impl/io_service.ipp +++ b/3rdParty/Boost/src/boost/asio/impl/io_service.ipp @@ -2,7 +2,7 @@ // impl/io_service.ipp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/limits.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/service_registry.hpp> #include <boost/asio/detail/throw_error.hpp> @@ -33,17 +34,18 @@ namespace boost { namespace asio { io_service::io_service() - : service_registry_(new boost::asio::detail::service_registry(*this)), - impl_(service_registry_->use_service<impl_type>()) + : service_registry_(new boost::asio::detail::service_registry( + *this, static_cast<impl_type*>(0), + (std::numeric_limits<std::size_t>::max)())), + impl_(service_registry_->first_service<impl_type>()) { - impl_.init((std::numeric_limits<std::size_t>::max)()); } io_service::io_service(std::size_t concurrency_hint) - : service_registry_(new boost::asio::detail::service_registry(*this)), - impl_(service_registry_->use_service<impl_type>()) + : service_registry_(new boost::asio::detail::service_registry( + *this, static_cast<impl_type*>(0), concurrency_hint)), + impl_(service_registry_->first_service<impl_type>()) { - impl_.init(concurrency_hint); } io_service::~io_service() @@ -108,11 +110,21 @@ void io_service::stop() impl_.stop(); } +bool io_service::stopped() const +{ + return impl_.stopped(); +} + void io_service::reset() { impl_.reset(); } +void io_service::notify_fork(boost::asio::io_service::fork_event event) +{ + service_registry_->notify_fork(event); +} + io_service::service::service(boost::asio::io_service& owner) : owner_(owner), next_(0) @@ -123,6 +135,10 @@ io_service::service::~service() { } +void io_service::service::fork_service(boost::asio::io_service::fork_event) +{ +} + service_already_exists::service_already_exists() : std::logic_error("Service already exists.") { diff --git a/3rdParty/Boost/src/boost/asio/impl/read.hpp b/3rdParty/Boost/src/boost/asio/impl/read.hpp index 9fba190..9290cd4 100644 --- a/3rdParty/Boost/src/boost/asio/impl/read.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/read.hpp @@ -2,7 +2,7 @@ // impl/read.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,11 +18,14 @@ #include <algorithm> #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -58,10 +61,17 @@ inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers) { boost::system::error_code ec; std::size_t bytes_transferred = read(s, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read"); return bytes_transferred; } +template <typename SyncReadStream, typename MutableBufferSequence> +inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, + boost::system::error_code& ec) +{ + return read(s, buffers, transfer_all(), ec); +} + template <typename SyncReadStream, typename MutableBufferSequence, typename CompletionCondition> inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, @@ -69,7 +79,7 @@ inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, { boost::system::error_code ec; std::size_t bytes_transferred = read(s, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read"); return bytes_transferred; } @@ -104,10 +114,18 @@ inline std::size_t read(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read(s, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read"); return bytes_transferred; } +template <typename SyncReadStream, typename Allocator> +inline std::size_t read(SyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + boost::system::error_code& ec) +{ + return read(s, b, transfer_all(), ec); +} + template <typename SyncReadStream, typename Allocator, typename CompletionCondition> inline std::size_t read(SyncReadStream& s, @@ -116,7 +134,7 @@ inline std::size_t read(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read(s, b, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read"); return bytes_transferred; } @@ -131,15 +149,35 @@ namespace detail { public: read_op(AsyncReadStream& stream, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffers_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_op(const read_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_op(read_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) @@ -150,7 +188,8 @@ namespace detail buffers_.prepare(this->check_for_completion(ec, total_transferred_)); for (;;) { - stream_.async_read_some(buffers_, *this); + stream_.async_read_some(buffers_, + BOOST_ASIO_MOVE_CAST(read_op)(*this)); return; default: total_transferred_ += bytes_transferred; buffers_.consume(bytes_transferred); @@ -181,17 +220,36 @@ namespace detail public: read_op(AsyncReadStream& stream, const boost::asio::mutable_buffers_1& buffers, - CompletionCondition completion_condition, - ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_op(const read_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + read_op(read_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -202,8 +260,9 @@ namespace detail n = this->check_for_completion(ec, total_transferred_); for (;;) { - stream_.async_read_some(boost::asio::buffer( - buffer_ + total_transferred_, n), *this); + stream_.async_read_some( + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(read_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -223,6 +282,168 @@ namespace detail ReadHandler handler_; }; + template <typename AsyncReadStream, typename Elem, + typename CompletionCondition, typename ReadHandler> + class read_op<AsyncReadStream, boost::array<Elem, 2>, + CompletionCondition, ReadHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + read_op(AsyncReadStream& stream, const boost::array<Elem, 2>& buffers, + CompletionCondition completion_condition, ReadHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + stream_(stream), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_op(const read_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_op(read_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + boost::array<boost::asio::mutable_buffer, 2> >::type bufs = {{ + boost::asio::mutable_buffer(buffers_[0]), + boost::asio::mutable_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + stream_.async_read_some(bufs, BOOST_ASIO_MOVE_CAST(read_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncReadStream& stream_; + boost::array<Elem, 2> buffers_; + std::size_t total_transferred_; + ReadHandler handler_; + }; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + + template <typename AsyncReadStream, typename Elem, + typename CompletionCondition, typename ReadHandler> + class read_op<AsyncReadStream, std::array<Elem, 2>, + CompletionCondition, ReadHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + read_op(AsyncReadStream& stream, const std::array<Elem, 2>& buffers, + CompletionCondition completion_condition, ReadHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + stream_(stream), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_op(const read_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_op(read_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + std::array<boost::asio::mutable_buffer, 2> >::type bufs = {{ + boost::asio::mutable_buffer(buffers_[0]), + boost::asio::mutable_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + stream_.async_read_some(bufs, BOOST_ASIO_MOVE_CAST(read_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncReadStream& stream_; + std::array<Elem, 2> buffers_; + std::size_t total_transferred_; + ReadHandler handler_; + }; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + template <typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> inline void* asio_handler_allocate(std::size_t size, @@ -246,6 +467,17 @@ namespace detail template <typename Function, typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_op<AsyncReadStream, MutableBufferSequence, + CompletionCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, + typename MutableBufferSequence, typename CompletionCondition, + typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_op<AsyncReadStream, MutableBufferSequence, CompletionCondition, ReadHandler>* this_handler) @@ -253,25 +485,47 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename MutableBufferSequence, + typename CompletionCondition, typename ReadHandler> + inline read_op<AsyncReadStream, MutableBufferSequence, + CompletionCondition, ReadHandler> + make_read_op(AsyncReadStream& s, const MutableBufferSequence& buffers, + CompletionCondition completion_condition, ReadHandler handler) + { + return read_op<AsyncReadStream, MutableBufferSequence, CompletionCondition, + ReadHandler>(s, buffers, completion_condition, handler); + } } // namespace detail template <typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_op<AsyncReadStream, MutableBufferSequence, - CompletionCondition, ReadHandler>( - s, buffers, completion_condition, 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::make_read_op( + s, buffers, completion_condition, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( boost::system::error_code(), 0, 1); } template <typename AsyncReadStream, typename MutableBufferSequence, typename ReadHandler> inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - async_read(s, buffers, transfer_all(), 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::make_read_op( + s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } #if !defined(BOOST_NO_IOSTREAM) @@ -286,15 +540,35 @@ namespace detail public: read_streambuf_op(AsyncReadStream& stream, basic_streambuf<Allocator>& streambuf, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), streambuf_(streambuf), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_streambuf_op(const read_streambuf_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + streambuf_(other.streambuf_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_streambuf_op(read_streambuf_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + streambuf_(other.streambuf_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) @@ -307,7 +581,8 @@ namespace detail bytes_available = read_size_helper(streambuf_, max_size); for (;;) { - stream_.async_read_some(streambuf_.prepare(bytes_available), *this); + stream_.async_read_some(streambuf_.prepare(bytes_available), + BOOST_ASIO_MOVE_CAST(read_streambuf_op)(*this)); return; default: total_transferred_ += bytes_transferred; streambuf_.commit(bytes_transferred); @@ -350,6 +625,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename CompletionCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_streambuf_op<AsyncReadStream, Allocator, + CompletionCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, + typename Allocator, typename CompletionCondition, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_streambuf_op<AsyncReadStream, Allocator, CompletionCondition, ReadHandler>* this_handler) @@ -357,25 +642,48 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, + typename CompletionCondition, typename ReadHandler> + inline read_streambuf_op<AsyncReadStream, Allocator, + CompletionCondition, ReadHandler> + make_read_streambuf_op( + AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, + CompletionCondition completion_condition, ReadHandler handler) + { + return read_streambuf_op<AsyncReadStream, Allocator, CompletionCondition, + ReadHandler>(s, b, completion_condition, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename CompletionCondition, typename ReadHandler> inline void async_read(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_streambuf_op<AsyncReadStream, - Allocator, CompletionCondition, ReadHandler>( - s, b, completion_condition, handler)( - boost::system::error_code(), 0, 1); + // 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::make_read_streambuf_op( + s, b, completion_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } template <typename AsyncReadStream, typename Allocator, typename ReadHandler> inline void async_read(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, ReadHandler handler) + boost::asio::basic_streambuf<Allocator>& b, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - async_read(s, b, transfer_all(), 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::make_read_streambuf_op( + s, b, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/impl/read_at.hpp b/3rdParty/Boost/src/boost/asio/impl/read_at.hpp index dcf2c33..08e37fe 100644 --- a/3rdParty/Boost/src/boost/asio/impl/read_at.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/read_at.hpp @@ -2,7 +2,7 @@ // impl/read_at.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,11 +18,14 @@ #include <algorithm> #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -62,10 +65,18 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } +template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> +inline std::size_t read_at(SyncRandomAccessReadDevice& d, + boost::uint64_t offset, const MutableBufferSequence& buffers, + boost::system::error_code& ec) +{ + return read_at(d, offset, buffers, transfer_all(), ec); +} + template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition> inline std::size_t read_at(SyncRandomAccessReadDevice& d, @@ -75,7 +86,7 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } @@ -112,10 +123,18 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } +template <typename SyncRandomAccessReadDevice, typename Allocator> +inline std::size_t read_at(SyncRandomAccessReadDevice& d, + boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, + boost::system::error_code& ec) +{ + return read_at(d, offset, b, transfer_all(), ec); +} + template <typename SyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition> inline std::size_t read_at(SyncRandomAccessReadDevice& d, @@ -125,7 +144,7 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, b, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } @@ -142,16 +161,38 @@ namespace detail public: read_at_op(AsyncRandomAccessReadDevice& device, boost::uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffers_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_op(const read_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_at_op(read_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) @@ -162,8 +203,8 @@ namespace detail buffers_.prepare(this->check_for_completion(ec, total_transferred_)); for (;;) { - device_.async_read_some_at( - offset_ + total_transferred_, buffers_, *this); + device_.async_read_some_at(offset_ + total_transferred_, + buffers_, BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; buffers_.consume(bytes_transferred); @@ -195,16 +236,38 @@ namespace detail public: read_at_op(AsyncRandomAccessReadDevice& device, boost::uint64_t offset, const boost::asio::mutable_buffers_1& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_op(const read_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_at_op(read_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) @@ -217,7 +280,8 @@ namespace detail for (;;) { device_.async_read_some_at(offset_ + total_transferred_, - boost::asio::buffer(buffer_ + total_transferred_, n), *this); + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -238,6 +302,180 @@ namespace detail ReadHandler handler_; }; + template <typename AsyncRandomAccessReadDevice, typename Elem, + typename CompletionCondition, typename ReadHandler> + class read_at_op<AsyncRandomAccessReadDevice, boost::array<Elem, 2>, + CompletionCondition, ReadHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + read_at_op(AsyncRandomAccessReadDevice& device, + boost::uint64_t offset, const boost::array<Elem, 2>& buffers, + CompletionCondition completion_condition, ReadHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + device_(device), + offset_(offset), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_op(const read_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_at_op(read_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + boost::array<boost::asio::mutable_buffer, 2> >::type bufs = {{ + boost::asio::mutable_buffer(buffers_[0]), + boost::asio::mutable_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + device_.async_read_some_at(offset_ + total_transferred_, + bufs, BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncRandomAccessReadDevice& device_; + boost::uint64_t offset_; + boost::array<Elem, 2> buffers_; + std::size_t total_transferred_; + ReadHandler handler_; + }; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + + template <typename AsyncRandomAccessReadDevice, typename Elem, + typename CompletionCondition, typename ReadHandler> + class read_at_op<AsyncRandomAccessReadDevice, std::array<Elem, 2>, + CompletionCondition, ReadHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + read_at_op(AsyncRandomAccessReadDevice& device, + boost::uint64_t offset, const std::array<Elem, 2>& buffers, + CompletionCondition completion_condition, ReadHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + device_(device), + offset_(offset), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_op(const read_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_at_op(read_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + std::array<boost::asio::mutable_buffer, 2> >::type bufs = {{ + boost::asio::mutable_buffer(buffers_[0]), + boost::asio::mutable_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + device_.async_read_some_at(offset_ + total_transferred_, + bufs, BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncRandomAccessReadDevice& device_; + boost::uint64_t offset_; + std::array<Elem, 2> buffers_; + std::size_t total_transferred_; + ReadHandler handler_; + }; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> @@ -263,6 +501,17 @@ namespace detail template <typename Function, typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, + CompletionCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncRandomAccessReadDevice, + typename MutableBufferSequence, typename CompletionCondition, + typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, CompletionCondition, ReadHandler>* this_handler) @@ -270,17 +519,36 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncRandomAccessReadDevice, + typename MutableBufferSequence, typename CompletionCondition, + typename ReadHandler> + inline read_at_op<AsyncRandomAccessReadDevice, + MutableBufferSequence, CompletionCondition, ReadHandler> + make_read_at_op(AsyncRandomAccessReadDevice& d, + boost::uint64_t offset, const MutableBufferSequence& buffers, + CompletionCondition completion_condition, ReadHandler handler) + { + return read_at_op<AsyncRandomAccessReadDevice, + MutableBufferSequence, CompletionCondition, ReadHandler>( + d, offset, buffers, completion_condition, handler); + } } // namespace detail template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> inline void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_at_op<AsyncRandomAccessReadDevice, - MutableBufferSequence, CompletionCondition, ReadHandler>( - d, offset, buffers, completion_condition, 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::make_read_at_op( + d, offset, buffers, completion_condition, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( boost::system::error_code(), 0, 1); } @@ -288,9 +556,16 @@ template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename ReadHandler> inline void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - async_read_at(d, offset, buffers, transfer_all(), 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::make_read_at_op( + d, offset, buffers, transfer_all(), + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } #if !defined(BOOST_NO_IOSTREAM) @@ -305,17 +580,39 @@ namespace detail public: read_at_streambuf_op(AsyncRandomAccessReadDevice& device, boost::uint64_t offset, basic_streambuf<Allocator>& streambuf, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), streambuf_(streambuf), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_streambuf_op(const read_at_streambuf_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + streambuf_(other.streambuf_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + read_at_streambuf_op(read_at_streambuf_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + streambuf_(other.streambuf_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -328,7 +625,8 @@ namespace detail for (;;) { device_.async_read_some_at(offset_ + total_transferred_, - streambuf_.prepare(bytes_available), *this); + streambuf_.prepare(bytes_available), + BOOST_ASIO_MOVE_CAST(read_at_streambuf_op)(*this)); return; default: total_transferred_ += bytes_transferred; streambuf_.commit(bytes_transferred); @@ -372,6 +670,16 @@ namespace detail template <typename Function, typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, + CompletionCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncRandomAccessReadDevice, + typename Allocator, typename CompletionCondition, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, CompletionCondition, ReadHandler>* this_handler) @@ -379,17 +687,35 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncRandomAccessReadDevice, typename Allocator, + typename CompletionCondition, typename ReadHandler> + inline read_at_streambuf_op<AsyncRandomAccessReadDevice, + Allocator, CompletionCondition, ReadHandler> + make_read_at_streambuf_op(AsyncRandomAccessReadDevice& d, + boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, + CompletionCondition completion_condition, ReadHandler handler) + { + return read_at_streambuf_op<AsyncRandomAccessReadDevice, + Allocator, CompletionCondition, ReadHandler>( + d, offset, b, completion_condition, handler); + } } // namespace detail template <typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, typename ReadHandler> inline void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, - Allocator, CompletionCondition, ReadHandler>( - d, offset, b, completion_condition, 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::make_read_at_streambuf_op( + d, offset, b, completion_condition, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( boost::system::error_code(), 0, 1); } @@ -397,9 +723,16 @@ template <typename AsyncRandomAccessReadDevice, typename Allocator, typename ReadHandler> inline void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - async_read_at(d, offset, b, transfer_all(), 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::make_read_at_streambuf_op( + d, offset, b, transfer_all(), + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/impl/read_until.hpp b/3rdParty/Boost/src/boost/asio/impl/read_until.hpp index 5eeb1bc..1b9a8f3 100644 --- a/3rdParty/Boost/src/boost/asio/impl/read_until.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/read_until.hpp @@ -2,7 +2,7 @@ // impl/read_until.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -25,6 +25,7 @@ #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -38,7 +39,7 @@ inline std::size_t read_until(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read_until(s, b, delim, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_until"); return bytes_transferred; } @@ -56,11 +57,11 @@ std::size_t read_until(SyncReadStream& s, typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = b.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position; + iterator start_pos = begin + search_position; iterator end = iterator::end(buffers); // Look for a match. - iterator iter = std::find(start, end, delim); + iterator iter = std::find(start_pos, end, delim); if (iter != end) { // Found a match. We're done. @@ -94,7 +95,7 @@ inline std::size_t read_until(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read_until(s, b, delim, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_until"); return bytes_transferred; } @@ -147,12 +148,12 @@ std::size_t read_until(SyncReadStream& s, typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = b.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position; + iterator start_pos = begin + search_position; iterator end = iterator::end(buffers); // Look for a match. std::pair<iterator, bool> result = detail::partial_search( - start, end, delim.begin(), delim.end()); + start_pos, end, delim.begin(), delim.end()); if (result.first != end) { if (result.second) @@ -194,7 +195,7 @@ inline std::size_t read_until(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read_until(s, b, expr, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_until"); return bytes_transferred; } @@ -212,14 +213,14 @@ std::size_t read_until(SyncReadStream& s, typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = b.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position; + iterator start_pos = begin + search_position; iterator end = iterator::end(buffers); // Look for a match. boost::match_results<iterator, typename std::vector<boost::sub_match<iterator> >::allocator_type> match_results; - if (regex_search(start, end, match_results, expr, + if (regex_search(start_pos, end, match_results, expr, boost::match_default | boost::match_partial)) { if (match_results[0].matched) @@ -270,11 +271,11 @@ std::size_t read_until(SyncReadStream& s, typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = b.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position; + iterator start_pos = begin + search_position; iterator end = iterator::end(buffers); // Look for a match. - std::pair<iterator, bool> result = match_condition(start, end); + std::pair<iterator, bool> result = match_condition(start_pos, end); if (result.second) { // Full match. We're done. @@ -314,7 +315,7 @@ inline std::size_t read_until(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read_until(s, b, match_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_until"); return bytes_transferred; } @@ -326,15 +327,35 @@ namespace detail public: read_until_delim_op(AsyncReadStream& stream, boost::asio::basic_streambuf<Allocator>& streambuf, - char delim, ReadHandler handler) + char delim, ReadHandler& handler) : stream_(stream), streambuf_(streambuf), delim_(delim), search_position_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + read_until_delim_op(const read_until_delim_op& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + delim_(other.delim_), + search_position_(other.search_position_), + handler_(other.handler_) + { + } + + read_until_delim_op(read_until_delim_op&& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + delim_(other.delim_), + search_position_(other.search_position_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -352,11 +373,11 @@ namespace detail typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = streambuf_.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position_; + iterator start_pos = begin + search_position_; iterator end = iterator::end(buffers); // Look for a match. - iterator iter = std::find(start, end, delim_); + iterator iter = std::find(start_pos, end, delim_); if (iter != end) { // Found a match. We're done. @@ -385,7 +406,8 @@ namespace detail break; // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this); + stream_.async_read_some(streambuf_.prepare(bytes_to_read), + BOOST_ASIO_MOVE_CAST(read_until_delim_op)(*this)); return; default: streambuf_.commit(bytes_transferred); if (ec || bytes_transferred == 0) @@ -432,6 +454,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_until_delim_op<AsyncReadStream, + Allocator, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, typename Allocator, + typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>* this_handler) @@ -439,16 +471,30 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, typename ReadHandler> + inline read_until_delim_op<AsyncReadStream, Allocator, ReadHandler> + make_read_until_delim_op(AsyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + char delim, ReadHandler handler) + { + return read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>( + s, b, delim, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, char delim, ReadHandler handler) + boost::asio::basic_streambuf<Allocator>& b, char delim, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_until_delim_op< - AsyncReadStream, Allocator, ReadHandler>( - s, b, delim, handler)( - boost::system::error_code(), 0, 1); + // 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::make_read_until_delim_op( + s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } namespace detail @@ -459,15 +505,35 @@ namespace detail public: read_until_delim_string_op(AsyncReadStream& stream, boost::asio::basic_streambuf<Allocator>& streambuf, - const std::string& delim, ReadHandler handler) + const std::string& delim, ReadHandler& handler) : stream_(stream), streambuf_(streambuf), delim_(delim), search_position_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + read_until_delim_string_op(const read_until_delim_string_op& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + delim_(other.delim_), + search_position_(other.search_position_), + handler_(other.handler_) + { + } + + read_until_delim_string_op(read_until_delim_string_op&& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + delim_(BOOST_ASIO_MOVE_CAST(std::string)(other.delim_)), + search_position_(other.search_position_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -485,12 +551,12 @@ namespace detail typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = streambuf_.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position_; + iterator start_pos = begin + search_position_; iterator end = iterator::end(buffers); // Look for a match. std::pair<iterator, bool> result = detail::partial_search( - start, end, delim_.begin(), delim_.end()); + start_pos, end, delim_.begin(), delim_.end()); if (result.first != end && result.second) { // Full match. We're done. @@ -529,7 +595,8 @@ namespace detail break; // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this); + stream_.async_read_some(streambuf_.prepare(bytes_to_read), + BOOST_ASIO_MOVE_CAST(read_until_delim_string_op)(*this)); return; default: streambuf_.commit(bytes_transferred); if (ec || bytes_transferred == 0) @@ -576,6 +643,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_until_delim_string_op<AsyncReadStream, + Allocator, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, + typename Allocator, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>* this_handler) @@ -583,17 +660,30 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, typename ReadHandler> + inline read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler> + make_read_until_delim_string_op(AsyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + const std::string& delim, ReadHandler handler) + { + return read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>( + s, b, delim, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, const std::string& delim, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_until_delim_string_op< - AsyncReadStream, Allocator, ReadHandler>( - s, b, delim, handler)( - boost::system::error_code(), 0, 1); + // 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::make_read_until_delim_string_op( + s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } namespace detail @@ -605,15 +695,35 @@ namespace detail public: read_until_expr_op(AsyncReadStream& stream, boost::asio::basic_streambuf<Allocator>& streambuf, - const boost::regex& expr, ReadHandler handler) + const boost::regex& expr, ReadHandler& handler) : stream_(stream), streambuf_(streambuf), expr_(expr), search_position_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + read_until_expr_op(const read_until_expr_op& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + expr_(other.expr_), + search_position_(other.search_position_), + handler_(other.handler_) + { + } + + read_until_expr_op(read_until_expr_op&& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + expr_(other.expr_), + search_position_(other.search_position_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -631,14 +741,14 @@ namespace detail typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = streambuf_.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position_; + iterator start_pos = begin + search_position_; iterator end = iterator::end(buffers); // Look for a match. boost::match_results<iterator, typename std::vector<boost::sub_match<iterator> >::allocator_type> match_results; - bool match = regex_search(start, end, match_results, expr_, + bool match = regex_search(start_pos, end, match_results, expr_, boost::match_default | boost::match_partial); if (match && match_results[0].matched) { @@ -678,7 +788,8 @@ namespace detail break; // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this); + stream_.async_read_some(streambuf_.prepare(bytes_to_read), + BOOST_ASIO_MOVE_CAST(read_until_expr_op)(*this)); return; default: streambuf_.commit(bytes_transferred); if (ec || bytes_transferred == 0) @@ -727,6 +838,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename RegEx, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_until_expr_op<AsyncReadStream, + Allocator, RegEx, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, typename Allocator, + typename RegEx, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>* this_handler) @@ -734,17 +855,31 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, + typename RegEx, typename ReadHandler> + inline read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler> + make_read_until_expr_op(AsyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + const RegEx& expr, ReadHandler handler) + { + return read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>( + s, b, expr, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_until_expr_op<AsyncReadStream, - Allocator, boost::regex, ReadHandler>( - s, b, expr, handler)( - boost::system::error_code(), 0, 1); + // 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::make_read_until_expr_op( + s, b, expr, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } namespace detail @@ -756,15 +891,35 @@ namespace detail public: read_until_match_op(AsyncReadStream& stream, boost::asio::basic_streambuf<Allocator>& streambuf, - MatchCondition match_condition, ReadHandler handler) + MatchCondition match_condition, ReadHandler& handler) : stream_(stream), streambuf_(streambuf), match_condition_(match_condition), search_position_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + read_until_match_op(const read_until_match_op& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + match_condition_(other.match_condition_), + search_position_(other.search_position_), + handler_(other.handler_) + { + } + + read_until_match_op(read_until_match_op&& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + match_condition_(other.match_condition_), + search_position_(other.search_position_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -782,11 +937,11 @@ namespace detail typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = streambuf_.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position_; + iterator start_pos = begin + search_position_; iterator end = iterator::end(buffers); // Look for a match. - std::pair<iterator, bool> result = match_condition_(start, end); + std::pair<iterator, bool> result = match_condition_(start_pos, end); if (result.second) { // Full match. We're done. @@ -825,7 +980,8 @@ namespace detail break; // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this); + stream_.async_read_some(streambuf_.prepare(bytes_to_read), + BOOST_ASIO_MOVE_CAST(read_until_match_op)(*this)); return; default: streambuf_.commit(bytes_transferred); if (ec || bytes_transferred == 0) @@ -874,6 +1030,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename MatchCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_until_match_op<AsyncReadStream, + Allocator, MatchCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, typename Allocator, + typename MatchCondition, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_until_match_op<AsyncReadStream, Allocator, MatchCondition, ReadHandler>* this_handler) @@ -881,19 +1047,35 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, + typename MatchCondition, typename ReadHandler> + inline read_until_match_op<AsyncReadStream, Allocator, + MatchCondition, ReadHandler> + make_read_until_match_op(AsyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + MatchCondition match_condition, ReadHandler handler) + { + return read_until_match_op<AsyncReadStream, + Allocator, MatchCondition, ReadHandler>( + s, b, match_condition, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename MatchCondition, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, - MatchCondition match_condition, ReadHandler handler, + MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, typename boost::enable_if<is_match_condition<MatchCondition> >::type*) { - detail::read_until_match_op< - AsyncReadStream, Allocator, MatchCondition, ReadHandler>( - s, b, match_condition, handler)( - boost::system::error_code(), 0, 1); + // 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::make_read_until_match_op( + s, b, match_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp index c75f8c2..3066045 100644 --- a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp @@ -2,7 +2,7 @@ // impl/serial_port_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 diff --git a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp index c665ac8..0344fa5 100644 --- a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp +++ b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp @@ -2,7 +2,7 @@ // impl/serial_port_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 diff --git a/3rdParty/Boost/src/boost/asio/impl/write.hpp b/3rdParty/Boost/src/boost/asio/impl/write.hpp index ae420bc..61422e4 100644 --- a/3rdParty/Boost/src/boost/asio/impl/write.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/write.hpp @@ -2,7 +2,7 @@ // impl/write.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,11 +17,14 @@ #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -56,10 +59,17 @@ inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers) { boost::system::error_code ec; std::size_t bytes_transferred = write(s, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } +template <typename SyncWriteStream, typename ConstBufferSequence> +inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, + boost::system::error_code& ec) +{ + return write(s, buffers, transfer_all(), ec); +} + template <typename SyncWriteStream, typename ConstBufferSequence, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, @@ -67,7 +77,7 @@ inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, { boost::system::error_code ec; std::size_t bytes_transferred = write(s, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } @@ -90,10 +100,18 @@ inline std::size_t write(SyncWriteStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = write(s, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } +template <typename SyncWriteStream, typename Allocator> +inline std::size_t write(SyncWriteStream& s, + boost::asio::basic_streambuf<Allocator>& b, + boost::system::error_code& ec) +{ + return write(s, b, transfer_all(), ec); +} + template <typename SyncWriteStream, typename Allocator, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, @@ -102,7 +120,7 @@ inline std::size_t write(SyncWriteStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = write(s, b, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } @@ -117,16 +135,36 @@ namespace detail { public: write_op(AsyncWriteStream& stream, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffers_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -136,7 +174,8 @@ namespace detail buffers_.prepare(this->check_for_completion(ec, total_transferred_)); for (;;) { - stream_.async_write_some(buffers_, *this); + stream_.async_write_some(buffers_, + BOOST_ASIO_MOVE_CAST(write_op)(*this)); return; default: total_transferred_ += bytes_transferred; buffers_.consume(bytes_transferred); @@ -168,16 +207,36 @@ namespace detail write_op(AsyncWriteStream& stream, const boost::asio::mutable_buffers_1& buffers, CompletionCondition completion_condition, - WriteHandler handler) + WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -188,8 +247,9 @@ namespace detail n = this->check_for_completion(ec, total_transferred_); for (;;) { - stream_.async_write_some(boost::asio::buffer( - buffer_ + total_transferred_, n), *this); + stream_.async_write_some( + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(write_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -219,16 +279,36 @@ namespace detail write_op(AsyncWriteStream& stream, const boost::asio::const_buffers_1& buffers, CompletionCondition completion_condition, - WriteHandler handler) + WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -239,8 +319,9 @@ namespace detail n = this->check_for_completion(ec, total_transferred_); for (;;) { - stream_.async_write_some(boost::asio::buffer( - buffer_ + total_transferred_, n), *this); + stream_.async_write_some( + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(write_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -260,6 +341,168 @@ namespace detail WriteHandler handler_; }; + template <typename AsyncWriteStream, typename Elem, + typename CompletionCondition, typename WriteHandler> + class write_op<AsyncWriteStream, boost::array<Elem, 2>, + CompletionCondition, WriteHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + write_op(AsyncWriteStream& stream, const boost::array<Elem, 2>& buffers, + CompletionCondition completion_condition, WriteHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + stream_(stream), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + boost::array<boost::asio::const_buffer, 2> >::type bufs = {{ + boost::asio::const_buffer(buffers_[0]), + boost::asio::const_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + stream_.async_write_some(bufs, BOOST_ASIO_MOVE_CAST(write_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncWriteStream& stream_; + boost::array<Elem, 2> buffers_; + std::size_t total_transferred_; + WriteHandler handler_; + }; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + + template <typename AsyncWriteStream, typename Elem, + typename CompletionCondition, typename WriteHandler> + class write_op<AsyncWriteStream, std::array<Elem, 2>, + CompletionCondition, WriteHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + write_op(AsyncWriteStream& stream, const std::array<Elem, 2>& buffers, + CompletionCondition completion_condition, WriteHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + stream_(stream), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + std::array<boost::asio::const_buffer, 2> >::type bufs = {{ + boost::asio::const_buffer(buffers_[0]), + boost::asio::const_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + stream_.async_write_some(bufs, BOOST_ASIO_MOVE_CAST(write_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncWriteStream& stream_; + std::array<Elem, 2> buffers_; + std::size_t total_transferred_; + WriteHandler handler_; + }; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + template <typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> inline void* asio_handler_allocate(std::size_t size, @@ -283,6 +526,17 @@ namespace detail template <typename Function, typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> + inline void asio_handler_invoke(Function& function, + write_op<AsyncWriteStream, ConstBufferSequence, + CompletionCondition, WriteHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncWriteStream, + typename ConstBufferSequence, typename CompletionCondition, + typename WriteHandler> inline void asio_handler_invoke(const Function& function, write_op<AsyncWriteStream, ConstBufferSequence, CompletionCondition, WriteHandler>* this_handler) @@ -290,43 +544,78 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncWriteStream, typename ConstBufferSequence, + typename CompletionCondition, typename WriteHandler> + inline write_op<AsyncWriteStream, ConstBufferSequence, + CompletionCondition, WriteHandler> + make_write_op(AsyncWriteStream& s, const ConstBufferSequence& buffers, + CompletionCondition completion_condition, WriteHandler handler) + { + return write_op<AsyncWriteStream, ConstBufferSequence, CompletionCondition, + WriteHandler>(s, buffers, completion_condition, handler); + } } // namespace detail template <typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - detail::write_op<AsyncWriteStream, ConstBufferSequence, - CompletionCondition, WriteHandler>( - s, buffers, completion_condition, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + detail::make_write_op( + s, buffers, completion_condition, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))( boost::system::error_code(), 0, 1); } template <typename AsyncWriteStream, typename ConstBufferSequence, typename WriteHandler> inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - async_write(s, buffers, transfer_all(), 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + detail::make_write_op( + s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))( + boost::system::error_code(), 0, 1); } #if !defined(BOOST_NO_IOSTREAM) namespace detail { - template <typename AsyncWriteStream, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> class write_streambuf_handler { public: write_streambuf_handler(boost::asio::basic_streambuf<Allocator>& streambuf, - WriteHandler handler) + WriteHandler& handler) : streambuf_(streambuf), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + write_streambuf_handler(const write_streambuf_handler& other) + : streambuf_(other.streambuf_), + handler_(other.handler_) + { + } + + write_streambuf_handler(write_streambuf_handler&& other) + : streambuf_(other.streambuf_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, const std::size_t bytes_transferred) { @@ -339,53 +628,75 @@ namespace detail WriteHandler handler_; }; - template <typename AsyncWriteStream, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> inline void* asio_handler_allocate(std::size_t size, - write_streambuf_handler<AsyncWriteStream, - Allocator, WriteHandler>* this_handler) + write_streambuf_handler<Allocator, WriteHandler>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( size, this_handler->handler_); } - template <typename AsyncWriteStream, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> inline void asio_handler_deallocate(void* pointer, std::size_t size, - write_streambuf_handler<AsyncWriteStream, - Allocator, WriteHandler>* this_handler) + write_streambuf_handler<Allocator, WriteHandler>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( pointer, size, this_handler->handler_); } - template <typename Function, typename AsyncWriteStream, typename Allocator, - typename WriteHandler> + template <typename Function, typename Allocator, typename WriteHandler> + inline void asio_handler_invoke(Function& function, + write_streambuf_handler<Allocator, WriteHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename Allocator, typename WriteHandler> inline void asio_handler_invoke(const Function& function, - write_streambuf_handler<AsyncWriteStream, - Allocator, WriteHandler>* this_handler) + write_streambuf_handler<Allocator, WriteHandler>* this_handler) { boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename Allocator, typename WriteHandler> + inline write_streambuf_handler<Allocator, WriteHandler> + make_write_streambuf_handler( + boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler) + { + return write_streambuf_handler<Allocator, WriteHandler>(b, handler); + } } // namespace detail template <typename AsyncWriteStream, typename Allocator, typename CompletionCondition, typename WriteHandler> inline void async_write(AsyncWriteStream& s, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, + BOOST_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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + async_write(s, b.data(), completion_condition, - detail::write_streambuf_handler< - AsyncWriteStream, Allocator, WriteHandler>(b, handler)); + detail::make_write_streambuf_handler( + b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))); } template <typename AsyncWriteStream, typename Allocator, typename WriteHandler> inline void async_write(AsyncWriteStream& s, - boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler) + boost::asio::basic_streambuf<Allocator>& b, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - async_write(s, b, transfer_all(), 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + async_write(s, b.data(), transfer_all(), + detail::make_write_streambuf_handler( + b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))); } #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/impl/write_at.hpp b/3rdParty/Boost/src/boost/asio/impl/write_at.hpp index 39dc1af..acba02f 100644 --- a/3rdParty/Boost/src/boost/asio/impl/write_at.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/write_at.hpp @@ -2,7 +2,7 @@ // impl/write_at.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,11 +17,14 @@ #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -60,10 +63,18 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = write_at( d, offset, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } +template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> +inline std::size_t write_at(SyncRandomAccessWriteDevice& d, + boost::uint64_t offset, const ConstBufferSequence& buffers, + boost::system::error_code& ec) +{ + return write_at(d, offset, buffers, transfer_all(), ec); +} + template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, @@ -73,7 +84,7 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = write_at( d, offset, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } @@ -97,10 +108,18 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d, { boost::system::error_code ec; std::size_t bytes_transferred = write_at(d, offset, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } +template <typename SyncRandomAccessWriteDevice, typename Allocator> +inline std::size_t write_at(SyncRandomAccessWriteDevice& d, + boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, + boost::system::error_code& ec) +{ + return write_at(d, offset, b, transfer_all(), ec); +} + template <typename SyncRandomAccessWriteDevice, typename Allocator, typename CompletionCondition> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, @@ -110,7 +129,7 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = write_at( d, offset, b, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } @@ -126,17 +145,39 @@ namespace detail public: write_at_op(AsyncRandomAccessWriteDevice& device, boost::uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffers_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -147,7 +188,8 @@ namespace detail for (;;) { device_.async_write_some_at( - offset_ + total_transferred_, buffers_, *this); + offset_ + total_transferred_, buffers_, + BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; buffers_.consume(bytes_transferred); @@ -180,17 +222,39 @@ namespace detail write_at_op(AsyncRandomAccessWriteDevice& device, boost::uint64_t offset, const boost::asio::mutable_buffers_1& buffers, CompletionCondition completion_condition, - WriteHandler handler) + WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -202,7 +266,8 @@ namespace detail for (;;) { device_.async_write_some_at(offset_ + total_transferred_, - boost::asio::buffer(buffer_ + total_transferred_, n), *this); + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -233,17 +298,39 @@ namespace detail write_at_op(AsyncRandomAccessWriteDevice& device, boost::uint64_t offset, const boost::asio::const_buffers_1& buffers, CompletionCondition completion_condition, - WriteHandler handler) + WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -255,7 +342,8 @@ namespace detail for (;;) { device_.async_write_some_at(offset_ + total_transferred_, - boost::asio::buffer(buffer_ + total_transferred_, n), *this); + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -276,6 +364,180 @@ namespace detail WriteHandler handler_; }; + template <typename AsyncRandomAccessWriteDevice, typename Elem, + typename CompletionCondition, typename WriteHandler> + class write_at_op<AsyncRandomAccessWriteDevice, boost::array<Elem, 2>, + CompletionCondition, WriteHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + write_at_op(AsyncRandomAccessWriteDevice& device, + boost::uint64_t offset, const boost::array<Elem, 2>& buffers, + CompletionCondition completion_condition, WriteHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + device_(device), + offset_(offset), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + boost::array<boost::asio::const_buffer, 2> >::type bufs = {{ + boost::asio::const_buffer(buffers_[0]), + boost::asio::const_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + device_.async_write_some_at(offset_ + total_transferred_, + bufs, BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncRandomAccessWriteDevice& device_; + boost::uint64_t offset_; + boost::array<Elem, 2> buffers_; + std::size_t total_transferred_; + WriteHandler handler_; + }; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + + template <typename AsyncRandomAccessWriteDevice, typename Elem, + typename CompletionCondition, typename WriteHandler> + class write_at_op<AsyncRandomAccessWriteDevice, std::array<Elem, 2>, + CompletionCondition, WriteHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + write_at_op(AsyncRandomAccessWriteDevice& device, + boost::uint64_t offset, const std::array<Elem, 2>& buffers, + CompletionCondition completion_condition, WriteHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + device_(device), + offset_(offset), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + std::array<boost::asio::const_buffer, 2> >::type bufs = {{ + boost::asio::const_buffer(buffers_[0]), + boost::asio::const_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + device_.async_write_some_at(offset_ + total_transferred_, + bufs, BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncRandomAccessWriteDevice& device_; + boost::uint64_t offset_; + std::array<Elem, 2> buffers_; + std::size_t total_transferred_; + WriteHandler handler_; + }; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> inline void* asio_handler_allocate(std::size_t size, @@ -299,6 +561,17 @@ namespace detail template <typename Function, typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> + inline void asio_handler_invoke(Function& function, + write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, + CompletionCondition, WriteHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncRandomAccessWriteDevice, + typename ConstBufferSequence, typename CompletionCondition, + typename WriteHandler> inline void asio_handler_invoke(const Function& function, write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, CompletionCondition, WriteHandler>* this_handler) @@ -306,17 +579,35 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, + typename CompletionCondition, typename WriteHandler> + inline write_at_op<AsyncRandomAccessWriteDevice, + ConstBufferSequence, CompletionCondition, WriteHandler> + make_write_at_op(AsyncRandomAccessWriteDevice& d, + boost::uint64_t offset, const ConstBufferSequence& buffers, + CompletionCondition completion_condition, WriteHandler handler) + { + return write_at_op<AsyncRandomAccessWriteDevice, + ConstBufferSequence, CompletionCondition, WriteHandler>( + d, offset, buffers, completion_condition, handler); + } } // namespace detail template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> inline void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - detail::write_at_op<AsyncRandomAccessWriteDevice, - ConstBufferSequence, CompletionCondition, WriteHandler>( - d, offset, buffers, completion_condition, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + detail::make_write_at_op( + d, offset, buffers, completion_condition, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))( boost::system::error_code(), 0, 1); } @@ -324,28 +615,48 @@ template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename WriteHandler> inline void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - async_write_at(d, offset, buffers, transfer_all(), 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + detail::make_write_at_op( + d, offset, buffers, transfer_all(), + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))( + boost::system::error_code(), 0, 1); } #if !defined(BOOST_NO_IOSTREAM) namespace detail { - template <typename AsyncRandomAccessWriteDevice, - typename Allocator, typename WriteHandler> + template <typename Allocator, typename WriteHandler> class write_at_streambuf_op { public: write_at_streambuf_op( boost::asio::basic_streambuf<Allocator>& streambuf, - WriteHandler handler) + WriteHandler& handler) : streambuf_(streambuf), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_streambuf_op(const write_at_streambuf_op& other) + : streambuf_(other.streambuf_), + handler_(other.handler_) { } + write_at_streambuf_op(write_at_streambuf_op&& other) + : streambuf_(other.streambuf_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, const std::size_t bytes_transferred) { @@ -358,55 +669,76 @@ namespace detail WriteHandler handler_; }; - template <typename AsyncRandomAccessWriteDevice, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> inline void* asio_handler_allocate(std::size_t size, - write_at_streambuf_op<AsyncRandomAccessWriteDevice, - Allocator, WriteHandler>* this_handler) + write_at_streambuf_op<Allocator, WriteHandler>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( size, this_handler->handler_); } - template <typename AsyncRandomAccessWriteDevice, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> inline void asio_handler_deallocate(void* pointer, std::size_t size, - write_at_streambuf_op<AsyncRandomAccessWriteDevice, - Allocator, WriteHandler>* this_handler) + write_at_streambuf_op<Allocator, WriteHandler>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( pointer, size, this_handler->handler_); } - template <typename Function, typename AsyncRandomAccessWriteDevice, - typename Allocator, typename WriteHandler> + template <typename Function, typename Allocator, typename WriteHandler> + inline void asio_handler_invoke(Function& function, + write_at_streambuf_op<Allocator, WriteHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename Allocator, typename WriteHandler> inline void asio_handler_invoke(const Function& function, - write_at_streambuf_op<AsyncRandomAccessWriteDevice, - Allocator, WriteHandler>* this_handler) + write_at_streambuf_op<Allocator, WriteHandler>* this_handler) { boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename Allocator, typename WriteHandler> + inline write_at_streambuf_op<Allocator, WriteHandler> + make_write_at_streambuf_op( + boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler) + { + return write_at_streambuf_op<Allocator, WriteHandler>(b, handler); + } } // namespace detail template <typename AsyncRandomAccessWriteDevice, typename Allocator, typename CompletionCondition, typename WriteHandler> inline void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, + BOOST_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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + async_write_at(d, offset, b.data(), completion_condition, - detail::write_at_streambuf_op< - AsyncRandomAccessWriteDevice, Allocator, WriteHandler>(b, handler)); + detail::make_write_at_streambuf_op( + b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))); } template <typename AsyncRandomAccessWriteDevice, typename Allocator, typename WriteHandler> inline void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - async_write_at(d, offset, b, transfer_all(), 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + async_write_at(d, offset, b.data(), transfer_all(), + detail::make_write_at_streambuf_op( + b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))); } #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/io_service.hpp b/3rdParty/Boost/src/boost/asio/io_service.hpp index a6a27fa..43b94e4 100644 --- a/3rdParty/Boost/src/boost/asio/io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/io_service.hpp @@ -2,7 +2,7 @@ // io_service.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -68,9 +68,12 @@ namespace detail { typedef task_io_service io_service_impl; } * * @par Thread Safety * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe, with the exception that calling reset() while - * there are unfinished run(), run_one(), poll() or poll_one() calls results in - * undefined behaviour. + * @e Shared @e objects: Safe, with the specific exceptions of the reset() and + * notify_fork() functions. Calling reset() while there are unfinished run(), + * run_one(), poll() or poll_one() calls results in undefined behaviour. The + * notify_fork() function should not be called while any io_service function, + * or any function on an I/O object that is associated with the io_service, is + * being called in another thread. * * @par Concepts: * Dispatcher. @@ -256,8 +259,10 @@ public: * waiting in the pool are equivalent and the io_service may choose any one * of them to invoke a handler. * - * The run() function may be safely called again once it has completed only - * after a call to reset(). + * A normal exit from the run() function implies that the io_service object + * is stopped (the stopped() function returns @c true). Subsequent calls to + * run(), run_one(), poll() or poll_one() will return immediately unless there + * is a prior call to reset(). * * @return The number of handlers that were executed. * @@ -282,8 +287,10 @@ public: * waiting in the pool are equivalent and the io_service may choose any one * of them to invoke a handler. * - * The run() function may be safely called again once it has completed only - * after a call to reset(). + * A normal exit from the run() function implies that the io_service object + * is stopped (the stopped() function returns @c true). Subsequent calls to + * run(), run_one(), poll() or poll_one() will return immediately unless there + * is a prior call to reset(). * * @param ec Set to indicate what error occurred, if any. * @@ -304,7 +311,11 @@ public: * The run_one() function blocks until one handler has been dispatched, or * until the io_service has been stopped. * - * @return The number of handlers that were executed. + * @return The number of handlers that were executed. A zero return value + * implies that the io_service object is stopped (the stopped() function + * returns @c true). Subsequent calls to run(), run_one(), poll() or + * poll_one() will return immediately unless there is a prior call to + * reset(). * * @throws boost::system::system_error Thrown on failure. */ @@ -316,7 +327,11 @@ public: * The run_one() function blocks until one handler has been dispatched, or * until the io_service has been stopped. * - * @param ec Set to indicate what error occurred, if any. + * @return The number of handlers that were executed. A zero return value + * implies that the io_service object is stopped (the stopped() function + * returns @c true). Subsequent calls to run(), run_one(), poll() or + * poll_one() will return immediately unless there is a prior call to + * reset(). * * @return The number of handlers that were executed. */ @@ -379,13 +394,25 @@ public: */ BOOST_ASIO_DECL void stop(); + /// Determine whether the io_service object has been stopped. + /** + * This function is used to determine whether an io_service object has been + * stopped, either through an explicit call to stop(), or due to running out + * of work. When an io_service object is stopped, calls to run(), run_one(), + * poll() or poll_one() will return immediately without invoking any + * handlers. + * + * @return @c true if the io_service object is stopped, otherwise @c false. + */ + BOOST_ASIO_DECL bool stopped() const; + /// Reset the io_service in preparation for a subsequent run() invocation. /** * This function must be called prior to any second or later set of * invocations of the run(), run_one(), poll() or poll_one() functions when a * previous invocation of these functions returned due to the io_service - * being stopped or running out of work. This function allows the io_service - * to reset any internal state, such as a "stopped" flag. + * being stopped or running out of work. After a call to reset(), the + * io_service object's stopped() function will return @c false. * * This function must not be called while there are any unfinished calls to * the run(), run_one(), poll() or poll_one() functions. @@ -414,7 +441,7 @@ public: * throws an exception. */ template <typename CompletionHandler> - void dispatch(CompletionHandler handler); + void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler); /// Request the io_service to invoke the given handler and return immediately. /** @@ -439,7 +466,7 @@ public: * throws an exception. */ template <typename CompletionHandler> - void post(CompletionHandler handler); + void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler); /// Create a new handler that automatically dispatches the wrapped handler /// on the io_service. @@ -471,6 +498,61 @@ public: #endif wrap(Handler handler); + /// Fork-related event notifications. + enum fork_event + { + /// Notify the io_service that the process is about to fork. + fork_prepare, + + /// Notify the io_service that the process has forked and is the parent. + fork_parent, + + /// Notify the io_service that the process has forked and is the child. + fork_child + }; + + /// Notify the io_service of a fork-related event. + /** + * This function is used to inform the io_service that the process is about + * to fork, or has just forked. This allows the io_service, and the services + * it contains, to perform any necessary housekeeping to ensure correct + * operation following a fork. + * + * This function must not be called while any other io_service function, or + * any function on an I/O object associated with the io_service, is being + * called in another thread. It is, however, safe to call this function from + * within a completion handler, provided no other thread is accessing the + * io_service. + * + * @param event A fork-related event. + * + * @throws boost::system::system_error Thrown on failure. If the notification + * fails the io_service object should no longer be used and should be + * destroyed. + * + * @par Example + * The following code illustrates how to incorporate the notify_fork() + * function: + * @code my_io_service.notify_fork(boost::asio::io_service::fork_prepare); + * if (fork() == 0) + * { + * // This is the child process. + * my_io_service.notify_fork(boost::asio::io_service::fork_child); + * } + * else + * { + * // This is the parent process. + * my_io_service.notify_fork(boost::asio::io_service::fork_parent); + * } @endcode + * + * @note For each service object @c svc in the io_service set, performs + * <tt>svc->fork_service();</tt>. When processing the fork_prepare event, + * services are visited in reverse order of the beginning of service object + * lifetime. Otherwise, services are visited in order of the beginning of + * service object lifetime. + */ + BOOST_ASIO_DECL void notify_fork(boost::asio::io_service::fork_event event); + /// Obtain the service object corresponding to the given type. /** * This function is used to locate a service object that corresponds to @@ -569,10 +651,6 @@ public: */ ~work(); - /// (Deprecated: use get_io_service().) Get the io_service associated with the - /// work. - boost::asio::io_service& io_service(); - /// Get the io_service associated with the work. boost::asio::io_service& get_io_service(); @@ -580,8 +658,8 @@ private: // Prevent assignment. void operator=(const work& other); - // The io_service. - boost::asio::io_service& io_service_; + // The io_service implementation. + detail::io_service_impl& io_service_impl_; }; /// Class used to uniquely identify a service. @@ -598,10 +676,6 @@ class io_service::service : private noncopyable { public: - /// (Deprecated: use get_io_service().) Get the io_service object that owns - /// the service. - boost::asio::io_service& io_service(); - /// Get the io_service object that owns the service. boost::asio::io_service& get_io_service(); @@ -619,6 +693,15 @@ private: /// Destroy all user-defined handler objects owned by the service. virtual void shutdown_service() = 0; + /// Handle notification of a fork-related event to perform any necessary + /// housekeeping. + /** + * This function is not a pure virtual so that services only have to + * implement it if necessary. The default implementation does nothing. + */ + BOOST_ASIO_DECL virtual void fork_service( + boost::asio::io_service::fork_event event); + friend class boost::asio::detail::service_registry; struct key { diff --git a/3rdParty/Boost/src/boost/asio/ip/address.hpp b/3rdParty/Boost/src/boost/asio/ip/address.hpp index 4ecae7a..9e62c04 100644 --- a/3rdParty/Boost/src/boost/asio/ip/address.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/address.hpp @@ -2,7 +2,7 @@ // ip/address.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -55,9 +55,19 @@ public: /// Copy constructor. BOOST_ASIO_DECL address(const address& other); +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + BOOST_ASIO_DECL address(address&& other); +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another address. BOOST_ASIO_DECL address& operator=(const address& other); +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another address. + BOOST_ASIO_DECL address& operator=(address&& other); +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from an IPv4 address. BOOST_ASIO_DECL address& operator=( const boost::asio::ip::address_v4& ipv4_address); @@ -108,6 +118,15 @@ public: BOOST_ASIO_DECL static address from_string( const std::string& str, boost::system::error_code& ec); + /// Determine whether the address is a loopback address. + BOOST_ASIO_DECL bool is_loopback() const; + + /// Determine whether the address is unspecified. + BOOST_ASIO_DECL bool is_unspecified() const; + + /// Determine whether the address is a multicast address. + BOOST_ASIO_DECL bool is_multicast() const; + /// Compare two addresses for equality. BOOST_ASIO_DECL friend bool operator==(const address& a1, const address& a2); diff --git a/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp b/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp index 5728a17..8d11921 100644 --- a/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp @@ -2,7 +2,7 @@ // ip/address_v4.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,7 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <string> -#include <boost/array.hpp> +#include <boost/asio/detail/array.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/winsock_init.hpp> #include <boost/system/error_code.hpp> @@ -45,7 +45,15 @@ class address_v4 { public: /// The type used to represent an address as an array of bytes. - typedef boost::array<unsigned char, 4> bytes_type; + /** + * @note This type is defined in terms of the C++0x template @c std::array + * when it is available. Otherwise, it uses @c boost:array. + */ +#if defined(GENERATING_DOCUMENTATION) + typedef array<unsigned char, 4> bytes_type; +#else + typedef boost::asio::detail::array<unsigned char, 4> bytes_type; +#endif /// Default constructor. address_v4() @@ -65,6 +73,14 @@ public: { } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + address_v4(address_v4&& other) + : addr_(other.addr_) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another address. address_v4& operator=(const address_v4& other) { @@ -72,6 +88,15 @@ public: return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another address. + address_v4& operator=(address_v4&& other) + { + addr_ = other.addr_; + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Get the address in bytes, in network byte order. BOOST_ASIO_DECL bytes_type to_bytes() const; @@ -98,6 +123,12 @@ public: BOOST_ASIO_DECL static address_v4 from_string( const std::string& str, boost::system::error_code& ec); + /// Determine whether the address is a loopback address. + BOOST_ASIO_DECL bool is_loopback() const; + + /// Determine whether the address is unspecified. + BOOST_ASIO_DECL bool is_unspecified() const; + /// Determine whether the address is a class A address. BOOST_ASIO_DECL bool is_class_a() const; @@ -149,19 +180,19 @@ public: /// Obtain an address object that represents any address. static address_v4 any() { - return address_v4(static_cast<unsigned long>(INADDR_ANY)); + return address_v4(); } /// Obtain an address object that represents the loopback address. static address_v4 loopback() { - return address_v4(static_cast<unsigned long>(INADDR_LOOPBACK)); + return address_v4(0x7F000001); } /// Obtain an address object that represents the broadcast address. static address_v4 broadcast() { - return address_v4(static_cast<unsigned long>(INADDR_BROADCAST)); + return address_v4(0xFFFFFFFF); } /// Obtain an address object that represents the broadcast address that diff --git a/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp b/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp index 9155bea..e35a176 100644 --- a/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp @@ -2,7 +2,7 @@ // ip/address_v6.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,7 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <string> -#include <boost/array.hpp> +#include <boost/asio/detail/array.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/winsock_init.hpp> #include <boost/system/error_code.hpp> @@ -46,7 +46,15 @@ class address_v6 { public: /// The type used to represent an address as an array of bytes. - typedef boost::array<unsigned char, 16> bytes_type; + /** + * @note This type is defined in terms of the C++0x template @c std::array + * when it is available. Otherwise, it uses @c boost:array. + */ +#if defined(GENERATING_DOCUMENTATION) + typedef array<unsigned char, 16> bytes_type; +#else + typedef boost::asio::detail::array<unsigned char, 16> bytes_type; +#endif /// Default constructor. BOOST_ASIO_DECL address_v6(); @@ -58,9 +66,19 @@ public: /// Copy constructor. BOOST_ASIO_DECL address_v6(const address_v6& other); +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + BOOST_ASIO_DECL address_v6(address_v6&& other); +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another address. BOOST_ASIO_DECL address_v6& operator=(const address_v6& other); +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another address. + BOOST_ASIO_DECL address_v6& operator=(address_v6&& other); +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// The scope ID of the address. /** * Returns the scope ID associated with the IPv6 address. diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_endpoint.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_endpoint.hpp index 0047adc..9eefe4c 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_endpoint.hpp @@ -2,7 +2,7 @@ // ip/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -78,8 +78,9 @@ public: * boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876); * @endcode */ - basic_endpoint(const InternetProtocol& protocol, unsigned short port_num) - : impl_(protocol.family(), port_num) + basic_endpoint(const InternetProtocol& internet_protocol, + unsigned short port_num) + : impl_(internet_protocol.family(), port_num) { } @@ -97,6 +98,14 @@ public: { } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + basic_endpoint(basic_endpoint&& other) + : impl_(other.impl_) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another endpoint. basic_endpoint& operator=(const basic_endpoint& other) { @@ -104,6 +113,15 @@ public: return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another endpoint. + basic_endpoint& operator=(basic_endpoint&& other) + { + impl_ = other.impl_; + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// The protocol associated with the endpoint. protocol_type protocol() const { @@ -131,9 +149,9 @@ public: } /// Set the underlying size of the endpoint in the native type. - void resize(std::size_t size) + void resize(std::size_t new_size) { - impl_.resize(size); + impl_.resize(new_size); } /// Get the capacity of the endpoint in the native type. diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp index f27515a..6265890 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/ip/basic_resolver_iterator.hpp> @@ -99,7 +100,7 @@ public: { boost::system::error_code ec; iterator i = this->service.resolve(this->implementation, q, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "resolve"); return i; } @@ -152,9 +153,16 @@ public: * the handler. */ template <typename ResolveHandler> - void async_resolve(const query& q, ResolveHandler handler) + void async_resolve(const query& q, + BOOST_ASIO_MOVE_ARG(ResolveHandler) handler) { - return this->service.async_resolve(this->implementation, q, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ResolveHandler. + BOOST_ASIO_RESOLVE_HANDLER_CHECK( + ResolveHandler, handler, iterator) type_check; + + return this->service.async_resolve(this->implementation, q, + BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler)); } /// Perform reverse resolution of an endpoint to a list of entries. @@ -179,7 +187,7 @@ public: { boost::system::error_code ec; iterator i = this->service.resolve(this->implementation, e, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "resolve"); return i; } @@ -236,9 +244,16 @@ public: * the handler. */ template <typename ResolveHandler> - void async_resolve(const endpoint_type& e, ResolveHandler handler) + void async_resolve(const endpoint_type& e, + BOOST_ASIO_MOVE_ARG(ResolveHandler) handler) { - return this->service.async_resolve(this->implementation, e, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ResolveHandler. + BOOST_ASIO_RESOLVE_HANDLER_CHECK( + ResolveHandler, handler, iterator) type_check; + + return this->service.async_resolve(this->implementation, e, + BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_entry.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_entry.hpp index 980b488..d170ab0 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_entry.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_entry.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_entry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -49,11 +49,11 @@ public: } /// Construct with specified endpoint, host name and service name. - basic_resolver_entry(const endpoint_type& endpoint, - const std::string& host_name, const std::string& service_name) - : endpoint_(endpoint), - host_name_(host_name), - service_name_(service_name) + basic_resolver_entry(const endpoint_type& ep, + const std::string& host, const std::string& service) + : endpoint_(ep), + host_name_(host), + service_name_(service) { } diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp index 465c278..6e52a85 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_iterator.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,8 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/iterator.hpp> +#include <cstddef> #include <cstring> +#include <iterator> #include <string> #include <vector> #include <boost/asio/detail/shared_ptr.hpp> @@ -45,15 +46,23 @@ namespace ip { */ template <typename InternetProtocol> class basic_resolver_iterator -#if defined(GENERATING_DOCUMENTATION) - : public std::iterator< -#else // defined(GENERATING_DOCUMENTATION) - : public boost::iterator< -#endif // defined(GENERATING_DOCUMENTATION) - std::forward_iterator_tag, - const basic_resolver_entry<InternetProtocol> > { public: + /// The type used for the distance between two iterators. + typedef std::ptrdiff_t difference_type; + + /// The type of the value pointed to by the iterator. + typedef basic_resolver_entry<InternetProtocol> value_type; + + /// The type of the result of applying operator->() to the iterator. + typedef const basic_resolver_entry<InternetProtocol>* pointer; + + /// The type of the result of applying operator*() to the iterator. + typedef const basic_resolver_entry<InternetProtocol>& reference; + + /// The iterator category. + typedef std::forward_iterator_tag iterator_category; + /// Default constructor creates an end iterator. basic_resolver_iterator() : index_(0) diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp index 8fd63bc..0f7a54d 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_query.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -48,8 +48,8 @@ public: * This constructor is typically used to perform name resolution for local * service binding. * - * @param service_name A string identifying the requested service. This may - * be a descriptive name or a numeric string corresponding to a port number. + * @param service A string identifying the requested service. This may be a + * descriptive name or a numeric string corresponding to a port number. * * @param resolve_flags A set of flags that determine how name resolution * should be performed. The default flags are suitable for local service @@ -60,11 +60,11 @@ public: * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems * may use additional locations when resolving service names. */ - basic_resolver_query(const std::string& service_name, + basic_resolver_query(const std::string& service, resolver_query_base::flags resolve_flags = passive | address_configured) : hints_(), host_name_(), - service_name_(service_name) + service_name_(service) { typename InternetProtocol::endpoint endpoint; hints_.ai_flags = static_cast<int>(resolve_flags); @@ -85,8 +85,8 @@ public: * @param protocol A protocol object, normally representing either the IPv4 or * IPv6 version of an internet protocol. * - * @param service_name A string identifying the requested service. This may - * be a descriptive name or a numeric string corresponding to a port number. + * @param service A string identifying the requested service. This may be a + * descriptive name or a numeric string corresponding to a port number. * * @param resolve_flags A set of flags that determine how name resolution * should be performed. The default flags are suitable for local service @@ -98,11 +98,11 @@ public: * may use additional locations when resolving service names. */ basic_resolver_query(const protocol_type& protocol, - const std::string& service_name, + const std::string& service, resolver_query_base::flags resolve_flags = passive | address_configured) : hints_(), host_name_(), - service_name_(service_name) + service_name_(service) { hints_.ai_flags = static_cast<int>(resolve_flags); hints_.ai_family = protocol.family(); @@ -119,16 +119,16 @@ public: * This constructor is typically used to perform name resolution for * communication with remote hosts. * - * @param host_name A string identifying a location. May be a descriptive name - * or a numeric address string. If an empty string and the passive flag has - * been specified, the resolved endpoints are suitable for local service - * binding. If an empty string and passive is not specified, the resolved - * endpoints will use the loopback address. + * @param host A string identifying a location. May be a descriptive name or + * a numeric address string. If an empty string and the passive flag has been + * specified, the resolved endpoints are suitable for local service binding. + * If an empty string and passive is not specified, the resolved endpoints + * will use the loopback address. * - * @param service_name A string identifying the requested service. This may - * be a descriptive name or a numeric string corresponding to a port number. - * May be an empty string, in which case all resolved endpoints will have a - * port number of 0. + * @param service A string identifying the requested service. This may be a + * descriptive name or a numeric string corresponding to a port number. May + * be an empty string, in which case all resolved endpoints will have a port + * number of 0. * * @param resolve_flags A set of flags that determine how name resolution * should be performed. The default flags are suitable for communication with @@ -145,12 +145,11 @@ public: * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems * may use additional locations when resolving service names. */ - basic_resolver_query(const std::string& host_name, - const std::string& service_name, + basic_resolver_query(const std::string& host, const std::string& service, resolver_query_base::flags resolve_flags = address_configured) : hints_(), - host_name_(host_name), - service_name_(service_name) + host_name_(host), + service_name_(service) { typename InternetProtocol::endpoint endpoint; hints_.ai_flags = static_cast<int>(resolve_flags); @@ -171,16 +170,16 @@ public: * @param protocol A protocol object, normally representing either the IPv4 or * IPv6 version of an internet protocol. * - * @param host_name A string identifying a location. May be a descriptive name - * or a numeric address string. If an empty string and the passive flag has - * been specified, the resolved endpoints are suitable for local service - * binding. If an empty string and passive is not specified, the resolved - * endpoints will use the loopback address. + * @param host A string identifying a location. May be a descriptive name or + * a numeric address string. If an empty string and the passive flag has been + * specified, the resolved endpoints are suitable for local service binding. + * If an empty string and passive is not specified, the resolved endpoints + * will use the loopback address. * - * @param service_name A string identifying the requested service. This may - * be a descriptive name or a numeric string corresponding to a port number. - * May be an empty string, in which case all resolved endpoints will have a - * port number of 0. + * @param service A string identifying the requested service. This may be a + * descriptive name or a numeric string corresponding to a port number. May + * be an empty string, in which case all resolved endpoints will have a port + * number of 0. * * @param resolve_flags A set of flags that determine how name resolution * should be performed. The default flags are suitable for communication with @@ -198,11 +197,11 @@ public: * may use additional locations when resolving service names. */ basic_resolver_query(const protocol_type& protocol, - const std::string& host_name, const std::string& service_name, + const std::string& host, const std::string& service, resolver_query_base::flags resolve_flags = address_configured) : hints_(), - host_name_(host_name), - service_name_(service_name) + host_name_(host), + service_name_(service) { hints_.ai_flags = static_cast<int>(resolve_flags); hints_.ai_family = protocol.family(); diff --git a/3rdParty/Boost/src/boost/asio/ip/detail/endpoint.hpp b/3rdParty/Boost/src/boost/asio/ip/detail/endpoint.hpp index fe95a00..04335ef 100644 --- a/3rdParty/Boost/src/boost/asio/ip/detail/endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/detail/endpoint.hpp @@ -2,7 +2,7 @@ // ip/detail/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -78,12 +78,12 @@ public: } // Set the underlying size of the endpoint in the native type. - BOOST_ASIO_DECL void resize(std::size_t size); + BOOST_ASIO_DECL void resize(std::size_t new_size); // Get the capacity of the endpoint in the native type. std::size_t capacity() const { - return sizeof(boost::asio::detail::sockaddr_storage_type); + return sizeof(data_); } // Get the port associated with the endpoint. @@ -122,7 +122,6 @@ private: union data_union { boost::asio::detail::socket_addr_type base; - boost::asio::detail::sockaddr_storage_type storage; boost::asio::detail::sockaddr_in4_type v4; boost::asio::detail::sockaddr_in6_type v6; } data_; diff --git a/3rdParty/Boost/src/boost/asio/ip/detail/impl/endpoint.ipp b/3rdParty/Boost/src/boost/asio/ip/detail/impl/endpoint.ipp index 0443d38..24bfce2 100644 --- a/3rdParty/Boost/src/boost/asio/ip/detail/impl/endpoint.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/detail/impl/endpoint.ipp @@ -2,7 +2,7 @@ // ip/detail/impl/endpoint.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -57,8 +57,14 @@ endpoint::endpoint(int family, unsigned short port_num) data_.v6.sin6_port = boost::asio::detail::socket_ops::host_to_network_short(port_num); data_.v6.sin6_flowinfo = 0; - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - data_.v6.sin6_addr = tmp_addr; + data_.v6.sin6_addr.s6_addr[0] = 0; data_.v6.sin6_addr.s6_addr[1] = 0; + data_.v6.sin6_addr.s6_addr[2] = 0, data_.v6.sin6_addr.s6_addr[3] = 0; + data_.v6.sin6_addr.s6_addr[4] = 0, data_.v6.sin6_addr.s6_addr[5] = 0; + data_.v6.sin6_addr.s6_addr[6] = 0, data_.v6.sin6_addr.s6_addr[7] = 0; + data_.v6.sin6_addr.s6_addr[8] = 0, data_.v6.sin6_addr.s6_addr[9] = 0; + data_.v6.sin6_addr.s6_addr[10] = 0, data_.v6.sin6_addr.s6_addr[11] = 0; + data_.v6.sin6_addr.s6_addr[12] = 0, data_.v6.sin6_addr.s6_addr[13] = 0; + data_.v6.sin6_addr.s6_addr[14] = 0, data_.v6.sin6_addr.s6_addr[15] = 0; data_.v6.sin6_scope_id = 0; } } @@ -85,14 +91,14 @@ endpoint::endpoint(const boost::asio::ip::address& addr, data_.v6.sin6_flowinfo = 0; boost::asio::ip::address_v6 v6_addr = addr.to_v6(); boost::asio::ip::address_v6::bytes_type bytes = v6_addr.to_bytes(); - memcpy(data_.v6.sin6_addr.s6_addr, bytes.elems, 16); + memcpy(data_.v6.sin6_addr.s6_addr, bytes.data(), 16); data_.v6.sin6_scope_id = v6_addr.scope_id(); } } -void endpoint::resize(std::size_t size) +void endpoint::resize(std::size_t new_size) { - if (size > sizeof(boost::asio::detail::sockaddr_storage_type)) + if (new_size > sizeof(boost::asio::detail::sockaddr_storage_type)) { boost::system::error_code ec(boost::asio::error::invalid_argument); boost::asio::detail::throw_error(ec); @@ -139,7 +145,11 @@ boost::asio::ip::address endpoint::address() const else { boost::asio::ip::address_v6::bytes_type bytes; +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + memcpy(bytes.data(), data_.v6.sin6_addr.s6_addr, 16); +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) memcpy(bytes.elems, data_.v6.sin6_addr.s6_addr, 16); +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) return boost::asio::ip::address_v6(bytes, data_.v6.sin6_scope_id); } } diff --git a/3rdParty/Boost/src/boost/asio/ip/detail/socket_option.hpp b/3rdParty/Boost/src/boost/asio/ip/detail/socket_option.hpp index 6fde8c3..041a9f8 100644 --- a/3rdParty/Boost/src/boost/asio/ip/detail/socket_option.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/detail/socket_option.hpp @@ -2,7 +2,7 @@ // detail/socket_option.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> #include <cstring> +#include <stdexcept> #include <boost/throw_exception.hpp> #include <boost/asio/detail/socket_ops.hpp> #include <boost/asio/detail/socket_types.hpp> @@ -385,35 +386,22 @@ class multicast_request public: // Default constructor. multicast_request() + : ipv4_value_(), // Zero-initialisation gives the "any" address. + ipv6_value_() // Zero-initialisation gives the "any" address. { - ipv4_value_.imr_multiaddr.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - ipv4_value_.imr_interface.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - ipv6_value_.ipv6mr_multiaddr = tmp_addr; - ipv6_value_.ipv6mr_interface = 0; } // Construct with multicast address only. explicit multicast_request(const boost::asio::ip::address& multicast_address) + : ipv4_value_(), // Zero-initialisation gives the "any" address. + ipv6_value_() // Zero-initialisation gives the "any" address. { if (multicast_address.is_v6()) { - ipv4_value_.imr_multiaddr.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - ipv4_value_.imr_interface.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - using namespace std; // For memcpy. boost::asio::ip::address_v6 ipv6_address = multicast_address.to_v6(); boost::asio::ip::address_v6::bytes_type bytes = ipv6_address.to_bytes(); - memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.elems, 16); + memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16); ipv6_value_.ipv6mr_interface = 0; } else @@ -424,10 +412,6 @@ public: ipv4_value_.imr_interface.s_addr = boost::asio::detail::socket_ops::host_to_network_long( boost::asio::ip::address_v4::any().to_ulong()); - - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - ipv6_value_.ipv6mr_multiaddr = tmp_addr; - ipv6_value_.ipv6mr_interface = 0; } } @@ -436,6 +420,7 @@ public: const boost::asio::ip::address_v4& multicast_address, const boost::asio::ip::address_v4& network_interface = boost::asio::ip::address_v4::any()) + : ipv6_value_() // Zero-initialisation gives the "any" address. { ipv4_value_.imr_multiaddr.s_addr = boost::asio::detail::socket_ops::host_to_network_long( @@ -443,28 +428,18 @@ public: ipv4_value_.imr_interface.s_addr = boost::asio::detail::socket_ops::host_to_network_long( network_interface.to_ulong()); - - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - ipv6_value_.ipv6mr_multiaddr = tmp_addr; - ipv6_value_.ipv6mr_interface = 0; } // Construct with multicast address and IPv6 network interface index. explicit multicast_request( const boost::asio::ip::address_v6& multicast_address, unsigned long network_interface = 0) + : ipv4_value_() // Zero-initialisation gives the "any" address. { - ipv4_value_.imr_multiaddr.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - ipv4_value_.imr_interface.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - using namespace std; // For memcpy. boost::asio::ip::address_v6::bytes_type bytes = multicast_address.to_bytes(); - memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.elems, 16); + memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16); ipv6_value_.ipv6mr_interface = network_interface; } diff --git a/3rdParty/Boost/src/boost/asio/ip/host_name.hpp b/3rdParty/Boost/src/boost/asio/ip/host_name.hpp index 33860c9..9e024e1 100644 --- a/3rdParty/Boost/src/boost/asio/ip/host_name.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/host_name.hpp @@ -2,7 +2,7 @@ // ip/host_name.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/icmp.hpp b/3rdParty/Boost/src/boost/asio/ip/icmp.hpp index 14bb944..62748b6 100644 --- a/3rdParty/Boost/src/boost/asio/ip/icmp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/icmp.hpp @@ -2,7 +2,7 @@ // ip/icmp.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -46,12 +46,6 @@ public: /// The type of a ICMP endpoint. typedef basic_endpoint<icmp> endpoint; - /// (Deprecated: use resolver::query.) The type of a resolver query. - typedef basic_resolver_query<icmp> resolver_query; - - /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. - typedef basic_resolver_iterator<icmp> resolver_iterator; - /// Construct to represent the IPv4 ICMP protocol. static icmp v4() { @@ -102,9 +96,9 @@ public: private: // Construct with a specific family. - explicit icmp(int protocol, int family) - : protocol_(protocol), - family_(family) + explicit icmp(int protocol_id, int protocol_family) + : protocol_(protocol_id), + family_(protocol_family) { } diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address.hpp b/3rdParty/Boost/src/boost/asio/ip/impl/address.hpp index 94dfb17..a875e1b 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address.hpp @@ -2,7 +2,7 @@ // ip/impl/address.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address.ipp b/3rdParty/Boost/src/boost/asio/ip/impl/address.ipp index 11f06fc..5353758 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address.ipp @@ -2,7 +2,7 @@ // ip/impl/address.ipp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -57,6 +57,15 @@ address::address(const address& other) { } +#if defined(BOOST_ASIO_HAS_MOVE) +address::address(address&& other) + : type_(other.type_), + ipv4_address_(other.ipv4_address_), + ipv6_address_(other.ipv6_address_) +{ +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + address& address::operator=(const address& other) { type_ = other.type_; @@ -65,6 +74,16 @@ address& address::operator=(const address& other) return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) +address& address::operator=(address&& other) +{ + type_ = other.type_; + ipv4_address_ = other.ipv4_address_; + ipv6_address_ = other.ipv6_address_; + return *this; +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + address& address::operator=(const boost::asio::ip::address_v4& ipv4_address) { type_ = ipv4; @@ -159,6 +178,27 @@ address address::from_string(const std::string& str, return from_string(str.c_str(), ec); } +bool address::is_loopback() const +{ + return (type_ == ipv4) + ? ipv4_address_.is_loopback() + : ipv6_address_.is_loopback(); +} + +bool address::is_unspecified() const +{ + return (type_ == ipv4) + ? ipv4_address_.is_unspecified() + : ipv6_address_.is_unspecified(); +} + +bool address::is_multicast() const +{ + return (type_ == ipv4) + ? ipv4_address_.is_multicast() + : ipv6_address_.is_multicast(); +} + bool operator==(const address& a1, const address& a2) { if (a1.type_ != a2.type_) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.hpp b/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.hpp index d27d48d..87b0e19 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.hpp @@ -2,7 +2,7 @@ // ip/impl/address_v4.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.ipp b/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.ipp index 8bdef19..31f6e27 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.ipp @@ -2,7 +2,7 @@ // ip/impl/address_v4.ipp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -42,7 +42,7 @@ address_v4::address_v4(const address_v4::bytes_type& bytes) #endif // UCHAR_MAX > 0xFF using namespace std; // For memcpy. - memcpy(&addr_.s_addr, bytes.elems, 4); + memcpy(&addr_.s_addr, bytes.data(), 4); } address_v4::address_v4(unsigned long addr) @@ -62,7 +62,11 @@ address_v4::bytes_type address_v4::to_bytes() const { using namespace std; // For memcpy. bytes_type bytes; +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + memcpy(bytes.data(), &addr_.s_addr, 4); +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) memcpy(bytes.elems, &addr_.s_addr, 4); +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) return bytes; } @@ -119,24 +123,34 @@ address_v4 address_v4::from_string( return from_string(str.c_str(), ec); } +bool address_v4::is_loopback() const +{ + return (to_ulong() & 0xFF000000) == 0x7F000000; +} + +bool address_v4::is_unspecified() const +{ + return to_ulong() == 0; +} + bool address_v4::is_class_a() const { - return IN_CLASSA(to_ulong()); + return (to_ulong() & 0x80000000) == 0; } bool address_v4::is_class_b() const { - return IN_CLASSB(to_ulong()); + return (to_ulong() & 0xC0000000) == 0x80000000; } bool address_v4::is_class_c() const { - return IN_CLASSC(to_ulong()); + return (to_ulong() & 0xE0000000) == 0xC0000000; } bool address_v4::is_multicast() const { - return IN_MULTICAST(to_ulong()); + return (to_ulong() & 0xF0000000) == 0xE0000000; } address_v4 address_v4::broadcast(const address_v4& addr, const address_v4& mask) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.hpp b/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.hpp index 11e1797..6993ef0 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.hpp @@ -2,7 +2,7 @@ // ip/impl/address_v6.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.ipp b/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.ipp index 5a3dddd..9bf9e96 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.ipp @@ -2,7 +2,7 @@ // ip/impl/address_v6.ipp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -32,15 +32,14 @@ namespace asio { namespace ip { address_v6::address_v6() - : scope_id_(0) + : addr_(), + scope_id_(0) { - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - addr_ = tmp_addr; } address_v6::address_v6(const address_v6::bytes_type& bytes, - unsigned long scope_id) - : scope_id_(scope_id) + unsigned long scope) + : scope_id_(scope) { #if UCHAR_MAX > 0xFF for (std::size_t i = 0; i < bytes.size(); ++i) @@ -54,7 +53,7 @@ address_v6::address_v6(const address_v6::bytes_type& bytes, #endif // UCHAR_MAX > 0xFF using namespace std; // For memcpy. - memcpy(addr_.s6_addr, bytes.elems, 16); + memcpy(addr_.s6_addr, bytes.data(), 16); } address_v6::address_v6(const address_v6& other) @@ -63,6 +62,14 @@ address_v6::address_v6(const address_v6& other) { } +#if defined(BOOST_ASIO_HAS_MOVE) +address_v6::address_v6(address_v6&& other) + : addr_(other.addr_), + scope_id_(other.scope_id_) +{ +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + address_v6& address_v6::operator=(const address_v6& other) { addr_ = other.addr_; @@ -70,11 +77,24 @@ address_v6& address_v6::operator=(const address_v6& other) return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) +address_v6& address_v6::operator=(address_v6&& other) +{ + addr_ = other.addr_; + scope_id_ = other.scope_id_; + return *this; +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + address_v6::bytes_type address_v6::to_bytes() const { using namespace std; // For memcpy. bytes_type bytes; +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + memcpy(bytes.data(), addr_.s6_addr, 16); +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) memcpy(bytes.elems, addr_.s6_addr, 16); +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) return bytes; } @@ -141,7 +161,6 @@ address_v4 address_v6::to_v4() const bool address_v6::is_loopback() const { -#if defined(__BORLANDC__) return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0) && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0) && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0) @@ -150,15 +169,10 @@ bool address_v6::is_loopback() const && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0) && (addr_.s6_addr[12] == 0) && (addr_.s6_addr[13] == 0) && (addr_.s6_addr[14] == 0) && (addr_.s6_addr[15] == 1)); -#else - using namespace boost::asio::detail; - return IN6_IS_ADDR_LOOPBACK(&addr_) != 0; -#endif } bool address_v6::is_unspecified() const { -#if defined(__BORLANDC__) return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0) && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0) && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0) @@ -167,70 +181,70 @@ bool address_v6::is_unspecified() const && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0) && (addr_.s6_addr[12] == 0) && (addr_.s6_addr[13] == 0) && (addr_.s6_addr[14] == 0) && (addr_.s6_addr[15] == 0)); -#else - using namespace boost::asio::detail; - return IN6_IS_ADDR_UNSPECIFIED(&addr_) != 0; -#endif } bool address_v6::is_link_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_LINKLOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xfe) && ((addr_.s6_addr[1] & 0xc0) == 0x80)); } bool address_v6::is_site_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_SITELOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xfe) && ((addr_.s6_addr[1] & 0xc0) == 0xc0)); } bool address_v6::is_v4_mapped() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_V4MAPPED(&addr_) != 0; + return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0) + && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0) + && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0) + && (addr_.s6_addr[6] == 0) && (addr_.s6_addr[7] == 0) + && (addr_.s6_addr[8] == 0) && (addr_.s6_addr[9] == 0) + && (addr_.s6_addr[10] == 0xff) && (addr_.s6_addr[11] == 0xff)); } bool address_v6::is_v4_compatible() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_V4COMPAT(&addr_) != 0; + return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0) + && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0) + && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0) + && (addr_.s6_addr[6] == 0) && (addr_.s6_addr[7] == 0) + && (addr_.s6_addr[8] == 0) && (addr_.s6_addr[9] == 0) + && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0) + && !((addr_.s6_addr[12] == 0) + && (addr_.s6_addr[13] == 0) + && (addr_.s6_addr[14] == 0) + && ((addr_.s6_addr[15] == 0) || (addr_.s6_addr[15] == 1)))); } bool address_v6::is_multicast() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MULTICAST(&addr_) != 0; + return (addr_.s6_addr[0] == 0xff); } bool address_v6::is_multicast_global() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_GLOBAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x0e)); } bool address_v6::is_multicast_link_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_LINKLOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x02)); } bool address_v6::is_multicast_node_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_NODELOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x01)); } bool address_v6::is_multicast_org_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_ORGLOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x08)); } bool address_v6::is_multicast_site_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_SITELOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x05)); } bool operator==(const address_v6& a1, const address_v6& a2) @@ -256,8 +270,7 @@ bool operator<(const address_v6& a1, const address_v6& a2) address_v6 address_v6::loopback() { address_v6 tmp; - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_LOOPBACK_INIT; - tmp.addr_ = tmp_addr; + tmp.addr_.s6_addr[15] = 1; return tmp; } diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/basic_endpoint.hpp b/3rdParty/Boost/src/boost/asio/ip/impl/basic_endpoint.hpp index 9d39c87..681d76e 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/basic_endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/basic_endpoint.hpp @@ -2,7 +2,7 @@ // ip/impl/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/host_name.ipp b/3rdParty/Boost/src/boost/asio/ip/impl/host_name.ipp index 734341e..cbac039 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/host_name.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/host_name.ipp @@ -2,7 +2,7 @@ // ip/impl/host_name.ipp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/multicast.hpp b/3rdParty/Boost/src/boost/asio/ip/multicast.hpp index 2a02627..a0a3c41 100644 --- a/3rdParty/Boost/src/boost/asio/ip/multicast.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/multicast.hpp @@ -2,7 +2,7 @@ // ip/multicast.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp b/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp index 96ad512..4e281a6 100644 --- a/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp @@ -2,7 +2,7 @@ // ip/resolver_query_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp b/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp index db0554b..74915d2 100644 --- a/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp @@ -2,7 +2,7 @@ // ip/resolver_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -77,12 +77,6 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new resolver implementation. void construct(implementation_type& impl) { @@ -109,11 +103,12 @@ public: } /// Asynchronously resolve a query to a list of entries. - template <typename Handler> + template <typename ResolveHandler> void async_resolve(implementation_type& impl, const query_type& query, - Handler handler) + BOOST_ASIO_MOVE_ARG(ResolveHandler) handler) { - service_impl_.async_resolve(impl, query, handler); + service_impl_.async_resolve(impl, query, + BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler)); } /// Resolve an endpoint to a list of entries. @@ -126,12 +121,25 @@ public: /// Asynchronously resolve an endpoint to a list of entries. template <typename ResolveHandler> void async_resolve(implementation_type& impl, const endpoint_type& endpoint, - ResolveHandler handler) + BOOST_ASIO_MOVE_ARG(ResolveHandler) handler) { - return service_impl_.async_resolve(impl, endpoint, handler); + return service_impl_.async_resolve(impl, endpoint, + BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // Perform any fork-related housekeeping. + void fork_service(boost::asio::io_service::fork_event event) + { + service_impl_.fork_service(event); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/ip/tcp.hpp b/3rdParty/Boost/src/boost/asio/ip/tcp.hpp index 4163a8d..0256e6f 100644 --- a/3rdParty/Boost/src/boost/asio/ip/tcp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/tcp.hpp @@ -2,7 +2,7 @@ // ip/tcp.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -49,12 +49,6 @@ public: /// The type of a TCP endpoint. typedef basic_endpoint<tcp> endpoint; - /// (Deprecated: use resolver::query.) The type of a resolver query. - typedef basic_resolver_query<tcp> resolver_query; - - /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. - typedef basic_resolver_iterator<tcp> resolver_iterator; - /// Construct to represent the IPv4 TCP protocol. static tcp v4() { @@ -146,8 +140,8 @@ public: private: // Construct with a specific family. - explicit tcp(int family) - : family_(family) + explicit tcp(int protocol_family) + : family_(protocol_family) { } diff --git a/3rdParty/Boost/src/boost/asio/ip/udp.hpp b/3rdParty/Boost/src/boost/asio/ip/udp.hpp index 40f5d3a..acf61ef 100644 --- a/3rdParty/Boost/src/boost/asio/ip/udp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/udp.hpp @@ -2,7 +2,7 @@ // ip/udp.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -46,12 +46,6 @@ public: /// The type of a UDP endpoint. typedef basic_endpoint<udp> endpoint; - /// (Deprecated: use resolver::query.) The type of a resolver query. - typedef basic_resolver_query<udp> resolver_query; - - /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. - typedef basic_resolver_iterator<udp> resolver_iterator; - /// Construct to represent the IPv4 UDP protocol. static udp v4() { @@ -102,8 +96,8 @@ public: private: // Construct with a specific family. - explicit udp(int family) - : family_(family) + explicit udp(int protocol_family) + : family_(protocol_family) { } diff --git a/3rdParty/Boost/src/boost/asio/ip/unicast.hpp b/3rdParty/Boost/src/boost/asio/ip/unicast.hpp index dc7d8e9..5ff0dc8 100644 --- a/3rdParty/Boost/src/boost/asio/ip/unicast.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/unicast.hpp @@ -2,7 +2,7 @@ // ip/unicast.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/v6_only.hpp b/3rdParty/Boost/src/boost/asio/ip/v6_only.hpp index e67a548..0441991 100644 --- a/3rdParty/Boost/src/boost/asio/ip/v6_only.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/v6_only.hpp @@ -2,7 +2,7 @@ // ip/v6_only.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/is_read_buffered.hpp b/3rdParty/Boost/src/boost/asio/is_read_buffered.hpp index 1aac50f..8ad32e4 100644 --- a/3rdParty/Boost/src/boost/asio/is_read_buffered.hpp +++ b/3rdParty/Boost/src/boost/asio/is_read_buffered.hpp @@ -2,7 +2,7 @@ // is_read_buffered.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/is_write_buffered.hpp b/3rdParty/Boost/src/boost/asio/is_write_buffered.hpp index 03de0f1..bbc2e22 100644 --- a/3rdParty/Boost/src/boost/asio/is_write_buffered.hpp +++ b/3rdParty/Boost/src/boost/asio/is_write_buffered.hpp @@ -2,7 +2,7 @@ // is_write_buffered.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/local/basic_endpoint.hpp b/3rdParty/Boost/src/boost/asio/local/basic_endpoint.hpp index fcb53a0..f191dd6 100644 --- a/3rdParty/Boost/src/boost/asio/local/basic_endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/local/basic_endpoint.hpp @@ -2,7 +2,7 @@ // local/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -66,14 +66,14 @@ public: } /// Construct an endpoint using the specified path name. - basic_endpoint(const char* path) - : impl_(path) + basic_endpoint(const char* path_name) + : impl_(path_name) { } /// Construct an endpoint using the specified path name. - basic_endpoint(const std::string& path) - : impl_(path) + basic_endpoint(const std::string& path_name) + : impl_(path_name) { } @@ -83,6 +83,14 @@ public: { } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + basic_endpoint(basic_endpoint&& other) + : impl_(other.impl_) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another endpoint. basic_endpoint& operator=(const basic_endpoint& other) { @@ -90,6 +98,15 @@ public: return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another endpoint. + basic_endpoint& operator=(basic_endpoint&& other) + { + impl_ = other.impl_; + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// The protocol associated with the endpoint. protocol_type protocol() const { @@ -115,9 +132,9 @@ public: } /// Set the underlying size of the endpoint in the native type. - void resize(std::size_t size) + void resize(std::size_t new_size) { - impl_.resize(size); + impl_.resize(new_size); } /// Get the capacity of the endpoint in the native type. diff --git a/3rdParty/Boost/src/boost/asio/local/connect_pair.hpp b/3rdParty/Boost/src/boost/asio/local/connect_pair.hpp index 9ef6cd3..e691398 100644 --- a/3rdParty/Boost/src/boost/asio/local/connect_pair.hpp +++ b/3rdParty/Boost/src/boost/asio/local/connect_pair.hpp @@ -2,7 +2,7 @@ // local/connect_pair.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -52,7 +52,7 @@ inline void connect_pair( { boost::system::error_code ec; connect_pair(socket1, socket2, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "connect_pair"); } template <typename Protocol, typename SocketService1, typename SocketService2> diff --git a/3rdParty/Boost/src/boost/asio/local/datagram_protocol.hpp b/3rdParty/Boost/src/boost/asio/local/datagram_protocol.hpp index eaa0241..6fa6323 100644 --- a/3rdParty/Boost/src/boost/asio/local/datagram_protocol.hpp +++ b/3rdParty/Boost/src/boost/asio/local/datagram_protocol.hpp @@ -2,7 +2,7 @@ // local/datagram_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/local/detail/endpoint.hpp b/3rdParty/Boost/src/boost/asio/local/detail/endpoint.hpp index c527793..998d371 100644 --- a/3rdParty/Boost/src/boost/asio/local/detail/endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/local/detail/endpoint.hpp @@ -2,7 +2,7 @@ // local/detail/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -39,10 +39,10 @@ public: BOOST_ASIO_DECL endpoint(); // Construct an endpoint using the specified path name. - BOOST_ASIO_DECL endpoint(const char* path); + BOOST_ASIO_DECL endpoint(const char* path_name); // Construct an endpoint using the specified path name. - BOOST_ASIO_DECL endpoint(const std::string& path); + BOOST_ASIO_DECL endpoint(const std::string& path_name); // Copy constructor. endpoint(const endpoint& other) diff --git a/3rdParty/Boost/src/boost/asio/local/detail/impl/endpoint.ipp b/3rdParty/Boost/src/boost/asio/local/detail/impl/endpoint.ipp index a4c1e56..8e3d06a 100644 --- a/3rdParty/Boost/src/boost/asio/local/detail/impl/endpoint.ipp +++ b/3rdParty/Boost/src/boost/asio/local/detail/impl/endpoint.ipp @@ -2,7 +2,7 @@ // local/detail/impl/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -38,31 +38,31 @@ endpoint::endpoint() init("", 0); } -endpoint::endpoint(const char* path) +endpoint::endpoint(const char* path_name) { using namespace std; // For strlen. - init(path, strlen(path)); + init(path_name, strlen(path_name)); } -endpoint::endpoint(const std::string& path) +endpoint::endpoint(const std::string& path_name) { - init(path.data(), path.length()); + init(path_name.data(), path_name.length()); } -void endpoint::resize(std::size_t size) +void endpoint::resize(std::size_t new_size) { - if (size > sizeof(boost::asio::detail::sockaddr_un_type)) + if (new_size > sizeof(boost::asio::detail::sockaddr_un_type)) { boost::system::error_code ec(boost::asio::error::invalid_argument); boost::asio::detail::throw_error(ec); } - else if (size == 0) + else if (new_size == 0) { path_length_ = 0; } else { - path_length_ = size + path_length_ = new_size - offsetof(boost::asio::detail::sockaddr_un_type, sun_path); // The path returned by the operating system may be NUL-terminated. @@ -97,7 +97,7 @@ bool operator<(const endpoint& e1, const endpoint& e2) return e1.path() < e2.path(); } -void endpoint::init(const char* path, std::size_t path_length) +void endpoint::init(const char* path_name, std::size_t path_length) { if (path_length > sizeof(data_.local.sun_path) - 1) { @@ -109,7 +109,7 @@ void endpoint::init(const char* path, std::size_t path_length) using namespace std; // For memcpy. data_.local = boost::asio::detail::sockaddr_un_type(); data_.local.sun_family = AF_UNIX; - memcpy(data_.local.sun_path, path, path_length); + memcpy(data_.local.sun_path, path_name, path_length); path_length_ = path_length; // NUL-terminate normal path names. Names that start with a NUL are in the diff --git a/3rdParty/Boost/src/boost/asio/local/stream_protocol.hpp b/3rdParty/Boost/src/boost/asio/local/stream_protocol.hpp index e8692c5..c747666 100644 --- a/3rdParty/Boost/src/boost/asio/local/stream_protocol.hpp +++ b/3rdParty/Boost/src/boost/asio/local/stream_protocol.hpp @@ -2,7 +2,7 @@ // local/stream_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/placeholders.hpp b/3rdParty/Boost/src/boost/asio/placeholders.hpp index 19ddb66..d4bf743 100644 --- a/3rdParty/Boost/src/boost/asio/placeholders.hpp +++ b/3rdParty/Boost/src/boost/asio/placeholders.hpp @@ -2,7 +2,7 @@ // placeholders.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -42,6 +42,11 @@ unspecified bytes_transferred; /// boost::asio::basic_resolver::async_resolve. unspecified iterator; +/// An argument placeholder, for use with boost::bind(), that corresponds to +/// the signal_number argument of a handler for asynchronous functions such as +/// boost::asio::signal_set::async_wait. +unspecified signal_number; + #elif defined(__BORLANDC__) || defined(__GNUC__) inline boost::arg<1> error() @@ -59,6 +64,11 @@ inline boost::arg<2> iterator() return boost::arg<2>(); } +inline boost::arg<2> signal_number() +{ + return boost::arg<2>(); +} + #else namespace detail @@ -82,6 +92,8 @@ static boost::arg<2>& bytes_transferred = boost::asio::placeholders::detail::placeholder<2>::get(); static boost::arg<2>& iterator = boost::asio::placeholders::detail::placeholder<2>::get(); +static boost::arg<2>& signal_number + = boost::asio::placeholders::detail::placeholder<2>::get(); #else @@ -93,6 +105,8 @@ namespace = boost::asio::placeholders::detail::placeholder<2>::get(); boost::arg<2>& iterator = boost::asio::placeholders::detail::placeholder<2>::get(); + boost::arg<2>& signal_number + = boost::asio::placeholders::detail::placeholder<2>::get(); } // namespace #endif diff --git a/3rdParty/Boost/src/boost/asio/posix/basic_descriptor.hpp b/3rdParty/Boost/src/boost/asio/posix/basic_descriptor.hpp index cf953db..d4af5a4 100644 --- a/3rdParty/Boost/src/boost/asio/posix/basic_descriptor.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/basic_descriptor.hpp @@ -2,7 +2,7 @@ // posix/basic_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -46,8 +46,12 @@ class basic_descriptor public descriptor_base { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// descriptor. + typedef typename DescriptorService::native_handle_type native_type; + /// The native representation of a descriptor. - typedef typename DescriptorService::native_type native_type; + typedef typename DescriptorService::native_handle_type native_handle_type; /// A basic_descriptor is always the lowest layer. typedef basic_descriptor<DescriptorService> lowest_layer_type; @@ -79,14 +83,50 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_descriptor(boost::asio::io_service& io_service, - const native_type& native_descriptor) + const native_handle_type& native_descriptor) : basic_io_object<DescriptorService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, native_descriptor, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + native_descriptor, ec); + boost::asio::detail::throw_error(ec, "assign"); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_descriptor from another. + /** + * This constructor moves a descriptor from one object to another. + * + * @param other The other basic_descriptor 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_descriptor(io_service&) constructor. + */ + basic_descriptor(basic_descriptor&& other) + : basic_io_object<DescriptorService>( + BOOST_ASIO_MOVE_CAST(basic_descriptor)(other)) + { + } + + /// Move-assign a basic_descriptor from another. + /** + * This assignment operator moves a descriptor from one object to another. + * + * @param other The other basic_descriptor 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_descriptor(io_service&) constructor. + */ + basic_descriptor& operator=(basic_descriptor&& other) + { + basic_io_object<DescriptorService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_descriptor)(other)); + return *this; + } +#endif // defined(BOOST_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 @@ -123,11 +163,12 @@ public: * * @throws boost::system::system_error Thrown on failure. */ - void assign(const native_type& native_descriptor) + void assign(const native_handle_type& native_descriptor) { boost::system::error_code ec; - this->service.assign(this->implementation, native_descriptor, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + native_descriptor, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assign an existing native descriptor to the descriptor. @@ -138,16 +179,17 @@ public: * * @param ec Set to indicate what error occurred, if any. */ - boost::system::error_code assign(const native_type& native_descriptor, + boost::system::error_code assign(const native_handle_type& native_descriptor, boost::system::error_code& ec) { - return this->service.assign(this->implementation, native_descriptor, ec); + return this->get_service().assign( + this->get_implementation(), native_descriptor, ec); } /// Determine whether the descriptor is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->implementation); } /// Close the descriptor. @@ -156,13 +198,14 @@ public: * write operations will be cancelled immediately, and will complete with the * boost::asio::error::operation_aborted error. * - * @throws boost::system::system_error Thrown on failure. + * @throws boost::system::system_error Thrown on failure. Note that, even if + * the function indicates an error, the underlying descriptor is closed. */ void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the descriptor. @@ -171,14 +214,16 @@ public: * write operations will be cancelled immediately, and will complete with the * boost::asio::error::operation_aborted error. * - * @param ec Set to indicate what error occurred, if any. + * @param ec Set to indicate what error occurred, if any. Note that, even if + * the function indicates an error, the underlying descriptor is closed. */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native descriptor representation. + /// (Deprecated: Use native_handle().) Get the native descriptor + /// representation. /** * This function may be used to obtain the underlying representation of the * descriptor. This is intended to allow access to native descriptor @@ -186,7 +231,33 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->implementation); + } + + /// Get the native descriptor representation. + /** + * This function may be used to obtain the underlying representation of the + * descriptor. This is intended to allow access to native descriptor + * functionality that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->implementation); + } + + /// Release ownership of the native descriptor implementation. + /** + * This function may be used to obtain the underlying representation of the + * descriptor. After calling this function, @c is_open() returns false. The + * caller is responsible for closing the descriptor. + * + * All outstanding asynchronous read or write operations will finish + * immediately, and the handlers for cancelled operations will be passed the + * boost::asio::error::operation_aborted error. + */ + native_handle_type release() + { + return this->get_service().release(this->implementation); } /// Cancel all asynchronous operations associated with the descriptor. @@ -200,8 +271,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the descriptor. @@ -214,7 +285,7 @@ public: */ boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Perform an IO control command on the descriptor. @@ -243,8 +314,8 @@ public: void io_control(IoControlCommand& command) { boost::system::error_code ec; - this->service.io_control(this->implementation, command, ec); - boost::asio::detail::throw_error(ec); + this->get_service().io_control(this->get_implementation(), command, ec); + boost::asio::detail::throw_error(ec, "io_control"); } /// Perform an IO control command on the descriptor. @@ -278,7 +349,128 @@ public: boost::system::error_code io_control(IoControlCommand& command, boost::system::error_code& ec) { - return this->service.io_control(this->implementation, command, ec); + return this->get_service().io_control( + this->get_implementation(), command, ec); + } + + /// Gets the non-blocking mode of the descriptor. + /** + * @returns @c true if the descriptor's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + bool non_blocking() const + { + return this->get_service().non_blocking(this->implementation); + } + + /// Sets the non-blocking mode of the descriptor. + /** + * @param mode If @c true, the descriptor's synchronous operations will fail + * with boost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + void non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().non_blocking(this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "non_blocking"); + } + + /// Sets the non-blocking mode of the descriptor. + /** + * @param mode If @c true, the descriptor's synchronous operations will fail + * with boost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + boost::system::error_code non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().non_blocking( + this->get_implementation(), mode, ec); + } + + /// Gets the non-blocking mode of the native descriptor implementation. + /** + * This function is used to retrieve the non-blocking mode of the underlying + * native descriptor. This mode has no effect on the behaviour of the + * descriptor object's synchronous operations. + * + * @returns @c true if the underlying descriptor is in non-blocking mode and + * direct system calls may fail with boost::asio::error::would_block (or the + * equivalent system error). + * + * @note The current non-blocking mode is cached by the descriptor object. + * Consequently, the return value may be incorrect if the non-blocking mode + * was set directly on the native descriptor. + */ + bool native_non_blocking() const + { + return this->get_service().native_non_blocking(this->implementation); + } + + /// Sets the non-blocking mode of the native descriptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native descriptor. It has no effect on the behaviour of the descriptor + * object's synchronous operations. + * + * @param mode If @c true, the underlying descriptor is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @throws boost::system::system_error Thrown on failure. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + void native_non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "native_non_blocking"); + } + + /// Sets the non-blocking mode of the native descriptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native descriptor. It has no effect on the behaviour of the descriptor + * object's synchronous operations. + * + * @param mode If @c true, the underlying descriptor is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @param ec Set to indicate what error occurred, if any. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + boost::system::error_code native_non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); } protected: diff --git a/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp b/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp index ee08567..2e8ed4b 100644 --- a/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp @@ -2,7 +2,7 @@ // posix/basic_stream_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -21,6 +21,7 @@ || defined(GENERATING_DOCUMENTATION) #include <cstddef> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/posix/basic_descriptor.hpp> @@ -49,8 +50,13 @@ class basic_stream_descriptor : public basic_descriptor<StreamDescriptorService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// descriptor. + typedef typename StreamDescriptorService::native_handle_type native_type; + /// The native representation of a descriptor. - typedef typename StreamDescriptorService::native_type native_type; + typedef typename StreamDescriptorService::native_handle_type + native_handle_type; /// Construct a basic_stream_descriptor without opening it. /** @@ -81,11 +87,47 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_stream_descriptor(boost::asio::io_service& io_service, - const native_type& native_descriptor) + const native_handle_type& native_descriptor) : basic_descriptor<StreamDescriptorService>(io_service, native_descriptor) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_stream_descriptor from another. + /** + * This constructor moves a stream descriptor from one object to another. + * + * @param other The other basic_stream_descriptor 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_stream_descriptor(io_service&) constructor. + */ + basic_stream_descriptor(basic_stream_descriptor&& other) + : basic_descriptor<StreamDescriptorService>( + BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other)) + { + } + + /// Move-assign a basic_stream_descriptor from another. + /** + * This assignment operator moves a stream descriptor from one object to + * another. + * + * @param other The other basic_stream_descriptor 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_stream_descriptor(io_service&) constructor. + */ + basic_stream_descriptor& operator=(basic_stream_descriptor&& other) + { + basic_descriptor<StreamDescriptorService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Write some data to the descriptor. /** * This function is used to write data to the stream descriptor. The function @@ -117,8 +159,9 @@ public: std::size_t write_some(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.write_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().write_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "write_some"); return s; } @@ -142,7 +185,8 @@ public: std::size_t write_some(const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.write_some(this->implementation, buffers, ec); + return this->get_service().write_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous write. @@ -182,9 +226,14 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_write_some(this->implementation, buffers, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_write_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the descriptor. @@ -219,8 +268,9 @@ public: std::size_t read_some(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.read_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().read_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "read_some"); return s; } @@ -245,7 +295,8 @@ public: std::size_t read_some(const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.read_some(this->implementation, buffers, ec); + return this->get_service().read_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous read. @@ -286,9 +337,14 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_read_some(this->implementation, buffers, 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; + + this->get_service().async_read_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/posix/descriptor_base.hpp b/3rdParty/Boost/src/boost/asio/posix/descriptor_base.hpp index 2e5cb47..c75b85a 100644 --- a/3rdParty/Boost/src/boost/asio/posix/descriptor_base.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/descriptor_base.hpp @@ -2,7 +2,7 @@ // posix/descriptor_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -35,7 +35,8 @@ namespace posix { class descriptor_base { public: - /// IO control command to set the blocking mode of the descriptor. + /// (Deprecated: Use non_blocking().) IO control command to set the blocking + /// mode of the descriptor. /** * Implements the FIONBIO IO control command. * diff --git a/3rdParty/Boost/src/boost/asio/posix/stream_descriptor.hpp b/3rdParty/Boost/src/boost/asio/posix/stream_descriptor.hpp index 22551ab..9078107 100644 --- a/3rdParty/Boost/src/boost/asio/posix/stream_descriptor.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/stream_descriptor.hpp @@ -2,7 +2,7 @@ // posix/stream_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/posix/stream_descriptor_service.hpp b/3rdParty/Boost/src/boost/asio/posix/stream_descriptor_service.hpp index c582b8e..0daa21a 100644 --- a/3rdParty/Boost/src/boost/asio/posix/stream_descriptor_service.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/stream_descriptor_service.hpp @@ -2,7 +2,7 @@ // posix/stream_descriptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -57,11 +57,18 @@ public: typedef service_impl_type::implementation_type implementation_type; #endif - /// The native descriptor type. + /// (Deprecated: Use native_handle_type.) The native descriptor type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef service_impl_type::native_type native_type; + typedef service_impl_type::native_handle_type native_type; +#endif + + /// The native descriptor type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new stream descriptor service for the specified io_service. @@ -71,18 +78,29 @@ public: { } - /// Destroy all user-defined descriptorr objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new stream descriptor implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new stream descriptor implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another stream descriptor implementation. + void move_assign(implementation_type& impl, + stream_descriptor_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a stream descriptor implementation. void destroy(implementation_type& impl) { @@ -91,7 +109,8 @@ public: /// Assign an existing native descriptor to a stream descriptor. boost::system::error_code assign(implementation_type& impl, - const native_type& native_descriptor, boost::system::error_code& ec) + const native_handle_type& native_descriptor, + boost::system::error_code& ec) { return service_impl_.assign(impl, native_descriptor, ec); } @@ -109,10 +128,23 @@ public: return service_impl_.close(impl, ec); } - /// Get the native descriptor implementation. + /// (Deprecated: Use native_handle().) Get the native descriptor + /// implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native descriptor implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); + } + + /// Release ownership of the native descriptor implementation. + native_handle_type release(implementation_type& impl) + { + return service_impl_.release(impl); } /// Cancel all asynchronous operations associated with the descriptor. @@ -130,6 +162,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the descriptor. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the descriptor. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native descriptor implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native descriptor implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Write the given data to the stream. template <typename ConstBufferSequence> std::size_t write_some(implementation_type& impl, @@ -141,9 +199,11 @@ public: /// Start an asynchronous write. template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, WriteHandler descriptorr) + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_write_some(impl, buffers, descriptorr); + service_impl_.async_write_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the stream. @@ -157,12 +217,20 @@ public: /// Start an asynchronous read. template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, ReadHandler descriptorr) + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_read_some(impl, buffers, descriptorr); + service_impl_.async_read_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/raw_socket_service.hpp b/3rdParty/Boost/src/boost/asio/raw_socket_service.hpp index 783c4c2..cd8aa04 100644 --- a/3rdParty/Boost/src/boost/asio/raw_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/raw_socket_service.hpp @@ -2,7 +2,7 @@ // raw_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -68,11 +68,18 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// The native socket type. + /// (Deprecated: Use native_handle_type.) The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef typename service_impl_type::native_type native_type; + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new raw socket service for the specified io_service. @@ -83,18 +90,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new raw socket implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new raw socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another raw socket implementation. + void move_assign(implementation_type& impl, + raw_socket_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a raw socket implementation. void destroy(implementation_type& impl) { @@ -114,7 +132,7 @@ public: /// Assign an existing native socket to a raw socket. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { return service_impl_.assign(impl, protocol, native_socket, ec); @@ -133,10 +151,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native socket implementation. + /// (Deprecated: Use native_handle().) Get the native socket implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native socket implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the socket. @@ -177,9 +201,11 @@ public: /// Start an asynchronous connect. template <typename ConnectHandler> void async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, ConnectHandler handler) + const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { - service_impl_.async_connect(impl, peer_endpoint, handler); + service_impl_.async_connect(impl, peer_endpoint, + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } /// Set a socket option. @@ -206,6 +232,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the socket. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, boost::system::error_code& ec) const @@ -239,9 +291,11 @@ public: /// Start an asynchronous send. template <typename ConstBufferSequence, typename WriteHandler> void async_send(implementation_type& impl, const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send(impl, buffers, flags, handler); + service_impl_.async_send(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Send raw data to the specified endpoint. @@ -257,9 +311,11 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(implementation_type& impl, const ConstBufferSequence& buffers, const endpoint_type& destination, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send_to(impl, buffers, destination, flags, handler); + service_impl_.async_send_to(impl, buffers, destination, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data from the peer. @@ -275,9 +331,11 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive(implementation_type& impl, const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_receive(impl, buffers, flags, handler); + service_impl_.async_receive(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Receive raw data with the endpoint of the sender. @@ -294,13 +352,20 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(implementation_type& impl, const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags, - handler); + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/read.hpp b/3rdParty/Boost/src/boost/asio/read.hpp index fd13e75..937dccd 100644 --- a/3rdParty/Boost/src/boost/asio/read.hpp +++ b/3rdParty/Boost/src/boost/asio/read.hpp @@ -2,7 +2,7 @@ // read.hpp // ~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -80,6 +80,46 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers); * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * read_some function. + * + * @param s The stream from which the data is to be read. The type must support + * the SyncReadStream concept. + * + * @param buffers One or more buffers into which the data will be read. The sum + * of the buffer sizes indicates the maximum number of bytes to read from the + * stream. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To read into a single data buffer use the @ref buffer function as follows: + * @code boost::asio::read(s, boost::asio::buffer(data, size), ec); @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. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read( + * s, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncReadStream, typename MutableBufferSequence> +std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data from a stream before returning. +/** + * This function is used to read a certain number of bytes of data from a + * stream. The call will block until one of the following conditions is true: + * + * @li The supplied buffers are full. That is, the bytes transferred is equal to + * the sum of the buffer sizes. + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -174,6 +214,8 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's @@ -201,6 +243,38 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b); * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * read_some function. + * + * @param s The stream from which the data is to be read. The type must support + * the SyncReadStream concept. + * + * @param b The basic_streambuf object into which the data will be read. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read( + * s, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncReadStream, typename Allocator> +std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data from a stream before returning. +/** + * This function is used to read a certain number of bytes of data from a + * stream. The call will block until one of the following conditions is true: + * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -239,6 +313,8 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -347,7 +423,7 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, template <typename AsyncReadStream, typename MutableBufferSequence, typename ReadHandler> void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data from a /// stream. @@ -415,7 +491,8 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, template <typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -427,6 +504,8 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, * asynchronous operation will continue until one of the following conditions is * true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's @@ -467,7 +546,7 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, */ template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data from a /// stream. @@ -477,6 +556,8 @@ void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, * asynchronous operation will continue until one of the following conditions is * true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -526,7 +607,8 @@ void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, template <typename AsyncReadStream, typename Allocator, typename CompletionCondition, typename ReadHandler> void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/read_at.hpp b/3rdParty/Boost/src/boost/asio/read_at.hpp index 1feba6c..7eb30e0 100644 --- a/3rdParty/Boost/src/boost/asio/read_at.hpp +++ b/3rdParty/Boost/src/boost/asio/read_at.hpp @@ -2,7 +2,7 @@ // read_at.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -88,6 +88,52 @@ std::size_t read_at(SyncRandomAccessReadDevice& d, * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the device's + * read_some_at function. + * + * @param d The device from which the data is to be read. The type must support + * the SyncRandomAccessReadDevice concept. + * + * @param offset The offset at which the data will be read. + * + * @param buffers One or more buffers into which the data will be read. The sum + * of the buffer sizes indicates the maximum number of bytes to read from the + * device. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To read into a single data buffer use the @ref buffer function as follows: + * @code boost::asio::read_at(d, 42, + * boost::asio::buffer(data, size), ec); @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. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read_at( + * d, 42, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> +std::size_t read_at(SyncRandomAccessReadDevice& d, + boost::uint64_t offset, const MutableBufferSequence& buffers, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data at the specified offset before +/// returning. +/** + * This function is used to read a certain number of bytes of data from a + * random access device at the specified offset. The call will block until one + * of the following conditions is true: + * + * @li The supplied buffers are full. That is, the bytes transferred is equal to + * the sum of the buffer sizes. + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's @@ -224,6 +270,39 @@ std::size_t read_at(SyncRandomAccessReadDevice& d, * random access device at the specified offset. The call will block until one * of the following conditions is true: * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the device's + * read_some_at function. + * + * @param d The device from which the data is to be read. The type must support + * the SyncRandomAccessReadDevice concept. + * + * @param offset The offset at which the data will be read. + * + * @param b The basic_streambuf object into which the data will be read. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read_at( + * d, 42, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncRandomAccessReadDevice, typename Allocator> +std::size_t read_at(SyncRandomAccessReadDevice& d, + boost::uint64_t offset, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data at the specified offset before +/// returning. +/** + * This function is used to read a certain number of bytes of data from a + * random access device at the specified offset. The call will block 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 @@ -377,7 +456,8 @@ std::size_t read_at(SyncRandomAccessReadDevice& d, template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename ReadHandler> void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, - const MutableBufferSequence& buffers, ReadHandler handler); + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data at the /// specified offset. @@ -448,7 +528,8 @@ template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -500,7 +581,7 @@ void async_read_at(AsyncRandomAccessReadDevice& d, template <typename AsyncRandomAccessReadDevice, typename Allocator, typename ReadHandler> void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, - basic_streambuf<Allocator>& b, ReadHandler handler); + 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. @@ -559,7 +640,8 @@ template <typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, typename ReadHandler> void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/read_until.hpp b/3rdParty/Boost/src/boost/asio/read_until.hpp index 546537b..1f1bddb 100644 --- a/3rdParty/Boost/src/boost/asio/read_until.hpp +++ b/3rdParty/Boost/src/boost/asio/read_until.hpp @@ -2,7 +2,7 @@ // read_until.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -36,30 +36,16 @@ namespace asio { namespace detail { -#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) + char (&has_result_type_helper(...))[2]; + template <typename T> - struct has_result_type - { - template <typename U> struct inner - { - struct big { char a[100]; }; - static big helper(U, ...); - static char helper(U, typename U::result_type* = 0); - }; - static const T& ref(); - enum { value = (sizeof((inner<const T&>::helper)((ref)())) == 1) }; - }; -#else // BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) + char has_result_type_helper(T*, typename T::result_type* = 0); + template <typename T> struct has_result_type { - struct big { char a[100]; }; - template <typename U> static big helper(U, ...); - template <typename U> static char helper(U, typename U::result_type* = 0); - static const T& ref(); - enum { value = (sizeof((helper)((ref)())) == 1) }; + enum { value = (sizeof((has_result_type_helper)((T*)(0))) == 1) }; }; -#endif // BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) } // namespace detail /// Type trait used to determine whether a type can be used as a match condition @@ -604,7 +590,7 @@ std::size_t read_until(SyncReadStream& s, template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, - char delim, ReadHandler handler); + char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read data into a streambuf until it /// contains a specified delimiter. @@ -687,7 +673,7 @@ void async_read_until(AsyncReadStream& s, template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, const std::string& delim, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read data into a streambuf until some /// part of its data matches a regular expression. @@ -774,7 +760,7 @@ void async_read_until(AsyncReadStream& s, template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read data into a streambuf until a /// function object indicates a match. @@ -903,7 +889,7 @@ template <typename AsyncReadStream, typename Allocator, typename MatchCondition, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, - MatchCondition match_condition, ReadHandler handler, + MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, typename boost::enable_if<is_match_condition<MatchCondition> >::type* = 0); /*@}*/ diff --git a/3rdParty/Boost/src/boost/asio/seq_packet_socket_service.hpp b/3rdParty/Boost/src/boost/asio/seq_packet_socket_service.hpp new file mode 100644 index 0000000..edd1593 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/seq_packet_socket_service.hpp @@ -0,0 +1,341 @@ +// +// seq_packet_socket_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP +#define BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <cstddef> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> + +#if defined(BOOST_ASIO_HAS_IOCP) +# include <boost/asio/detail/win_iocp_socket_service.hpp> +#else +# include <boost/asio/detail/reactive_socket_service.hpp> +#endif + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Default service implementation for a sequenced packet socket. +template <typename Protocol> +class seq_packet_socket_service +#if defined(GENERATING_DOCUMENTATION) + : public boost::asio::io_service::service +#else + : public boost::asio::detail::service_base< + seq_packet_socket_service<Protocol> > +#endif +{ +public: +#if defined(GENERATING_DOCUMENTATION) + /// The unique service identifier. + static boost::asio::io_service::id id; +#endif + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + +private: + // The type of the platform-specific implementation. +#if defined(BOOST_ASIO_HAS_IOCP) + typedef detail::win_iocp_socket_service<Protocol> service_impl_type; +#else + typedef detail::reactive_socket_service<Protocol> service_impl_type; +#endif + +public: + /// The type of a sequenced packet socket implementation. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined implementation_type; +#else + typedef typename service_impl_type::implementation_type implementation_type; +#endif + + /// (Deprecated: Use native_handle_type.) The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_type; +#else + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; +#endif + + /// Construct a new sequenced packet socket service for the specified + /// io_service. + explicit seq_packet_socket_service(boost::asio::io_service& io_service) + : boost::asio::detail::service_base< + seq_packet_socket_service<Protocol> >(io_service), + service_impl_(io_service) + { + } + + /// Construct a new sequenced packet socket implementation. + void construct(implementation_type& impl) + { + service_impl_.construct(impl); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new sequenced packet socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another sequenced packet socket implementation. + void move_assign(implementation_type& impl, + seq_packet_socket_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Destroy a sequenced packet socket implementation. + void destroy(implementation_type& impl) + { + service_impl_.destroy(impl); + } + + /// Open a sequenced packet socket. + boost::system::error_code open(implementation_type& impl, + const protocol_type& protocol, boost::system::error_code& ec) + { + if (protocol.type() == SOCK_SEQPACKET) + service_impl_.open(impl, protocol, ec); + else + ec = boost::asio::error::invalid_argument; + return ec; + } + + /// Assign an existing native socket to a sequenced packet socket. + boost::system::error_code assign(implementation_type& impl, + const protocol_type& protocol, const native_handle_type& native_socket, + boost::system::error_code& ec) + { + return service_impl_.assign(impl, protocol, native_socket, ec); + } + + /// Determine whether the socket is open. + bool is_open(const implementation_type& impl) const + { + return service_impl_.is_open(impl); + } + + /// Close a sequenced packet socket implementation. + boost::system::error_code close(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.close(impl, ec); + } + + /// (Deprecated: Use native_handle().) Get the native socket implementation. + native_type native(implementation_type& impl) + { + return service_impl_.native_handle(impl); + } + + /// Get the native socket implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); + } + + /// Cancel all asynchronous operations associated with the socket. + boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.cancel(impl, ec); + } + + /// Determine whether the socket is at the out-of-band data mark. + bool at_mark(const implementation_type& impl, + boost::system::error_code& ec) const + { + return service_impl_.at_mark(impl, ec); + } + + /// Determine the number of bytes available for reading. + std::size_t available(const implementation_type& impl, + boost::system::error_code& ec) const + { + return service_impl_.available(impl, ec); + } + + /// Bind the sequenced packet socket to the specified local endpoint. + boost::system::error_code bind(implementation_type& impl, + const endpoint_type& endpoint, boost::system::error_code& ec) + { + return service_impl_.bind(impl, endpoint, ec); + } + + /// Connect the sequenced packet socket to the specified endpoint. + boost::system::error_code connect(implementation_type& impl, + const endpoint_type& peer_endpoint, boost::system::error_code& ec) + { + return service_impl_.connect(impl, peer_endpoint, ec); + } + + /// Start an asynchronous connect. + template <typename ConnectHandler> + void async_connect(implementation_type& impl, + const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) + { + service_impl_.async_connect(impl, peer_endpoint, + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); + } + + /// Set a socket option. + template <typename SettableSocketOption> + boost::system::error_code set_option(implementation_type& impl, + const SettableSocketOption& option, boost::system::error_code& ec) + { + return service_impl_.set_option(impl, option, ec); + } + + /// Get a socket option. + template <typename GettableSocketOption> + boost::system::error_code get_option(const implementation_type& impl, + GettableSocketOption& option, boost::system::error_code& ec) const + { + return service_impl_.get_option(impl, option, ec); + } + + /// Perform an IO control command on the socket. + template <typename IoControlCommand> + boost::system::error_code io_control(implementation_type& impl, + IoControlCommand& command, boost::system::error_code& ec) + { + return service_impl_.io_control(impl, command, ec); + } + + /// Gets the non-blocking mode of the socket. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + + /// Get the local endpoint. + endpoint_type local_endpoint(const implementation_type& impl, + boost::system::error_code& ec) const + { + return service_impl_.local_endpoint(impl, ec); + } + + /// Get the remote endpoint. + endpoint_type remote_endpoint(const implementation_type& impl, + boost::system::error_code& ec) const + { + return service_impl_.remote_endpoint(impl, ec); + } + + /// Disable sends or receives on the socket. + boost::system::error_code shutdown(implementation_type& impl, + socket_base::shutdown_type what, boost::system::error_code& ec) + { + return service_impl_.shutdown(impl, what, ec); + } + + /// Send the given data to the peer. + template <typename ConstBufferSequence> + std::size_t send(implementation_type& impl, + const ConstBufferSequence& buffers, + socket_base::message_flags flags, boost::system::error_code& ec) + { + return service_impl_.send(impl, buffers, flags, ec); + } + + /// Start an asynchronous send. + template <typename ConstBufferSequence, typename WriteHandler> + void async_send(implementation_type& impl, + const ConstBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + service_impl_.async_send(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Receive some data from the peer. + template <typename MutableBufferSequence> + std::size_t receive(implementation_type& impl, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + return service_impl_.receive_with_flags(impl, + buffers, in_flags, out_flags, ec); + } + + /// Start an asynchronous receive. + template <typename MutableBufferSequence, typename ReadHandler> + void async_receive(implementation_type& impl, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + service_impl_.async_receive_with_flags(impl, buffers, in_flags, + out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + +private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // The platform-specific implementation. + service_impl_type service_impl_; +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/serial_port.hpp b/3rdParty/Boost/src/boost/asio/serial_port.hpp index a2f1721..58d6b78 100644 --- a/3rdParty/Boost/src/boost/asio/serial_port.hpp +++ b/3rdParty/Boost/src/boost/asio/serial_port.hpp @@ -2,7 +2,7 @@ // serial_port.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 diff --git a/3rdParty/Boost/src/boost/asio/serial_port_base.hpp b/3rdParty/Boost/src/boost/asio/serial_port_base.hpp index 083d006..f14ba02 100644 --- a/3rdParty/Boost/src/boost/asio/serial_port_base.hpp +++ b/3rdParty/Boost/src/boost/asio/serial_port_base.hpp @@ -2,7 +2,7 @@ // serial_port_base.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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 diff --git a/3rdParty/Boost/src/boost/asio/serial_port_service.hpp b/3rdParty/Boost/src/boost/asio/serial_port_service.hpp index 1a8a11b..ed7306c 100644 --- a/3rdParty/Boost/src/boost/asio/serial_port_service.hpp +++ b/3rdParty/Boost/src/boost/asio/serial_port_service.hpp @@ -2,7 +2,7 @@ // serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -63,11 +63,18 @@ public: typedef service_impl_type::implementation_type implementation_type; #endif - /// The native handle type. + /// (Deprecated: Use native_handle_type.) The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef service_impl_type::native_type native_type; + typedef service_impl_type::native_handle_type native_type; +#endif + + /// The native handle type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new serial port service for the specified io_service. @@ -77,18 +84,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new serial port implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new serial port implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another serial port implementation. + void move_assign(implementation_type& impl, + serial_port_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a serial port implementation. void destroy(implementation_type& impl) { @@ -104,9 +122,9 @@ public: /// Assign an existing native handle to a serial port. boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { - return service_impl_.assign(impl, native_handle, ec); + return service_impl_.assign(impl, handle, ec); } /// Determine whether the handle is open. @@ -122,10 +140,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native handle implementation. + /// (Deprecated: Use native_handle().) Get the native handle implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native handle implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the handle. @@ -169,9 +193,11 @@ public: /// Start an asynchronous write. template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, WriteHandler handler) + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_write_some(impl, buffers, handler); + service_impl_.async_write_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the stream. @@ -185,12 +211,20 @@ public: /// Start an asynchronous read. template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, ReadHandler handler) + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_read_some(impl, buffers, handler); + service_impl_.async_read_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/signal_set.hpp b/3rdParty/Boost/src/boost/asio/signal_set.hpp new file mode 100644 index 0000000..3427a03 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/signal_set.hpp @@ -0,0 +1,30 @@ +// +// signal_set.hpp +// ~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_SIGNAL_SET_HPP +#define BOOST_ASIO_SIGNAL_SET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/basic_signal_set.hpp> + +namespace boost { +namespace asio { + +/// Typedef for the typical usage of a signal set. +typedef basic_signal_set<> signal_set; + +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_SIGNAL_SET_HPP diff --git a/3rdParty/Boost/src/boost/asio/signal_set_service.hpp b/3rdParty/Boost/src/boost/asio/signal_set_service.hpp new file mode 100644 index 0000000..48896f2 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/signal_set_service.hpp @@ -0,0 +1,128 @@ +// +// signal_set_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_SIGNAL_SET_SERVICE_HPP +#define BOOST_ASIO_SIGNAL_SET_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/signal_set_service.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Default service implementation for a signal set. +class signal_set_service +#if defined(GENERATING_DOCUMENTATION) + : public boost::asio::io_service::service +#else + : public boost::asio::detail::service_base<signal_set_service> +#endif +{ +public: +#if defined(GENERATING_DOCUMENTATION) + /// The unique service identifier. + static boost::asio::io_service::id id; +#endif + +public: + /// The type of a signal set implementation. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined implementation_type; +#else + typedef detail::signal_set_service::implementation_type implementation_type; +#endif + + /// Construct a new signal set service for the specified io_service. + explicit signal_set_service(boost::asio::io_service& io_service) + : boost::asio::detail::service_base<signal_set_service>(io_service), + service_impl_(io_service) + { + } + + /// Construct a new signal set implementation. + void construct(implementation_type& impl) + { + service_impl_.construct(impl); + } + + /// Destroy a signal set implementation. + void destroy(implementation_type& impl) + { + service_impl_.destroy(impl); + } + + /// Add a signal to a signal_set. + boost::system::error_code add(implementation_type& impl, + int signal_number, boost::system::error_code& ec) + { + return service_impl_.add(impl, signal_number, ec); + } + + /// Remove a signal to a signal_set. + boost::system::error_code remove(implementation_type& impl, + int signal_number, boost::system::error_code& ec) + { + return service_impl_.remove(impl, signal_number, ec); + } + + /// Remove all signals from a signal_set. + boost::system::error_code clear(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.clear(impl, ec); + } + + /// Cancel all operations associated with the signal set. + boost::system::error_code cancel(implementation_type& impl, + boost::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> + void async_wait(implementation_type& impl, + BOOST_ASIO_MOVE_ARG(SignalHandler) handler) + { + service_impl_.async_wait(impl, + BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); + } + +private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // Perform any fork-related housekeeping. + void fork_service(boost::asio::io_service::fork_event event) + { + service_impl_.fork_service(event); + } + + // The platform-specific implementation. + detail::signal_set_service service_impl_; +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_SIGNAL_SET_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/socket_acceptor_service.hpp b/3rdParty/Boost/src/boost/asio/socket_acceptor_service.hpp index f287c65..54aaf7a 100644 --- a/3rdParty/Boost/src/boost/asio/socket_acceptor_service.hpp +++ b/3rdParty/Boost/src/boost/asio/socket_acceptor_service.hpp @@ -2,7 +2,7 @@ // socket_acceptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -68,11 +68,18 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// The native acceptor type. + /// (Deprecated: Use native_handle_type.) The native acceptor type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef typename service_impl_type::native_type native_type; + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native acceptor type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new socket acceptor service for the specified io_service. @@ -83,18 +90,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new socket acceptor implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new socket acceptor implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another socket acceptor implementation. + void move_assign(implementation_type& impl, + socket_acceptor_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a socket acceptor implementation. void destroy(implementation_type& impl) { @@ -110,7 +128,7 @@ public: /// Assign an existing native acceptor to a socket acceptor. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_acceptor, + const protocol_type& protocol, const native_handle_type& native_acceptor, boost::system::error_code& ec) { return service_impl_.assign(impl, protocol, native_acceptor, ec); @@ -151,10 +169,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native acceptor implementation. + /// (Deprecated: Use native_handle().) Get the native acceptor implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native acceptor implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Set a socket option. @@ -181,6 +205,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the acceptor. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the acceptor. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native acceptor implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native acceptor implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, boost::system::error_code& ec) const @@ -201,12 +251,20 @@ public: template <typename SocketService, typename AcceptHandler> void async_accept(implementation_type& impl, basic_socket<protocol_type, SocketService>& peer, - endpoint_type* peer_endpoint, AcceptHandler handler) + endpoint_type* peer_endpoint, + BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { - service_impl_.async_accept(impl, peer, peer_endpoint, handler); + service_impl_.async_accept(impl, peer, peer_endpoint, + BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/socket_base.hpp b/3rdParty/Boost/src/boost/asio/socket_base.hpp index f5bac91..f964d00 100644 --- a/3rdParty/Boost/src/boost/asio/socket_base.hpp +++ b/3rdParty/Boost/src/boost/asio/socket_base.hpp @@ -2,7 +2,7 @@ // socket_base.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -63,6 +63,9 @@ public: /// Specify that the data should not be subject to routing. static const int message_do_not_route = implementation_defined; + + /// Specifies that the data marks the end of a record. + static const int message_end_of_record = implementation_defined; #else BOOST_STATIC_CONSTANT(int, message_peek = boost::asio::detail::message_peek); @@ -70,6 +73,8 @@ public: message_out_of_band = boost::asio::detail::message_out_of_band); BOOST_STATIC_CONSTANT(int, message_do_not_route = boost::asio::detail::message_do_not_route); + BOOST_STATIC_CONSTANT(int, + message_end_of_record = boost::asio::detail::message_end_of_record); #endif /// Socket option to permit sending of broadcast messages. @@ -442,7 +447,8 @@ public: enable_connection_aborted; #endif - /// IO control command to set the blocking mode of the socket. + /// (Deprecated: Use non_blocking().) IO control command to + /// set the blocking mode of the socket. /** * Implements the FIONBIO IO control command. * diff --git a/3rdParty/Boost/src/boost/asio/strand.hpp b/3rdParty/Boost/src/boost/asio/strand.hpp index 2928167..6a1033f 100644 --- a/3rdParty/Boost/src/boost/asio/strand.hpp +++ b/3rdParty/Boost/src/boost/asio/strand.hpp @@ -2,7 +2,7 @@ // strand.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -16,6 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/strand_service.hpp> #include <boost/asio/detail/wrapped_handler.hpp> #include <boost/asio/io_service.hpp> @@ -104,21 +105,6 @@ public: */ ~strand() { - service_.destroy(impl_); - } - - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the strand. - /** - * This function may be used to obtain the io_service object that the strand - * uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_service object that the strand will use to - * dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_service& io_service() - { - return service_.get_io_service(); } /// Get the io_service associated with the strand. @@ -153,10 +139,14 @@ public: * handler object as required. The function signature of the handler must be: * @code void handler(); @endcode */ - template <typename Handler> - void dispatch(Handler handler) + template <typename CompletionHandler> + void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { - service_.dispatch(impl_, 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; + + service_.dispatch(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); } /// Request the strand to invoke the given handler and return @@ -175,10 +165,14 @@ public: * handler object as required. The function signature of the handler must be: * @code void handler(); @endcode */ - template <typename Handler> - void post(Handler handler) + template <typename CompletionHandler> + void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { - service_.post(impl_, 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; + + service_.post(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); } /// Create a new handler that automatically dispatches the wrapped handler diff --git a/3rdParty/Boost/src/boost/asio/stream_socket_service.hpp b/3rdParty/Boost/src/boost/asio/stream_socket_service.hpp index 40d5e18..afc9406 100644 --- a/3rdParty/Boost/src/boost/asio/stream_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/stream_socket_service.hpp @@ -2,7 +2,7 @@ // stream_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -68,11 +68,18 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// The native socket type. + /// (Deprecated: Use native_handle_type.) The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef typename service_impl_type::native_type native_type; + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new stream socket service for the specified io_service. @@ -83,18 +90,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new stream socket implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new stream socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another stream socket implementation. + void move_assign(implementation_type& impl, + stream_socket_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a stream socket implementation. void destroy(implementation_type& impl) { @@ -114,7 +132,7 @@ public: /// Assign an existing native socket to a stream socket. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { return service_impl_.assign(impl, protocol, native_socket, ec); @@ -133,10 +151,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native socket implementation. + /// (Deprecated: Use native_handle().) Get the native socket implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native socket implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the socket. @@ -177,9 +201,11 @@ public: /// Start an asynchronous connect. template <typename ConnectHandler> void async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, ConnectHandler handler) + const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { - service_impl_.async_connect(impl, peer_endpoint, handler); + service_impl_.async_connect(impl, peer_endpoint, + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } /// Set a socket option. @@ -206,6 +232,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the socket. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, boost::system::error_code& ec) const @@ -240,9 +292,11 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send(implementation_type& impl, const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send(impl, buffers, flags, handler); + service_impl_.async_send(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data from the peer. @@ -258,12 +312,20 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive(implementation_type& impl, const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_receive(impl, buffers, flags, handler); + service_impl_.async_receive(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/streambuf.hpp b/3rdParty/Boost/src/boost/asio/streambuf.hpp index 8f724c3..004de8d 100644 --- a/3rdParty/Boost/src/boost/asio/streambuf.hpp +++ b/3rdParty/Boost/src/boost/asio/streambuf.hpp @@ -2,7 +2,7 @@ // streambuf.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/time_traits.hpp b/3rdParty/Boost/src/boost/asio/time_traits.hpp index 0da7e6b..8f48d47 100644 --- a/3rdParty/Boost/src/boost/asio/time_traits.hpp +++ b/3rdParty/Boost/src/boost/asio/time_traits.hpp @@ -2,7 +2,7 @@ // time_traits.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/version.hpp b/3rdParty/Boost/src/boost/asio/version.hpp index 9ef5ab5..4fc894b 100644 --- a/3rdParty/Boost/src/boost/asio/version.hpp +++ b/3rdParty/Boost/src/boost/asio/version.hpp @@ -2,7 +2,7 @@ // version.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -18,6 +18,6 @@ // BOOST_ASIO_VERSION % 100 is the sub-minor version // BOOST_ASIO_VERSION / 100 % 1000 is the minor version // BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 100409 // 1.4.9 +#define BOOST_ASIO_VERSION 100802 // 1.8.2 #endif // BOOST_ASIO_VERSION_HPP diff --git a/3rdParty/Boost/src/boost/asio/wait_traits.hpp b/3rdParty/Boost/src/boost/asio/wait_traits.hpp new file mode 100644 index 0000000..c4eef20 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/wait_traits.hpp @@ -0,0 +1,43 @@ +// +// wait_traits.hpp +// ~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_WAIT_TRAITS_HPP +#define BOOST_ASIO_WAIT_TRAITS_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Wait traits suitable for use with the basic_waitable_timer class template. +template <typename Clock> +struct wait_traits +{ + /// Convert a clock duration into a duration used for waiting. + /** + * @returns @c d. + */ + static typename Clock::duration to_wait_duration( + const typename Clock::duration& d) + { + return d; + } +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_WAIT_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/asio/waitable_timer_service.hpp b/3rdParty/Boost/src/boost/asio/waitable_timer_service.hpp new file mode 100644 index 0000000..69a9580 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/waitable_timer_service.hpp @@ -0,0 +1,161 @@ +// +// waitable_timer_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 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 BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP +#define BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <cstddef> +#include <boost/asio/detail/chrono_time_traits.hpp> +#include <boost/asio/detail/deadline_timer_service.hpp> +#include <boost/asio/io_service.hpp> +#include <boost/asio/wait_traits.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Default service implementation for a timer. +template <typename Clock, + typename WaitTraits = boost::asio::wait_traits<Clock> > +class waitable_timer_service +#if defined(GENERATING_DOCUMENTATION) + : public boost::asio::io_service::service +#else + : public boost::asio::detail::service_base< + waitable_timer_service<Clock, WaitTraits> > +#endif +{ +public: +#if defined(GENERATING_DOCUMENTATION) + /// The unique service identifier. + static boost::asio::io_service::id id; +#endif + + /// The clock type. + typedef Clock clock_type; + + /// The duration type of the clock. + typedef typename clock_type::duration duration; + + /// The time point type of the clock. + typedef typename clock_type::time_point time_point; + + /// The wait traits type. + typedef WaitTraits traits_type; + +private: + // The type of the platform-specific implementation. + typedef detail::deadline_timer_service< + detail::chrono_time_traits<Clock, WaitTraits> > service_impl_type; + +public: + /// The implementation type of the waitable timer. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined implementation_type; +#else + typedef typename service_impl_type::implementation_type implementation_type; +#endif + + /// Construct a new timer service for the specified io_service. + explicit waitable_timer_service(boost::asio::io_service& io_service) + : boost::asio::detail::service_base< + waitable_timer_service<Clock, WaitTraits> >(io_service), + service_impl_(io_service) + { + } + + /// Construct a new timer implementation. + void construct(implementation_type& impl) + { + service_impl_.construct(impl); + } + + /// Destroy a timer implementation. + void destroy(implementation_type& impl) + { + service_impl_.destroy(impl); + } + + /// Cancel any asynchronous wait operations associated with the timer. + std::size_t cancel(implementation_type& impl, boost::system::error_code& ec) + { + return service_impl_.cancel(impl, ec); + } + + /// Cancels one asynchronous wait operation associated with the timer. + std::size_t cancel_one(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.cancel_one(impl, ec); + } + + /// Get the expiry time for the timer as an absolute time. + time_point expires_at(const implementation_type& impl) const + { + return service_impl_.expires_at(impl); + } + + /// Set the expiry time for the timer as an absolute time. + std::size_t expires_at(implementation_type& impl, + const time_point& expiry_time, boost::system::error_code& ec) + { + return service_impl_.expires_at(impl, expiry_time, ec); + } + + /// Get the expiry time for the timer relative to now. + duration expires_from_now(const implementation_type& impl) const + { + return service_impl_.expires_from_now(impl); + } + + /// Set the expiry time for the timer relative to now. + std::size_t expires_from_now(implementation_type& impl, + const duration& expiry_time, boost::system::error_code& ec) + { + return service_impl_.expires_from_now(impl, expiry_time, ec); + } + + // Perform a blocking wait on the timer. + void wait(implementation_type& impl, boost::system::error_code& ec) + { + service_impl_.wait(impl, ec); + } + + // Start an asynchronous wait on the timer. + template <typename WaitHandler> + void async_wait(implementation_type& impl, + BOOST_ASIO_MOVE_ARG(WaitHandler) handler) + { + service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); + } + +private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // The platform-specific implementation. + service_impl_type service_impl_; +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/basic_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/basic_handle.hpp index aedd79a..5169cae 100644 --- a/3rdParty/Boost/src/boost/asio/windows/basic_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/basic_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -19,6 +19,7 @@ #if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \ || defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \ + || defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ || defined(GENERATING_DOCUMENTATION) #include <boost/asio/basic_io_object.hpp> @@ -45,8 +46,12 @@ class basic_handle : public basic_io_object<HandleService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// handle. + typedef typename HandleService::native_handle_type native_type; + /// The native representation of a handle. - typedef typename HandleService::native_type native_type; + typedef typename HandleService::native_handle_type native_handle_type; /// A basic_handle is always the lowest layer. typedef basic_handle<HandleService> lowest_layer_type; @@ -70,18 +75,51 @@ public: * @param io_service The io_service object that the handle will use to * dispatch handlers for any asynchronous operations performed on the handle. * - * @param native_handle A native handle. + * @param handle A native handle. * * @throws boost::system::system_error Thrown on failure. */ basic_handle(boost::asio::io_service& io_service, - const native_type& native_handle) + const native_handle_type& handle) : basic_io_object<HandleService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, native_handle, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), handle, ec); + boost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_handle from another. + /** + * This constructor moves a handle from one object to another. + * + * @param other The other basic_handle 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_handle(io_service&) constructor. + */ + basic_handle(basic_handle&& other) + : basic_io_object<HandleService>( + BOOST_ASIO_MOVE_CAST(basic_handle)(other)) + { + } + + /// Move-assign a basic_handle from another. + /** + * This assignment operator moves a handle from one object to another. + * + * @param other The other basic_handle 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_handle(io_service&) constructor. + */ + basic_handle& operator=(basic_handle&& other) + { + basic_io_object<HandleService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_handle)(other)); + return *this; } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get a reference to the lowest layer. /** @@ -115,35 +153,35 @@ public: /* * This function opens the handle to hold an existing native handle. * - * @param native_handle A native handle. + * @param handle A native handle. * * @throws boost::system::system_error Thrown on failure. */ - void assign(const native_type& native_handle) + void assign(const native_handle_type& handle) { boost::system::error_code ec; - this->service.assign(this->implementation, native_handle, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), handle, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assign an existing native handle to the handle. /* * This function opens the handle to hold an existing native handle. * - * @param native_handle A native handle. + * @param handle A native handle. * * @param ec Set to indicate what error occurred, if any. */ - boost::system::error_code assign(const native_type& native_handle, + boost::system::error_code assign(const native_handle_type& handle, boost::system::error_code& ec) { - return this->service.assign(this->implementation, native_handle, ec); + return this->get_service().assign(this->get_implementation(), handle, ec); } /// Determine whether the handle is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Close the handle. @@ -157,8 +195,8 @@ public: void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the handle. @@ -171,10 +209,10 @@ public: */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native handle representation. + /// (Deprecated: Use native_handle().) Get the native handle representation. /** * This function may be used to obtain the underlying representation of the * handle. This is intended to allow access to native handle functionality @@ -182,7 +220,18 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native handle representation. + /** + * This function may be used to obtain the underlying representation of the + * handle. This is intended to allow access to native handle 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 handle. @@ -196,8 +245,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the handle. @@ -210,7 +259,7 @@ public: */ boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } protected: @@ -228,6 +277,7 @@ protected: #endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) // || defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) + // || defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) // || defined(GENERATING_DOCUMENTATION) #endif // BOOST_ASIO_WINDOWS_BASIC_HANDLE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/basic_object_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/basic_object_handle.hpp new file mode 100644 index 0000000..a94bb57 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/windows/basic_object_handle.hpp @@ -0,0 +1,177 @@ +// +// windows/basic_object_handle.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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 BOOST_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP +#define BOOST_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ + || defined(GENERATING_DOCUMENTATION) + +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/windows/basic_handle.hpp> +#include <boost/asio/windows/object_handle_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace windows { + +/// Provides object-oriented handle functionality. +/** + * The windows::basic_object_handle class template provides asynchronous and + * blocking object-oriented handle functionality. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template <typename ObjectHandleService = object_handle_service> +class basic_object_handle + : public basic_handle<ObjectHandleService> +{ +public: + /// The native representation of a handle. + typedef typename ObjectHandleService::native_handle_type native_handle_type; + + /// Construct a basic_object_handle without opening it. + /** + * This constructor creates an object handle without opening it. + * + * @param io_service The io_service object that the object handle will use to + * dispatch handlers for any asynchronous operations performed on the handle. + */ + explicit basic_object_handle(boost::asio::io_service& io_service) + : basic_handle<ObjectHandleService>(io_service) + { + } + + /// Construct a basic_object_handle on an existing native handle. + /** + * This constructor creates an object handle object to hold an existing native + * handle. + * + * @param io_service The io_service object that the object handle will use to + * dispatch handlers for any asynchronous operations performed on the handle. + * + * @param native_handle The new underlying handle implementation. + * + * @throws boost::system::system_error Thrown on failure. + */ + basic_object_handle(boost::asio::io_service& io_service, + const native_handle_type& native_handle) + : basic_handle<ObjectHandleService>(io_service, native_handle) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_object_handle from another. + /** + * This constructor moves an object handle from one object to another. + * + * @param other The other basic_object_handle 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_object_handle(io_service&) constructor. + */ + basic_object_handle(basic_object_handle&& other) + : basic_handle<ObjectHandleService>( + BOOST_ASIO_MOVE_CAST(basic_object_handle)(other)) + { + } + + /// Move-assign a basic_object_handle from another. + /** + * This assignment operator moves an object handle from one object to another. + * + * @param other The other basic_object_handle 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_object_handle(io_service&) constructor. + */ + basic_object_handle& operator=(basic_object_handle&& other) + { + basic_handle<ObjectHandleService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_object_handle)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Perform a blocking wait on the object handle. + /** + * This function is used to wait for the object handle to be set to the + * signalled state. This function blocks and does not return until the object + * handle has been set to the signalled state. + * + * @throws boost::system::system_error Thrown on failure. + */ + void wait() + { + boost::system::error_code ec; + this->get_service().wait(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "wait"); + } + + /// Perform a blocking wait on the object handle. + /** + * This function is used to wait for the object handle to be set to the + * signalled state. This function blocks and does not return until the object + * handle has been set to the signalled state. + * + * @param ec Set to indicate what error occurred, if any. + */ + void wait(boost::system::error_code& ec) + { + this->get_service().wait(this->get_implementation(), ec); + } + + /// Start an asynchronous wait on the object handle. + /** + * This function is be used to initiate an asynchronous wait against the + * object handle. It always returns immediately. + * + * @param handler The handler to be called when the object handle is set to + * the signalled state. 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(WaitHandler handler) + { + this->get_service().async_wait(this->get_implementation(), handler); + } +}; + +} // namespace windows +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/basic_random_access_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/basic_random_access_handle.hpp index 207e414..0d57141 100644 --- a/3rdParty/Boost/src/boost/asio/windows/basic_random_access_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/basic_random_access_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_random_access_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -21,6 +21,7 @@ || defined(GENERATING_DOCUMENTATION) #include <cstddef> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/windows/basic_handle.hpp> @@ -46,8 +47,13 @@ class basic_random_access_handle : public basic_handle<RandomAccessHandleService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// handle. + typedef typename RandomAccessHandleService::native_handle_type native_type; + /// The native representation of a handle. - typedef typename RandomAccessHandleService::native_type native_type; + typedef typename RandomAccessHandleService::native_handle_type + native_handle_type; /// Construct a basic_random_access_handle without opening it. /** @@ -72,16 +78,54 @@ public: * use to dispatch handlers for any asynchronous operations performed on the * handle. * - * @param native_handle The new underlying handle implementation. + * @param handle The new underlying handle implementation. * * @throws boost::system::system_error Thrown on failure. */ basic_random_access_handle(boost::asio::io_service& io_service, - const native_type& native_handle) - : basic_handle<RandomAccessHandleService>(io_service, native_handle) + const native_handle_type& handle) + : basic_handle<RandomAccessHandleService>(io_service, handle) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_random_access_handle from another. + /** + * This constructor moves a random-access handle from one object to another. + * + * @param other The other basic_random_access_handle 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_random_access_handle(io_service&) + * constructor. + */ + basic_random_access_handle(basic_random_access_handle&& other) + : basic_handle<RandomAccessHandleService>( + BOOST_ASIO_MOVE_CAST(basic_random_access_handle)(other)) + { + } + + /// Move-assign a basic_random_access_handle from another. + /** + * This assignment operator moves a random-access handle from one object to + * another. + * + * @param other The other basic_random_access_handle 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_random_access_handle(io_service&) + * constructor. + */ + basic_random_access_handle& operator=(basic_random_access_handle&& other) + { + basic_handle<RandomAccessHandleService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_random_access_handle)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Write some data to the handle at the specified offset. /** * This function is used to write data to the random-access handle. The @@ -116,9 +160,9 @@ public: const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.write_some_at( - this->implementation, offset, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().write_some_at( + this->get_implementation(), offset, buffers, ec); + boost::asio::detail::throw_error(ec, "write_some_at"); return s; } @@ -144,8 +188,8 @@ public: std::size_t write_some_at(boost::uint64_t offset, const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.write_some_at( - this->implementation, offset, buffers, ec); + return this->get_service().write_some_at( + this->get_implementation(), offset, buffers, ec); } /// Start an asynchronous write at the specified offset. @@ -187,10 +231,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some_at(boost::uint64_t offset, - const ConstBufferSequence& buffers, WriteHandler handler) + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_write_some_at( - this->implementation, offset, buffers, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_write_some_at(this->get_implementation(), + offset, buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the handle at the specified offset. @@ -228,9 +277,9 @@ public: const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.read_some_at( - this->implementation, offset, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().read_some_at( + this->get_implementation(), offset, buffers, ec); + boost::asio::detail::throw_error(ec, "read_some_at"); return s; } @@ -257,8 +306,8 @@ public: std::size_t read_some_at(boost::uint64_t offset, const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.read_some_at( - this->implementation, offset, buffers, ec); + return this->get_service().read_some_at( + this->get_implementation(), offset, buffers, ec); } /// Start an asynchronous read at the specified offset. @@ -301,10 +350,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some_at(boost::uint64_t offset, - const MutableBufferSequence& buffers, ReadHandler handler) + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_read_some_at( - this->implementation, offset, buffers, 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; + + this->get_service().async_read_some_at(this->get_implementation(), + offset, buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/windows/basic_stream_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/basic_stream_handle.hpp index 105b041..ccc8f09 100644 --- a/3rdParty/Boost/src/boost/asio/windows/basic_stream_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/basic_stream_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_stream_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -21,10 +21,11 @@ || defined(GENERATING_DOCUMENTATION) #include <cstddef> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/windows/basic_handle.hpp> #include <boost/asio/windows/stream_handle_service.hpp> -#include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -49,8 +50,12 @@ class basic_stream_handle : public basic_handle<StreamHandleService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// handle. + typedef typename StreamHandleService::native_handle_type native_type; + /// The native representation of a handle. - typedef typename StreamHandleService::native_type native_type; + typedef typename StreamHandleService::native_handle_type native_handle_type; /// Construct a basic_stream_handle without opening it. /** @@ -74,16 +79,52 @@ public: * @param io_service The io_service object that the stream handle will use to * dispatch handlers for any asynchronous operations performed on the handle. * - * @param native_handle The new underlying handle implementation. + * @param handle The new underlying handle implementation. * * @throws boost::system::system_error Thrown on failure. */ basic_stream_handle(boost::asio::io_service& io_service, - const native_type& native_handle) - : basic_handle<StreamHandleService>(io_service, native_handle) + const native_handle_type& handle) + : basic_handle<StreamHandleService>(io_service, handle) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_stream_handle from another. + /** + * This constructor moves a stream handle from one object to another. + * + * @param other The other basic_stream_handle 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_stream_handle(io_service&) constructor. + */ + basic_stream_handle(basic_stream_handle&& other) + : basic_handle<StreamHandleService>( + BOOST_ASIO_MOVE_CAST(basic_stream_handle)(other)) { } + /// Move-assign a basic_stream_handle from another. + /** + * This assignment operator moves a stream handle from one object to + * another. + * + * @param other The other basic_stream_handle 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_stream_handle(io_service&) constructor. + */ + basic_stream_handle& operator=(basic_stream_handle&& other) + { + basic_handle<StreamHandleService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_stream_handle)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Write some data to the handle. /** * This function is used to write data to the stream handle. The function call @@ -115,8 +156,9 @@ public: std::size_t write_some(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.write_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().write_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "write_some"); return s; } @@ -140,7 +182,8 @@ public: std::size_t write_some(const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.write_some(this->implementation, buffers, ec); + return this->get_service().write_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous write. @@ -180,9 +223,14 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_write_some(this->implementation, buffers, 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. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_write_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the handle. @@ -217,8 +265,9 @@ public: std::size_t read_some(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.read_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().read_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "read_some"); return s; } @@ -243,7 +292,8 @@ public: std::size_t read_some(const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.read_some(this->implementation, buffers, ec); + return this->get_service().read_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous read. @@ -284,9 +334,14 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_read_some(this->implementation, buffers, 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; + + this->get_service().async_read_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/windows/object_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/object_handle.hpp new file mode 100644 index 0000000..7bf0654 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/windows/object_handle.hpp @@ -0,0 +1,40 @@ +// +// windows/object_handle.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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 BOOST_ASIO_WINDOWS_OBJECT_HANDLE_HPP +#define BOOST_ASIO_WINDOWS_OBJECT_HANDLE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ + || defined(GENERATING_DOCUMENTATION) + +#include <boost/asio/windows/basic_object_handle.hpp> + +namespace boost { +namespace asio { +namespace windows { + +/// Typedef for the typical usage of an object handle. +typedef basic_object_handle<> object_handle; + +} // namespace windows +} // namespace asio +} // namespace boost + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_WINDOWS_OBJECT_HANDLE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/object_handle_service.hpp b/3rdParty/Boost/src/boost/asio/windows/object_handle_service.hpp new file mode 100644 index 0000000..ffc89e6 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/windows/object_handle_service.hpp @@ -0,0 +1,170 @@ +// +// windows/object_handle_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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 BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP +#define BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ + || defined(GENERATING_DOCUMENTATION) + +#include <boost/asio/detail/win_object_handle_service.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace windows { + +/// Default service implementation for an object handle. +class object_handle_service +#if defined(GENERATING_DOCUMENTATION) + : public boost::asio::io_service::service +#else + : public boost::asio::detail::service_base<object_handle_service> +#endif +{ +public: +#if defined(GENERATING_DOCUMENTATION) + /// The unique service identifier. + static boost::asio::io_service::id id; +#endif + +private: + // The type of the platform-specific implementation. + typedef detail::win_object_handle_service service_impl_type; + +public: + /// The type of an object handle implementation. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined implementation_type; +#else + typedef service_impl_type::implementation_type implementation_type; +#endif + + /// The native handle type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; +#endif + + /// Construct a new object handle service for the specified io_service. + explicit object_handle_service(boost::asio::io_service& io_service) + : boost::asio::detail::service_base<object_handle_service>(io_service), + service_impl_(io_service) + { + } + + /// Construct a new object handle implementation. + void construct(implementation_type& impl) + { + service_impl_.construct(impl); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new object handle implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another object handle implementation. + void move_assign(implementation_type& impl, + object_handle_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Destroy an object handle implementation. + void destroy(implementation_type& impl) + { + service_impl_.destroy(impl); + } + + /// Assign an existing native handle to an object handle. + boost::system::error_code assign(implementation_type& impl, + const native_handle_type& handle, boost::system::error_code& ec) + { + return service_impl_.assign(impl, handle, ec); + } + + /// Determine whether the handle is open. + bool is_open(const implementation_type& impl) const + { + return service_impl_.is_open(impl); + } + + /// Close an object handle implementation. + boost::system::error_code close(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.close(impl, ec); + } + + /// Get the native handle implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); + } + + /// Cancel all asynchronous operations associated with the handle. + boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec) + { + 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> + void async_wait(implementation_type& impl, + BOOST_ASIO_MOVE_ARG(WaitHandler) handler) + { + service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); + } + +private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // The platform-specific implementation. + service_impl_type service_impl_; +}; + +} // namespace windows +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/overlapped_ptr.hpp b/3rdParty/Boost/src/boost/asio/windows/overlapped_ptr.hpp index c9b1889..94f9842 100644 --- a/3rdParty/Boost/src/boost/asio/windows/overlapped_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/overlapped_ptr.hpp @@ -2,7 +2,7 @@ // windows/overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -51,8 +51,9 @@ public: /// Construct an overlapped_ptr to contain the specified handler. template <typename Handler> - explicit overlapped_ptr(boost::asio::io_service& io_service, Handler handler) - : impl_(io_service, handler) + explicit overlapped_ptr(boost::asio::io_service& io_service, + BOOST_ASIO_MOVE_ARG(Handler) handler) + : impl_(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -70,9 +71,10 @@ public: /// Reset to contain the specified handler, freeing any current OVERLAPPED /// object. template <typename Handler> - void reset(boost::asio::io_service& io_service, Handler handler) + void reset(boost::asio::io_service& io_service, + BOOST_ASIO_MOVE_ARG(Handler) handler) { - impl_.reset(io_service, handler); + impl_.reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler)); } /// Get the contained OVERLAPPED object. diff --git a/3rdParty/Boost/src/boost/asio/windows/random_access_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/random_access_handle.hpp index 183ad0d..61fe1aa 100644 --- a/3rdParty/Boost/src/boost/asio/windows/random_access_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/random_access_handle.hpp @@ -2,7 +2,7 @@ // windows/random_access_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/windows/random_access_handle_service.hpp b/3rdParty/Boost/src/boost/asio/windows/random_access_handle_service.hpp index 08cb561..9b5e456 100644 --- a/3rdParty/Boost/src/boost/asio/windows/random_access_handle_service.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/random_access_handle_service.hpp @@ -2,7 +2,7 @@ // windows/random_access_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -59,11 +59,18 @@ public: typedef service_impl_type::implementation_type implementation_type; #endif - /// The native handle type. + /// (Deprecated: Use native_handle_type.) The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef service_impl_type::native_type native_type; + typedef service_impl_type::native_handle_type native_type; +#endif + + /// The native handle type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new random-access handle service for the specified io_service. @@ -74,18 +81,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new random-access handle implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new random-access handle implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another random-access handle implementation. + void move_assign(implementation_type& impl, + random_access_handle_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a random-access handle implementation. void destroy(implementation_type& impl) { @@ -94,9 +112,9 @@ public: /// Assign an existing native handle to a random-access handle. boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { - return service_impl_.assign(impl, native_handle, ec); + return service_impl_.assign(impl, handle, ec); } /// Determine whether the handle is open. @@ -112,10 +130,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native handle implementation. + /// (Deprecated: Use native_handle().) Get the native handle implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native handle implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the handle. @@ -135,10 +159,12 @@ public: /// Start an asynchronous write at the specified offset. template <typename ConstBufferSequence, typename WriteHandler> - void async_write_some_at(implementation_type& impl, boost::uint64_t offset, - const ConstBufferSequence& buffers, WriteHandler handler) + void async_write_some_at(implementation_type& impl, + boost::uint64_t offset, const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_write_some_at(impl, offset, buffers, handler); + service_impl_.async_write_some_at(impl, offset, buffers, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the specified offset. @@ -151,13 +177,21 @@ public: /// Start an asynchronous read at the specified offset. template <typename MutableBufferSequence, typename ReadHandler> - void async_read_some_at(implementation_type& impl, boost::uint64_t offset, - const MutableBufferSequence& buffers, ReadHandler handler) + void async_read_some_at(implementation_type& impl, + boost::uint64_t offset, const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_read_some_at(impl, offset, buffers, handler); + service_impl_.async_read_some_at(impl, offset, buffers, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/windows/stream_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/stream_handle.hpp index 67f6452..7d829db 100644 --- a/3rdParty/Boost/src/boost/asio/windows/stream_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/stream_handle.hpp @@ -2,7 +2,7 @@ // windows/stream_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) diff --git a/3rdParty/Boost/src/boost/asio/windows/stream_handle_service.hpp b/3rdParty/Boost/src/boost/asio/windows/stream_handle_service.hpp index 418ea1e..7d0ec9c 100644 --- a/3rdParty/Boost/src/boost/asio/windows/stream_handle_service.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/stream_handle_service.hpp @@ -2,7 +2,7 @@ // windows/stream_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -57,11 +57,18 @@ public: typedef service_impl_type::implementation_type implementation_type; #endif - /// The native handle type. + /// (Deprecated: Use native_handle_type.) The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef service_impl_type::native_type native_type; + typedef service_impl_type::native_handle_type native_type; +#endif + + /// The native handle type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new stream handle service for the specified io_service. @@ -71,18 +78,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new stream handle implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new stream handle implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another stream handle implementation. + void move_assign(implementation_type& impl, + stream_handle_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a stream handle implementation. void destroy(implementation_type& impl) { @@ -91,9 +109,9 @@ public: /// Assign an existing native handle to a stream handle. boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { - return service_impl_.assign(impl, native_handle, ec); + return service_impl_.assign(impl, handle, ec); } /// Determine whether the handle is open. @@ -109,10 +127,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native handle implementation. + /// (Deprecated: Use native_handle().) Get the native handle implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native handle implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the handle. @@ -133,9 +157,11 @@ public: /// Start an asynchronous write. template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, WriteHandler handler) + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_write_some(impl, buffers, handler); + service_impl_.async_write_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the stream. @@ -149,12 +175,20 @@ public: /// Start an asynchronous read. template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, ReadHandler handler) + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_read_some(impl, buffers, handler); + service_impl_.async_read_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/write.hpp b/3rdParty/Boost/src/boost/asio/write.hpp index 537a8d6..dd6cb34 100644 --- a/3rdParty/Boost/src/boost/asio/write.hpp +++ b/3rdParty/Boost/src/boost/asio/write.hpp @@ -2,7 +2,7 @@ // write.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -71,6 +71,46 @@ namespace asio { template <typename SyncWriteStream, typename ConstBufferSequence> std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers); +/// Write all of the supplied data to a stream before returning. +/** + * This function is used to write a certain number of bytes of data to a stream. + * The call will block until one of the following conditions is true: + * + * @li All of the data in the supplied buffers has been written. That is, the + * bytes transferred is equal to the sum of the buffer sizes. + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * write_some function. + * + * @param s The stream to which the data is to be written. The type must support + * the SyncWriteStream concept. + * + * @param buffers One or more buffers containing the data to be written. The sum + * of the buffer sizes indicates the maximum number of bytes to write to the + * stream. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To write a single data buffer use the @ref buffer function as follows: + * @code boost::asio::write(s, boost::asio::buffer(data, size), ec); @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. + * + * @note This overload is equivalent to calling: + * @code boost::asio::write( + * s, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncWriteStream, typename ConstBufferSequence> +std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, + boost::system::error_code& ec); + /// Write a certain amount of data to a stream before returning. /** * This function is used to write a certain number of bytes of data to a stream. @@ -197,6 +237,36 @@ std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, template <typename SyncWriteStream, typename Allocator> std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b); +/// Write all of the supplied data to a stream before returning. +/** + * This function is used to write a certain number of bytes of data to a stream. + * The call will block until one of the following conditions is true: + * + * @li All of the data in the supplied basic_streambuf has been written. + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * write_some function. + * + * @param s The stream to which the data is to be written. The type must support + * the SyncWriteStream concept. + * + * @param b The basic_streambuf object from which data will be written. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::write( + * s, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncWriteStream, typename Allocator> +std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + /// Write a certain amount of data to a stream before returning. /** * This function is used to write a certain number of bytes of data to a stream. @@ -344,7 +414,7 @@ std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b, template <typename AsyncWriteStream, typename ConstBufferSequence, typename WriteHandler> void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - WriteHandler handler); + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); /// Start an asynchronous operation to write a certain amount of data to a /// stream. @@ -416,7 +486,8 @@ void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, template <typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -463,7 +534,7 @@ void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, */ template <typename AsyncWriteStream, typename Allocator, typename WriteHandler> void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, - WriteHandler handler); + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); /// Start an asynchronous operation to write a certain amount of data to a /// stream. @@ -523,7 +594,8 @@ void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, template <typename AsyncWriteStream, typename Allocator, typename CompletionCondition, typename WriteHandler> void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, WriteHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/write_at.hpp b/3rdParty/Boost/src/boost/asio/write_at.hpp index 9c0c575..9535a55 100644 --- a/3rdParty/Boost/src/boost/asio/write_at.hpp +++ b/3rdParty/Boost/src/boost/asio/write_at.hpp @@ -2,7 +2,7 @@ // write_at.hpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -76,6 +76,51 @@ template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::uint64_t offset, const ConstBufferSequence& buffers); +/// Write all of the supplied data at the specified offset before returning. +/** + * This function is used to write a certain number of bytes of data to a random + * access device at a specified offset. The call will block until one of the + * following conditions is true: + * + * @li All of the data in the supplied buffers has been written. That is, the + * bytes transferred is equal to the sum of the buffer sizes. + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the device's + * write_some_at function. + * + * @param d The device to which the data is to be written. The type must support + * the SyncRandomAccessWriteDevice concept. + * + * @param offset The offset at which the data will be written. + * + * @param buffers One or more buffers containing the data to be written. The sum + * of the buffer sizes indicates the maximum number of bytes to write to the + * device. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To write a single data buffer use the @ref buffer function as follows: + * @code boost::asio::write_at(d, 42, + * boost::asio::buffer(data, size), ec); @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. + * + * @note This overload is equivalent to calling: + * @code boost::asio::write_at( + * d, offset, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> +std::size_t write_at(SyncRandomAccessWriteDevice& d, + boost::uint64_t offset, const ConstBufferSequence& buffers, + boost::system::error_code& ec); + /// Write a certain amount of data at a specified offset before returning. /** * This function is used to write a certain number of bytes of data to a random @@ -214,6 +259,40 @@ template <typename SyncRandomAccessWriteDevice, typename Allocator> std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::uint64_t offset, basic_streambuf<Allocator>& b); +/// Write all of the supplied data at the specified offset before returning. +/** + * This function is used to write a certain number of bytes of data to a random + * access device at a specified offset. The call will block until one of the + * following conditions is true: + * + * @li All of the data in the supplied basic_streambuf has been written. + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the device's + * write_some_at function. + * + * @param d The device to which the data is to be written. The type must support + * the SyncRandomAccessWriteDevice concept. + * + * @param offset The offset at which the data will be written. + * + * @param b The basic_streambuf object from which data will be written. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::write_at( + * d, 42, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncRandomAccessWriteDevice, typename Allocator> +std::size_t write_at(SyncRandomAccessWriteDevice& d, + boost::uint64_t offset, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + /// Write a certain amount of data at a specified offset before returning. /** * This function is used to write a certain number of bytes of data to a random @@ -367,7 +446,8 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::uint64_t offset, template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename WriteHandler> void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, - const ConstBufferSequence& buffers, WriteHandler handler); + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); /// Start an asynchronous operation to write a certain amount of data at the /// specified offset. @@ -439,7 +519,8 @@ template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -486,7 +567,7 @@ void async_write_at(AsyncRandomAccessWriteDevice& d, template <typename AsyncRandomAccessWriteDevice, typename Allocator, typename WriteHandler> void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, - basic_streambuf<Allocator>& b, WriteHandler handler); + basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(WriteHandler) handler); /// Start an asynchronous operation to write a certain amount of data at the /// specified offset. @@ -546,7 +627,7 @@ template <typename AsyncRandomAccessWriteDevice, typename Allocator, typename CompletionCondition, typename WriteHandler> void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, basic_streambuf<Allocator>& b, CompletionCondition completion_condition, - WriteHandler handler); + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/bind/bind.hpp b/3rdParty/Boost/src/boost/bind/bind.hpp index a63d2a0..fb67097 100644 --- a/3rdParty/Boost/src/boost/bind/bind.hpp +++ b/3rdParty/Boost/src/boost/bind/bind.hpp @@ -1680,7 +1680,7 @@ template< class R, class T > struct add_cref< R (T::*) (), 1 > typedef void type; }; -#if !( defined(__IBMCPP__) && BOOST_WORKAROUND( __IBMCPP__, BOOST_TESTED_AT(600) ) ) +#if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION template< class R, class T > struct add_cref< R (T::*) () const, 1 > { diff --git a/3rdParty/Boost/src/boost/chrono/ceil.hpp b/3rdParty/Boost/src/boost/chrono/ceil.hpp new file mode 100644 index 0000000..7fbf9dd --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/ceil.hpp @@ -0,0 +1,36 @@ +// boost/chrono/round.hpp ------------------------------------------------------------// + +// (C) Copyright Howard Hinnant +// Copyright 2011 Vicente J. Botet Escriba + +// 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) + +// See http://www.boost.org/libs/chrono for documentation. + +#ifndef BOOST_CHRONO_CEIL_HPP +#define BOOST_CHRONO_CEIL_HPP + +#include <boost/chrono/duration.hpp> + +namespace boost +{ + namespace chrono + { + + /** + * rounds up + */ + template <class To, class Rep, class Period> + To ceil(const duration<Rep, Period>& d) + { + To t = duration_cast<To>(d); + if (t < d) + ++t; + return t; + } + + } // namespace chrono +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/chrono/chrono.hpp b/3rdParty/Boost/src/boost/chrono/chrono.hpp new file mode 100644 index 0000000..ebc29d8 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/chrono.hpp @@ -0,0 +1,15 @@ +// chrono.hpp --------------------------------------------------------------// + +// Copyright 2009-2011 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHRONO_CHRONO_HPP +#define BOOST_CHRONO_CHRONO_HPP + +#include <boost/chrono/duration.hpp> +#include <boost/chrono/time_point.hpp> +#include <boost/chrono/system_clocks.hpp> + +#endif // BOOST_CHRONO_CHRONO_HPP diff --git a/3rdParty/Boost/src/boost/chrono/clock_string.hpp b/3rdParty/Boost/src/boost/chrono/clock_string.hpp new file mode 100644 index 0000000..af025f2 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/clock_string.hpp @@ -0,0 +1,25 @@ +// +// (C) Copyright 2010-2011 Vicente J. Botet Escriba +// Use, modification and distribution are subject to 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 BOOST_CHRONO_CLOCK_STRING_HPP +#define BOOST_CHRONO_CLOCK_STRING_HPP + +#include <string> + +namespace boost +{ + namespace chrono + { + + template<class Clock, class CharT> + struct clock_string; + + } // chrono + +} // boost + +#endif // BOOST_CHRONO_CLOCK_STRING_HPP diff --git a/3rdParty/Boost/src/boost/chrono/config.hpp b/3rdParty/Boost/src/boost/chrono/config.hpp new file mode 100644 index 0000000..7812dad --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/config.hpp @@ -0,0 +1,215 @@ +// boost/chrono/config.hpp -------------------------------------------------// + +// Copyright Beman Dawes 2003, 2006, 2008 +// Copyright 2009-2011 Vicente J. Botet Escriba + +// 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) + +// See http://www.boost.org/libs/chrono for documentation. + +#ifndef BOOST_CHRONO_CONFIG_HPP +#define BOOST_CHRONO_CONFIG_HPP + +#include <boost/config.hpp> + +#if !defined BOOST_CHRONO_VERSION +#define BOOST_CHRONO_VERSION 1 +#else +#if BOOST_CHRONO_VERSION!=1 && BOOST_CHRONO_VERSION!=2 +#error "BOOST_CHRONO_VERSION must be 1 or 2" +#endif +#endif + +#if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H) +#define BOOST_USE_WINDOWS_H +#endif + +#if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \ + && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + +# define BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + +#endif + +// BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API +// can be defined by the user to specify which API should be used + +#if defined(BOOST_CHRONO_WINDOWS_API) +# warning Boost.Chrono will use the Windows API +#elif defined(BOOST_CHRONO_MAC_API) +# warning Boost.Chrono will use the Mac API +#elif defined(BOOST_CHRONO_POSIX_API) +# warning Boost.Chrono will use the POSIX API +#endif + +# if defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_POSIX_API ) +# error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined +# elif defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_MAC_API ) +# error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined +# elif defined( BOOST_CHRONO_MAC_API ) && defined( BOOST_CHRONO_POSIX_API ) +# error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined +# elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API ) +# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) +# define BOOST_CHRONO_WINDOWS_API +# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +# define BOOST_CHRONO_MAC_API +# else +# define BOOST_CHRONO_POSIX_API +# endif +# endif + +# if defined( BOOST_CHRONO_WINDOWS_API ) +# ifndef UNDER_CE +# define BOOST_CHRONO_HAS_PROCESS_CLOCKS +# endif +# define BOOST_CHRONO_HAS_CLOCK_STEADY +# define BOOST_CHRONO_HAS_THREAD_CLOCK +# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true +# endif + +# if defined( BOOST_CHRONO_MAC_API ) +# define BOOST_CHRONO_HAS_PROCESS_CLOCKS +# define BOOST_CHRONO_HAS_CLOCK_STEADY +# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true +# endif + +# if defined( BOOST_CHRONO_POSIX_API ) +# define BOOST_CHRONO_HAS_PROCESS_CLOCKS +# include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME +# if defined(CLOCK_MONOTONIC) +# define BOOST_CHRONO_HAS_CLOCK_STEADY +# endif +# if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS) +# define BOOST_CHRONO_HAS_THREAD_CLOCK +# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true +# endif +# if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BOOST_DISABLE_THREADS) +# define BOOST_CHRONO_HAS_THREAD_CLOCK +# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true +# endif +# if defined(sun) || defined(__sun) +# undef BOOST_CHRONO_HAS_THREAD_CLOCK +# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +# endif +# if defined(__HP_aCC) && defined(__hpux) +# undef BOOST_CHRONO_HAS_THREAD_CLOCK +# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +# endif +# endif + +#if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK) +#undef BOOST_CHRONO_HAS_THREAD_CLOCK +#undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +#endif + +//#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS + +// unicode support ------------------------------// + +#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T) +//~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT +#else +#define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1 +#endif + +#if ! defined BOOST_NOEXCEPT +#if defined(BOOST_NO_CXX11_NOEXCEPT) +#define BOOST_NOEXCEPT +#else +#define BOOST_NOEXCEPT noexcept +#endif +#endif + +#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) +#define BOOST_CHRONO_LIB_CONSTEXPR +#else +#define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR +#endif + +#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() +#else +#ifdef BOOST_NO_NOEXCEPT +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() +#else +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept +#endif +#endif + + +#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ + && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +#error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined" +#endif + +#if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ + && defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 && BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined" +#endif + +#if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ + && ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +#define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING +#endif + +#if (BOOST_CHRONO_VERSION == 2) +#if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ + && ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#endif +#endif + +#ifdef BOOST_CHRONO_HEADER_ONLY +#define BOOST_CHRONO_INLINE inline +#define BOOST_CHRONO_STATIC inline +#define BOOST_CHRONO_DECL + +#else +#define BOOST_CHRONO_INLINE +#define BOOST_CHRONO_STATIC static + +// enable dynamic linking on Windows ---------------------------------------// + +// we need to import/export our code only if the user has specifically +// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost +// libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK +// if they want just this one to be dynamically liked: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) +// export if this is our own source, otherwise import: +#ifdef BOOST_CHRONO_SOURCE +# define BOOST_CHRONO_DECL BOOST_SYMBOL_EXPORT +#else +# define BOOST_CHRONO_DECL BOOST_SYMBOL_IMPORT +#endif // BOOST_CHRONO_SOURCE +#endif // DYN_LINK +// +// if BOOST_CHRONO_DECL isn't defined yet define it now: +#ifndef BOOST_CHRONO_DECL +#define BOOST_CHRONO_DECL +#endif + + + +// enable automatic library variant selection ------------------------------// + +#if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB) +// +// Set the name of our library; this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_chrono +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include <boost/config/auto_link.hpp> +#endif // auto-linking disabled +#endif // BOOST_CHRONO_HEADER_ONLY +#endif // BOOST_CHRONO_CONFIG_HPP + diff --git a/3rdParty/Boost/src/boost/chrono/detail/inlined/chrono.hpp b/3rdParty/Boost/src/boost/chrono/detail/inlined/chrono.hpp new file mode 100644 index 0000000..0278843 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/inlined/chrono.hpp @@ -0,0 +1,44 @@ +// chrono.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2008 +// Copyright Vicente J. Botet Escriba 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHRONO_DETAIL_INLINED_CHRONO_HPP +#define BOOST_CHRONO_DETAIL_INLINED_CHRONO_HPP + +#include <boost/version.hpp> +#include <boost/chrono/chrono.hpp> +#include <boost/system/system_error.hpp> +#include <boost/throw_exception.hpp> +#include <boost/chrono/detail/system.hpp> + +//----------------------------------------------------------------------------// +// // +// Platform-specific Implementations // +// // +//----------------------------------------------------------------------------// + +//----------------------------------------------------------------------------// +// Windows // +//----------------------------------------------------------------------------// +#if defined(BOOST_CHRONO_WINDOWS_API) +#include <boost/chrono/detail/inlined/win/chrono.hpp> + +//----------------------------------------------------------------------------// +// Mac // +//----------------------------------------------------------------------------// +#elif defined(BOOST_CHRONO_MAC_API) +#include <boost/chrono/detail/inlined/mac/chrono.hpp> + +//----------------------------------------------------------------------------// +// POSIX // +//----------------------------------------------------------------------------// +#elif defined(BOOST_CHRONO_POSIX_API) +#include <boost/chrono/detail/inlined/posix/chrono.hpp> + +#endif // POSIX + +#endif diff --git a/3rdParty/Boost/src/boost/chrono/detail/inlined/mac/chrono.hpp b/3rdParty/Boost/src/boost/chrono/detail/inlined/mac/chrono.hpp new file mode 100644 index 0000000..bf20ae9 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/inlined/mac/chrono.hpp @@ -0,0 +1,241 @@ +// mac/chrono.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2008 +// Copyright 2009-2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +//----------------------------------------------------------------------------// +// Mac // +//----------------------------------------------------------------------------// + +#include <sys/time.h> //for gettimeofday and timeval +#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t + +namespace boost +{ +namespace chrono +{ + +// system_clock + +// gettimeofday is the most precise "system time" available on this platform. +// It returns the number of microseconds since New Years 1970 in a struct called timeval +// which has a field for seconds and a field for microseconds. +// Fill in the timeval and then convert that to the time_point +system_clock::time_point +system_clock::now() BOOST_NOEXCEPT +{ + timeval tv; + gettimeofday(&tv, 0); + return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec)); +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +system_clock::time_point +system_clock::now(system::error_code & ec) +{ + timeval tv; + gettimeofday(&tv, 0); + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec)); +} +#endif +// Take advantage of the fact that on this platform time_t is nothing but +// an integral count of seconds since New Years 1970 (same epoch as timeval). +// Just get the duration out of the time_point and truncate it to seconds. +time_t +system_clock::to_time_t(const time_point& t) BOOST_NOEXCEPT +{ + return time_t(duration_cast<seconds>(t.time_since_epoch()).count()); +} + +// Just turn the time_t into a count of seconds and construct a time_point with it. +system_clock::time_point +system_clock::from_time_t(time_t t) BOOST_NOEXCEPT +{ + return system_clock::time_point(seconds(t)); +} + +namespace chrono_detail +{ + +// steady_clock + +// Note, in this implementation steady_clock and high_resolution_clock +// are the same clock. They are both based on mach_absolute_time(). +// mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of +// nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom +// are run time constants supplied by the OS. This clock has no relationship +// to the Gregorian calendar. It's main use is as a high resolution timer. + +// MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize +// for that case as an optimization. +BOOST_CHRONO_STATIC +steady_clock::rep +steady_simplified() +{ + return mach_absolute_time(); +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +BOOST_CHRONO_STATIC +steady_clock::rep +steady_simplified_ec(system::error_code & ec) +{ + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return mach_absolute_time(); +} +#endif + +BOOST_CHRONO_STATIC +double +compute_steady_factor(kern_return_t& err) +{ + mach_timebase_info_data_t MachInfo; + err = mach_timebase_info(&MachInfo); + if ( err != 0 ) { + return 0; + } + return static_cast<double>(MachInfo.numer) / MachInfo.denom; +} + +BOOST_CHRONO_STATIC +steady_clock::rep +steady_full() +{ + static kern_return_t err; + static const double factor = chrono_detail::compute_steady_factor(err); + if (err != 0) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + } + return static_cast<steady_clock::rep>(mach_absolute_time() * factor); +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +BOOST_CHRONO_STATIC +steady_clock::rep +steady_full_ec(system::error_code & ec) +{ + static kern_return_t err; + static const double factor = chrono_detail::compute_steady_factor(err); + if (err != 0) + { + if (BOOST_CHRONO_IS_THROWS(ec)) + { + boost::throw_exception( + system::system_error( + err, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::steady_clock" )); + } + else + { + ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); + return steady_clock::rep(); + } + } + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return static_cast<steady_clock::rep>(mach_absolute_time() * factor); +} +#endif + +typedef steady_clock::rep (*FP)(); +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +typedef steady_clock::rep (*FP_ec)(system::error_code &); +#endif + +BOOST_CHRONO_STATIC +FP +init_steady_clock(kern_return_t & err) +{ + mach_timebase_info_data_t MachInfo; + err = mach_timebase_info(&MachInfo); + if ( err != 0 ) + { + return 0; + } + + if (MachInfo.numer == MachInfo.denom) + { + return &chrono_detail::steady_simplified; + } + return &chrono_detail::steady_full; +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +BOOST_CHRONO_STATIC +FP_ec +init_steady_clock_ec(kern_return_t & err) +{ + mach_timebase_info_data_t MachInfo; + err = mach_timebase_info(&MachInfo); + if ( err != 0 ) + { + return 0; + } + + if (MachInfo.numer == MachInfo.denom) + { + return &chrono_detail::steady_simplified_ec; + } + return &chrono_detail::steady_full_ec; +} +#endif +} + +steady_clock::time_point +steady_clock::now() BOOST_NOEXCEPT +{ + static kern_return_t err; + static chrono_detail::FP fp = chrono_detail::init_steady_clock(err); + if ( err != 0 ) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + } + return time_point(duration(fp())); +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +steady_clock::time_point +steady_clock::now(system::error_code & ec) +{ + static kern_return_t err; + static chrono_detail::FP_ec fp = chrono_detail::init_steady_clock_ec(err); + if ( err != 0 ) + { + if (BOOST_CHRONO_IS_THROWS(ec)) + { + boost::throw_exception( + system::system_error( + err, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::steady_clock" )); + } + else + { + ec.assign( err, BOOST_CHRONO_SYSTEM_CATEGORY ); + return time_point(); + } + } + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration(fp(ec))); +} +#endif +} // namespace chrono +} // namespace boost diff --git a/3rdParty/Boost/src/boost/chrono/detail/inlined/posix/chrono.hpp b/3rdParty/Boost/src/boost/chrono/detail/inlined/posix/chrono.hpp new file mode 100644 index 0000000..e35a7ce --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/inlined/posix/chrono.hpp @@ -0,0 +1,120 @@ +// posix/chrono.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2008 +// Copyright Vicente J. Botet Escriba 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +//----------------------------------------------------------------------------// +// POSIX // +//----------------------------------------------------------------------------// + +#include <time.h> // for clock_gettime + +namespace boost +{ +namespace chrono +{ + + system_clock::time_point system_clock::now() BOOST_NOEXCEPT + { + timespec ts; + if ( ::clock_gettime( CLOCK_REALTIME, &ts ) ) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + } + + return time_point(duration( + static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); + } + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + system_clock::time_point system_clock::now(system::error_code & ec) + { + timespec ts; + if ( ::clock_gettime( CLOCK_REALTIME, &ts ) ) + { + if (BOOST_CHRONO_IS_THROWS(ec)) + { + boost::throw_exception( + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::system_clock" )); + } + else + { + ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); + return time_point(); + } + } + + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration( + static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); + } +#endif + + std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_NOEXCEPT + { + return static_cast<std::time_t>( t.time_since_epoch().count() / 1000000000 ); + } + + system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT + { + return time_point(duration(static_cast<system_clock::rep>(t) * 1000000000)); + } + +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + + steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT + { + timespec ts; + if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) ) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + } + + return time_point(duration( + static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); + } + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + steady_clock::time_point steady_clock::now(system::error_code & ec) + { + timespec ts; + if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) ) + { + if (BOOST_CHRONO_IS_THROWS(ec)) + { + boost::throw_exception( + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::steady_clock" )); + } + else + { + ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); + return time_point(); + } + } + + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration( + static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); + } +#endif +#endif + +} // namespace chrono +} // namespace boost + + diff --git a/3rdParty/Boost/src/boost/chrono/detail/inlined/win/chrono.hpp b/3rdParty/Boost/src/boost/chrono/detail/inlined/win/chrono.hpp new file mode 100644 index 0000000..75160db --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/inlined/win/chrono.hpp @@ -0,0 +1,160 @@ +// win/chrono.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2008 +// Copyright 2009-2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +//----------------------------------------------------------------------------// +// Windows // +//----------------------------------------------------------------------------// +#ifndef BOOST_CHRONO_DETAIL_INLINED_WIN_CHRONO_HPP +#define BOOST_CHRONO_DETAIL_INLINED_WIN_CHRONO_HPP + +#include <boost/detail/win/time.hpp> +#include <boost/detail/win/timers.hpp> +#include <boost/detail/win/GetLastError.hpp> + +namespace boost +{ +namespace chrono +{ +namespace chrono_detail +{ + + BOOST_CHRONO_INLINE double get_nanosecs_per_tic() BOOST_NOEXCEPT + { + boost::detail::win32::LARGE_INTEGER_ freq; + if ( !boost::detail::win32::QueryPerformanceFrequency( &freq ) ) + return 0.0L; + return double(1000000000.0L / freq.QuadPart); + } + +} + + steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT + { + static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic(); + + boost::detail::win32::LARGE_INTEGER_ pcount; + if ( (nanosecs_per_tic <= 0.0L) || + (!boost::detail::win32::QueryPerformanceCounter( &pcount )) ) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + return steady_clock::time_point(); + } + + return steady_clock::time_point(steady_clock::duration( + static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart))); + } + + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + steady_clock::time_point steady_clock::now( system::error_code & ec ) + { + static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic(); + + boost::detail::win32::LARGE_INTEGER_ pcount; + if ( (nanosecs_per_tic <= 0.0L) + || (!boost::detail::win32::QueryPerformanceCounter( &pcount )) ) + { + boost::detail::win32::DWORD_ cause = + ((nanosecs_per_tic <= 0.0L) + ? ERROR_NOT_SUPPORTED + : boost::detail::win32::GetLastError()); + if (BOOST_CHRONO_IS_THROWS(ec)) { + boost::throw_exception( + system::system_error( + cause, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::steady_clock" )); + } + else + { + ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY ); + return steady_clock::time_point(duration(0)); + } + } + + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration( + static_cast<steady_clock::rep>(nanosecs_per_tic * pcount.QuadPart))); + } +#endif + + BOOST_CHRONO_INLINE + system_clock::time_point system_clock::now() BOOST_NOEXCEPT + { + boost::detail::win32::FILETIME_ ft; + #if defined(UNDER_CE) + // Windows CE does not define GetSystemTimeAsFileTime so we do it in two steps. + boost::detail::win32::SYSTEMTIME_ st; + boost::detail::win32::GetSystemTime( &st ); + boost::detail::win32::SystemTimeToFileTime( &st, &ft ); + #else + boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails + #endif + return system_clock::time_point(system_clock::duration( + (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)); + } + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + BOOST_CHRONO_INLINE + system_clock::time_point system_clock::now( system::error_code & ec ) + { + boost::detail::win32::FILETIME_ ft; + #if defined(UNDER_CE) + // Windows CE does not define GetSystemTimeAsFileTime so we do it in two steps. + boost::detail::win32::SYSTEMTIME_ st; + boost::detail::win32::GetSystemTime( &st ); + boost::detail::win32::SystemTimeToFileTime( &st, &ft ); + #else + boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails + #endif + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration( + (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)); + } +#endif + + BOOST_CHRONO_INLINE + std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_NOEXCEPT + { + __int64 temp = t.time_since_epoch().count(); + + # if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0 + temp -= 116444736000000000LL; // delta from epoch in microseconds + # else + temp -= 116444736000000000; + # endif + + temp /= 10000000; + return static_cast<std::time_t>( temp ); + } + + BOOST_CHRONO_INLINE + system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT + { + __int64 temp = t; + temp *= 10000000; + + # if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0 + temp += 116444736000000000LL; + # else + temp += 116444736000000000; + # endif + + return time_point(duration(temp)); + } + +} // namespace chrono +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/chrono/detail/is_evenly_divisible_by.hpp b/3rdParty/Boost/src/boost/chrono/detail/is_evenly_divisible_by.hpp new file mode 100644 index 0000000..960a208 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/is_evenly_divisible_by.hpp @@ -0,0 +1,31 @@ +// is_evenly_divisible_by.hpp --------------------------------------------------------------// + +// Copyright 2009-2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP +#define BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP + +#include <boost/chrono/config.hpp> + +#include <boost/mpl/logical.hpp> +#include <boost/ratio/detail/overflow_helpers.hpp> + +namespace boost { +namespace chrono { +namespace chrono_detail { + +// template <class R1, class R2> +// struct is_evenly_divisible_by : public boost::mpl::bool_ < ratio_divide<R1, R2>::type::den == 1 > +// {}; + template <class R1, class R2> + struct is_evenly_divisible_by : public boost::ratio_detail::is_evenly_divisible_by<R1, R2> + {}; + +} // namespace chrono_detail +} // namespace detail +} // namespace chrono + +#endif // BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP diff --git a/3rdParty/Boost/src/boost/chrono/detail/static_assert.hpp b/3rdParty/Boost/src/boost/chrono/detail/static_assert.hpp new file mode 100644 index 0000000..8615194 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/static_assert.hpp @@ -0,0 +1,30 @@ +// static_assert.hpp --------------------------------------------------------------// + +// Copyright 2009-2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP +#define BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP + +#include <boost/chrono/config.hpp> + +#ifndef BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) +#elif defined(BOOST_CHRONO_USES_STATIC_ASSERT) +#include <boost/static_assert.hpp> +#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND) +#elif defined(BOOST_CHRONO_USES_MPL_ASSERT) +#include <boost/mpl/assert.hpp> +#include <boost/mpl/bool.hpp> +#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) \ + BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES) +#else +//~ #elif defined(BOOST_CHRONO_USES_ARRAY_ASSERT) +#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_JOIN(boost_chrono_test_,__LINE__)[(CND)?1:-1] +//~ #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) +#endif + +#endif // BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP diff --git a/3rdParty/Boost/src/boost/chrono/detail/system.hpp b/3rdParty/Boost/src/boost/chrono/detail/system.hpp new file mode 100644 index 0000000..0dcffe8 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/system.hpp @@ -0,0 +1,29 @@ +// Copyright 2009-2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHRONO_DETAIL_SYSTEM_HPP +#define BOOST_CHRONO_DETAIL_SYSTEM_HPP + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + +#include <boost/version.hpp> +#include <boost/system/error_code.hpp> + +#if ((BOOST_VERSION / 100000) < 2) && ((BOOST_VERSION / 100 % 1000) < 44) +#define BOOST_CHRONO_SYSTEM_CATEGORY boost::system::system_category +#else +#define BOOST_CHRONO_SYSTEM_CATEGORY boost::system::system_category() +#endif + +#ifdef BOOST_SYSTEM_NO_DEPRECATED +#define BOOST_CHRONO_THROWS boost::throws() +#define BOOST_CHRONO_IS_THROWS(EC) (&EC==&boost::throws()) +#else +#define BOOST_CHRONO_THROWS boost::system::throws +#define BOOST_CHRONO_IS_THROWS(EC) (&EC==&boost::system::throws) +#endif + +#endif +#endif diff --git a/3rdParty/Boost/src/boost/chrono/duration.hpp b/3rdParty/Boost/src/boost/chrono/duration.hpp new file mode 100644 index 0000000..97fe3d7 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/duration.hpp @@ -0,0 +1,795 @@ +// duration.hpp --------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009-2011 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.9 Time utilities [time] of the C++ committee's working paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + + +#ifndef BOOST_CHRONO_DURATION_HPP +#define BOOST_CHRONO_DURATION_HPP + +#include <boost/chrono/config.hpp> +#include <boost/chrono/detail/static_assert.hpp> + +#include <climits> +#include <limits> + + +#include <boost/mpl/logical.hpp> +#include <boost/ratio/ratio.hpp> +#include <boost/type_traits/common_type.hpp> +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_floating_point.hpp> +#include <boost/type_traits/is_unsigned.hpp> +#include <boost/chrono/detail/is_evenly_divisible_by.hpp> + +#include <boost/cstdint.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/integer_traits.hpp> + +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_CHRONO_USES_MPL_ASSERT) +#define BOOST_CHRONO_A_DURATION_REPRESENTATION_CAN_NOT_BE_A_DURATION "A duration representation can not be a duration" +#define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_DURATION_MUST_BE_A_STD_RATIO "Second template parameter of duration must be a boost::ratio" +#define BOOST_CHRONO_DURATION_PERIOD_MUST_BE_POSITIVE "duration period must be positive" +#define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_TIME_POINT_MUST_BE_A_BOOST_CHRONO_DURATION "Second template parameter of time_point must be a boost::chrono::duration" +#endif + +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include <boost/config/abi_prefix.hpp> // must be the last #include +#endif + +//----------------------------------------------------------------------------// +// // +// 20.9 Time utilities [time] // +// synopsis // +// // +//----------------------------------------------------------------------------// + +namespace boost { +namespace chrono { + + template <class Rep, class Period = ratio<1> > + class duration; + + namespace detail + { + template <class T> + struct is_duration + : boost::false_type {}; + + template <class Rep, class Period> + struct is_duration<duration<Rep, Period> > + : boost::true_type {}; + + template <class Duration, class Rep, bool = is_duration<Rep>::value> + struct duration_divide_result + { + }; + + template <class Duration, class Rep2, + bool = ( + ((boost::is_convertible<typename Duration::rep, + typename common_type<typename Duration::rep, Rep2>::type>::value)) + && ((boost::is_convertible<Rep2, + typename common_type<typename Duration::rep, Rep2>::type>::value)) + ) + > + struct duration_divide_imp + { + }; + + template <class Rep1, class Period, class Rep2> + struct duration_divide_imp<duration<Rep1, Period>, Rep2, true> + { + typedef duration<typename common_type<Rep1, Rep2>::type, Period> type; + }; + + template <class Rep1, class Period, class Rep2> + struct duration_divide_result<duration<Rep1, Period>, Rep2, false> + : duration_divide_imp<duration<Rep1, Period>, Rep2> + { + }; + +/// + template <class Rep, class Duration, bool = is_duration<Rep>::value> + struct duration_divide_result2 + { + }; + + template <class Rep, class Duration, + bool = ( + ((boost::is_convertible<typename Duration::rep, + typename common_type<typename Duration::rep, Rep>::type>::value)) + && ((boost::is_convertible<Rep, + typename common_type<typename Duration::rep, Rep>::type>::value)) + ) + > + struct duration_divide_imp2 + { + }; + + template <class Rep1, class Rep2, class Period > + struct duration_divide_imp2<Rep1, duration<Rep2, Period>, true> + { + //typedef typename common_type<Rep1, Rep2>::type type; + typedef double type; + }; + + template <class Rep1, class Rep2, class Period > + struct duration_divide_result2<Rep1, duration<Rep2, Period>, false> + : duration_divide_imp2<Rep1, duration<Rep2, Period> > + { + }; + +/// + template <class Duration, class Rep, bool = is_duration<Rep>::value> + struct duration_modulo_result + { + }; + + template <class Duration, class Rep2, + bool = ( + //boost::is_convertible<typename Duration::rep, + //typename common_type<typename Duration::rep, Rep2>::type>::value + //&& + boost::is_convertible<Rep2, + typename common_type<typename Duration::rep, Rep2>::type>::value + ) + > + struct duration_modulo_imp + { + }; + + template <class Rep1, class Period, class Rep2> + struct duration_modulo_imp<duration<Rep1, Period>, Rep2, true> + { + typedef duration<typename common_type<Rep1, Rep2>::type, Period> type; + }; + + template <class Rep1, class Period, class Rep2> + struct duration_modulo_result<duration<Rep1, Period>, Rep2, false> + : duration_modulo_imp<duration<Rep1, Period>, Rep2> + { + }; + +} // namespace detail +} // namespace chrono + + +// common_type trait specializations + +template <class Rep1, class Period1, class Rep2, class Period2> +struct common_type<chrono::duration<Rep1, Period1>, + chrono::duration<Rep2, Period2> >; + + +namespace chrono { + + // customization traits + template <class Rep> struct treat_as_floating_point; + template <class Rep> struct duration_values; + + // convenience typedefs + typedef duration<boost::int_least64_t, nano> nanoseconds; // at least 64 bits needed + typedef duration<boost::int_least64_t, micro> microseconds; // at least 55 bits needed + typedef duration<boost::int_least64_t, milli> milliseconds; // at least 45 bits needed + typedef duration<boost::int_least64_t> seconds; // at least 35 bits needed + typedef duration<boost::int_least32_t, ratio< 60> > minutes; // at least 29 bits needed + typedef duration<boost::int_least32_t, ratio<3600> > hours; // at least 23 bits needed + +//----------------------------------------------------------------------------// +// duration helpers // +//----------------------------------------------------------------------------// + +namespace detail +{ + + // duration_cast + + // duration_cast is the heart of this whole prototype. It can convert any + // duration to any other. It is also (implicitly) used in converting + // time_points. The conversion is always exact if possible. And it is + // always as efficient as hand written code. If different representations + // are involved, care is taken to never require implicit conversions. + // Instead static_cast is used explicitly for every required conversion. + // If there are a mixture of integral and floating point representations, + // the use of common_type ensures that the most logical "intermediate" + // representation is used. + template <class FromDuration, class ToDuration, + class Period, + bool PeriodNumEq1, + bool PeriodDenEq1> + struct duration_cast_aux; + + // When the two periods are the same, all that is left to do is static_cast from + // the source representation to the target representation (which may be a no-op). + // This conversion is always exact as long as the static_cast from the source + // representation to the destination representation is exact. + template <class FromDuration, class ToDuration, class Period> + struct duration_cast_aux<FromDuration, ToDuration, Period, true, true> + { + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + return ToDuration(static_cast<typename ToDuration::rep>(fd.count())); + } + }; + + // When the numerator of FromPeriod / ToPeriod is 1, then all we need to do is + // divide by the denominator of FromPeriod / ToPeriod. The common_type of + // the two representations is used for the intermediate computation before + // static_cast'ing to the destination. + // This conversion is generally not exact because of the division (but could be + // if you get lucky on the run time value of fd.count()). + template <class FromDuration, class ToDuration, class Period> + struct duration_cast_aux<FromDuration, ToDuration, Period, true, false> + { + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + typedef typename common_type< + typename ToDuration::rep, + typename FromDuration::rep, + boost::intmax_t>::type C; + return ToDuration(static_cast<typename ToDuration::rep>( + static_cast<C>(fd.count()) / static_cast<C>(Period::den))); + } + }; + + // When the denominator of FromPeriod / ToPeriod is 1, then all we need to do is + // multiply by the numerator of FromPeriod / ToPeriod. The common_type of + // the two representations is used for the intermediate computation before + // static_cast'ing to the destination. + // This conversion is always exact as long as the static_cast's involved are exact. + template <class FromDuration, class ToDuration, class Period> + struct duration_cast_aux<FromDuration, ToDuration, Period, false, true> + { + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + typedef typename common_type< + typename ToDuration::rep, + typename FromDuration::rep, + boost::intmax_t>::type C; + return ToDuration(static_cast<typename ToDuration::rep>( + static_cast<C>(fd.count()) * static_cast<C>(Period::num))); + } + }; + + // When neither the numerator or denominator of FromPeriod / ToPeriod is 1, then we need to + // multiply by the numerator and divide by the denominator of FromPeriod / ToPeriod. The + // common_type of the two representations is used for the intermediate computation before + // static_cast'ing to the destination. + // This conversion is generally not exact because of the division (but could be + // if you get lucky on the run time value of fd.count()). + template <class FromDuration, class ToDuration, class Period> + struct duration_cast_aux<FromDuration, ToDuration, Period, false, false> + { + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + typedef typename common_type< + typename ToDuration::rep, + typename FromDuration::rep, + boost::intmax_t>::type C; + return ToDuration(static_cast<typename ToDuration::rep>( + static_cast<C>(fd.count()) * static_cast<C>(Period::num) + / static_cast<C>(Period::den))); + } + }; + + template <class FromDuration, class ToDuration> + struct duration_cast { + typedef typename ratio_divide<typename FromDuration::period, + typename ToDuration::period>::type Period; + typedef duration_cast_aux< + FromDuration, + ToDuration, + Period, + Period::num == 1, + Period::den == 1 + > Aux; + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + return Aux()(fd); + } + }; + +} // namespace detail + +//----------------------------------------------------------------------------// +// // +// 20.9.2 Time-related traits [time.traits] // +// // +//----------------------------------------------------------------------------// +//----------------------------------------------------------------------------// +// 20.9.2.1 treat_as_floating_point [time.traits.is_fp] // +// Probably should have been treat_as_floating_point. Editor notifed. // +//----------------------------------------------------------------------------// + + // Support bidirectional (non-exact) conversions for floating point rep types + // (or user defined rep types which specialize treat_as_floating_point). + template <class Rep> + struct treat_as_floating_point : boost::is_floating_point<Rep> {}; + +//----------------------------------------------------------------------------// +// 20.9.2.2 duration_values [time.traits.duration_values] // +//----------------------------------------------------------------------------// + +namespace detail { + template <class T, bool = is_arithmetic<T>::value> + struct chrono_numeric_limits { + static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits<T>::min) ();} + }; + + template <class T> + struct chrono_numeric_limits<T,true> { + static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits<T>::min) ();} + }; + + template <> + struct chrono_numeric_limits<float,true> { + static BOOST_CHRONO_LIB_CONSTEXPR float lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW + { + return -(std::numeric_limits<float>::max) (); + } + }; + + template <> + struct chrono_numeric_limits<double,true> { + static BOOST_CHRONO_LIB_CONSTEXPR double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW + { + return -(std::numeric_limits<double>::max) (); + } + }; + + template <> + struct chrono_numeric_limits<long double,true> { + static BOOST_CHRONO_LIB_CONSTEXPR long double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW + { + return -(std::numeric_limits<long double>::max)(); + } + }; + + template <class T> + struct numeric_limits : chrono_numeric_limits<typename remove_cv<T>::type> + {}; + +} +template <class Rep> +struct duration_values +{ + static BOOST_CONSTEXPR Rep zero() {return Rep(0);} + static BOOST_CHRONO_LIB_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return (std::numeric_limits<Rep>::max)(); + } + + static BOOST_CHRONO_LIB_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return detail::numeric_limits<Rep>::lowest(); + } +}; + +} // namespace chrono + +//----------------------------------------------------------------------------// +// 20.9.2.3 Specializations of common_type [time.traits.specializations] // +//----------------------------------------------------------------------------// + +template <class Rep1, class Period1, class Rep2, class Period2> +struct common_type<chrono::duration<Rep1, Period1>, + chrono::duration<Rep2, Period2> > +{ + typedef chrono::duration<typename common_type<Rep1, Rep2>::type, + typename boost::ratio_gcd<Period1, Period2>::type> type; +}; + + +//----------------------------------------------------------------------------// +// // +// 20.9.3 Class template duration [time.duration] // +// // +//----------------------------------------------------------------------------// + + +namespace chrono { + + template <class Rep, class Period> + class duration + { + //BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, BOOST_CHRONO_A_DURATION_REPRESENTATION_MUST_BE_INTEGRAL, ()); + BOOST_CHRONO_STATIC_ASSERT(!boost::chrono::detail::is_duration<Rep>::value, + BOOST_CHRONO_A_DURATION_REPRESENTATION_CAN_NOT_BE_A_DURATION, ()); + BOOST_CHRONO_STATIC_ASSERT(boost::ratio_detail::is_ratio<typename Period::type>::value, + BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_DURATION_MUST_BE_A_STD_RATIO, ()); + BOOST_CHRONO_STATIC_ASSERT(Period::num>0, + BOOST_CHRONO_DURATION_PERIOD_MUST_BE_POSITIVE, ()); + public: + typedef Rep rep; + typedef Period period; + private: + rep rep_; + public: + + BOOST_CONSTEXPR + duration() : rep_(duration_values<rep>::zero()) { } + template <class Rep2> + BOOST_CONSTEXPR + explicit duration(const Rep2& r + , typename boost::enable_if < + mpl::and_ < + boost::is_convertible<Rep2, rep>, + mpl::or_ < + treat_as_floating_point<rep>, + mpl::and_ < + mpl::not_ < treat_as_floating_point<rep> >, + mpl::not_ < treat_as_floating_point<Rep2> > + > + > + > + >::type* = 0 + ) : rep_(r) { } + //~duration() {} //= default; + //BOOST_CONSTEXPR + //duration(const duration& rhs) : rep_(rhs.rep_) {} // = default; + duration& operator=(const duration& rhs) // = default; + { + if (&rhs != this) rep_= rhs.rep_; + return *this; + } + + // conversions + template <class Rep2, class Period2> + BOOST_CONSTEXPR + duration(const duration<Rep2, Period2>& d + , typename boost::enable_if < + mpl::or_ < + treat_as_floating_point<rep>, + mpl::and_ < + chrono_detail::is_evenly_divisible_by<Period2, period>, + mpl::not_ < treat_as_floating_point<Rep2> > + > + > + >::type* = 0 + ) + : rep_(chrono::detail::duration_cast<duration<Rep2, Period2>, duration>()(d).count()) {} + + // observer + + BOOST_CONSTEXPR + rep count() const {return rep_;} + + // arithmetic + + BOOST_CONSTEXPR + duration operator+() const {return duration(rep_);;} + BOOST_CONSTEXPR + duration operator-() const {return duration(-rep_);} + duration& operator++() {++rep_; return *this;} + duration operator++(int) {return duration(rep_++);} + duration& operator--() {--rep_; return *this;} + duration operator--(int) {return duration(rep_--);} + + duration& operator+=(const duration& d) + { + rep_ += d.count(); return *this; + } + duration& operator-=(const duration& d) + { + rep_ -= d.count(); return *this; + } + + duration& operator*=(const rep& rhs) {rep_ *= rhs; return *this;} + duration& operator/=(const rep& rhs) {rep_ /= rhs; return *this;} + duration& operator%=(const rep& rhs) {rep_ %= rhs; return *this;} + duration& operator%=(const duration& rhs) + { + rep_ %= rhs.count(); return *this; + } + // 20.9.3.4 duration special values [time.duration.special] + + static BOOST_CONSTEXPR duration zero() + { + return duration(duration_values<rep>::zero()); + } + static BOOST_CHRONO_LIB_CONSTEXPR duration min BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return duration((duration_values<rep>::min)()); + } + static BOOST_CHRONO_LIB_CONSTEXPR duration max BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return duration((duration_values<rep>::max)()); + } + }; + +//----------------------------------------------------------------------------// +// 20.9.3.5 duration non-member arithmetic [time.duration.nonmember] // +//----------------------------------------------------------------------------// + + // Duration + + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type + operator+(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + typedef typename common_type<duration<Rep1, Period1>, + duration<Rep2, Period2> >::type CD; + return CD(CD(lhs).count()+CD(rhs).count()); + } + + // Duration - + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type + operator-(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + typedef typename common_type<duration<Rep1, Period1>, + duration<Rep2, Period2> >::type CD; + return CD(CD(lhs).count()-CD(rhs).count()); + } + + // Duration * + + template <class Rep1, class Period, class Rep2> + inline BOOST_CONSTEXPR + typename boost::enable_if < + mpl::and_ < + boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>, + boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type> + >, + duration<typename common_type<Rep1, Rep2>::type, Period> + >::type + operator*(const duration<Rep1, Period>& d, const Rep2& s) + { + typedef typename common_type<Rep1, Rep2>::type CR; + typedef duration<CR, Period> CD; + return CD(CD(d).count()*static_cast<CR>(s)); + } + + template <class Rep1, class Period, class Rep2> + inline BOOST_CONSTEXPR + typename boost::enable_if < + mpl::and_ < + boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>, + boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type> + >, + duration<typename common_type<Rep1, Rep2>::type, Period> + >::type + operator*(const Rep1& s, const duration<Rep2, Period>& d) + { + return d * s; + } + + // Duration / + + template <class Rep1, class Period, class Rep2> + inline BOOST_CONSTEXPR + typename boost::disable_if <boost::chrono::detail::is_duration<Rep2>, + typename boost::chrono::detail::duration_divide_result< + duration<Rep1, Period>, Rep2>::type + >::type + operator/(const duration<Rep1, Period>& d, const Rep2& s) + { + typedef typename common_type<Rep1, Rep2>::type CR; + typedef duration<CR, Period> CD; + + return CD(CD(d).count()/static_cast<CR>(s)); + } + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + typename common_type<Rep1, Rep2>::type + operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs) + { + typedef typename common_type<duration<Rep1, Period1>, + duration<Rep2, Period2> >::type CD; + return CD(lhs).count() / CD(rhs).count(); + } + + #ifdef BOOST_CHRONO_EXTENSIONS + template <class Rep1, class Rep2, class Period> + inline BOOST_CONSTEXPR + typename boost::disable_if <boost::chrono::detail::is_duration<Rep1>, + typename boost::chrono::detail::duration_divide_result2< + Rep1, duration<Rep2, Period> >::type + >::type + operator/(const Rep1& s, const duration<Rep2, Period>& d) + { + typedef typename common_type<Rep1, Rep2>::type CR; + typedef duration<CR, Period> CD; + + return static_cast<CR>(s)/CD(d).count(); + } + #endif + // Duration % + + template <class Rep1, class Period, class Rep2> + inline BOOST_CONSTEXPR + typename boost::disable_if <boost::chrono::detail::is_duration<Rep2>, + typename boost::chrono::detail::duration_modulo_result< + duration<Rep1, Period>, Rep2>::type + >::type + operator%(const duration<Rep1, Period>& d, const Rep2& s) + { + typedef typename common_type<Rep1, Rep2>::type CR; + typedef duration<CR, Period> CD; + + return CD(CD(d).count()%static_cast<CR>(s)); + } + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type + operator%(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) { + typedef typename common_type<duration<Rep1, Period1>, + duration<Rep2, Period2> >::type CD; + + return CD(CD(lhs).count()%CD(rhs).count()); + } + + +//----------------------------------------------------------------------------// +// 20.9.3.6 duration comparisons [time.duration.comparisons] // +//----------------------------------------------------------------------------// + +namespace detail +{ + template <class LhsDuration, class RhsDuration> + struct duration_eq + { + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + { + typedef typename common_type<LhsDuration, RhsDuration>::type CD; + return CD(lhs).count() == CD(rhs).count(); + } + }; + + template <class LhsDuration> + struct duration_eq<LhsDuration, LhsDuration> + { + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + { + return lhs.count() == rhs.count(); + } + }; + + template <class LhsDuration, class RhsDuration> + struct duration_lt + { + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + { + typedef typename common_type<LhsDuration, RhsDuration>::type CD; + return CD(lhs).count() < CD(rhs).count(); + } + }; + + template <class LhsDuration> + struct duration_lt<LhsDuration, LhsDuration> + { + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + { + return lhs.count() < rhs.count(); + } + }; + +} // namespace detail + + // Duration == + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator==(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return boost::chrono::detail::duration_eq< + duration<Rep1, Period1>, duration<Rep2, Period2> >()(lhs, rhs); + } + + // Duration != + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator!=(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return !(lhs == rhs); + } + + // Duration < + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator< (const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return boost::chrono::detail::duration_lt< + duration<Rep1, Period1>, duration<Rep2, Period2> >()(lhs, rhs); + } + + // Duration > + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator> (const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return rhs < lhs; + } + + // Duration <= + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator<=(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return !(rhs < lhs); + } + + // Duration >= + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator>=(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return !(lhs < rhs); + } + +//----------------------------------------------------------------------------// +// 20.9.3.7 duration_cast [time.duration.cast] // +//----------------------------------------------------------------------------// + + // Compile-time select the most efficient algorithm for the conversion... + template <class ToDuration, class Rep, class Period> + inline BOOST_CONSTEXPR + typename boost::enable_if < + boost::chrono::detail::is_duration<ToDuration>, ToDuration>::type + duration_cast(const duration<Rep, Period>& fd) + { + return boost::chrono::detail::duration_cast< + duration<Rep, Period>, ToDuration>()(fd); + } + +} // namespace chrono +} // namespace boost + +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif + +#endif // BOOST_CHRONO_DURATION_HPP diff --git a/3rdParty/Boost/src/boost/chrono/system_clocks.hpp b/3rdParty/Boost/src/boost/chrono/system_clocks.hpp new file mode 100644 index 0000000..df8b79e --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/system_clocks.hpp @@ -0,0 +1,233 @@ +// boost/chrono/system_clocks.hpp --------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009-2011 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.9 Time utilities [time] of the C++ committee's working paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + +/* + +TODO: + + * Fully implement error handling, with test cases. + * Consider issues raised by Michael Marcin: + + > In the past I've seen QueryPerformanceCounter give incorrect results, + > especially with SpeedStep processors on laptops. This was many years ago and + > might have been fixed by service packs and drivers. + > + > Typically you check the results of QPC against GetTickCount to see if the + > results are reasonable. + > http://support.microsoft.com/kb/274323 + > + > I've also heard of problems with QueryPerformanceCounter in multi-processor + > systems. + > + > I know some people SetThreadAffinityMask to 1 for the current thread call + > their QueryPerformance* functions then restore SetThreadAffinityMask. This + > seems horrible to me because it forces your program to jump to another + > physical processor if it isn't already on cpu0 but they claim it worked well + > in practice because they called the timing functions infrequently. + > + > In the past I have chosen to use timeGetTime with timeBeginPeriod(1) for + > high resolution timers to avoid these issues. + +*/ + +#ifndef BOOST_CHRONO_SYSTEM_CLOCKS_HPP +#define BOOST_CHRONO_SYSTEM_CLOCKS_HPP + +#include <boost/chrono/config.hpp> +#include <boost/chrono/duration.hpp> +#include <boost/chrono/time_point.hpp> +#include <boost/chrono/detail/system.hpp> +#include <boost/chrono/clock_string.hpp> + +#include <ctime> + +# if defined( BOOST_CHRONO_POSIX_API ) +# if ! defined(CLOCK_REALTIME) +# error <time.h> does not supply CLOCK_REALTIME +# endif +# endif + +#ifdef BOOST_CHRONO_WINDOWS_API +// The system_clock tick is 100 nanoseconds +# define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::duration<boost::int_least64_t, ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10000000)> > +#else +# define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::nanoseconds +#endif + +// this must occur after all of the includes and before any code appears: +#ifndef BOOST_CHRONO_HEADER_ONLY +#include <boost/config/abi_prefix.hpp> // must be the last #include +#endif + + +//----------------------------------------------------------------------------// +// // +// 20.9 Time utilities [time] // +// synopsis // +// // +//----------------------------------------------------------------------------// + +namespace boost { +namespace chrono { + + // Clocks + class BOOST_CHRONO_DECL system_clock; +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + class BOOST_CHRONO_DECL steady_clock; +#endif + +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + typedef steady_clock high_resolution_clock; // as permitted by [time.clock.hires] +#else + typedef system_clock high_resolution_clock; // as permitted by [time.clock.hires] +#endif + +//----------------------------------------------------------------------------// +// // +// 20.9.5 Clocks [time.clock] // +// // +//----------------------------------------------------------------------------// + +// If you're porting, clocks are the system-specific (non-portable) part. +// You'll need to know how to get the current time and implement that under now(). +// You'll need to know what units (tick period) and representation makes the most +// sense for your clock and set those accordingly. +// If you know how to map this clock to time_t (perhaps your clock is std::time, which +// makes that trivial), then you can fill out system_clock's to_time_t() and from_time_t(). + +//----------------------------------------------------------------------------// +// 20.9.5.1 Class system_clock [time.clock.system] // +//----------------------------------------------------------------------------// + + class BOOST_CHRONO_DECL system_clock + { + public: + typedef BOOST_SYSTEM_CLOCK_DURATION duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point<system_clock> time_point; + BOOST_STATIC_CONSTEXPR bool is_steady = false; + + static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT; +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + static BOOST_CHRONO_INLINE time_point now(system::error_code & ec); +#endif + + static BOOST_CHRONO_INLINE std::time_t to_time_t(const time_point& t) BOOST_NOEXCEPT; + static BOOST_CHRONO_INLINE time_point from_time_t(std::time_t t) BOOST_NOEXCEPT; + }; + +//----------------------------------------------------------------------------// +// 20.9.5.2 Class steady_clock [time.clock.steady] // +//----------------------------------------------------------------------------// + +// As permitted by [time.clock.steady] +// The class steady_clock is conditionally supported. + +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + class BOOST_CHRONO_DECL steady_clock + { + public: + typedef nanoseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point<steady_clock> time_point; + BOOST_STATIC_CONSTEXPR bool is_steady = true; + + static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT; +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + static BOOST_CHRONO_INLINE time_point now(system::error_code & ec); +#endif + }; +#endif +//----------------------------------------------------------------------------// +// 20.9.5.3 Class high_resolution_clock [time.clock.hires] // +//----------------------------------------------------------------------------// + +// As permitted, steady_clock or system_clock is a typedef for high_resolution_clock. +// See synopsis. + + + template<class CharT> + struct clock_string<system_clock, CharT> + { + static std::basic_string<CharT> name() + { + static const CharT u[] = + { 's', 'y', 's', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' }; + static const std::basic_string<CharT> str(u, u + sizeof(u) + / sizeof(u[0])); + return str; + } + static std::basic_string<CharT> since() + { + static const CharT + u[] = + { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'J', 'a', 'n', ' ', '1', ',', ' ', '1', '9', '7', '0' }; + static const std::basic_string<CharT> str(u, u + sizeof(u) + / sizeof(u[0])); + return str; + } + }; + +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + + template<class CharT> + struct clock_string<steady_clock, CharT> + { + static std::basic_string<CharT> name() + { + static const CharT + u[] = + { 's', 't', 'e', 'a', 'd', 'y', '_', 'c', 'l', 'o', 'c', 'k' }; + static const std::basic_string<CharT> str(u, u + sizeof(u) + / sizeof(u[0])); + return str; + } + static std::basic_string<CharT> since() + { + const CharT u[] = + { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'b', 'o', 'o', 't' }; + const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0])); + return str; + } + }; + +#endif + +} // namespace chrono +} // namespace boost + +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#else +#include <boost/chrono/detail/inlined/chrono.hpp> +#endif + +#endif // BOOST_CHRONO_SYSTEM_CLOCKS_HPP diff --git a/3rdParty/Boost/src/boost/chrono/time_point.hpp b/3rdParty/Boost/src/boost/chrono/time_point.hpp new file mode 100644 index 0000000..7e80b59 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/time_point.hpp @@ -0,0 +1,379 @@ +// duration.hpp --------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009-2012 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.9 Time utilities [time] of the C++ committee's working paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + + +#ifndef BOOST_CHRONO_TIME_POINT_HPP +#define BOOST_CHRONO_TIME_POINT_HPP + +#include <boost/chrono/duration.hpp> +#include <iostream> + +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include <boost/config/abi_prefix.hpp> // must be the last #include +#endif + +//----------------------------------------------------------------------------// +// // +// 20.9 Time utilities [time] // +// synopsis // +// // +//----------------------------------------------------------------------------// + +namespace boost { +namespace chrono { + + template <class Clock, class Duration = typename Clock::duration> + class time_point; + + +} // namespace chrono + + +// common_type trait specializations + +template <class Clock, class Duration1, class Duration2> + struct common_type<chrono::time_point<Clock, Duration1>, + chrono::time_point<Clock, Duration2> >; + + +//----------------------------------------------------------------------------// +// 20.9.2.3 Specializations of common_type [time.traits.specializations] // +//----------------------------------------------------------------------------// + + +template <class Clock, class Duration1, class Duration2> +struct common_type<chrono::time_point<Clock, Duration1>, + chrono::time_point<Clock, Duration2> > +{ + typedef chrono::time_point<Clock, + typename common_type<Duration1, Duration2>::type> type; +}; + + + +namespace chrono { + + // time_point arithmetic + template <class Clock, class Duration1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<Duration1, duration<Rep2, Period2> >::type> + operator+( + const time_point<Clock, Duration1>& lhs, + const duration<Rep2, Period2>& rhs); + template <class Rep1, class Period1, class Clock, class Duration2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<duration<Rep1, Period1>, Duration2>::type> + operator+( + const duration<Rep1, Period1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<Duration1, duration<Rep2, Period2> >::type> + operator-( + const time_point<Clock, Duration1>& lhs, + const duration<Rep2, Period2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + typename common_type<Duration1, Duration2>::type + operator-( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, + Duration2>& rhs); + + // time_point comparisons + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator==( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator!=( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator< ( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator<=( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator> ( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator>=( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + + // time_point_cast + template <class ToDuration, class Clock, class Duration> + inline BOOST_CONSTEXPR + time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t); + +//----------------------------------------------------------------------------// +// // +// 20.9.4 Class template time_point [time.point] // +// // +//----------------------------------------------------------------------------// + + template <class Clock, class Duration> + class time_point + { + BOOST_CHRONO_STATIC_ASSERT(boost::chrono::detail::is_duration<Duration>::value, + BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_TIME_POINT_MUST_BE_A_BOOST_CHRONO_DURATION, (Duration)); + public: + typedef Clock clock; + typedef Duration duration; + typedef typename duration::rep rep; + typedef typename duration::period period; + typedef Duration difference_type; + + private: + duration d_; + + public: + BOOST_CONSTEXPR + time_point() : d_(duration::zero()) + {} + BOOST_CONSTEXPR explicit time_point(const duration& d) + : d_(d) + {} + + // conversions + template <class Duration2> + BOOST_CONSTEXPR + time_point(const time_point<clock, Duration2>& t + , typename boost::enable_if + < + boost::is_convertible<Duration2, duration> + >::type* = 0 + ) + : d_(t.time_since_epoch()) + { + } + // observer + + BOOST_CONSTEXPR + duration time_since_epoch() const + { + return d_; + } + + // arithmetic + +#ifdef BOOST_CHRONO_EXTENSIONS + BOOST_CONSTEXPR + time_point operator+() const {return *this;} + BOOST_CONSTEXPR + time_point operator-() const {return time_point(-d_);} + time_point& operator++() {++d_; return *this;} + time_point operator++(int) {return time_point(d_++);} + time_point& operator--() {--d_; return *this;} + time_point operator--(int) {return time_point(d_--);} + + time_point& operator+=(const rep& r) {d_ += duration(r); return *this;} + time_point& operator-=(const rep& r) {d_ -= duration(r); return *this;} + +#endif + + time_point& operator+=(const duration& d) {d_ += d; return *this;} + time_point& operator-=(const duration& d) {d_ -= d; return *this;} + + // special values + + static BOOST_CHRONO_LIB_CONSTEXPR time_point + min BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return time_point((duration::min)()); + } + static BOOST_CHRONO_LIB_CONSTEXPR time_point + max BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return time_point((duration::max)()); + } + }; + +//----------------------------------------------------------------------------// +// 20.9.4.5 time_point non-member arithmetic [time.point.nonmember] // +//----------------------------------------------------------------------------// + + // time_point operator+(time_point x, duration y); + + template <class Clock, class Duration1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<Duration1, duration<Rep2, Period2> >::type> + operator+(const time_point<Clock, Duration1>& lhs, + const duration<Rep2, Period2>& rhs) + { + typedef typename common_type<Duration1, duration<Rep2, Period2> >::type CDuration; + typedef time_point< + Clock, + CDuration + > TimeResult; + return TimeResult(lhs.time_since_epoch() + CDuration(rhs)); + } + + // time_point operator+(duration x, time_point y); + + template <class Rep1, class Period1, class Clock, class Duration2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<duration<Rep1, Period1>, Duration2>::type> + operator+(const duration<Rep1, Period1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return rhs + lhs; + } + + // time_point operator-(time_point x, duration y); + + template <class Clock, class Duration1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<Duration1, duration<Rep2, Period2> >::type> + operator-(const time_point<Clock, Duration1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return lhs + (-rhs); + } + + // duration operator-(time_point x, time_point y); + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + typename common_type<Duration1, Duration2>::type + operator-(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return lhs.time_since_epoch() - rhs.time_since_epoch(); + } + +//----------------------------------------------------------------------------// +// 20.9.4.6 time_point comparisons [time.point.comparisons] // +//----------------------------------------------------------------------------// + + // time_point == + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator==(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return lhs.time_since_epoch() == rhs.time_since_epoch(); + } + + // time_point != + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator!=(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return !(lhs == rhs); + } + + // time_point < + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator<(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return lhs.time_since_epoch() < rhs.time_since_epoch(); + } + + // time_point > + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator>(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return rhs < lhs; + } + + // time_point <= + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator<=(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return !(rhs < lhs); + } + + // time_point >= + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator>=(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return !(lhs < rhs); + } + +//----------------------------------------------------------------------------// +// 20.9.4.7 time_point_cast [time.point.cast] // +//----------------------------------------------------------------------------// + + template <class ToDuration, class Clock, class Duration> + inline BOOST_CONSTEXPR + time_point<Clock, ToDuration> + time_point_cast(const time_point<Clock, Duration>& t) + { + return time_point<Clock, ToDuration>( + duration_cast<ToDuration>(t.time_since_epoch())); + } + +} // namespace chrono +} // namespace boost + +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif + +#endif // BOOST_CHRONO_TIME_POINT_HPP diff --git a/3rdParty/Boost/src/boost/compressed_pair.hpp b/3rdParty/Boost/src/boost/compressed_pair.hpp deleted file mode 100644 index e6cd6a0..0000000 --- a/3rdParty/Boost/src/boost/compressed_pair.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to 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). -// -// See http://www.boost.org/libs/utility for most recent version including documentation. - -// See boost/detail/compressed_pair.hpp and boost/detail/ob_compressed_pair.hpp -// for full copyright notices. - -#ifndef BOOST_COMPRESSED_PAIR_HPP -#define BOOST_COMPRESSED_PAIR_HPP - -#ifndef BOOST_CONFIG_HPP -#include <boost/config.hpp> -#endif - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#include <boost/detail/ob_compressed_pair.hpp> -#else -#include <boost/detail/compressed_pair.hpp> -#endif - -#endif // BOOST_COMPRESSED_PAIR_HPP diff --git a/3rdParty/Boost/src/boost/concept/detail/backward_compatibility.hpp b/3rdParty/Boost/src/boost/concept/detail/backward_compatibility.hpp index 88d5921..66d573e 100644 --- a/3rdParty/Boost/src/boost/concept/detail/backward_compatibility.hpp +++ b/3rdParty/Boost/src/boost/concept/detail/backward_compatibility.hpp @@ -8,7 +8,7 @@ namespace boost { namespace concepts {} -# if !defined(BOOST_NO_CONCEPTS) && !defined(BOOST_CONCEPT_NO_BACKWARD_KEYWORD) +# if defined(BOOST_HAS_CONCEPTS) && !defined(BOOST_CONCEPT_NO_BACKWARD_KEYWORD) namespace concept = concepts; # endif } // namespace boost::concept diff --git a/3rdParty/Boost/src/boost/concept_check.hpp b/3rdParty/Boost/src/boost/concept_check.hpp index 01b2f4e..bf5a2af 100644 --- a/3rdParty/Boost/src/boost/concept_check.hpp +++ b/3rdParty/Boost/src/boost/concept_check.hpp @@ -1052,11 +1052,11 @@ namespace boost c.swap(c); } - void const_constraints(const C& c) { - ci = c.begin(); - ci = c.end(); - n = c.size(); - b = c.empty(); + void const_constraints(const C& cc) { + ci = cc.begin(); + ci = cc.end(); + n = cc.size(); + b = cc.empty(); } private: diff --git a/3rdParty/Boost/src/boost/config.hpp b/3rdParty/Boost/src/boost/config.hpp index 055a278..f37585e 100644 --- a/3rdParty/Boost/src/boost/config.hpp +++ b/3rdParty/Boost/src/boost/config.hpp @@ -36,7 +36,7 @@ #endif // if we don't have a std library config set, try and find one: -#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) +#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) && defined(__cplusplus) # include <boost/config/select_stdlib_config.hpp> #endif // if we have a std library config, include it now: diff --git a/3rdParty/Boost/src/boost/config/auto_link.hpp b/3rdParty/Boost/src/boost/config/auto_link.hpp index f5a0a00..ad021f4 100644 --- a/3rdParty/Boost/src/boost/config/auto_link.hpp +++ b/3rdParty/Boost/src/boost/config/auto_link.hpp @@ -145,11 +145,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // vc90: # define BOOST_LIB_TOOLSET "vc90" -#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1600) +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1600) // vc10: # define BOOST_LIB_TOOLSET "vc100" +#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1700) + + // vc11: +# define BOOST_LIB_TOOLSET "vc110" + #elif defined(__BORLANDC__) // CBuilder 6: @@ -364,7 +369,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. #ifdef BOOST_AUTO_LINK_TAGGED # pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib") # ifdef BOOST_LIB_DIAGNOSTIC -# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib") # endif #elif defined(BOOST_AUTO_LINK_NOMANGLE) # pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") diff --git a/3rdParty/Boost/src/boost/config/compiler/borland.hpp b/3rdParty/Boost/src/boost/config/compiler/borland.hpp index a989fd6..cffa8ea 100644 --- a/3rdParty/Boost/src/boost/config/compiler/borland.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/borland.hpp @@ -47,7 +47,7 @@ # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif // Variadic macros do not exist for C++ Builder versions 5 and below -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_MACROS # endif // Version 5.51 and below: @@ -56,8 +56,13 @@ # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_DEDUCED_TYPENAME // workaround for missing WCHAR_MAX/WCHAR_MIN: +#ifdef __cplusplus #include <climits> #include <cwchar> +#else +#include <limits.h> +#include <wchar.h> +#endif // __cplusplus #ifndef WCHAR_MAX # define WCHAR_MAX 0xffff #endif @@ -69,7 +74,7 @@ // Borland C++ Builder 6 and below: #if (__BORLANDC__ <= 0x564) -# ifdef NDEBUG +# if defined(NDEBUG) && defined(__cplusplus) // fix broken <cstring> so that Boost.test works: # include <cstring> # undef strcmp @@ -145,14 +150,14 @@ // C++0x Macros: // #if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610) -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DECLTYPE -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_EXTERN_TEMPLATE -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_SCOPED_ENUMS +# define BOOST_NO_CXX11_STATIC_ASSERT #else # define BOOST_HAS_ALIGNOF # define BOOST_HAS_CHAR16_T @@ -164,23 +169,27 @@ # define BOOST_HAS_STATIC_ASSERT #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS // UTF-8 still not supported +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH @@ -275,3 +284,4 @@ + diff --git a/3rdParty/Boost/src/boost/config/compiler/clang.hpp b/3rdParty/Boost/src/boost/config/compiler/clang.hpp index 0893033..aab3c61 100644 --- a/3rdParty/Boost/src/boost/config/compiler/clang.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/clang.hpp @@ -8,15 +8,18 @@ // Clang compiler setup. -#if __has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) -#else +#if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif -#if !__has_feature(cxx_rtti) +#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif +#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID) +# define BOOST_NO_TYPEID +#endif + #if defined(__int64) # define BOOST_HAS_MS_INT64 #endif @@ -24,52 +27,100 @@ #define BOOST_HAS_NRVO // Clang supports "long long" in all compilation modes. +#define BOOST_HAS_LONG_LONG + +#if !__has_feature(cxx_auto_type) +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR +#if !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +#endif + +#if !__has_feature(cxx_constexpr) +# define BOOST_NO_CXX11_CONSTEXPR +#endif #if !__has_feature(cxx_decltype) -# define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE #endif -#define BOOST_NO_DEFAULTED_FUNCTIONS +#if !__has_feature(cxx_decltype_incomplete_return_types) +# define BOOST_NO_CXX11_DECLTYPE_N3276 +#endif + +#if !__has_feature(cxx_defaulted_functions) +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#endif #if !__has_feature(cxx_deleted_functions) -# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS #endif -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#if !__has_feature(cxx_explicit_conversions) +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#endif #if !__has_feature(cxx_default_function_template_args) - #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS #endif -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS +#if !__has_feature(cxx_generalized_initializers) +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#endif + +#if !__has_feature(cxx_lambdas) +# define BOOST_NO_CXX11_LAMBDAS +#endif + +#if !__has_feature(cxx_local_type_template_args) +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#endif + +#if !__has_feature(cxx_noexcept) +# define BOOST_NO_CXX11_NOEXCEPT +#endif + +#if !__has_feature(cxx_nullptr) +# define BOOST_NO_CXX11_NULLPTR +#endif + +#if !__has_feature(cxx_range_for) +# define BOOST_NO_CXX11_RANGE_BASED_FOR +#endif + +#if !__has_feature(cxx_raw_string_literals) +# define BOOST_NO_CXX11_RAW_LITERALS +#endif + +#if !__has_feature(cxx_generalized_initializers) +# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#endif #if !__has_feature(cxx_rvalue_references) -# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES #endif #if !__has_feature(cxx_strong_enums) -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif #if !__has_feature(cxx_static_assert) -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_STATIC_ASSERT #endif -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS +#if !__has_feature(cxx_alias_templates) +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +#endif + +#if !__has_feature(cxx_unicode_literals) +# define BOOST_NO_CXX11_UNICODE_LITERALS +#endif #if !__has_feature(cxx_variadic_templates) -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif // Clang always supports variadic macros diff --git a/3rdParty/Boost/src/boost/config/compiler/codegear.hpp b/3rdParty/Boost/src/boost/config/compiler/codegear.hpp index f6dc4c0..1a6df33 100644 --- a/3rdParty/Boost/src/boost/config/compiler/codegear.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/codegear.hpp @@ -60,7 +60,7 @@ // (Niels Dekker, LKEB, April 2010) # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -# ifdef NDEBUG +# if defined(NDEBUG) && defined(__cplusplus) // fix broken <cstring> so that Boost.test works: # include <cstring> # undef strcmp @@ -76,7 +76,7 @@ // C++0x macros: // #if (__CODEGEARC__ <= 0x620) -#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_CXX11_STATIC_ASSERT #else #define BOOST_HAS_STATIC_ASSERT #endif @@ -91,23 +91,25 @@ // #define BOOST_HAS_STATIC_ASSERT #define BOOST_HAS_STD_TYPE_TRAITS -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // TR1 macros: @@ -119,7 +121,7 @@ #define BOOST_HAS_MACRO_USE_FACET -#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST // On non-Win32 platforms let the platform config figure this out: #ifdef _WIN32 diff --git a/3rdParty/Boost/src/boost/config/compiler/common_edg.hpp b/3rdParty/Boost/src/boost/config/compiler/common_edg.hpp index 9042578..441a055 100644 --- a/3rdParty/Boost/src/boost/config/compiler/common_edg.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/common_edg.hpp @@ -60,37 +60,41 @@ // See above for BOOST_NO_LONG_LONG // #if (__EDG_VERSION__ < 310) -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if (__EDG_VERSION__ <= 310) // No support for initializer lists -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #if (__EDG_VERSION__ < 400) -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #ifdef c_plusplus // EDG has "long long" in non-strict mode diff --git a/3rdParty/Boost/src/boost/config/compiler/cray.hpp b/3rdParty/Boost/src/boost/config/compiler/cray.hpp new file mode 100644 index 0000000..5463ea0 --- /dev/null +++ b/3rdParty/Boost/src/boost/config/compiler/cray.hpp @@ -0,0 +1,63 @@ +// (C) Copyright John Maddock 2011. +// Use, modification and distribution are subject to 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) + +// See http://www.boost.org for most recent version. + +// Greenhills C compiler setup: + +#define BOOST_COMPILER "Cray C version " BOOST_STRINGIZE(_RELEASE) + +#if _RELEASE < 7 +# error "Boost is not configured for Cray compilers prior to version 7, please try the configure script." +#endif + +// +// Check this is a recent EDG based compiler, otherwise we don't support it here: +// +#ifndef __EDG_VERSION__ +# error "Unsupported Cray compiler, please try running the configure script." +#endif + +#include "boost/config/compiler/common_edg.hpp" + +// +// Cray peculiarities, probably version 7 specific: +// +#undef BOOST_NO_CXX11_AUTO_DECLARATIONS +#undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_HAS_NRVO +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_HAS_NRVO +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SCOPED_ENUMS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CHAR16_T +//#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG +#define BOOST_MATH_DISABLE_STD_FPCLASSIFY +//#define BOOST_HAS_FPCLASSIFY + +#define BOOST_SP_USE_PTHREADS +#define BOOST_AC_USE_PTHREADS + diff --git a/3rdParty/Boost/src/boost/config/compiler/digitalmars.hpp b/3rdParty/Boost/src/boost/config/compiler/digitalmars.hpp index 31c11bf..15cc209 100644 --- a/3rdParty/Boost/src/boost/config/compiler/digitalmars.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/digitalmars.hpp @@ -44,7 +44,9 @@ // // Is this really the best way to detect whether the std lib is in namespace std? // +#ifdef __cplusplus #include <cstddef> +#endif #if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD) # define BOOST_NO_STDC_NAMESPACE #endif @@ -58,30 +60,35 @@ // // C++0x features // -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + #if (__DMC__ < 0x812) -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if __DMC__ < 0x800 diff --git a/3rdParty/Boost/src/boost/config/compiler/gcc.hpp b/3rdParty/Boost/src/boost/config/compiler/gcc.hpp index f633647..de8875c 100644 --- a/3rdParty/Boost/src/boost/config/compiler/gcc.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/gcc.hpp @@ -42,9 +42,9 @@ # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for gcc versions before 3.0 -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP @@ -61,7 +61,7 @@ # if __GNUC_MINOR__ < 4 # define BOOST_NO_IS_ABSTRACT # endif -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if __GNUC__ < 4 // @@ -146,9 +146,6 @@ # endif #endif -// C++0x features not implemented in any GCC version -// -#define BOOST_NO_TEMPLATE_ALIASES // C++0x features in 4.3.n and later // @@ -161,59 +158,73 @@ # define BOOST_HAS_STATIC_ASSERT # define BOOST_HAS_VARIADIC_TMPL #else -# define BOOST_NO_DECLTYPE -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT // Variadic templates compiler: // http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html -# ifdef __VARIADIC_TEMPLATES +# if defined(__VARIADIC_TEMPLATES) || (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)) # define BOOST_HAS_VARIADIC_TMPL # else -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES # endif #endif // C++0x features in 4.4.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS #endif -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) # define BOOST_NO_SFINAE_EXPR #endif -// C++0x features in 4.4.1 and later +// C++0x features in 4.5.0 and later // -#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40401) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.4.1 -// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 -# define BOOST_NO_SCOPED_ENUMS +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS #endif -// C++0x features in 4.5.n and later +// C++0x features in 4.5.1 and later // -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_LAMBDAS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS +#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40501) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1 +// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif -// C++0x features in 4.5.n and later +// C++0x features in 4.6.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_NULLPTR +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#endif + +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +#endif +// C++0x features not supported at all yet +// +#define BOOST_NO_CXX11_DECLTYPE_N3276 + +#ifndef BOOST_COMPILER +# define BOOST_COMPILER "GNU C++ version " __VERSION__ #endif // ConceptGCC compiler: @@ -221,15 +232,8 @@ #ifdef __GXX_CONCEPTS__ # define BOOST_HAS_CONCEPTS # define BOOST_COMPILER "ConceptGCC version " __VERSION__ -#else -# define BOOST_NO_CONCEPTS #endif -#ifndef BOOST_COMPILER -# define BOOST_COMPILER "GNU C++ version " __VERSION__ -#endif - -// // versions check: // we don't know gcc prior to version 2.90: #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90) diff --git a/3rdParty/Boost/src/boost/config/compiler/gcc_xml.hpp b/3rdParty/Boost/src/boost/config/compiler/gcc_xml.hpp index a456463..eaed4b5 100644 --- a/3rdParty/Boost/src/boost/config/compiler/gcc_xml.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/gcc_xml.hpp @@ -27,29 +27,33 @@ // C++0x features: // -# define BOOST_NO_CONSTEXPR -# define BOOST_NO_NULLPTR -# define BOOST_NO_TEMPLATE_ALIASES -# define BOOST_NO_DECLTYPE -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_STATIC_ASSERT -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_VARIADIC_MACROS -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_CONSTEXPR +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE_N3276 +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_SCOPED_ENUMS # define BOOST_NO_SFINAE_EXPR -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_LAMBDAS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS +# define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ diff --git a/3rdParty/Boost/src/boost/config/compiler/hp_acc.hpp b/3rdParty/Boost/src/boost/config/compiler/hp_acc.hpp index d0b672e..4f5f81b 100644 --- a/3rdParty/Boost/src/boost/config/compiler/hp_acc.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/hp_acc.hpp @@ -92,29 +92,32 @@ // #if !defined(__EDG__) -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES /* See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and @@ -122,7 +125,7 @@ */ #if (__HP_aCC < 62500) || !defined(HP_CXX0x_SOURCE) - #define BOOST_NO_VARIADIC_MACROS + #define BOOST_NO_CXX11_VARIADIC_MACROS #endif #endif diff --git a/3rdParty/Boost/src/boost/config/compiler/intel.hpp b/3rdParty/Boost/src/boost/config/compiler/intel.hpp index f209ae7..8c746c1 100644 --- a/3rdParty/Boost/src/boost/config/compiler/intel.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/intel.hpp @@ -27,7 +27,7 @@ #endif // Flags determined by comparing output of 'icpc -dM -E' with and without '-std=c++0x' -#if (!(defined(_WIN32) || defined(_WIN64)) && defined(__STDC_HOSTED__) && __STDC_HOSTED__) || defined(__GXX_EXPERIMENTAL_CPP0X__) +#if (!(defined(_WIN32) || defined(_WIN64)) && defined(__STDC_HOSTED__) && (__STDC_HOSTED__ && (BOOST_INTEL_CXX_VERSION <= 1200))) || defined(__GXX_EXPERIMENTAL_CPP0X__) # define BOOST_INTEL_STDCXX0X #endif #if defined(_MSC_VER) && (_MSC_VER >= 1600) @@ -121,6 +121,7 @@ // in type_traits code among other things, getting this correct // for the Intel compiler is actually remarkably fragile and tricky: // +#ifdef __cplusplus #if defined(BOOST_NO_INTRINSIC_WCHAR_T) #include <cwchar> template< typename T > struct assert_no_intrinsic_wchar_t; @@ -134,8 +135,9 @@ template<> struct assert_intrinsic_wchar_t<wchar_t> {}; // if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line: template<> struct assert_intrinsic_wchar_t<unsigned short> {}; #endif +#endif -#if _MSC_VER+0 >= 1000 +#if defined(_MSC_VER) && (_MSC_VER+0 >= 1000) # if _MSC_VER >= 1200 # define BOOST_HAS_MS_INT64 # endif @@ -177,8 +179,9 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {}; // intel-vc9-win-11.1 may leave a non-POD array uninitialized, in some // cases when it should be value-initialized. // (Niels Dekker, LKEB, May 2010) +// Apparently Intel 12.1 (compiler version number 9999 !!) has the same issue (compiler regression). #if defined(__INTEL_COMPILER) -# if __INTEL_COMPILER <= 1110 +# if (__INTEL_COMPILER <= 1110) || (__INTEL_COMPILER == 9999) # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION # endif #endif @@ -196,31 +199,66 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {}; // - ICC added static_assert in 11.0 (first version with C++0x support) // #if defined(BOOST_INTEL_STDCXX0X) -# undef BOOST_NO_STATIC_ASSERT +# undef BOOST_NO_CXX11_STATIC_ASSERT // // These pass our test cases, but aren't officially supported according to: // http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ // -//# undef BOOST_NO_LAMBDAS -//# undef BOOST_NO_DECLTYPE -//# undef BOOST_NO_AUTO_DECLARATIONS -//# undef BOOST_NO_AUTO_MULTIDECLARATIONS +//# undef BOOST_NO_CXX11_LAMBDAS +//# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +//# undef BOOST_NO_CXX11_DECLTYPE +//# undef BOOST_NO_CXX11_AUTO_DECLARATIONS +//# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION >= 1200) -# undef BOOST_NO_RVALUE_REFERENCES -# undef BOOST_NO_SCOPED_ENUMS -# undef BOOST_NO_DELETED_FUNCTIONS -# undef BOOST_NO_DEFAULTED_FUNCTIONS -# undef BOOST_NO_LAMBDAS -# undef BOOST_NO_DECLTYPE -# undef BOOST_NO_AUTO_DECLARATIONS -# undef BOOST_NO_AUTO_MULTIDECLARATIONS +//# undef BOOST_NO_CXX11_RVALUE_REFERENCES // Enabling this breaks Filesystem and Exception libraries +//# undef BOOST_NO_CXX11_SCOPED_ENUMS // doesn't really work!! +# undef BOOST_NO_CXX11_DELETED_FUNCTIONS +# undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# undef BOOST_NO_CXX11_LAMBDAS +# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# undef BOOST_NO_CXX11_DECLTYPE +# undef BOOST_NO_CXX11_AUTO_DECLARATIONS +# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#endif + +// icl Version 12.1.0.233 Build 20110811 and possibly some other builds +// had an incorrect __INTEL_COMPILER value of 9999. Intel say this has been fixed. +#if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION > 1200) +# undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# undef BOOST_NO_CXX11_NULLPTR +# undef BOOST_NO_CXX11_RVALUE_REFERENCES +# undef BOOST_NO_SFINAE_EXPR +# undef BOOST_NO_CXX11_TEMPLATE_ALIASES +# undef BOOST_NO_CXX11_VARIADIC_TEMPLATES + +// http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ +// continues to list scoped enum support as "Partial" +//# undef BOOST_NO_CXX11_SCOPED_ENUMS +#endif + +#if defined(_MSC_VER) && (_MSC_VER <= 1700) +// +// Although the Intel compiler is capable of supporting these, it appears not to in MSVC compatibility mode: +// +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +#endif + +#if (BOOST_INTEL_CXX_VERSION < 1200) +// +// fenv.h appears not to work with Intel prior to 12.0: +// +# define BOOST_NO_FENV_H #endif // // last known and checked version: -#if (BOOST_INTEL_CXX_VERSION > 1110) +#if (BOOST_INTEL_CXX_VERSION > 1200) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) diff --git a/3rdParty/Boost/src/boost/config/compiler/metrowerks.hpp b/3rdParty/Boost/src/boost/config/compiler/metrowerks.hpp index 21083b7..184cb71 100644 --- a/3rdParty/Boost/src/boost/config/compiler/metrowerks.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/metrowerks.hpp @@ -90,31 +90,35 @@ #if __MWERKS__ > 0x3206 && __option(rvalue_refs) # define BOOST_HAS_RVALUE_REFS #else -# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/3rdParty/Boost/src/boost/config/compiler/mpw.hpp b/3rdParty/Boost/src/boost/config/compiler/mpw.hpp index ae12f80..14adee0 100644 --- a/3rdParty/Boost/src/boost/config/compiler/mpw.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/mpw.hpp @@ -40,30 +40,34 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // versions check: diff --git a/3rdParty/Boost/src/boost/config/compiler/pathscale.hpp b/3rdParty/Boost/src/boost/config/compiler/pathscale.hpp index 13ede88..3041126 100644 --- a/3rdParty/Boost/src/boost/config/compiler/pathscale.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/pathscale.hpp @@ -32,51 +32,49 @@ # define BOOST_HAS_EXPM1 # define BOOST_HAS_DIRENT_H # define BOOST_HAS_CLOCK_GETTIME -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_UNICODE_LITERALS -# define BOOST_NO_TEMPLATE_ALIASES -# define BOOST_NO_STD_UNORDERED -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_UNICODE_LITERALS +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_NO_SFINAE_EXPR -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_NULLPTR -# define BOOST_NO_NUMERIC_LIMITS_LOWEST -# define BOOST_NO_LAMBDAS -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_SCOPED_ENUMS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_NOEXCEPT +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS # define BOOST_NO_MS_INT64_NUMERIC_LIMITS -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DECLTYPE -# define BOOST_NO_CONSTEXPR -# define BOOST_NO_CONCEPTS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE_N3276 +# define BOOST_NO_CXX11_CONSTEXPR # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -# define BOOST_NO_CHAR32_T -# define BOOST_NO_CHAR16_T -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CHRONO #endif diff --git a/3rdParty/Boost/src/boost/config/compiler/pgi.hpp b/3rdParty/Boost/src/boost/config/compiler/pgi.hpp index fb3a6c0..fa32fef 100644 --- a/3rdParty/Boost/src/boost/config/compiler/pgi.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/pgi.hpp @@ -1,6 +1,6 @@ // (C) Copyright Noel Belcourt 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// Use, modification and distribution are subject to 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) // See http://www.boost.org for most recent version. @@ -8,7 +8,7 @@ // PGI C++ compiler setup: #define BOOST_COMPILER_VERSION __PGIC__##__PGIC_MINOR__ -#define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) +#define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // Threading support: @@ -16,13 +16,29 @@ // if no threading API is detected. // -// PGI 10.x doesn't seem to define __PGIC__ - -// versions earlier than 10.x do define __PGIC__ -#if __PGIC__ >= 10 +#if __PGIC__ >= 11 // options requested by configure --enable-test #define BOOST_HAS_PTHREADS +#define BOOST_HAS_THREADS +#define BOOST_HAS_PTHREAD_YIELD +#define BOOST_HAS_NRVO +#define BOOST_HAS_LONG_LONG + +// options --enable-test wants undefined +#undef BOOST_NO_STDC_NAMESPACE +#undef BOOST_NO_EXCEPTION_STD_NAMESPACE +#undef BOOST_DEDUCED_TYPENAME + +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS + +#elif __PGIC__ >= 10 + +// options requested by configure --enable-test +#define BOOST_HAS_THREADS #define BOOST_HAS_NRVO #define BOOST_HAS_LONG_LONG @@ -33,11 +49,11 @@ #elif __PGIC__ >= 7 -#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_SWPRINTF -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS #else @@ -49,28 +65,52 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NUMERIC_LIMITS +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_SWPRINTF +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#define BOOST_NO_CXX11_HDR_UNORDERED_SET +#define BOOST_NO_CXX11_HDR_UNORDERED_MAP +#define BOOST_NO_CXX11_HDR_TYPEINDEX +#define BOOST_NO_CXX11_HDR_TYPE_TRAITS +#define BOOST_NO_CXX11_HDR_TUPLE +#define BOOST_NO_CXX11_HDR_THREAD +#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +#define BOOST_NO_CXX11_HDR_REGEX +#define BOOST_NO_CXX11_HDR_RATIO +#define BOOST_NO_CXX11_HDR_RANDOM +#define BOOST_NO_CXX11_HDR_MUTEX +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_HDR_FUTURE +#define BOOST_NO_CXX11_HDR_FORWARD_LIST +#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +#define BOOST_NO_CXX11_HDR_CODECVT +#define BOOST_NO_CXX11_HDR_CHRONO +#define BOOST_NO_CXX11_HDR_ARRAY // // version check: diff --git a/3rdParty/Boost/src/boost/config/compiler/sunpro_cc.hpp b/3rdParty/Boost/src/boost/config/compiler/sunpro_cc.hpp index 85fa462..65beb50 100644 --- a/3rdParty/Boost/src/boost/config/compiler/sunpro_cc.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/sunpro_cc.hpp @@ -99,30 +99,34 @@ // # define BOOST_HAS_LONG_LONG -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // Version diff --git a/3rdParty/Boost/src/boost/config/compiler/vacpp.hpp b/3rdParty/Boost/src/boost/config/compiler/vacpp.hpp index 7ad616e..2410d5a 100644 --- a/3rdParty/Boost/src/boost/config/compiler/vacpp.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/vacpp.hpp @@ -71,47 +71,59 @@ // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #if ! __IBMCPP_AUTO_TYPEDEDUCTION -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if ! __IBMCPP_UTF_LITERAL__ -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +#endif +#if ! __IBMCPP_CONSTEXPR +# define BOOST_NO_CXX11_CONSTEXPR #endif -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR #if ! __IBMCPP_DECLTYPE -# define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE #else # define BOOST_HAS_DECLTYPE #endif -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#if ! __IBMCPP_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#endif #if ! __IBMCPP_EXTERN_TEMPLATE -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if ! __IBMCPP_VARIADIC_TEMPLATES // not enabled separately at this time -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#endif -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#endif +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#if ! __IBMCPP_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES +#endif +#if ! __IBMCPP_SCOPED_ENUM +# define BOOST_NO_CXX11_SCOPED_ENUMS +#endif #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if ! __IBMCPP_STATIC_ASSERT -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_STATIC_ASSERT #endif -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS #if ! __IBMCPP_VARIADIC_TEMPLATES -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif #if ! __C99_MACRO_WITH_VA_ARGS -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif diff --git a/3rdParty/Boost/src/boost/config/compiler/visualc.hpp b/3rdParty/Boost/src/boost/config/compiler/visualc.hpp index 3878936..0b11faa 100644 --- a/3rdParty/Boost/src/boost/config/compiler/visualc.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/visualc.hpp @@ -9,38 +9,54 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. - +// // Microsoft Visual C++ compiler setup: +// +// We need to be careful with the checks in this file, as contrary +// to popular belief there are versions with _MSC_VER with the final +// digit non-zero (mainly the MIPS cross compiler). +// +// So we either test _MSC_VER >= XXXX or else _MSC_VER < XXXX. +// No other comparisons (==, >, or <=) are safe. +// #define BOOST_MSVC _MSC_VER +// +// Helper macro BOOST_MSVC_FULL_VER for use in Boost code: +// #if _MSC_FULL_VER > 100000000 # define BOOST_MSVC_FULL_VER _MSC_FULL_VER #else # define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10) #endif -// turn off the warnings before we #include anything +// Attempt to suppress VC6 warnings about the length of decorated names (obsolete): #pragma warning( disable : 4503 ) // warning: decorated name length exceeded +// +// versions check: +// we don't support Visual C++ prior to version 6: +#if _MSC_VER < 1200 +# error "Compiler not supported or configured - please reconfigure" +#endif + #if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4 # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE -# if BOOST_MSVC == 1202 +# if _MSC_VER == 1202 # define BOOST_NO_STD_TYPEINFO # endif - // disable min/max macro defines on vc6: - // #endif /// Visual Studio has no fenv.h #define BOOST_NO_FENV_H -#if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 +#if (_MSC_VER < 1310) // 130X == VC++ 7.0 # if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS @@ -72,7 +88,7 @@ # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? -# if (_MSC_VER > 1200) +# if (_MSC_VER >= 1300) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif @@ -83,9 +99,9 @@ // it appears not to actually work: # define BOOST_NO_SWPRINTF // Our extern template tests also fail for this compiler: -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for VC7.1 and lower -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if defined(UNDER_CE) @@ -93,17 +109,16 @@ # define BOOST_NO_SWPRINTF #endif -#if _MSC_VER <= 1400 // 1400 == VC++ 8.0 +#if _MSC_VER < 1500 // 140X == VC++ 8.0 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif -#if _MSC_VER == 1500 // 1500 == VC++ 9.0 +#if _MSC_VER < 1600 // 150X == VC++ 9.0 // A bug in VC9: # define BOOST_NO_ADL_BARRIER #endif -#if (_MSC_VER <= 1600) // MSVC (including the latest checked version) has not yet completely // implemented value-initialization, as is reported: // "VC++ does not value-initialize members of derived classes without @@ -117,11 +132,10 @@ // https://connect.microsoft.com/VisualStudio/feedback/details/100744 // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues // (Niels Dekker, LKEB, May 2010) -#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#endif +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 -# define BOOST_NO_INITIALIZER_LISTS +#if _MSC_VER < 1600 || !defined(BOOST_STRICT_CONFIG) // 150X == VC++ 9.0 +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #ifndef _NATIVE_WCHAR_T_DEFINED @@ -129,11 +143,15 @@ #endif #if defined(_WIN32_WCE) || defined(UNDER_CE) -# define BOOST_NO_THREADEX -# define BOOST_NO_GETSYSTEMTIMEASFILETIME # define BOOST_NO_SWPRINTF #endif +// we have ThreadEx or GetSystemTimeAsFileTime unless we're running WindowsCE +#if !defined(_WIN32_WCE) && !defined(UNDER_CE) +# define BOOST_HAS_THREADEX +# define BOOST_HAS_GETSYSTEMTIMEASFILETIME +#endif + // // check for exception handling support: #if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS) @@ -173,36 +191,44 @@ // C++ features supported by VC++ 10 (aka 2010) // #if _MSC_VER < 1600 -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_NULLPTR +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_DECLTYPE #endif // _MSC_VER < 1600 #if _MSC_VER >= 1600 -#define BOOST_HAS_STDINT_H +# define BOOST_HAS_STDINT_H #endif +// C++ features supported by VC++ 11 (aka 2012) +// +#if _MSC_VER < 1700 +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_SCOPED_ENUMS +#endif // _MSC_VER < 1700 + // C++0x features not supported by any versions -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // prefix and suffix headers: // @@ -213,6 +239,7 @@ # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif +#ifndef BOOST_COMPILER // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The // artificial versions assigned to them only refer to the versions of some IDE @@ -224,12 +251,21 @@ // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 -# elif _MSC_VER == 1400 +# elif _MSC_VER < 1400 + // Note: I'm not aware of any CE compiler with version 13xx +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown EVC++ compiler version - please run the configure tests and report the results" +# else +# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") +# endif +# elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION evc8 -# elif _MSC_VER == 1500 +# elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION evc9 -# elif _MSC_VER == 1600 +# elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION evc10 +# elif _MSC_VER < 1800 +# define BOOST_COMPILER_VERSION evc11 # else # if defined(BOOST_ASSERT_CONFIG) # error "Unknown EVC++ compiler version - please run the configure tests and report the results" @@ -243,32 +279,29 @@ # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 -# elif _MSC_VER == 1300 +# elif _MSC_VER < 1310 # define BOOST_COMPILER_VERSION 7.0 -# elif _MSC_VER == 1310 +# elif _MSC_VER < 1400 # define BOOST_COMPILER_VERSION 7.1 -# elif _MSC_VER == 1400 +# elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION 8.0 -# elif _MSC_VER == 1500 +# elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION 9.0 -# elif _MSC_VER == 1600 +# elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION 10.0 +# elif _MSC_VER < 1800 +# define BOOST_COMPILER_VERSION 11.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif # endif -#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) - -// -// versions check: -// we don't support Visual C++ prior to version 6: -#if _MSC_VER < 1200 -#error "Compiler not supported or configured - please reconfigure" +# define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) #endif + // -// last known and checked version is 1600 (VC10, aka 2010): -#if (_MSC_VER > 1600) +// last known and checked version is 1700 (VC11, aka 2011): +#if (_MSC_VER > 1700) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else diff --git a/3rdParty/Boost/src/boost/config/platform/cray.hpp b/3rdParty/Boost/src/boost/config/platform/cray.hpp new file mode 100644 index 0000000..5c476e4 --- /dev/null +++ b/3rdParty/Boost/src/boost/config/platform/cray.hpp @@ -0,0 +1,18 @@ +// (C) Copyright John Maddock 2011. +// Use, modification and distribution are subject to 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) + + +// See http://www.boost.org for most recent version. + +// SGI Irix specific config options: + +#define BOOST_PLATFORM "Cray" + +// boilerplate code: +#define BOOST_HAS_UNISTD_H +#include <boost/config/posix_features.hpp> + + + diff --git a/3rdParty/Boost/src/boost/config/platform/linux.hpp b/3rdParty/Boost/src/boost/config/platform/linux.hpp index 51ae133..a02aff7 100644 --- a/3rdParty/Boost/src/boost/config/platform/linux.hpp +++ b/3rdParty/Boost/src/boost/config/platform/linux.hpp @@ -11,7 +11,11 @@ #define BOOST_PLATFORM "linux" // make sure we have __GLIBC_PREREQ if available at all +#ifdef __cplusplus #include <cstdlib> +#else +#include <stdlib.h> +#endif // // <stdint.h> added to glibc 2.1.1 @@ -68,6 +72,7 @@ // boilerplate code: #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> +#define BOOST_HAS_PTHREAD_YIELD #ifndef __GNUC__ // diff --git a/3rdParty/Boost/src/boost/config/platform/macos.hpp b/3rdParty/Boost/src/boost/config/platform/macos.hpp index 2780ef9..6d876b1 100644 --- a/3rdParty/Boost/src/boost/config/platform/macos.hpp +++ b/3rdParty/Boost/src/boost/config/platform/macos.hpp @@ -64,16 +64,17 @@ # if ( defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON ) || ( defined(TARGET_CARBON) && TARGET_CARBON ) # if !defined(BOOST_HAS_PTHREADS) -# define BOOST_HAS_MPTASKS +// MPTasks support is deprecated/removed from Boost: +//# define BOOST_HAS_MPTASKS # elif ( __dest_os == __mac_os_x ) // We are doing a Carbon/Mach-O/MSL build which has pthreads, but only the // gettimeofday and no posix. # define BOOST_HAS_GETTIMEOFDAY # endif -// The MP task implementation of Boost Threads aims to replace MP-unsafe -// parts of the MSL, so we turn on threads unconditionally. -# define BOOST_HAS_THREADS +#ifdef BOOST_HAS_PTHREADS +# define BOOST_HAS_THREADS +#endif // The remote call manager depends on this. # define BOOST_BIND_ENABLE_PASCAL diff --git a/3rdParty/Boost/src/boost/config/platform/symbian.hpp b/3rdParty/Boost/src/boost/config/platform/symbian.hpp index ad37943..e02a778 100644 --- a/3rdParty/Boost/src/boost/config/platform/symbian.hpp +++ b/3rdParty/Boost/src/boost/config/platform/symbian.hpp @@ -18,8 +18,11 @@ // Open C / C++ plugin was introdused in this SDK, earlier versions don't have CRT / STL # define BOOST_S60_3rd_EDITION_FP2_OR_LATER_SDK // make sure we have __GLIBC_PREREQ if available at all -# include <cstdlib> -// boilerplate code: +#ifdef __cplusplus +#include <cstdlib> +#else +#include <stdlib.h> +#endif// boilerplate code: # define BOOST_HAS_UNISTD_H # include <boost/config/posix_features.hpp> // S60 SDK defines _POSIX_VERSION as POSIX.1 diff --git a/3rdParty/Boost/src/boost/config/platform/win32.hpp b/3rdParty/Boost/src/boost/config/platform/win32.hpp index 72c3dce..3922012 100644 --- a/3rdParty/Boost/src/boost/config/platform/win32.hpp +++ b/3rdParty/Boost/src/boost/config/platform/win32.hpp @@ -55,6 +55,8 @@ #ifdef _WIN32_WCE # define BOOST_NO_ANSI_APIS +#else +# define BOOST_HAS_GETSYSTEMTIMEASFILETIME #endif #ifndef BOOST_HAS_PTHREADS diff --git a/3rdParty/Boost/src/boost/config/select_compiler_config.hpp b/3rdParty/Boost/src/boost/config/select_compiler_config.hpp index e19469a..0d47b25 100644 --- a/3rdParty/Boost/src/boost/config/select_compiler_config.hpp +++ b/3rdParty/Boost/src/boost/config/select_compiler_config.hpp @@ -10,33 +10,6 @@ // See http://www.boost.org/ for most recent version. - -// one identification macro for each of the -// compilers we support: - -# define BOOST_CXX_GCCXML 0 -# define BOOST_CXX_NVCC 0 -# define BOOST_CXX_COMO 0 -# define BOOST_CXX_PATHSCALE 0 -# define BOOST_CXX_CLANG 0 -# define BOOST_CXX_DMC 0 -# define BOOST_CXX_INTEL 0 -# define BOOST_CXX_GNUC 0 -# define BOOST_CXX_KCC 0 -# define BOOST_CXX_SGI 0 -# define BOOST_CXX_TRU64 0 -# define BOOST_CXX_GHS 0 -# define BOOST_CXX_BORLAND 0 -# define BOOST_CXX_CW 0 -# define BOOST_CXX_SUNPRO 0 -# define BOOST_CXX_HPACC 0 -# define BOOST_CXX_MPW 0 -# define BOOST_CXX_IBMCPP 0 -# define BOOST_CXX_MSVC 0 -# define BOOST_CXX_PGI 0 -# define BOOST_CXX_NVCC 0 - - // locate which compiler we are using and define // BOOST_COMPILER_CONFIG as needed: @@ -44,6 +17,10 @@ // GCC-XML emulates other compilers, it has to appear first here! # define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp" +#elif defined(_CRAYC) +// EDG based Cray compiler: +# define BOOST_COMPILER_CONFIG "boost/config/compiler/cray.hpp" + #elif defined __CUDACC__ // NVIDIA CUDA C++ compiler for GPU # define BOOST_COMPILER_CONFIG "boost/config/compiler/nvcc.hpp" diff --git a/3rdParty/Boost/src/boost/config/select_platform_config.hpp b/3rdParty/Boost/src/boost/config/select_platform_config.hpp index bc1ffaf..2af61d2 100644 --- a/3rdParty/Boost/src/boost/config/select_platform_config.hpp +++ b/3rdParty/Boost/src/boost/config/select_platform_config.hpp @@ -13,7 +13,7 @@ // <header_name> in order to prevent macro expansion within the header // name (for example "linux" is a macro on linux systems). -#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) +#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) // linux, also other platforms (Hurd etc) that use GLIBC, should these really have their own config headers though? # define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" @@ -69,6 +69,10 @@ // Symbian: # define BOOST_PLATFORM_CONFIG "boost/config/platform/symbian.hpp" +#elif defined(_CRAYC) +// Cray: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/cray.hpp" + #elif defined(__VMS) // VMS: # define BOOST_PLATFORM_CONFIG "boost/config/platform/vms.hpp" diff --git a/3rdParty/Boost/src/boost/config/select_stdlib_config.hpp b/3rdParty/Boost/src/boost/config/select_stdlib_config.hpp index f020482..96ede00 100644 --- a/3rdParty/Boost/src/boost/config/select_stdlib_config.hpp +++ b/3rdParty/Boost/src/boost/config/select_stdlib_config.hpp @@ -14,7 +14,11 @@ // First include <cstddef> to determine if some version of STLport is in use as the std lib // (do not rely on this header being included since users can short-circuit this header // if they know whose std lib they are using.) -#include <cstddef> +#ifdef __cplusplus +# include <cstddef> +#else +# include <stddef.h> +#endif #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) // STLPort library; this _must_ come first, otherwise since diff --git a/3rdParty/Boost/src/boost/config/stdlib/dinkumware.hpp b/3rdParty/Boost/src/boost/config/stdlib/dinkumware.hpp index a7579da..e0032b9 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/dinkumware.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/dinkumware.hpp @@ -87,45 +87,44 @@ #endif #include <typeinfo> -#if !_HAS_EXCEPTIONS +#if ( (!_HAS_EXCEPTIONS && !defined(__ghs__)) || (!_HAS_NAMESPACE && defined(__ghs__)) ) # define BOOST_NO_STD_TYPEINFO #endif // C++0x headers implemented in 520 (as shipped by Microsoft) // #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_FUNCTIONAL +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_SMART_PTR #endif -#if !defined(_HAS_TR1_IMPORTS) && !defined(BOOST_NO_0X_HDR_TUPLE) -# define BOOST_NO_0X_HDR_TUPLE +#if (!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_CXX11_HDR_TUPLE) +# define BOOST_NO_CXX11_HDR_TUPLE #endif - -// C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_THREAD +// C++0x headers not yet (fully) implemented: +// +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER diff --git a/3rdParty/Boost/src/boost/config/stdlib/libcomo.hpp b/3rdParty/Boost/src/boost/config/stdlib/libcomo.hpp index 16a842a..29490f1 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/libcomo.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/libcomo.hpp @@ -35,30 +35,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL // // Intrinsic type_traits support. diff --git a/3rdParty/Boost/src/boost/config/stdlib/libcpp.hpp b/3rdParty/Boost/src/boost/config/stdlib/libcpp.hpp index db7f6f1..3d57440 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/libcpp.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/libcpp.hpp @@ -19,15 +19,18 @@ #define BOOST_HAS_THREADS -#define BOOST_NO_0X_HDR_CONCEPTS -#define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -#define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -#define BOOST_NO_0X_HDR_MEMORY_CONCEPTS - #ifdef _LIBCPP_HAS_NO_VARIADICS -# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TUPLE #endif +// +// These appear to be unusable/incomplete so far: +// +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR + // libc++ uses a non-standard messages_base #define BOOST_NO_STD_MESSAGES diff --git a/3rdParty/Boost/src/boost/config/stdlib/libstdcpp3.hpp b/3rdParty/Boost/src/boost/config/stdlib/libstdcpp3.hpp index c048b89..c56dff2 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/libstdcpp3.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/libstdcpp3.hpp @@ -33,7 +33,9 @@ #ifdef __GLIBCXX__ // gcc 3.4 and greater: # if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \ - || defined(_GLIBCXX__PTHREADS) + || defined(_GLIBCXX__PTHREADS) \ + || defined(_GLIBCXX_HAS_GTHREADS) \ + || defined(_WIN32) // // If the std lib has thread support turned on, then turn it on in Boost // as well. We do this because some gcc-3.4 std lib headers define _REENTANT @@ -103,43 +105,61 @@ // C++0x headers in GCC 4.3.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #endif // C++0x headers in GCC 4.4.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_SMART_PTR +#else +# define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG +# define BOOST_HAS_TR1_COMPLEX_OVERLOADS +#endif + +#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1)) && (!defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) || !defined(BOOST_NO_CXX11_HDR_MUTEX)) +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_MUTEX #endif // C++0x features in GCC 4.5.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_RANDOM +#endif + +// C++0x features in GCC 4.6.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_CXX11_HDR_TYPEINDEX #endif -// C++0x headers not yet implemented +// C++0x features in GCC 4.7.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +// Note that although <chrono> existed prior to 4.7, "stead_clock" is spelled "monotonic_clock" +// so 4.7.0 is the first truely conforming one. +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_ALLOCATOR +#endif +// C++0x headers not yet (fully!) implemented // -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR // --- end --- diff --git a/3rdParty/Boost/src/boost/config/stdlib/modena.hpp b/3rdParty/Boost/src/boost/config/stdlib/modena.hpp index 147060d..b483b6e 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/modena.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/modena.hpp @@ -24,30 +24,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Modena C++ standard library" diff --git a/3rdParty/Boost/src/boost/config/stdlib/msl.hpp b/3rdParty/Boost/src/boost/config/stdlib/msl.hpp index 8185e35..4f9a2da 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/msl.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/msl.hpp @@ -48,30 +48,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/3rdParty/Boost/src/boost/config/stdlib/roguewave.hpp b/3rdParty/Boost/src/boost/config/stdlib/roguewave.hpp index b43623b..cb80f57 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/roguewave.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/roguewave.hpp @@ -154,32 +154,33 @@ # endif #endif +#if _RWSTD_VER < 0x05000000 +# define BOOST_NO_CXX11_HDR_ARRAY +#endif +// type_traits header is incomplete: +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +// // C++0x headers not yet implemented // -#if _RWSTD_VER < 0x05000000 -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_TYPE_TRAITS -#endif -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/3rdParty/Boost/src/boost/config/stdlib/sgi.hpp b/3rdParty/Boost/src/boost/config/stdlib/sgi.hpp index 5731fe5..ae9b6ad 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/sgi.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/sgi.hpp @@ -118,30 +118,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "SGI standard library" diff --git a/3rdParty/Boost/src/boost/config/stdlib/stlport.hpp b/3rdParty/Boost/src/boost/config/stdlib/stlport.hpp index 85176a4..bcc30b9 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/stlport.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/stlport.hpp @@ -71,10 +71,6 @@ # endif #endif -#if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520)) -# define BOOST_NO_STD_UNORDERED -#endif - #if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520) # define BOOST_HAS_TR1_UNORDERED_SET # define BOOST_HAS_TR1_UNORDERED_MAP @@ -212,30 +208,29 @@ namespace boost { using std::min; using std::max; } // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/3rdParty/Boost/src/boost/config/stdlib/vacpp.hpp b/3rdParty/Boost/src/boost/config/stdlib/vacpp.hpp index 3fcf6e0..9d16946 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/vacpp.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/vacpp.hpp @@ -24,30 +24,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Visual Age default standard library" diff --git a/3rdParty/Boost/src/boost/config/suffix.hpp b/3rdParty/Boost/src/boost/config/suffix.hpp index 9cce6fd..2d24813 100644 --- a/3rdParty/Boost/src/boost/config/suffix.hpp +++ b/3rdParty/Boost/src/boost/config/suffix.hpp @@ -104,13 +104,6 @@ #endif // -// Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT: -// -#if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) -# define BOOST_HAS_STATIC_ASSERT -#endif - -// // if there is no __int64 then there is no specialisation // for numeric_limits<__int64> either: // @@ -334,28 +327,6 @@ # define BOOST_HASH_MAP_HEADER <hash_map> #endif -// -// Set BOOST_NO_INITIALIZER_LISTS if there is no library support. -// - -#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) -# define BOOST_NO_INITIALIZER_LISTS -#endif - -// -// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined -// -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) -#define BOOST_HAS_RVALUE_REFS -#endif - -// -// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_VARIADIC_TEMPLATES is not defined -// -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) -#define BOOST_HAS_VARIADIC_TMPL -#endif - // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: @@ -376,7 +347,7 @@ // works as expected with standard conforming compilers. The resulting // double inclusion of <cstddef> is harmless. -# ifdef BOOST_NO_STDC_NAMESPACE +# if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus) # include <cstddef> namespace std { using ::ptrdiff_t; using ::size_t; } # endif @@ -395,7 +366,7 @@ // BOOST_NO_STD_MIN_MAX workaround -----------------------------------------// -# ifdef BOOST_NO_STD_MIN_MAX +# if defined(BOOST_NO_STD_MIN_MAX) && defined(__cplusplus) namespace std { template <class _Tp> @@ -506,7 +477,7 @@ namespace std { // but it's use may generate either warnings (with -ansi), or errors // (with -pedantic -ansi) unless it's use is prefixed by __extension__ // -#if defined(BOOST_HAS_LONG_LONG) +#if defined(BOOST_HAS_LONG_LONG) && defined(__cplusplus) namespace boost{ # ifdef __GNUC__ __extension__ typedef long long long_long_type; @@ -560,7 +531,7 @@ namespace boost{ // -#if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) && defined(__cplusplus) # include "boost/type.hpp" # include "boost/non_type.hpp" @@ -598,7 +569,7 @@ namespace boost{ // When BOOST_NO_STD_TYPEINFO is defined, we can just import // the global definition into std namespace: -#ifdef BOOST_NO_STD_TYPEINFO +#if defined(BOOST_NO_STD_TYPEINFO) && defined(__cplusplus) #include <typeinfo> namespace std{ using ::type_info; } #endif @@ -651,6 +622,260 @@ namespace std{ using ::type_info; } # define BOOST_GPU_ENABLED # endif +// BOOST_FORCEINLINE ---------------------------------------------// +// Macro to use in place of 'inline' to force a function to be inline +#if !defined(BOOST_FORCEINLINE) +# if defined(_MSC_VER) +# define BOOST_FORCEINLINE __forceinline +# elif defined(__GNUC__) && __GNUC__ > 3 +# define BOOST_FORCEINLINE inline __attribute__ ((always_inline)) +# else +# define BOOST_FORCEINLINE inline +# endif +#endif + +// +// Set BOOST_NO_DECLTYPE_N3276 when BOOST_NO_DECLTYPE is defined +// +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) +#define BOOST_NO_CXX11_DECLTYPE_N3276 BOOST_NO_CXX11_DECLTYPE +#endif + +// -------------------- Deprecated macros for 1.50 --------------------------- +// These will go away in a future release + +// Use BOOST_NO_CXX11_HDR_UNORDERED_SET or BOOST_NO_CXX11_HDR_UNORDERED_MAP +// instead of BOOST_NO_STD_UNORDERED +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) +# ifndef BOOST_NO_STD_UNORDERED +# define BOOST_NO_STD_UNORDERED +# endif +#endif + +// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST instead of BOOST_NO_INITIALIZER_LISTS +#if defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) +# define BOOST_NO_INITIALIZER_LISTS +#endif + +// Use BOOST_NO_CXX11_HDR_ARRAY instead of BOOST_NO_0X_HDR_ARRAY +#if defined(BOOST_NO_CXX11_HDR_ARRAY) && !defined(BOOST_NO_BOOST_NO_0X_HDR_ARRAY) +# define BOOST_NO_0X_HDR_ARRAY +#endif +// Use BOOST_NO_CXX11_HDR_CHRONO instead of BOOST_NO_0X_HDR_CHRONO +#if defined(BOOST_NO_CXX11_HDR_CHRONO) && !defined(BOOST_NO_0X_HDR_CHRONO) +# define BOOST_NO_0X_HDR_CHRONO +#endif +// Use BOOST_NO_CXX11_HDR_CODECVT instead of BOOST_NO_0X_HDR_CODECVT +#if defined(BOOST_NO_CXX11_HDR_CODECVT) && !defined(BOOST_NO_0X_HDR_CODECVT) +# define BOOST_NO_0X_HDR_CODECVT +#endif +// Use BOOST_NO_CXX11_HDR_CONDITION_VARIABLE instead of BOOST_NO_0X_HDR_CONDITION_VARIABLE +#if defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) && !defined(BOOST_NO_0X_HDR_CONDITION_VARIABLE) +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +#endif +// Use BOOST_NO_CXX11_HDR_FORWARD_LIST instead of BOOST_NO_0X_HDR_FORWARD_LIST +#if defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) && !defined(BOOST_NO_0X_HDR_FORWARD_LIST) +# define BOOST_NO_0X_HDR_FORWARD_LIST +#endif +// Use BOOST_NO_CXX11_HDR_FUTURE instead of BOOST_NO_0X_HDR_FUTURE +#if defined(BOOST_NO_CXX11_HDR_FUTURE) && !defined(BOOST_NO_0X_HDR_FUTURE) +# define BOOST_NO_0X_HDR_FUTURE +#endif + +// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST +// instead of BOOST_NO_0X_HDR_INITIALIZER_LIST or BOOST_NO_INITIALIZER_LISTS +#ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# ifndef BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# endif +# ifndef BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_INITIALIZER_LISTS +# endif +#endif + +// Use BOOST_NO_CXX11_HDR_MUTEX instead of BOOST_NO_0X_HDR_MUTEX +#if defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX) +# define BOOST_NO_0X_HDR_MUTEX +#endif +// Use BOOST_NO_CXX11_HDR_RANDOM instead of BOOST_NO_0X_HDR_RANDOM +#if defined(BOOST_NO_CXX11_HDR_RANDOM) && !defined(BOOST_NO_0X_HDR_RANDOM) +# define BOOST_NO_0X_HDR_RANDOM +#endif +// Use BOOST_NO_CXX11_HDR_RATIO instead of BOOST_NO_0X_HDR_RATIO +#if defined(BOOST_NO_CXX11_HDR_RATIO) && !defined(BOOST_NO_0X_HDR_RATIO) +# define BOOST_NO_0X_HDR_RATIO +#endif +// Use BOOST_NO_CXX11_HDR_REGEX instead of BOOST_NO_0X_HDR_REGEX +#if defined(BOOST_NO_CXX11_HDR_REGEX) && !defined(BOOST_NO_0X_HDR_REGEX) +# define BOOST_NO_0X_HDR_REGEX +#endif +// Use BOOST_NO_CXX11_HDR_SYSTEM_ERROR instead of BOOST_NO_0X_HDR_SYSTEM_ERROR +#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) && !defined(BOOST_NO_0X_HDR_SYSTEM_ERROR) +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +#endif +// Use BOOST_NO_CXX11_HDR_THREAD instead of BOOST_NO_0X_HDR_THREAD +#if defined(BOOST_NO_CXX11_HDR_THREAD) && !defined(BOOST_NO_0X_HDR_THREAD) +# define BOOST_NO_0X_HDR_THREAD +#endif +// Use BOOST_NO_CXX11_HDR_TUPLE instead of BOOST_NO_0X_HDR_TUPLE +#if defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_0X_HDR_TUPLE) +# define BOOST_NO_0X_HDR_TUPLE +#endif +// Use BOOST_NO_CXX11_HDR_TYPE_TRAITS instead of BOOST_NO_0X_HDR_TYPE_TRAITS +#if defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) && !defined(BOOST_NO_0X_HDR_TYPE_TRAITS) +# define BOOST_NO_0X_HDR_TYPE_TRAITS +#endif +// Use BOOST_NO_CXX11_HDR_TYPEINDEX instead of BOOST_NO_0X_HDR_TYPEINDEX +#if defined(BOOST_NO_CXX11_HDR_TYPEINDEX) && !defined(BOOST_NO_0X_HDR_TYPEINDEX) +# define BOOST_NO_0X_HDR_TYPEINDEX +#endif +// Use BOOST_NO_CXX11_HDR_UNORDERED_MAP instead of BOOST_NO_0X_HDR_UNORDERED_MAP +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) && !defined(BOOST_NO_0X_HDR_UNORDERED_MAP) +# define BOOST_NO_0X_HDR_UNORDERED_MAP +#endif +// Use BOOST_NO_CXX11_HDR_UNORDERED_SET instead of BOOST_NO_0X_HDR_UNORDERED_SET +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) && !defined(BOOST_NO_0X_HDR_UNORDERED_SET) +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// ------------------ End of deprecated macros for 1.50 --------------------------- + +// -------------------- Deprecated macros for 1.51 --------------------------- +// These will go away in a future release + +// Use BOOST_NO_CXX11_AUTO_DECLARATIONS instead of BOOST_NO_AUTO_DECLARATIONS +#if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_AUTO_DECLARATIONS) +# define BOOST_NO_AUTO_DECLARATIONS +#endif +// Use BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS instead of BOOST_NO_AUTO_MULTIDECLARATIONS +#if defined(BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS) && !defined(BOOST_NO_AUTO_MULTIDECLARATIONS) +# define BOOST_NO_AUTO_MULTIDECLARATIONS +#endif +// Use BOOST_NO_CXX11_CHAR16_T instead of BOOST_NO_CHAR16_T +#if defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CHAR16_T) +# define BOOST_NO_CHAR16_T +#endif +// Use BOOST_NO_CXX11_CHAR32_T instead of BOOST_NO_CHAR32_T +#if defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CHAR32_T) +# define BOOST_NO_CHAR32_T +#endif +// Use BOOST_NO_CXX11_TEMPLATE_ALIASES instead of BOOST_NO_TEMPLATE_ALIASES +#if defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_TEMPLATE_ALIASES) +# define BOOST_NO_TEMPLATE_ALIASES +#endif +// Use BOOST_NO_CXX11_CONSTEXPR instead of BOOST_NO_CONSTEXPR +#if defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CONSTEXPR) +# define BOOST_NO_CONSTEXPR +#endif +// Use BOOST_NO_CXX11_DECLTYPE_N3276 instead of BOOST_NO_DECLTYPE_N3276 +#if defined(BOOST_NO_CXX11_DECLTYPE_N3276) && !defined(BOOST_NO_DECLTYPE_N3276) +# define BOOST_NO_DECLTYPE_N3276 +#endif +// Use BOOST_NO_CXX11_DECLTYPE instead of BOOST_NO_DECLTYPE +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_DECLTYPE) +# define BOOST_NO_DECLTYPE +#endif +// Use BOOST_NO_CXX11_DEFAULTED_FUNCTIONS instead of BOOST_NO_DEFAULTED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_DEFAULTED_FUNCTIONS) +# define BOOST_NO_DEFAULTED_FUNCTIONS +#endif +// Use BOOST_NO_CXX11_DELETED_FUNCTIONS instead of BOOST_NO_DELETED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_DELETED_FUNCTIONS) +# define BOOST_NO_DELETED_FUNCTIONS +#endif +// Use BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS instead of BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) && !defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS) +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#endif +// Use BOOST_NO_CXX11_EXTERN_TEMPLATE instead of BOOST_NO_EXTERN_TEMPLATE +#if defined(BOOST_NO_CXX11_EXTERN_TEMPLATE) && !defined(BOOST_NO_EXTERN_TEMPLATE) +# define BOOST_NO_EXTERN_TEMPLATE +#endif +// Use BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS instead of BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#if defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) +# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#endif +// Use BOOST_NO_CXX11_LAMBDAS instead of BOOST_NO_LAMBDAS +#if defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_LAMBDAS) +# define BOOST_NO_LAMBDAS +#endif +// Use BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS instead of BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#if defined(BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS) && !defined(BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS) +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#endif +// Use BOOST_NO_CXX11_NOEXCEPT instead of BOOST_NO_NOEXCEPT +#if defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_NOEXCEPT) +# define BOOST_NO_NOEXCEPT +#endif +// Use BOOST_NO_CXX11_NULLPTR instead of BOOST_NO_NULLPTR +#if defined(BOOST_NO_CXX11_NULLPTR) && !defined(BOOST_NO_NULLPTR) +# define BOOST_NO_NULLPTR +#endif +// Use BOOST_NO_CXX11_RAW_LITERALS instead of BOOST_NO_RAW_LITERALS +#if defined(BOOST_NO_CXX11_RAW_LITERALS) && !defined(BOOST_NO_RAW_LITERALS) +# define BOOST_NO_RAW_LITERALS +#endif +// Use BOOST_NO_CXX11_RVALUE_REFERENCES instead of BOOST_NO_RVALUE_REFERENCES +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_RVALUE_REFERENCES) +# define BOOST_NO_RVALUE_REFERENCES +#endif +// Use BOOST_NO_CXX11_SCOPED_ENUMS instead of BOOST_NO_SCOPED_ENUMS +#if defined(BOOST_NO_CXX11_SCOPED_ENUMS) && !defined(BOOST_NO_SCOPED_ENUMS) +# define BOOST_NO_SCOPED_ENUMS +#endif +// Use BOOST_NO_CXX11_STATIC_ASSERT instead of BOOST_NO_STATIC_ASSERT +#if defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_NO_STATIC_ASSERT) +# define BOOST_NO_STATIC_ASSERT +#endif +// Use BOOST_NO_CXX11_STD_UNORDERD instead of BOOST_NO_STD_UNORDERD +#if defined(BOOST_NO_CXX11_STD_UNORDERD) && !defined(BOOST_NO_STD_UNORDERD) +# define BOOST_NO_STD_UNORDERD +#endif +// Use BOOST_NO_CXX11_UNICODE_LITERALS instead of BOOST_NO_UNICODE_LITERALS +#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(BOOST_NO_UNICODE_LITERALS) +# define BOOST_NO_UNICODE_LITERALS +#endif +// Use BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX instead of BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX) +# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#endif +// Use BOOST_NO_CXX11_VARIADIC_TEMPLATES instead of BOOST_NO_VARIADIC_TEMPLATES +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +# define BOOST_NO_VARIADIC_TEMPLATES +#endif +// Use BOOST_NO_CXX11_VARIADIC_MACROS instead of BOOST_NO_VARIADIC_MACROS +#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS) +# define BOOST_NO_VARIADIC_MACROS +#endif +// Use BOOST_NO_CXX11_NUMERIC_LIMITS instead of BOOST_NO_NUMERIC_LIMITS_LOWEST +#if defined(BOOST_NO_CXX11_NUMERIC_LIMITS) && !defined(BOOST_NO_NUMERIC_LIMITS_LOWEST) +# define BOOST_NO_NUMERIC_LIMITS_LOWEST +#endif +// ------------------ End of deprecated macros for 1.51 --------------------------- + + + +// +// Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR +// These aid the transition to C++11 while still supporting C++03 compilers +// +#ifdef BOOST_NO_NOEXCEPT +# define BOOST_NOEXCEPT +# define BOOST_NOEXCEPT_IF(Predicate) +# define BOOST_NOEXCEPT_EXPR(Expression) false +#else +# define BOOST_NOEXCEPT noexcept +# define BOOST_NOEXCEPT_IF(Predicate) noexcept((Predicate)) +# define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression)) +#endif + +// +// Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT: +// +#if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) +# define BOOST_HAS_STATIC_ASSERT +#endif + // // constexpr workarounds // @@ -664,5 +889,19 @@ namespace std{ using ::type_info; } #define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST +// +// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined +// +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) +#define BOOST_HAS_RVALUE_REFS #endif +// +// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_VARIADIC_TEMPLATES is not defined +// +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) +#define BOOST_HAS_VARIADIC_TMPL +#endif + + +#endif diff --git a/3rdParty/Boost/src/boost/config/warning_disable.hpp b/3rdParty/Boost/src/boost/config/warning_disable.hpp index 26ff132..fea8e82 100644 --- a/3rdParty/Boost/src/boost/config/warning_disable.hpp +++ b/3rdParty/Boost/src/boost/config/warning_disable.hpp @@ -23,7 +23,7 @@ // Note that THIS HEADER MUST NOT INCLUDE ANY OTHER HEADERS: // not even std library ones! Doing so may turn the warning // off too late to be of any use. For example the VC++ C4996 -// warning can be omitted from <iosfwd> if that header is included +// warning can be emitted from <iosfwd> if that header is included // before or by this one :-( // diff --git a/3rdParty/Boost/src/boost/container/allocator_traits.hpp b/3rdParty/Boost/src/boost/container/allocator_traits.hpp new file mode 100644 index 0000000..11d948b --- /dev/null +++ b/3rdParty/Boost/src/boost/container/allocator_traits.hpp @@ -0,0 +1,385 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP +#define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/intrusive/pointer_traits.hpp> +#include <boost/intrusive/detail/memory_util.hpp> +#include <boost/container/detail/memory_util.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/move/move.hpp> +#include <limits> //numeric_limits<>::max() +#include <new> //placement new +#include <memory> //std::allocator +#include <boost/container/detail/preprocessor.hpp> + +///@cond + +namespace boost { +namespace container { +namespace container_detail { + +//workaround needed for C++03 compilers with no construct() +//supporting rvalue references +template<class A> +struct is_std_allocator +{ static const bool value = false; }; + +template<class T> +struct is_std_allocator< std::allocator<T> > +{ static const bool value = true; }; + +} //namespace container_detail { + +///@endcond + +//! The class template allocator_traits supplies a uniform interface to all allocator types. +//! This class is a C++03-compatible implementation of std::allocator_traits +template <typename Alloc> +struct allocator_traits +{ + //allocator_type + typedef Alloc allocator_type; + //value_type + typedef typename Alloc::value_type value_type; + + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! Alloc::pointer if such a type exists; otherwise, value_type* + //! + typedef unspecified pointer; + //! Alloc::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const + //! + typedef see_documentation const_pointer; + //! Non-standard extension + //! Alloc::reference if such a type exists; otherwise, value_type& + typedef see_documentation reference; + //! Non-standard extension + //! Alloc::const_reference if such a type exists ; otherwise, const value_type& + typedef see_documentation const_reference; + //! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>. + //! + typedef see_documentation void_pointer; + //! Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const + //! + typedef see_documentation const_void_pointer; + //! Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type. + //! + typedef see_documentation difference_type; + //! Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type + //! + typedef see_documentation size_type; + //! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_copy_assignment; + //! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_move_assignment; + //! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_swap; + //! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args> + //! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or + //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. + //! + //! In C++03 compilers `rebind_alloc` is a struct derived from an allocator + //! deduced by previously detailed rules. + template <class T> using rebind_alloc = see_documentation; + + //! In C++03 compilers `rebind_traits` is a struct derived from + //! `allocator_traits<OtherAlloc>`, where `OtherAlloc` is + //! the allocator deduced by rules explained in `rebind_alloc`. + template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >; + + //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers. + //! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`. + template <class T> + struct portable_rebind_alloc + { typedef see_documentation type; }; + #else + //pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + pointer, value_type*) + pointer; + //const_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + const_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<const value_type>) + const_pointer; + //reference + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + reference, typename container_detail::unvoid<value_type>::type&) + reference; + //const_reference + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + const_reference, const typename container_detail::unvoid<value_type>::type&) + const_reference; + //void_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + void_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<void>) + void_pointer; + //const_void_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + const_void_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<const void>) + const_void_pointer; + //difference_type + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + difference_type, std::ptrdiff_t) + difference_type; + //size_type + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + size_type, std::size_t) + size_type; + //propagate_on_container_copy_assignment + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_copy_assignment, boost::false_type) + propagate_on_container_copy_assignment; + //propagate_on_container_move_assignment + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_move_assignment, boost::false_type) + propagate_on_container_move_assignment; + //propagate_on_container_swap + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_swap, boost::false_type) + propagate_on_container_swap; + + #if !defined(BOOST_NO_TEMPLATE_ALIASES) + //C++11 + template <typename T> using rebind_alloc = typename boost::intrusive::detail::type_rebinder<Alloc, T>::type; + template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; + #else // #if !defined(BOOST_NO_TEMPLATE_ALIASES) + //Some workaround for C++03 or C++11 compilers with no template aliases + template <typename T> + struct rebind_alloc : boost::intrusive::detail::type_rebinder<Alloc,T>::type + { + typedef typename boost::intrusive::detail::type_rebinder<Alloc,T>::type Base; + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + template <typename... Args> + rebind_alloc(BOOST_FWD_REF(Args)... args) + : Base(boost::forward<Args>(args)...) + {} + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + #define BOOST_PP_LOCAL_MACRO(n) \ + BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ + rebind_alloc(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + : Base(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \ + {} \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + }; + + template <typename T> + struct rebind_traits + : allocator_traits<typename boost::intrusive::detail::type_rebinder<Alloc, T>::type> + {}; + #endif // #if !defined(BOOST_NO_TEMPLATE_ALIASES) + template <class T> + struct portable_rebind_alloc + { typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; }; + #endif //BOOST_CONTAINER_DOXYGEN_INVOKED + + //! <b>Returns</b>: `a.allocate(n)` + //! + static pointer allocate(Alloc &a, size_type n) + { return a.allocate(n); } + + //! <b>Returns</b>: `a.deallocate(p, n)` + //! + //! <b>Throws</b>: Nothing + static void deallocate(Alloc &a, pointer p, size_type n) + { return a.deallocate(p, n); } + + //! <b>Effects</b>: calls `a.allocate(n, p)` if that call is well-formed; + //! otherwise, invokes `a.allocate(n)` + static pointer allocate(Alloc &a, size_type n, const_void_pointer p) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_allocate + <Alloc, const size_type, const const_void_pointer>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_allocate(flag, a, n, p); + } + + //! <b>Effects</b>: calls `a.destroy(p)` if that call is well-formed; + //! otherwise, invokes `p->~T()`. + template<class T> + static void destroy(Alloc &a, T*p) + { + typedef T* destroy_pointer; + const bool value = boost::container::container_detail:: + has_member_function_callable_with_destroy + <Alloc, const destroy_pointer>::value; + ::boost::integral_constant<bool, value> flag; + allocator_traits::priv_destroy(flag, a, p); + } + + //! <b>Returns</b>: `a.max_size()` if that expression is well-formed; otherwise, + //! `numeric_limits<size_type>::max()`. + static size_type max_size(const Alloc &a) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_max_size + <const Alloc>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_max_size(flag, a); + } + + //! <b>Returns</b>: `a.select_on_container_copy_construction()` if that expression is well-formed; + //! otherwise, a. + static Alloc select_on_container_copy_construction(const Alloc &a) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_select_on_container_copy_construction + <const Alloc>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_select_on_container_copy_construction(flag, a); + } + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed; + //! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)` + template <class T, class ...Args> + static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args) + { + ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag; + allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...); + } + #endif + ///@cond + #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + private: + static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p) + { return a.allocate(n, p); } + + static pointer priv_allocate(boost::false_type, Alloc &a, size_type n, const_void_pointer) + { return allocator_traits::allocate(a, n); } + + template<class T> + static void priv_destroy(boost::true_type, Alloc &a, T* p) + { a.destroy(p); } + + template<class T> + static void priv_destroy(boost::false_type, Alloc &, T* p) + { p->~T(); (void)p; } + + static size_type priv_max_size(boost::true_type, const Alloc &a) + { return a.max_size(); } + + static size_type priv_max_size(boost::false_type, const Alloc &) + { return (std::numeric_limits<size_type>::max)(); } + + static Alloc priv_select_on_container_copy_construction(boost::true_type, const Alloc &a) + { return a.select_on_container_copy_construction(); } + + static Alloc priv_select_on_container_copy_construction(boost::false_type, const Alloc &a) + { return a; } + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + template<class T, class ...Args> + static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_construct + < Alloc, T*, Args... >::value; + ::boost::integral_constant<bool, value> flag; + priv_construct_dispatch2(flag, a, p, ::boost::forward<Args>(args)...); + } + + template<class T, class ...Args> + static void priv_construct(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { + priv_construct_dispatch2(boost::false_type(), a, p, ::boost::forward<Args>(args)...); + } + + template<class T, class ...Args> + static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { a.construct( p, ::boost::forward<Args>(args)...); } + + template<class T, class ...Args> + static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, BOOST_FWD_REF(Args) ...args) + { ::new((void*)p) T(::boost::forward<Args>(args)...); } + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + public: + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void construct(Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + { \ + ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag; \ + allocator_traits::priv_construct(flag, a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ + } \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + private: + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct(boost::false_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { \ + const bool value = \ + boost::container::container_detail::has_member_function_callable_with_construct \ + < Alloc, T* BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_FWD_TYPE, _) >::value; \ + ::boost::integral_constant<bool, value> flag; \ + priv_construct_dispatch2(flag, a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \ + } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct(boost::true_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { \ + priv_construct_dispatch2(boost::false_type(), a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \ + } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { a.construct( p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \ + { ::new((void*)p) T(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + ///@endcond +}; + +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP) diff --git a/3rdParty/Boost/src/boost/container/container_fwd.hpp b/3rdParty/Boost/src/boost/container/container_fwd.hpp new file mode 100644 index 0000000..bdefd81 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/container_fwd.hpp @@ -0,0 +1,173 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP +#define BOOST_CONTAINER_CONTAINER_FWD_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +////////////////////////////////////////////////////////////////////////////// +// Standard predeclarations +////////////////////////////////////////////////////////////////////////////// + +/// @cond + +namespace boost{ +namespace intrusive{ + //Create namespace to avoid compilation errors +}} + +namespace boost{ namespace container{ namespace container_detail{ + +namespace bi = boost::intrusive; + +}}} + +#include <utility> +#include <memory> +#include <functional> +#include <iosfwd> +#include <string> + +/// @endcond + +////////////////////////////////////////////////////////////////////////////// +// Containers +////////////////////////////////////////////////////////////////////////////// + +namespace boost { +namespace container { + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class vector; + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class stable_vector; + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class deque; + +//list class +template <class T + ,class Allocator = std::allocator<T> > +class list; + +//slist class +template <class T + ,class Allocator = std::allocator<T> > +class slist; + +//set class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class set; + +//multiset class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class multiset; + +//map class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<const Key, T> > > +class map; + +//multimap class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<const Key, T> > > +class multimap; + +//flat_set class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class flat_set; + +//flat_multiset class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class flat_multiset; + +//flat_map class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<Key, T> > > +class flat_map; + +//flat_multimap class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<Key, T> > > +class flat_multimap; + +//basic_string class +template <class CharT + ,class Traits = std::char_traits<CharT> + ,class Allocator = std::allocator<CharT> > +class basic_string; + +//! Type used to tag that the input range is +//! guaranteed to be ordered +struct ordered_range_t +{}; + +//! Type used to tag that the input range is +//! guaranteed to be ordered and unique +struct ordered_unique_range_t + : public ordered_range_t +{}; + +//! Value used to tag that the input range is +//! guaranteed to be ordered +static const ordered_range_t ordered_range = ordered_range_t(); + +//! Value used to tag that the input range is +//! guaranteed to be ordered and unique +static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); + +/// @cond + +namespace detail_really_deep_namespace { + +//Otherwise, gcc issues a warning of previously defined +//anonymous_instance and unique_instance +struct dummy +{ + dummy() + { + (void)ordered_range; + (void)ordered_unique_range; + } +}; + +} //detail_really_deep_namespace { + +/// @endcond + +}} //namespace boost { namespace container { + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/config_begin.hpp b/3rdParty/Boost/src/boost/container/detail/config_begin.hpp new file mode 100644 index 0000000..83c2cfe --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/config_begin.hpp @@ -0,0 +1,49 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED +#define BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED +#include <boost/config.hpp> + +#endif //BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED + +#ifdef BOOST_MSVC + #ifndef _CRT_SECURE_NO_DEPRECATE + #define BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE + #endif + #pragma warning (push) + #pragma warning (disable : 4702) // unreachable code + #pragma warning (disable : 4706) // assignment within conditional expression + #pragma warning (disable : 4127) // conditional expression is constant + #pragma warning (disable : 4146) // unary minus operator applied to unsigned type, result still unsigned + #pragma warning (disable : 4284) // odd return type for operator-> + #pragma warning (disable : 4244) // possible loss of data + #pragma warning (disable : 4251) // "identifier" : class "type" needs to have dll-interface to be used by clients of class "type2" + #pragma warning (disable : 4267) // conversion from "X" to "Y", possible loss of data + #pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier" + #pragma warning (disable : 4355) // "this" : used in base member initializer list + #pragma warning (disable : 4503) // "identifier" : decorated name length exceeded, name was truncated + #pragma warning (disable : 4511) // copy constructor could not be generated + #pragma warning (disable : 4512) // assignment operator could not be generated + #pragma warning (disable : 4514) // unreferenced inline removed + #pragma warning (disable : 4521) // Disable "multiple copy constructors specified" + #pragma warning (disable : 4522) // "class" : multiple assignment operators specified + #pragma warning (disable : 4675) // "method" should be declared "static" and have exactly one parameter + #pragma warning (disable : 4710) // function not inlined + #pragma warning (disable : 4711) // function selected for automatic inline expansion + #pragma warning (disable : 4786) // identifier truncated in debug info + #pragma warning (disable : 4996) // "function": was declared deprecated + #pragma warning (disable : 4197) // top-level volatile in cast is ignored + #pragma warning (disable : 4541) // 'typeid' used on polymorphic type 'boost::exception' + // with /GR-; unpredictable behavior may result + #pragma warning (disable : 4673) // throwing '' the following types will not be considered at the catch site + #pragma warning (disable : 4671) // the copy constructor is inaccessible + #pragma warning (disable : 4584) // X is already a base-class of Y +#endif //BOOST_MSVC diff --git a/3rdParty/Boost/src/boost/container/detail/config_end.hpp b/3rdParty/Boost/src/boost/container/detail/config_end.hpp new file mode 100644 index 0000000..3451371 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/config_end.hpp @@ -0,0 +1,17 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#if defined BOOST_MSVC + #pragma warning (pop) + #ifdef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #undef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #undef _CRT_SECURE_NO_DEPRECATE + #endif +#endif + diff --git a/3rdParty/Boost/src/boost/container/detail/memory_util.hpp b/3rdParty/Boost/src/boost/container/detail/memory_util.hpp new file mode 100644 index 0000000..c00172c --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/memory_util.hpp @@ -0,0 +1,77 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP +#define BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/container/detail/preprocessor.hpp> +#include <boost/intrusive/detail/has_member_function_callable_with.hpp> + + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 2, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 3, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME max_size +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME select_on_container_copy_construction +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS+1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +namespace boost { +namespace container { +namespace container_detail { + + +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP) diff --git a/3rdParty/Boost/src/boost/container/detail/mpl.hpp b/3rdParty/Boost/src/boost/container/detail/mpl.hpp new file mode 100644 index 0000000..74a1ce0 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/mpl.hpp @@ -0,0 +1,160 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <cstddef> + +namespace boost { +namespace container { +namespace container_detail { + +template <class T, T val> +struct integral_constant +{ + static const T value = val; + typedef integral_constant<T,val> type; +}; + +template< bool C_ > +struct bool_ : integral_constant<bool, C_> +{ + static const bool value = C_; + operator bool() const { return bool_::value; } +}; + +typedef bool_<true> true_; +typedef bool_<false> false_; + +typedef true_ true_type; +typedef false_ false_type; + +typedef char yes_type; +struct no_type +{ + char padding[8]; +}; + +template <bool B, class T = void> +struct enable_if_c { + typedef T type; +}; + +template <class T> +struct enable_if_c<false, T> {}; + +template <class Cond, class T = void> +struct enable_if : public enable_if_c<Cond::value, T> {}; + +template <class Cond, class T = void> +struct disable_if : public enable_if_c<!Cond::value, T> {}; + +template <bool B, class T = void> +struct disable_if_c : public enable_if_c<!B, T> {}; + +template <class T, class U> +class is_convertible +{ + typedef char true_t; + class false_t { char dummy[2]; }; + static true_t dispatch(U); + static false_t dispatch(...); + static T trigger(); + public: + enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; +}; + +template< + bool C + , typename T1 + , typename T2 + > +struct if_c +{ + typedef T1 type; +}; + +template< + typename T1 + , typename T2 + > +struct if_c<false,T1,T2> +{ + typedef T2 type; +}; + +template< + typename T1 + , typename T2 + , typename T3 + > +struct if_ +{ + typedef typename if_c<0 != T1::value, T2, T3>::type type; +}; + + +template <class Pair> +struct select1st +// : public std::unary_function<Pair, typename Pair::first_type> +{ + template<class OtherPair> + const typename Pair::first_type& operator()(const OtherPair& x) const + { return x.first; } + + const typename Pair::first_type& operator()(const typename Pair::first_type& x) const + { return x; } +}; + +// identity is an extension: it is not part of the standard. +template <class T> +struct identity +// : public std::unary_function<T,T> +{ + typedef T type; + const T& operator()(const T& x) const + { return x; } +}; + +template<std::size_t S> +struct ls_zeros +{ + static const std::size_t value = (S & std::size_t(1)) ? 0 : (1u + ls_zeros<(S >> 1u)>::value); +}; + +template<> +struct ls_zeros<0> +{ + static const std::size_t value = 0; +}; + +template<> +struct ls_zeros<1> +{ + static const std::size_t value = 0; +}; + +template <typename T> struct unvoid { typedef T type; }; +template <> struct unvoid<void> { struct type { }; }; +template <> struct unvoid<const void> { struct type { }; }; + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP + diff --git a/3rdParty/Boost/src/boost/container/detail/pair.hpp b/3rdParty/Boost/src/boost/container/detail/pair.hpp new file mode 100644 index 0000000..2a20ed1 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/pair.hpp @@ -0,0 +1,353 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include "config_begin.hpp" +#include <boost/container/detail/workaround.hpp> + +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> + +#include <utility> //std::pair + +#include <boost/move/move.hpp> +#include <boost/type_traits/is_class.hpp> + +#ifndef BOOST_CONTAINER_PERFECT_FORWARDING +#include <boost/container/detail/preprocessor.hpp> +#endif + +namespace boost { +namespace container { +namespace container_detail { + +template <class T1, class T2> +struct pair; + +template <class T> +struct is_pair +{ + static const bool value = false; +}; + +template <class T1, class T2> +struct is_pair< pair<T1, T2> > +{ + static const bool value = true; +}; + +template <class T1, class T2> +struct is_pair< std::pair<T1, T2> > +{ + static const bool value = true; +}; + +struct pair_nat; + +struct piecewise_construct_t { }; +static const piecewise_construct_t piecewise_construct = piecewise_construct_t(); + +/* +template <class T1, class T2> +struct pair +{ + template <class U, class V> pair(pair<U, V>&& p); + template <class... Args1, class... Args2> + pair(piecewise_construct_t, tuple<Args1...> first_args, + tuple<Args2...> second_args); + + template <class U, class V> pair& operator=(const pair<U, V>& p); + pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable<T1>::value && + is_nothrow_move_assignable<T2>::value); + template <class U, class V> pair& operator=(pair<U, V>&& p); + + void swap(pair& p) noexcept(noexcept(swap(first, p.first)) && + noexcept(swap(second, p.second))); +}; + +template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&); +*/ + + +template <class T1, class T2> +struct pair +{ + private: + BOOST_COPYABLE_AND_MOVABLE(pair) + + public: + typedef T1 first_type; + typedef T2 second_type; + + T1 first; + T2 second; + + //Default constructor + pair() + : first(), second() + {} + + //pair copy assignment + pair(const pair& x) + : first(x.first), second(x.second) + {} + + //pair move constructor + pair(BOOST_RV_REF(pair) p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + template <class D, class S> + pair(const pair<D, S> &p) + : first(p.first), second(p.second) + {} + + template <class D, class S> + pair(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + //pair from two values + pair(const T1 &t1, const T2 &t2) + : first(t1) + , second(t2) + {} + + template<class U, class V> + pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v) + : first(::boost::forward<U>(u)) + , second(::boost::forward<V>(v)) + {} + + //And now compatibility with std::pair + pair(const std::pair<T1, T2>& x) + : first(x.first), second(x.second) + {} + + template <class D, class S> + pair(const std::pair<D, S>& p) + : first(p.first), second(p.second) + {} + + pair(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + template <class D, class S> + pair(BOOST_RV_REF_BEG std::pair<D, S> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + //piecewise_construct missing + //template <class U, class V> pair(pair<U, V>&& p); + //template <class... Args1, class... Args2> + // pair(piecewise_construct_t, tuple<Args1...> first_args, + // tuple<Args2...> second_args); +/* + //Variadic versions + template<class U> + pair(BOOST_CONTAINER_PP_PARAM(U, u), typename container_detail::disable_if + < container_detail::is_pair< typename container_detail::remove_ref_const<U>::type >, pair_nat>::type* = 0) + : first(::boost::forward<U>(u)) + , second() + {} + + #ifdef BOOST_CONTAINER_PERFECT_FORWARDING + + template<class U, class V, class ...Args> + pair(U &&u, V &&v) + : first(::boost::forward<U>(u)) + , second(::boost::forward<V>(v), ::boost::forward<Args>(args)...) + {} + + #else + + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class U, BOOST_PP_ENUM_PARAMS(n, class P)> \ + pair(BOOST_CONTAINER_PP_PARAM(U, u) \ + ,BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + : first(::boost::forward<U>(u)) \ + , second(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \ + {} \ + //! + #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif +*/ + //pair copy assignment + pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p) + { + first = p.first; + second = p.second; + return *this; + } + + //pair move assignment + pair& operator=(BOOST_RV_REF(pair) p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + template <class D, class S> + typename ::boost::container::container_detail::enable_if_c + < !(::boost::container::container_detail::is_same<T1, D>::value && + ::boost::container::container_detail::is_same<T2, S>::value) + , pair &>::type + operator=(const pair<D, S>&p) + { + first = p.first; + second = p.second; + return *this; + } + + template <class D, class S> + typename ::boost::container::container_detail::enable_if_c + < !(::boost::container::container_detail::is_same<T1, D>::value && + ::boost::container::container_detail::is_same<T2, S>::value) + , pair &>::type + operator=(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //std::pair copy assignment + pair& operator=(const std::pair<T1, T2> &p) + { + first = p.first; + second = p.second; + return *this; + } + + template <class D, class S> + pair& operator=(const std::pair<D, S> &p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //std::pair move assignment + pair& operator=(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + template <class D, class S> + pair& operator=(BOOST_RV_REF_BEG std::pair<D, S> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //swap + void swap(pair& p) + { + using std::swap; + swap(this->first, p.first); + swap(this->second, p.second); + } +}; + +template <class T1, class T2> +inline bool operator==(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(x.first == y.first && x.second == y.second); } + +template <class T1, class T2> +inline bool operator< (const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(x.first < y.first || + (!(y.first < x.first) && x.second < y.second)); } + +template <class T1, class T2> +inline bool operator!=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(x == y)); } + +template <class T1, class T2> +inline bool operator> (const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return y < x; } + +template <class T1, class T2> +inline bool operator>=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(x < y)); } + +template <class T1, class T2> +inline bool operator<=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(y < x)); } + +template <class T1, class T2> +inline pair<T1, T2> make_pair(T1 x, T2 y) +{ return pair<T1, T2>(x, y); } + +template <class T1, class T2> +inline void swap(pair<T1, T2>& x, pair<T1, T2>& y) +{ + swap(x.first, y.first); + swap(x.second, y.second); +} + +} //namespace container_detail { +} //namespace container { + + +//Without this specialization recursive flat_(multi)map instantiation fails +//because is_enum needs to instantiate the recursive pair, leading to a compilation error). +//This breaks the cycle clearly stating that pair is not an enum avoiding any instantiation. +template<class T> +struct is_enum; + +template<class T, class U> +struct is_enum< ::boost::container::container_detail::pair<T, U> > +{ + static const bool value = false; +}; + +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +template <class T1, class T2> +struct is_class< ::boost::container::container_detail::pair<T1, T2> > + : public ::boost::true_type +{}; + +#ifdef BOOST_NO_RVALUE_REFERENCES + +template<class T1, class T2> +struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> > + : ::boost::true_type +{}; + +#endif + + +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_PAIR_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp b/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp new file mode 100644 index 0000000..5129ea1 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp @@ -0,0 +1,230 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2008-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP +#define BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> + +#ifdef BOOST_CONTAINER_PERFECT_FORWARDING +//#error "This file is not needed when perfect forwarding is available" +#endif //BOOST_CONTAINER_PERFECT_FORWARDING + +#include <boost/preprocessor/iteration/local.hpp> +#include <boost/preprocessor/punctuation/paren_if.hpp> +#include <boost/preprocessor/punctuation/comma_if.hpp> +#include <boost/preprocessor/control/expr_if.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing.hpp> +#include <boost/preprocessor/repetition/enum_shifted_params.hpp> +#include <boost/preprocessor/repetition/enum_shifted.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> +#include <boost/preprocessor/logical/not.hpp> +#include <boost/preprocessor/arithmetic/sub.hpp> +#include <boost/preprocessor/arithmetic/add.hpp> +#include <boost/preprocessor/iteration/iterate.hpp> + +#define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10 + +//Note: +//We define template parameters as const references to +//be able to bind temporaries. After that we will un-const them. +//This cast is ugly but it is necessary until "perfect forwarding" +//is achieved in C++0x. Meanwhile, if we want to be able to +//bind rvalues with non-const references, we have to be ugly +#ifndef BOOST_NO_RVALUE_REFERENCES + #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \ + BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \ + //! +#else + #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \ + const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#define BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q(z, n, Data) \ +const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \ +//! + +#ifndef BOOST_NO_RVALUE_REFERENCES + #define BOOST_CONTAINER_PP_PARAM(U, u) \ + U && u \ + //! +#else + #define BOOST_CONTAINER_PP_PARAM(U, u) \ + const U & u \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#ifndef BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ + //! + +#else //BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#ifndef BOOST_NO_RVALUE_REFERENCES + + #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + namespace boost { + namespace container { + namespace container_detail { + template<class T> + struct ref_holder; + + template<class T> + struct ref_holder<T &> + { + ref_holder(T &t) + : t_(t) + {} + T &t_; + T & get() { return t_; } + }; + + template<class T> + struct ref_holder<const T> + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + }; + + template<class T> + struct ref_holder<const T &&> + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + }; + + template<class T> + struct ref_holder + { + ref_holder(T &&t) + : t_(t) + {} + T &t_; + T && get() { return ::boost::move(t_); } + }; + + template<class T> + struct ref_holder<T &&> + { + ref_holder(T &&t) + : t(t) + {} + T &t; + T && get() { return ::boost::move(t_); } + }; + + } //namespace container_detail { + } //namespace container { + } //namespace boost { + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + ::boost::container::container_detail::ref_holder<BOOST_PP_CAT(P, n)> BOOST_PP_CAT(m_p, n); \ + //! + + #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ + //! + + #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#else //BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \ + //! + +#else //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \ + ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \ + //! + +#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#define BOOST_CONTAINER_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++this->m_p, n) \ +//! + +#define BOOST_CONTAINER_PP_IDENTITY(z, n, data) data + + +#define BOOST_CONTAINER_PP_PARAM_FORWARD(z, n, data) \ +::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ +//! + +#define BOOST_CONTAINER_PP_DECLVAL(z, n, data) \ +::boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \ +//! + +#define BOOST_CONTAINER_PP_MEMBER_IT_FORWARD(z, n, data) \ +BOOST_PP_CAT(*this->m_p, n) \ +//! + +#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data) \ + BOOST_PP_CAT(class P, n) = void \ +//! + +#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT(z, n, default_type) \ + BOOST_PP_CAT(class P, n) = default_type \ +//! + +#define BOOST_CONTAINER_PP_STATIC_PARAM_REF_DECLARE(z, n, data) \ + static BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n); \ +//! + +#define BOOST_CONTAINER_PP_PARAM_PASS(z, n, data) \ + BOOST_PP_CAT(p, n) \ +//! + +#define BOOST_CONTAINER_PP_FWD_TYPE(z, n, data) \ + typename ::boost::move_detail::forward_type< BOOST_PP_CAT(P, n) >::type \ +//! + +#include <boost/container/detail/config_end.hpp> + +//#else + +//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING +//#error "This file is not needed when perfect forwarding is available" +//#endif //BOOST_CONTAINER_PERFECT_FORWARDING + +#endif //#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/type_traits.hpp b/3rdParty/Boost/src/boost/container/detail/type_traits.hpp new file mode 100644 index 0000000..0e096e5 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/type_traits.hpp @@ -0,0 +1,210 @@ +////////////////////////////////////////////////////////////////////////////// +// (C) Copyright John Maddock 2000. +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// 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) +// +// See http://www.boost.org/libs/container for documentation. +// +// The alignment_of implementation comes from John Maddock's boost::alignment_of code +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include "config_begin.hpp" + +#include <boost/move/move.hpp> + +namespace boost { +namespace container { +namespace container_detail { + +struct nat{}; + +template <typename U> +struct LowPriorityConversion +{ + // Convertible from T with user-defined-conversion rank. + LowPriorityConversion(const U&) { } +}; + +//boost::alignment_of yields to 10K lines of preprocessed code, so we +//need an alternative +template <typename T> struct alignment_of; + +template <typename T> +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; + +template <unsigned A, unsigned S> +struct alignment_logic +{ + enum{ value = A < S ? A : S }; +}; + +template< typename T > +struct alignment_of +{ + enum{ value = alignment_logic + < sizeof(alignment_of_hack<T>) - sizeof(T) + , sizeof(T)>::value }; +}; + +//This is not standard, but should work with all compilers +union max_align +{ + char char_; + short short_; + int int_; + long long_; + #ifdef BOOST_HAS_LONG_LONG + long long long_long_; + #endif + float float_; + double double_; + long double long_double_; + void * void_ptr_; +}; + +template<class T> +struct remove_reference +{ + typedef T type; +}; + +template<class T> +struct remove_reference<T&> +{ + typedef T type; +}; + +#ifndef BOOST_NO_RVALUE_REFERENCES + +template<class T> +struct remove_reference<T&&> +{ + typedef T type; +}; + +#else + +template<class T> +struct remove_reference< ::boost::rv<T> > +{ + typedef T type; +}; + +#endif + +template<class T> +struct is_reference +{ + enum { value = false }; +}; + +template<class T> +struct is_reference<T&> +{ + enum { value = true }; +}; + +template<class T> +struct is_pointer +{ + enum { value = false }; +}; + +template<class T> +struct is_pointer<T*> +{ + enum { value = true }; +}; + +template <typename T> +struct add_reference +{ + typedef T& type; +}; + +template<class T> +struct add_reference<T&> +{ + typedef T& type; +}; + +template<> +struct add_reference<void> +{ + typedef nat &type; +}; + +template<> +struct add_reference<const void> +{ + typedef const nat &type; +}; + +template <class T> +struct add_const_reference +{ typedef const T &type; }; + +template <class T> +struct add_const_reference<T&> +{ typedef T& type; }; + +template <typename T, typename U> +struct is_same +{ + typedef char yes_type; + struct no_type + { + char padding[8]; + }; + + template <typename V> + static yes_type is_same_tester(V*, V*); + static no_type is_same_tester(...); + + static T *t; + static U *u; + + static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u)); +}; + +template<class T> +struct remove_const +{ + typedef T type; +}; + +template<class T> +struct remove_const< const T> +{ + typedef T type; +}; + +template<class T> +struct remove_ref_const +{ + typedef typename remove_const< typename remove_reference<T>::type >::type type; +}; + +} // namespace container_detail +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/utilities.hpp b/3rdParty/Boost/src/boost/container/detail/utilities.hpp new file mode 100644 index 0000000..ece9a2e --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/utilities.hpp @@ -0,0 +1,252 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP + +#include "config_begin.hpp" +#include <cstdio> +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_member_pointer.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/move/move.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/allocator_traits.hpp> +#include <algorithm> + +namespace boost { +namespace container { +namespace container_detail { + +template <typename T> +inline T* addressof(T& obj) +{ + return static_cast<T*>( + static_cast<void*>( + const_cast<char*>( + &reinterpret_cast<const char&>(obj) + ))); +} + +template<class T> +const T &max_value(const T &a, const T &b) +{ return a > b ? a : b; } + +template<class T> +const T &min_value(const T &a, const T &b) +{ return a < b ? a : b; } + +template <class SizeType> +SizeType + get_next_capacity(const SizeType max_size + ,const SizeType capacity + ,const SizeType n) +{ +// if (n > max_size - capacity) +// throw std::length_error("get_next_capacity"); + + const SizeType m3 = max_size/3; + + if (capacity < m3) + return capacity + max_value(3*(capacity+1)/5, n); + + if (capacity < m3*2) + return capacity + max_value((capacity+1)/2, n); + + return max_size; +} + +template <class T> +inline T* to_raw_pointer(T* p) +{ return p; } + +template <class Pointer> +inline typename Pointer::element_type* + to_raw_pointer(const Pointer &p) +{ return boost::container::container_detail::to_raw_pointer(p.operator->()); } + +//!To avoid ADL problems with swap +template <class T> +inline void do_swap(T& x, T& y) +{ + using std::swap; + swap(x, y); +} + +template<class AllocatorType> +inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +{ container_detail::do_swap(l, r); } + +template<class AllocatorType> +inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void assign_alloc(AllocatorType &l, const AllocatorType &r, container_detail::true_type) +{ l = r; } + +template<class AllocatorType> +inline void move_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void move_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +{ l = ::boost::move(r); } + +//Rounds "orig_size" by excess to round_to bytes +template<class SizeType> +inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to) +{ + return ((orig_size-1)/round_to+1)*round_to; +} + +template <std::size_t OrigSize, std::size_t RoundTo> +struct ct_rounded_size +{ + enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo }; +}; + +template<class T> +struct move_const_ref_type + : if_c +// < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value || ::boost::is_member_pointer<T>::value || ::boost::is_enum<T>::value + < !::boost::is_class<T>::value + ,const T & + ,BOOST_CATCH_CONST_RLVALUE(T) + > +{}; + +} //namespace container_detail { + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_move_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, boost::move(*first)); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move_alloc(A &a, I f, I l, F r) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f)); + ++f; ++r; + } + return r; +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, *first); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_copy_alloc(A &a, I f, I l, F r) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f); + ++f; ++r; + } + return r; +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, *first); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename F, // F models ForwardIterator + typename T> +void uninitialized_fill_alloc(A &a, F f, F l, const T &t) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*f), t); + ++f; + } +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_or_move_alloc +// +////////////////////////////////////////////////////////////////////////////// + +template +<typename A +,typename I // I models InputIterator +,typename F> // F models ForwardIterator +F uninitialized_copy_or_move_alloc + (A &a, I f, I l, F r + ,typename boost::container::container_detail::enable_if + < boost::move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::container::uninitialized_move_alloc(a, f, l, r); +} + +template +<typename A +,typename I // I models InputIterator +,typename F> // F models ForwardIterator +F uninitialized_copy_or_move_alloc + (A &a, I f, I l, F r + ,typename boost::container::container_detail::disable_if + < boost::move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::container::uninitialized_copy_alloc(a, f, l, r); +} + + +} //namespace container { +} //namespace boost { + + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/workaround.hpp b/3rdParty/Boost/src/boost/container/detail/workaround.hpp new file mode 100644 index 0000000..7838a5d --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/workaround.hpp @@ -0,0 +1,40 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#define BOOST_CONTAINER_DETAIL_WORKAROUND_HPP + +#include <boost/container/detail/config_begin.hpp> + +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\ + && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) + #define BOOST_CONTAINER_PERFECT_FORWARDING +#endif + +#if defined(BOOST_NO_NOEXCEPT) + #define BOOST_CONTAINER_NOEXCEPT + #define BOOST_CONTAINER_NOEXCEPT_IF(x) +#else + #define BOOST_CONTAINER_NOEXCEPT noexcept + #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x) +#endif + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\ + && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700) + #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST +#endif + +//Macros for documentation purposes. For code, expands to the argument +#define BOOST_CONTAINER_IMPDEF(TYPE) TYPE +#define BOOST_CONTAINER_SEEDOC(TYPE) TYPE + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP diff --git a/3rdParty/Boost/src/boost/container/scoped_allocator.hpp b/3rdParty/Boost/src/boost/container/scoped_allocator.hpp new file mode 100644 index 0000000..5111d37 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/scoped_allocator.hpp @@ -0,0 +1,1466 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP +#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP + +#if (defined MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/container/scoped_allocator_fwd.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/container/allocator_traits.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/detail/utilities.hpp> +#include <utility> +#include <boost/container/detail/pair.hpp> +#include <boost/move/move.hpp> + + +namespace boost { namespace container { + +//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed +//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the +//! copy and move constructors) should have a variant that accepts a final argument of +//! allocator_type. +//! +//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type, +//! allocator_type and at least one constructor for which allocator_type is the last +//! parameter. If not all constructors of T can be called with a final allocator_type argument, +//! and if T is used in a context where a container must call such a constructor, then the program is +//! ill-formed. +//! +//! [Example: +//! template <class T, class Allocator = allocator<T> > +//! class Z { +//! public: +//! typedef Allocator allocator_type; +//! +//! // Default constructor with optional allocator suffix +//! Z(const allocator_type& a = allocator_type()); +//! +//! // Copy constructor and allocator-extended copy constructor +//! Z(const Z& zz); +//! Z(const Z& zz, const allocator_type& a); +//! }; +//! +//! // Specialize trait for class template Z +//! template <class T, class Allocator = allocator<T> > +//! struct constructible_with_allocator_suffix<Z<T,Allocator> > +//! : ::boost::true_type { }; +//! -- end example] +//! +//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" +//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as +//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. +//! Applications aiming portability with several compilers should always define this trait. +//! +//! In conforming C++11 compilers or compilers supporting SFINAE expressions +//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used +//! to detect if a type should be constructed with suffix or prefix allocator arguments. +template <class T> +struct constructible_with_allocator_suffix + : ::boost::false_type +{}; + +//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed +//! with allocator_arg and T::allocator_type as its first two constructor arguments. +//! Ideally, all constructors of T (including the copy and move constructors) should have a variant +//! that accepts these two initial arguments. +//! +//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type, +//! allocator_type and at least one constructor for which allocator_arg_t is the first +//! parameter and allocator_type is the second parameter. If not all constructors of T can be +//! called with these initial arguments, and if T is used in a context where a container must call such +//! a constructor, then the program is ill-formed. +//! +//! [Example: +//! template <class T, class Allocator = allocator<T> > +//! class Y { +//! public: +//! typedef Allocator allocator_type; +//! +//! // Default constructor with and allocator-extended default constructor +//! Y(); +//! Y(allocator_arg_t, const allocator_type& a); +//! +//! // Copy constructor and allocator-extended copy constructor +//! Y(const Y& yy); +//! Y(allocator_arg_t, const allocator_type& a, const Y& yy); +//! +//! // Variadic constructor and allocator-extended variadic constructor +//! template<class ...Args> Y(Args&& args...); +//! template<class ...Args> +//! Y(allocator_arg_t, const allocator_type& a, Args&&... args); +//! }; +//! +//! // Specialize trait for class template Y +//! template <class T, class Allocator = allocator<T> > +//! struct constructible_with_allocator_prefix<Y<T,Allocator> > +//! : ::boost::true_type { }; +//! +//! -- end example] +//! +//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" +//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as +//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. +//! Applications aiming portability with several compilers should always define this trait. +//! +//! In conforming C++11 compilers or compilers supporting SFINAE expressions +//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used +//! to detect if a type should be constructed with suffix or prefix allocator arguments. +template <class T> +struct constructible_with_allocator_prefix + : ::boost::false_type +{}; + +///@cond + +namespace container_detail { + +template<typename T, typename Alloc> +struct uses_allocator_imp +{ + // Use SFINAE (Substitution Failure Is Not An Error) to detect the + // presence of an 'allocator_type' nested type convertilble from Alloc. + + private: + // Match this function if TypeT::allocator_type exists and is + // implicitly convertible from Alloc + template <typename U> + static char test(int, typename U::allocator_type); + + // Match this function if TypeT::allocator_type does not exist or is + // not convertible from Alloc. + template <typename U> + static int test(LowPriorityConversion<int>, LowPriorityConversion<Alloc>); + + static Alloc alloc; // Declared but not defined + + public: + enum { value = sizeof(test<T>(0, alloc)) == sizeof(char) }; +}; + +} //namespace container_detail { + +///@endcond + +//! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from +//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may +//! specialize this type to derive from true_type for a T of user-defined type if T does not +//! have a nested allocator_type but is nonetheless constructible using the specified Alloc. +//! +//! <b>Result</b>: derived from true_type if Convertible<Alloc,T::allocator_type> and +//! derived from false_type otherwise. +template <typename T, typename Alloc> +struct uses_allocator + : boost::integral_constant<bool, container_detail::uses_allocator_imp<T, Alloc>::value> +{}; + +///@cond + +namespace container_detail { + +template <typename Alloc> +struct is_scoped_allocator_imp +{ + template <typename T> + static char test(int, typename T::outer_allocator_type*); + + template <typename T> + static int test(LowPriorityConversion<int>, void*); + + static const bool value = (sizeof(char) == sizeof(test<Alloc>(0, 0))); +}; + +template<class MaybeScopedAlloc, bool = is_scoped_allocator_imp<MaybeScopedAlloc>::value > +struct outermost_allocator_type_impl +{ + typedef typename MaybeScopedAlloc::outer_allocator_type outer_type; + typedef typename outermost_allocator_type_impl<outer_type>::type type; +}; + +template<class MaybeScopedAlloc> +struct outermost_allocator_type_impl<MaybeScopedAlloc, false> +{ + typedef MaybeScopedAlloc type; +}; + +template<class MaybeScopedAlloc, bool = is_scoped_allocator_imp<MaybeScopedAlloc>::value > +struct outermost_allocator_imp +{ + typedef MaybeScopedAlloc type; + + static type &get(MaybeScopedAlloc &a) + { return a; } + + static const type &get(const MaybeScopedAlloc &a) + { return a; } +}; + +template<class MaybeScopedAlloc> +struct outermost_allocator_imp<MaybeScopedAlloc, true> +{ + typedef typename MaybeScopedAlloc::outer_allocator_type outer_type; + typedef typename outermost_allocator_type_impl<outer_type>::type type; + + static type &get(MaybeScopedAlloc &a) + { return outermost_allocator_imp<outer_type>::get(a.outer_allocator()); } + + static const type &get(const MaybeScopedAlloc &a) + { return outermost_allocator_imp<outer_type>::get(a.outer_allocator()); } +}; + +} //namespace container_detail { + +template <typename Alloc> +struct is_scoped_allocator + : boost::integral_constant<bool, container_detail::is_scoped_allocator_imp<Alloc>::value> +{}; + +template <typename Alloc> +struct outermost_allocator + : container_detail::outermost_allocator_imp<Alloc> +{}; + +template <typename Alloc> +typename container_detail::outermost_allocator_imp<Alloc>::type & + get_outermost_allocator(Alloc &a) +{ return container_detail::outermost_allocator_imp<Alloc>::get(a); } + +template <typename Alloc> +const typename container_detail::outermost_allocator_imp<Alloc>::type & + get_outermost_allocator(const Alloc &a) +{ return container_detail::outermost_allocator_imp<Alloc>::get(a); } + +namespace container_detail { + +// Check if we can detect is_convertible using advanced SFINAE expressions +#if !defined(BOOST_NO_SFINAE_EXPR) + + //! Code inspired by Mathias Gaunard's is_convertible.cpp found in the Boost mailing list + //! http://boost.2283326.n4.nabble.com/type-traits-is-constructible-when-decltype-is-supported-td3575452.html + //! Thanks Mathias! + + //With variadic templates, we need a single class to implement the trait + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template<class T, class ...Args> + struct is_constructible_impl + { + typedef char yes_type; + struct no_type + { char padding[2]; }; + + template<std::size_t N> + struct dummy; + + template<class X> + static yes_type test(dummy<sizeof(X(boost::move_detail::declval<Args>()...))>*); + + template<class X> + static no_type test(...); + + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); + }; + + template<class T, class ...Args> + struct is_constructible + : boost::integral_constant<bool, is_constructible_impl<T, Args...>::value> + {}; + + template <class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_prefix + : is_constructible<T, allocator_arg_t, InnerAlloc, Args...> + {}; + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + //Without variadic templates, we need to use de preprocessor to generate + //some specializations. + + #define BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS \ + BOOST_PP_ADD(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, 3) + //! + + //Generate N+1 template parameters so that we can specialize N + template<class T + BOOST_PP_ENUM_TRAILING( BOOST_PP_ADD(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_impl; + + //Generate N specializations, from 0 to + //BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS parameters + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)> \ + struct is_constructible_impl \ + <T BOOST_PP_ENUM_TRAILING_PARAMS(n, P) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, void) \ + , void> \ + { \ + typedef char yes_type; \ + struct no_type \ + { char padding[2]; }; \ + \ + template<std::size_t N> \ + struct dummy; \ + \ + template<class X> \ + static yes_type test(dummy<sizeof(X(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_DECLVAL, ~)))>*); \ + \ + template<class X> \ + static no_type test(...); \ + \ + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); \ + }; \ + //! + + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + //Finally just inherit from the implementation to define he trait + template< class T + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible + : boost::integral_constant + < bool + , is_constructible_impl + < T + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, P) + , void>::value + > + {}; + + //Finally just inherit from the implementation to define he trait + template <class T + ,class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_prefix + : is_constructible + < T, allocator_arg_t, InnerAlloc + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2), P) + > + {}; +/* + template <class T + ,class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_suffix + : is_constructible + < T + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1), P) + , InnerAlloc + > + {};*/ + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#else // #if !defined(BOOST_NO_SFINAE_EXPR) + + //Without advanced SFINAE expressions, we can't use is_constructible + //so backup to constructible_with_allocator_xxx + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template < class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_prefix + : constructible_with_allocator_prefix<T> + {}; +/* + template < class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_suffix + : constructible_with_allocator_suffix<T> + {};*/ + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template < class T + , class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_prefix + : constructible_with_allocator_prefix<T> + {}; +/* + template < class T + , class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_suffix + : constructible_with_allocator_suffix<T> + {};*/ + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#endif // #if !defined(BOOST_NO_SFINAE_EXPR) + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_allocator_prefix_suffix + ( boost::true_type use_alloc_prefix, OutermostAlloc& outermost_alloc + , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args) ...args) +{ + (void)use_alloc_prefix; + allocator_traits<OutermostAlloc>::construct + ( outermost_alloc, p, allocator_arg, inner_alloc, ::boost::forward<Args>(args)...); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_allocator_prefix_suffix + ( boost::false_type use_alloc_prefix, OutermostAlloc& outermost_alloc + , InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args) +{ + (void)use_alloc_prefix; + allocator_traits<OutermostAlloc>::construct + (outermost_alloc, p, ::boost::forward<Args>(args)..., inner_alloc); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_uses_allocator + ( boost::true_type uses_allocator, OutermostAlloc& outermost_alloc + , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args)...args) +{ + (void)uses_allocator; + //BOOST_STATIC_ASSERT((is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>::value || + // is_constructible_with_allocator_suffix<T, InnerAlloc, Args...>::value )); + dispatch_allocator_prefix_suffix + ( is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>() + , outermost_alloc, inner_alloc, p, ::boost::forward<Args>(args)...); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_uses_allocator + ( boost::false_type uses_allocator, OutermostAlloc & outermost_alloc + , InnerAlloc & inner_alloc + ,T* p, BOOST_FWD_REF(Args)...args) +{ + (void)uses_allocator; (void)inner_alloc; + allocator_traits<OutermostAlloc>::construct + (outermost_alloc, p, ::boost::forward<Args>(args)...); +} + +#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#define BOOST_PP_LOCAL_MACRO(n) \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_allocator_prefix_suffix( \ + boost::true_type use_alloc_prefix, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)use_alloc_prefix, \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p, allocator_arg, inner_alloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_allocator_prefix_suffix( \ + boost::false_type use_alloc_prefix, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)use_alloc_prefix; \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \ + , inner_alloc); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_uses_allocator(boost::true_type uses_allocator, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)uses_allocator; \ + dispatch_allocator_prefix_suffix \ + (is_constructible_with_allocator_prefix \ + < T, InnerAlloc BOOST_PP_ENUM_TRAILING_PARAMS(n, P)>() \ + , outermost_alloc, inner_alloc, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_uses_allocator(boost::false_type uses_allocator \ + ,OutermostAlloc & outermost_alloc \ + ,InnerAlloc & inner_alloc \ + ,T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)uses_allocator; (void)inner_alloc; \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ +//! +#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) +#include BOOST_PP_LOCAL_ITERATE() + +#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template <typename OuterAlloc, class ...InnerAllocs> +class scoped_allocator_adaptor_base + : public OuterAlloc +{ + typedef allocator_traits<OuterAlloc> outer_traits_type; + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) + + public: + template <class OuterA2> + struct rebind_base + { + typedef scoped_allocator_adaptor_base<OuterA2, InnerAllocs...> other; + }; + + typedef OuterAlloc outer_allocator_type; + typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_copy_assignment::value || + inner_allocator_type::propagate_on_container_copy_assignment::value + > propagate_on_container_copy_assignment; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_move_assignment::value || + inner_allocator_type::propagate_on_container_move_assignment::value + > propagate_on_container_move_assignment; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_swap::value || + inner_allocator_type::propagate_on_container_swap::value + > propagate_on_container_swap; + + scoped_allocator_adaptor_base() + {} + + template <class OuterA2> + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs &...args) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + , m_inner(args...) + {} + + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + : outer_allocator_type(::boost::move(other.outer_allocator())) + , m_inner(::boost::move(other.inner_allocator())) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (const scoped_allocator_adaptor_base<OuterA2, InnerAllocs...>& other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base + <OuterA2, InnerAllocs...> BOOST_RV_REF_END other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + protected: + struct internal_type_t{}; + + template <class OuterA2> + scoped_allocator_adaptor_base + ( internal_type_t + , BOOST_FWD_REF(OuterA2) outerAlloc + , const inner_allocator_type &inner) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + , m_inner(inner) + {} + + public: + + scoped_allocator_adaptor_base &operator= + (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(other.outer_allocator()); + m_inner = other.inner_allocator(); + return *this; + } + + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(boost::move(other.outer_allocator())); + m_inner = ::boost::move(other.inner_allocator()); + return *this; + } + + inner_allocator_type& inner_allocator() + { return m_inner; } + + inner_allocator_type const& inner_allocator() const + { return m_inner; } + + outer_allocator_type & outer_allocator() + { return static_cast<outer_allocator_type&>(*this); } + + const outer_allocator_type &outer_allocator() const + { return static_cast<const outer_allocator_type&>(*this); } + + private: + inner_allocator_type m_inner; +}; + +#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +//Let's add a dummy first template parameter to allow creating +//specializations up to maximum InnerAlloc count +template < + typename OuterAlloc + , bool Dummy + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + > +class scoped_allocator_adaptor_base; + +//Specializations for the adaptor with InnerAlloc allocators + +#define BOOST_PP_LOCAL_MACRO(n) \ +template <typename OuterAlloc \ +BOOST_PP_ENUM_TRAILING_PARAMS(n, class Q) \ +> \ +class scoped_allocator_adaptor_base<OuterAlloc, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > \ + : public OuterAlloc \ +{ \ + typedef allocator_traits<OuterAlloc> outer_traits_type; \ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) \ + \ + public: \ + template <class OuterA2> \ + struct rebind_base \ + { \ + typedef scoped_allocator_adaptor_base<OuterA2, true BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > other; \ + }; \ + \ + typedef OuterAlloc outer_allocator_type; \ + typedef scoped_allocator_adaptor<BOOST_PP_ENUM_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > inner_allocator_type; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_copy_assignment::value || \ + inner_allocator_type::propagate_on_container_copy_assignment::value \ + > propagate_on_container_copy_assignment; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_move_assignment::value || \ + inner_allocator_type::propagate_on_container_move_assignment::value \ + > propagate_on_container_move_assignment; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_swap::value || \ + inner_allocator_type::propagate_on_container_swap::value \ + > propagate_on_container_swap; \ + \ + scoped_allocator_adaptor_base() \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _)) \ + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) \ + , m_inner(BOOST_PP_ENUM_PARAMS(n, q)) \ + {} \ + \ + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) \ + : outer_allocator_type(::boost::move(other.outer_allocator())) \ + , m_inner(::boost::move(other.inner_allocator())) \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base<OuterA2, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + >& other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base \ + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base<OuterA2, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > BOOST_RV_REF_END other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + protected: \ + struct internal_type_t{}; \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base \ + ( internal_type_t \ + , BOOST_FWD_REF(OuterA2) outerAlloc \ + , const inner_allocator_type &inner) \ + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) \ + , m_inner(inner) \ + {} \ + \ + public: \ + scoped_allocator_adaptor_base &operator= \ + (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) \ + { \ + outer_allocator_type::operator=(other.outer_allocator()); \ + m_inner = other.inner_allocator(); \ + return *this; \ + } \ + \ + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) \ + { \ + outer_allocator_type::operator=(boost::move(other.outer_allocator())); \ + m_inner = ::boost::move(other.inner_allocator()); \ + return *this; \ + } \ + \ + inner_allocator_type& inner_allocator() \ + { return m_inner; } \ + \ + inner_allocator_type const& inner_allocator() const \ + { return m_inner; } \ + \ + outer_allocator_type & outer_allocator() \ + { return static_cast<outer_allocator_type&>(*this); } \ + \ + const outer_allocator_type &outer_allocator() const \ + { return static_cast<const outer_allocator_type&>(*this); } \ + \ + private: \ + inner_allocator_type m_inner; \ +}; \ +//! +#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) +#include BOOST_PP_LOCAL_ITERATE() + +#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +//Specialization for adaptor without any InnerAlloc +template <typename OuterAlloc> +class scoped_allocator_adaptor_base + < OuterAlloc + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, nat) + #endif + > + : public OuterAlloc +{ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) + public: + + template <class U> + struct rebind_base + { + typedef scoped_allocator_adaptor_base + <typename allocator_traits<OuterAlloc>::template portable_rebind_alloc<U>::type + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + > other; + }; + + typedef OuterAlloc outer_allocator_type; + typedef allocator_traits<OuterAlloc> outer_traits_type; + typedef scoped_allocator_adaptor<OuterAlloc> inner_allocator_type; + typedef typename outer_traits_type:: + propagate_on_container_copy_assignment propagate_on_container_copy_assignment; + typedef typename outer_traits_type:: + propagate_on_container_move_assignment propagate_on_container_move_assignment; + typedef typename outer_traits_type:: + propagate_on_container_swap propagate_on_container_swap; + + scoped_allocator_adaptor_base() + {} + + template <class OuterA2> + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + {} + + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) + : outer_allocator_type(other.outer_allocator()) + {} + + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + : outer_allocator_type(::boost::move(other.outer_allocator())) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (const scoped_allocator_adaptor_base< + OuterA2 + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + >& other) + : outer_allocator_type(other.outer_allocator()) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base< + OuterA2 + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + > BOOST_RV_REF_END other) + : outer_allocator_type(other.outer_allocator()) + {} + + protected: + struct internal_type_t{}; + + template <class OuterA2> + scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + {} + + public: + scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(other.outer_allocator()); + return *this; + } + + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(boost::move(other.outer_allocator())); + return *this; + } + + inner_allocator_type& inner_allocator() + { return static_cast<inner_allocator_type&>(*this); } + + inner_allocator_type const& inner_allocator() const + { return static_cast<const inner_allocator_type&>(*this); } + + outer_allocator_type & outer_allocator() + { return static_cast<outer_allocator_type&>(*this); } + + const outer_allocator_type &outer_allocator() const + { return static_cast<const outer_allocator_type&>(*this); } +}; + +} //namespace container_detail { + +///@endcond + +//Scoped allocator +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + //! This class is a C++03-compatible implementation of std::scoped_allocator_adaptor. + //! The class template scoped_allocator_adaptor is an allocator template that specifies + //! the memory resource (the outer allocator) to be used by a container (as any other + //! allocator does) and also specifies an inner allocator resource to be passed to + //! the constructor of every element within the container. + //! + //! This adaptor is + //! instantiated with one outer and zero or more inner allocator types. If + //! instantiated with only one allocator type, the inner allocator becomes the + //! scoped_allocator_adaptor itself, thus using the same allocator resource for the + //! container and every element within the container and, if the elements themselves + //! are containers, each of their elements recursively. If instantiated with more than + //! one allocator, the first allocator is the outer allocator for use by the container, + //! the second allocator is passed to the constructors of the container's elements, + //! and, if the elements themselves are containers, the third allocator is passed to + //! the elements' elements, and so on. If containers are nested to a depth greater + //! than the number of allocators, the last allocator is used repeatedly, as in the + //! single-allocator case, for any remaining recursions. + //! + //! [<b>Note</b>: The + //! scoped_allocator_adaptor is derived from the outer allocator type so it can be + //! substituted for the outer allocator type in most expressions. -end note] + //! + //! In the construct member functions, `OUTERMOST(x)` is x if x does not have + //! an `outer_allocator()` member function and + //! `OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)` is + //! `allocator_traits<decltype(OUTERMOST(x))>`. + //! + //! [<b>Note</b>: `OUTERMOST(x)` and + //! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon + //! the definition of `outer_allocator()` to ensure that the recursion terminates. + //! It will terminate for all instantiations of scoped_allocator_adaptor. -end note] + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor + + #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor<OuterAlloc, InnerAllocs...> + + #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + +#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +template <typename OuterAlloc + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + > +class scoped_allocator_adaptor +#endif + : public container_detail::scoped_allocator_adaptor_base + <OuterAlloc + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + , true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > +{ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor) + + public: + /// @cond + typedef container_detail::scoped_allocator_adaptor_base + <OuterAlloc + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + , true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > base_type; + typedef typename base_type::internal_type_t internal_type_t; + /// @endcond + typedef OuterAlloc outer_allocator_type; + //! Type: For exposition only + //! + typedef allocator_traits<OuterAlloc> outer_traits_type; + //! Type: `scoped_allocator_adaptor<OuterAlloc>` if `sizeof...(InnerAllocs)` is zero; otherwise, + //! `scoped_allocator_adaptor<InnerAllocs...>`. + typedef typename base_type::inner_allocator_type inner_allocator_type; + typedef typename outer_traits_type::value_type value_type; + typedef typename outer_traits_type::size_type size_type; + typedef typename outer_traits_type::difference_type difference_type; + typedef typename outer_traits_type::pointer pointer; + typedef typename outer_traits_type::const_pointer const_pointer; + typedef typename outer_traits_type::void_pointer void_pointer; + typedef typename outer_traits_type::const_void_pointer const_void_pointer; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_copy_assignment::value` is + //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_copy_assignment propagate_on_container_copy_assignment; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_move_assignment::value` is + //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_move_assignment propagate_on_container_move_assignment; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_swap::value` is true for any + //! `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_swap propagate_on_container_swap; + + //! Type: Rebinds scoped allocator to + //! `typedef scoped_allocator_adaptor + //! < typename outer_traits_type::template portable_rebind_alloc<U>::type + //! , InnerAllocs... >` + template <class U> + struct rebind + { + typedef scoped_allocator_adaptor + < typename outer_traits_type::template portable_rebind_alloc<U>::type + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > other; + }; + + //! <b>Effects</b>: value-initializes the OuterAlloc base class + //! and the inner allocator object. + scoped_allocator_adaptor() + {} + + ~scoped_allocator_adaptor() + {} + + //! <b>Effects</b>: initializes each allocator within the adaptor with + //! the corresponding allocator from other. + scoped_allocator_adaptor(const scoped_allocator_adaptor& other) + : base_type(other.base()) + {} + + //! <b>Effects</b>: move constructs each allocator within the adaptor with + //! the corresponding allocator from other. + scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other) + : base_type(::boost::move(other.base())) + {} + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes the OuterAlloc base class with boost::forward<OuterA2>(outerAlloc) and inner + //! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the + //! corresponding allocator from the argument list). + template <class OuterA2> + scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs) + : base_type(::boost::forward<OuterA2>(outerAlloc), innerAllocs...) + {} + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + #define BOOST_PP_LOCAL_MACRO(n) \ + template <class OuterA2> \ + scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _)) \ + : base_type(::boost::forward<OuterA2>(outerAlloc) \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, q) \ + ) \ + {} \ + //! + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator from other. + template <class OuterA2> + scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > &other) + : base_type(other.base()) + {} + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator + //! rvalue from other. + template <class OuterA2> + scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > BOOST_RV_REF_END other) + : base_type(::boost::move(other.base())) + {} + + scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other) + { + base_type::operator=(static_cast<const base_type &>(other)); + return *this; + } + + scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other) + { + base_type::operator=(boost::move(static_cast<scoped_allocator_adaptor&>(other))); + return *this; + } + + //! <b>Returns</b>: + //! `static_cast<OuterAlloc&>(*this)`. + outer_allocator_type & outer_allocator() + { return *this; } + + //! <b>Returns</b>: + //! `static_cast<const OuterAlloc&>(*this)`. + const outer_allocator_type &outer_allocator() const + { return *this; } + + //! <b>Returns</b>: + //! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner. + inner_allocator_type& inner_allocator() + { return base_type::inner_allocator(); } + + //! <b>Returns</b>: + //! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner. + inner_allocator_type const& inner_allocator() const + { return base_type::inner_allocator(); } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::max_size(outer_allocator())`. + size_type max_size() const + { + return outer_traits_type::max_size(this->outer_allocator()); + } + + //! <b>Effects</b>: + //! calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`. + template <class T> + void destroy(T* p) + { + allocator_traits<typename outermost_allocator<OuterAlloc>::type> + ::destroy(get_outermost_allocator(this->outer_allocator()), p); + } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`. + pointer allocate(size_type n) + { + return outer_traits_type::allocate(this->outer_allocator(), n); + } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`. + pointer allocate(size_type n, const_void_pointer hint) + { + return outer_traits_type::allocate(this->outer_allocator(), n, hint); + } + + //! <b>Effects</b>: + //! `allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n)`. + void deallocate(pointer p, size_type n) + { + outer_traits_type::deallocate(this->outer_allocator(), p, n); + } + + //! <b>Returns</b>: Allocator new scoped_allocator_adaptor object where each allocator + //! A in the adaptor is initialized from the result of calling + //! `allocator_traits<Allocator>::select_on_container_copy_construction()` on + //! the corresponding allocator in *this. + scoped_allocator_adaptor select_on_container_copy_construction() const + { + return scoped_allocator_adaptor + (internal_type_t() + ,outer_traits_type::select_on_container_copy_construction(this->outer_allocator()) + ,outer_traits_type::select_on_container_copy_construction(this->inner_allocator()) + ); + } + /// @cond + base_type &base() { return *this; } + + const base_type &base() const { return *this; } + /// @endcond + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Effects</b>: + //! 1) If `uses_allocator<T, inner_allocator_type>::value` is false calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct + //! (OUTERMOST(*this), p, std::forward<Args>(args)...)`. + //! + //! 2) Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is true and + //! `is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value` is true, calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg, + //! inner_allocator(), std::forward<Args>(args)...)`. + //! + //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't + //! be implemented so that condition will be replaced by + //! constructible_with_allocator_prefix<T>::value. -end note] + //! + //! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and + //! `is_constructible<T, Args..., inner_allocator_type>::value` is true, calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, + //! std::forward<Args>(args)..., inner_allocator())`. + //! + //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't be + //! implemented so that condition will be replaced by + //! `constructible_with_allocator_suffix<T>::value`. -end note] + //! + //! 4) Otherwise, the program is ill-formed. + //! + //! [<b>Note</b>: An error will result if `uses_allocator` evaluates + //! to true but the specific constructor does not take an allocator. This definition prevents a silent + //! failure to pass an inner allocator to a contained element. -end note] + template < typename T, class ...Args> + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + void + #else + typename container_detail::enable_if_c<!container_detail::is_pair<T>::value, void>::type + #endif + construct(T* p, BOOST_FWD_REF(Args)...args) + { + container_detail::dispatch_uses_allocator + ( uses_allocator<T, inner_allocator_type>() + , get_outermost_allocator(this->outer_allocator()) + , this->inner_allocator() + , p, ::boost::forward<Args>(args)...); + } + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //Disable this overload if the first argument is pair as some compilers have + //overload selection problems when the first parameter is a pair. + #define BOOST_PP_LOCAL_MACRO(n) \ + template < typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ + typename container_detail::enable_if_c<!container_detail::is_pair<T>::value, void>::type \ + construct(T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + { \ + container_detail::dispatch_uses_allocator \ + ( uses_allocator<T, inner_allocator_type>() \ + , get_outermost_allocator(this->outer_allocator()) \ + , this->inner_allocator() \ + , p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ + } \ + //! + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + template <class T1, class T2> + void construct(std::pair<T1,T2>* p) + { this->construct_pair(p); } + + template <class T1, class T2> + void construct(container_detail::pair<T1,T2>* p) + { this->construct_pair(p); } + + template <class T1, class T2, class U, class V> + void construct(std::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); } + + template <class T1, class T2, class U, class V> + void construct(container_detail::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); } + + template <class T1, class T2, class U, class V> + void construct(std::pair<T1, T2>* p, const std::pair<U, V>& x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( container_detail::pair<T1, T2>* p + , const container_detail::pair<U, V>& x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( std::pair<T1, T2>* p + , BOOST_RV_REF_BEG std::pair<U, V> BOOST_RV_REF_END x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( container_detail::pair<T1, T2>* p + , BOOST_RV_REF_BEG container_detail::pair<U, V> BOOST_RV_REF_END x) + { this->construct_pair(p, x); } + + /// @cond + private: + template <class Pair> + void construct_pair(Pair* p) + { + this->construct(container_detail::addressof(p->first)); + try { + this->construct(container_detail::addressof(p->second)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class U, class V> + void construct_pair(Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { + this->construct(container_detail::addressof(p->first), ::boost::forward<U>(x)); + try { + this->construct(container_detail::addressof(p->second), ::boost::forward<V>(y)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class Pair2> + void construct_pair(Pair* p, const Pair2& pr) + { + this->construct(container_detail::addressof(p->first), pr.first); + try { + this->construct(container_detail::addressof(p->second), pr.second); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class Pair2> + void construct_pair(Pair* p, BOOST_RV_REF(Pair2) pr) + { + this->construct(container_detail::addressof(p->first), ::boost::move(pr.first)); + try { + this->construct(container_detail::addressof(p->second), ::boost::move(pr.second)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + //template <class T1, class T2, class... Args1, class... Args2> + //void construct(pair<T1, T2>* p, piecewise_construct_t, tuple<Args1...> x, tuple<Args2...> y); + + private: + template <class OuterA2> + scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner) + : base_type(internal_type_t(), ::boost::forward<OuterA2>(outer), inner) + {} + + /// @endcond +}; + +template <typename OuterA1, typename OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , typename... InnerAllocs + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + #endif + > +inline bool operator==( + const scoped_allocator_adaptor<OuterA1 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& a, + const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& b) +{ + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + const bool has_zero_inner = sizeof...(InnerAllocs) == 0u; + #else + const bool has_zero_inner = + boost::container::container_detail::is_same + <Q0, container_detail::nat>::value; + #endif + + return a.outer_allocator() == b.outer_allocator() + && (has_zero_inner || a.inner_allocator() == b.inner_allocator()); +} + +template <typename OuterA1, typename OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , typename... InnerAllocs + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + #endif + > +inline bool operator!=( + const scoped_allocator_adaptor<OuterA1 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& a, + const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& b) +{ + return ! (a == b); +} + +}} // namespace boost { namespace container { + +#include <boost/container/detail/config_end.hpp> + +#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP diff --git a/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp b/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp new file mode 100644 index 0000000..0814a50 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp @@ -0,0 +1,83 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP +#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP + +#if (defined MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> + +#if defined(BOOST_NO_VARIADIC_TEMPLATES) +#include <boost/container/detail/preprocessor.hpp> +#include <boost/container/detail/type_traits.hpp> +#endif + +namespace boost { namespace container { + +///@cond + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor; + + #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename ...InnerAllocs> + class scoped_allocator_adaptor; + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>; + + #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + +#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template <typename OuterAlloc +BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT, container_detail::nat) +> +class scoped_allocator_adaptor; + +#endif + +///@endcond + +//! The allocator_arg_t struct is an empty structure type used as a unique type to +//! disambiguate constructor and function overloading. Specifically, several types +//! have constructors with allocator_arg_t as the first argument, immediately followed +//! by an argument of a type that satisfies the Allocator requirements +struct allocator_arg_t{}; + +//! A instance of type allocator_arg_t +//! +static const allocator_arg_t allocator_arg = allocator_arg_t(); + +template <class T> +struct constructible_with_allocator_suffix; + +template <class T> +struct constructible_with_allocator_prefix; + +template <typename T, typename Alloc> +struct uses_allocator; + +}} // namespace boost { namespace container { + +#include <boost/container/detail/config_end.hpp> + +#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP diff --git a/3rdParty/Boost/src/boost/current_function.hpp b/3rdParty/Boost/src/boost/current_function.hpp index aa5756e..cb36e35 100644 --- a/3rdParty/Boost/src/boost/current_function.hpp +++ b/3rdParty/Boost/src/boost/current_function.hpp @@ -28,7 +28,7 @@ namespace detail inline void current_function_helper() { -#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) +#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__) # define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ @@ -65,3 +65,4 @@ inline void current_function_helper() } // namespace boost #endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED + diff --git a/3rdParty/Boost/src/boost/date_time/adjust_functors.hpp b/3rdParty/Boost/src/boost/date_time/adjust_functors.hpp index 7854ae4..dde8ca8 100644 --- a/3rdParty/Boost/src/boost/date_time/adjust_functors.hpp +++ b/3rdParty/Boost/src/boost/date_time/adjust_functors.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/date.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp b/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp index f802582..45e96d3 100644 --- a/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp +++ b/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ /*! @file c_local_time_adjustor.hpp diff --git a/3rdParty/Boost/src/boost/date_time/c_time.hpp b/3rdParty/Boost/src/boost/date_time/c_time.hpp index 24ccfe5..f7e116b 100644 --- a/3rdParty/Boost/src/boost/date_time/c_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/c_time.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ @@ -57,7 +57,15 @@ namespace date_time { static std::tm* localtime(const std::time_t* t, std::tm* result) { // localtime_r() not in namespace std??? + #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + std::tm tmp; + if(!localtime_r(t,&tmp)) + result = 0; + else + *result = tmp; + #else result = localtime_r(t, result); + #endif if (!result) boost::throw_exception(std::runtime_error("could not convert calendar time to local time")); return result; @@ -67,7 +75,15 @@ namespace date_time { static std::tm* gmtime(const std::time_t* t, std::tm* result) { // gmtime_r() not in namespace std??? + #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + std::tm tmp; + if(!gmtime_r(t,&tmp)) + result = 0; + else + *result = tmp; + #else result = gmtime_r(t, result); + #endif if (!result) boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time")); return result; diff --git a/3rdParty/Boost/src/boost/date_time/compiler_config.hpp b/3rdParty/Boost/src/boost/date_time/compiler_config.hpp index 0dc893f..1aa1330 100644 --- a/3rdParty/Boost/src/boost/date_time/compiler_config.hpp +++ b/3rdParty/Boost/src/boost/date_time/compiler_config.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2011-07-26 10:40:21 -0700 (Tue, 26 Jul 2011) $ */ #include <cstdlib> @@ -118,20 +118,18 @@ namespace std { * */ -#ifdef BOOST_HAS_DECLSPEC // defined in config system - // we need to import/export our code only if the user has specifically - // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost - // libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK - // if they want just this one to be dynamically liked: -# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK) - // export if this is our own source, otherwise import: -# ifdef BOOST_DATE_TIME_SOURCE -# define BOOST_DATE_TIME_DECL __declspec(dllexport) -# else -# define BOOST_DATE_TIME_DECL __declspec(dllimport) -# endif // BOOST_DATE_TIME_SOURCE -# endif // DYN_LINK -#endif // BOOST_HAS_DECLSPEC +// we need to import/export our code only if the user has specifically +// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost +// libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK +// if they want just this one to be dynamically liked: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK) + // export if this is our own source, otherwise import: +# ifdef BOOST_DATE_TIME_SOURCE +# define BOOST_DATE_TIME_DECL BOOST_SYMBOL_EXPORT +# else +# define BOOST_DATE_TIME_DECL BOOST_SYMBOL_IMPORT +# endif // BOOST_DATE_TIME_SOURCE +#endif // DYN_LINK // // if BOOST_WHATEVER_DECL isn't defined yet define it now: #ifndef BOOST_DATE_TIME_DECL diff --git a/3rdParty/Boost/src/boost/date_time/constrained_value.hpp b/3rdParty/Boost/src/boost/date_time/constrained_value.hpp index b273dd5..7338105 100644 --- a/3rdParty/Boost/src/boost/date_time/constrained_value.hpp +++ b/3rdParty/Boost/src/boost/date_time/constrained_value.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <exception> diff --git a/3rdParty/Boost/src/boost/date_time/date.hpp b/3rdParty/Boost/src/boost/date_time/date.hpp index 1056fb6..f77ae29 100644 --- a/3rdParty/Boost/src/boost/date_time/date.hpp +++ b/3rdParty/Boost/src/boost/date_time/date.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include <boost/operators.hpp> @@ -191,8 +191,8 @@ namespace date_time { dates. It is not exposed to users since that would require class users to understand the inner workings of the date class. */ - explicit date(date_int_type days) : days_(days) {}; - explicit date(date_rep_type days) : days_(days.as_number()) {}; + explicit date(date_int_type days) : days_(days) {} + explicit date(date_rep_type days) : days_(days.as_number()) {} date_int_type days_; }; diff --git a/3rdParty/Boost/src/boost/date_time/date_clock_device.hpp b/3rdParty/Boost/src/boost/date_time/date_clock_device.hpp index 6ccb26e..6202f6c 100644 --- a/3rdParty/Boost/src/boost/date_time/date_clock_device.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_clock_device.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/c_time.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/date_defs.hpp b/3rdParty/Boost/src/boost/date_time/date_defs.hpp index bc25b56..ae7e4c5 100644 --- a/3rdParty/Boost/src/boost/date_time/date_defs.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_defs.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/date_duration.hpp b/3rdParty/Boost/src/boost/date_time/date_duration.hpp index 3871aac..c573944 100644 --- a/3rdParty/Boost/src/boost/date_time/date_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_duration.hpp @@ -2,11 +2,11 @@ #define DATE_TIME_DATE_DURATION__ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -26,14 +26,14 @@ namespace date_time { , boost::subtractable1< date_duration< duration_rep_traits > , boost::dividable2< date_duration< duration_rep_traits >, int > > > > > - { + { public: typedef typename duration_rep_traits::int_type duration_rep_type; typedef typename duration_rep_traits::impl_type duration_rep; - + //! Construct from a day count - explicit date_duration(duration_rep day_count) : days_(day_count) {}; - + explicit date_duration(duration_rep day_count) : days_(day_count) {} + /*! construct from special_values - only works when * instantiated with duration_traits_adapted */ date_duration(special_values sv) : @@ -125,7 +125,7 @@ namespace date_time { { typedef long int_type; typedef long impl_type; - static int_type as_number(impl_type i) { return i; }; + static int_type as_number(impl_type i) { return i; } }; /*! Struct for instantiating date_duration <b>WITH</b> special values @@ -135,9 +135,9 @@ namespace date_time { { typedef long int_type; typedef boost::date_time::int_adapter<long> impl_type; - static int_type as_number(impl_type i) { return i.as_number(); }; + static int_type as_number(impl_type i) { return i.as_number(); } }; - + } } //namspace date_time diff --git a/3rdParty/Boost/src/boost/date_time/date_duration_types.hpp b/3rdParty/Boost/src/boost/date_time/date_duration_types.hpp index 1512c0e..e44c59f 100644 --- a/3rdParty/Boost/src/boost/date_time/date_duration_types.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_duration_types.hpp @@ -6,7 +6,7 @@ * (See accompanying file LICENSE_1_0.txt or * http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include <boost/date_time/int_adapter.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/date_facet.hpp b/3rdParty/Boost/src/boost/date_time/date_facet.hpp index 3eda4c7..fc2ddc2 100644 --- a/3rdParty/Boost/src/boost/date_time/date_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_facet.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Martin Andrian, Jeff Garland, Bart Garst - * $Date: 2009-06-04 07:40:18 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ #include <locale> @@ -208,7 +208,8 @@ namespace boost { namespace date_time { // return do_put_special(next, a_ios, fill_char, d.as_special()); //} //The following line of code required the date to support a to_tm function - std::tm dtm = {}; + std::tm dtm; + std::memset(&dtm, 0, sizeof(dtm)); dtm.tm_mon = m - 1; return do_put_tm(next, a_ios, fill_char, dtm, m_month_format); } @@ -219,7 +220,8 @@ namespace boost { namespace date_time { char_type fill_char, const day_type& day) const { - std::tm dtm = {}; + std::tm dtm; + std::memset(&dtm, 0, sizeof(dtm)); dtm.tm_mday = day.as_number(); char_type tmp[3] = {'%','d'}; string_type temp_format(tmp); @@ -235,7 +237,8 @@ namespace boost { namespace date_time { // return do_put_special(next, a_ios, fill_char, d.as_special()); //} //The following line of code required the date to support a to_tm function - std::tm dtm = {}; + std::tm dtm; + std::memset(&dtm, 0, sizeof(dtm)); dtm.tm_wday = dow; return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format); } diff --git a/3rdParty/Boost/src/boost/date_time/date_format_simple.hpp b/3rdParty/Boost/src/boost/date_time/date_format_simple.hpp index be21ce4..05119c4 100644 --- a/3rdParty/Boost/src/boost/date_time/date_format_simple.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_format_simple.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/parse_format_base.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/date_formatting.hpp b/3rdParty/Boost/src/boost/date_time/date_formatting.hpp index abe547a..06709bc 100644 --- a/3rdParty/Boost/src/boost/date_time/date_formatting.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_formatting.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ #include "boost/date_time/iso_format.hpp" @@ -54,7 +54,9 @@ namespace date_time { os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number(); break; } - + default: + break; + } return os; } // format_month @@ -79,7 +81,13 @@ namespace date_time { { typedef typename ymd_type::month_type month_type; std::basic_ostringstream<charT> ss; + + // Temporarily switch to classic locale to prevent possible formatting + // of year with comma or other character (for example 2,008). + ss.imbue(std::locale::classic()); ss << ymd.year; + ss.imbue(std::locale()); + if (format_type::has_date_sep_chars()) { ss << format_type::month_sep_char(); } diff --git a/3rdParty/Boost/src/boost/date_time/date_formatting_limited.hpp b/3rdParty/Boost/src/boost/date_time/date_formatting_limited.hpp index 38fee07..5721473 100644 --- a/3rdParty/Boost/src/boost/date_time/date_formatting_limited.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_formatting_limited.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/iso_format.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/date_formatting_locales.hpp b/3rdParty/Boost/src/boost/date_time/date_formatting_locales.hpp index 4ac9c4e..e3aec49 100644 --- a/3rdParty/Boost/src/boost/date_time/date_formatting_locales.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_formatting_locales.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/date_generator_formatter.hpp b/3rdParty/Boost/src/boost/date_time/date_generator_formatter.hpp index 88cd7e1..159cf36 100644 --- a/3rdParty/Boost/src/boost/date_time/date_generator_formatter.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_generator_formatter.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $ */ #include <iostream> diff --git a/3rdParty/Boost/src/boost/date_time/date_generator_parser.hpp b/3rdParty/Boost/src/boost/date_time/date_generator_parser.hpp index f11eb42..7cff9ca 100644 --- a/3rdParty/Boost/src/boost/date_time/date_generator_parser.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_generator_parser.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <string> diff --git a/3rdParty/Boost/src/boost/date_time/date_generators.hpp b/3rdParty/Boost/src/boost/date_time/date_generators.hpp index 1f1a34a..6d3a4ac 100644 --- a/3rdParty/Boost/src/boost/date_time/date_generators.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_generators.hpp @@ -2,11 +2,11 @@ #define DATE_TIME_DATE_GENERATORS_HPP__ /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * Author: Jeff Garland, Bart Garst + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ /*! @file date_generators.hpp @@ -34,16 +34,16 @@ namespace date_time { public: typedef typename date_type::calendar_type calendar_type; typedef typename calendar_type::year_type year_type; - year_based_generator() {}; - virtual ~year_based_generator() {}; + year_based_generator() {} + virtual ~year_based_generator() {} virtual date_type get_date(year_type y) const = 0; //! Returns a string for use in a POSIX time_zone string virtual std::string to_string() const =0; }; - + //! Generates a date by applying the year to the given month and day. /*! - Example usage: + Example usage: @code partial_date pd(1, Jan); partial_date pd2(70); @@ -123,9 +123,9 @@ namespace date_time { //months are equal return (day_ < rhs.day_); } - + // added for streaming purposes - month_type month() const + month_type month() const { return month_; } @@ -135,15 +135,15 @@ namespace date_time { } //! Returns string suitable for use in POSIX time zone string - /*! Returns string formatted with up to 3 digits: - * Jan-01 == "0" + /*! Returns string formatted with up to 3 digits: + * Jan-01 == "0" * Feb-29 == "58" * Dec-31 == "365" */ virtual std::string to_string() const { std::ostringstream ss; date_type d(2004, month_, day_); - unsigned short c = d.day_of_year(); + unsigned short c = d.day_of_year(); c--; // numbered 0-365 while day_of_year is 1 based... ss << c; return ss.str(); @@ -161,7 +161,7 @@ namespace date_time { /*! Based on the idea in Cal. Calc. for finding holidays that are * the 'first Monday of September'. When instantiated with * 'fifth' kday of month, the result will be the last kday of month - * which can be the fourth or fifth depending on the structure of + * which can be the fourth or fifth depending on the structure of * the month. * * The algorithm here basically guesses for the first @@ -169,8 +169,8 @@ namespace date_time { * type. That is, if the first of the month is a Tuesday * and it needs Wenesday then we simply increment by a day * and then we can add the length of a week until we get - * to the 'nth kday'. There are probably more efficient - * algorithms based on using a mod 7, but this one works + * to the 'nth kday'. There are probably more efficient + * algorithms based on using a mod 7, but this one works * reasonably well for basic applications. * \ingroup date_alg */ @@ -233,7 +233,7 @@ namespace date_time { virtual std::string to_string() const { std::ostringstream ss; - ss << 'M' + ss << 'M' << static_cast<int>(month_) << '.' << static_cast<int>(wn_) << '.' << static_cast<int>(dow_); @@ -244,7 +244,7 @@ namespace date_time { week_num wn_; day_of_week_type dow_; }; - + //! Useful generator functor for finding holidays and daylight savings /*! Similar to nth_kday_of_month, but requires less paramters * \ingroup date_alg @@ -290,7 +290,7 @@ namespace date_time { virtual std::string to_string() const { std::ostringstream ss; - ss << 'M' + ss << 'M' << static_cast<int>(month_) << '.' << 1 << '.' << static_cast<int>(dow_); @@ -300,9 +300,9 @@ namespace date_time { month_type month_; day_of_week_type dow_; }; - - - + + + //! Calculate something like Last Sunday of January /*! Useful generator functor for finding holidays and daylight savings * Get the last day of the month and then calculate the difference @@ -351,7 +351,7 @@ namespace date_time { virtual std::string to_string() const { std::ostringstream ss; - ss << 'M' + ss << 'M' << static_cast<int>(month_) << '.' << 5 << '.' << static_cast<int>(dow_); @@ -361,8 +361,8 @@ namespace date_time { month_type month_; day_of_week_type dow_; }; - - + + //! Calculate something like "First Sunday after Jan 1,2002 /*! Date generator that takes a date and finds kday after *@code @@ -400,7 +400,7 @@ namespace date_time { private: day_of_week_type dow_; }; - + //! Calculate something like "First Sunday before Jan 1,2002 /*! Date generator that takes a date and finds kday after *@code @@ -438,10 +438,10 @@ namespace date_time { private: day_of_week_type dow_; }; - + //! Calculates the number of days until the next weekday /*! Calculates the number of days until the next weekday. - * If the date given falls on a Sunday and the given weekday + * If the date given falls on a Sunday and the given weekday * is Tuesday the result will be 2 days */ template<typename date_type, class weekday_type> inline @@ -458,8 +458,8 @@ namespace date_time { //! Calculates the number of days since the previous weekday /*! Calculates the number of days since the previous weekday - * If the date given falls on a Sunday and the given weekday - * is Tuesday the result will be 5 days. The answer will be a positive + * If the date given falls on a Sunday and the given weekday + * is Tuesday the result will be 5 days. The answer will be a positive * number because Tuesday is 5 days before Sunday, not -5 days before. */ template<typename date_type, class weekday_type> inline @@ -477,9 +477,9 @@ namespace date_time { } //! Generates a date object representing the date of the following weekday from the given date - /*! Generates a date object representing the date of the following - * weekday from the given date. If the date given is 2004-May-9 - * (a Sunday) and the given weekday is Tuesday then the resulting date + /*! Generates a date object representing the date of the following + * weekday from the given date. If the date given is 2004-May-9 + * (a Sunday) and the given weekday is Tuesday then the resulting date * will be 2004-May-11. */ template<class date_type, class weekday_type> inline @@ -489,9 +489,9 @@ namespace date_time { } //! Generates a date object representing the date of the previous weekday from the given date - /*! Generates a date object representing the date of the previous - * weekday from the given date. If the date given is 2004-May-9 - * (a Sunday) and the given weekday is Tuesday then the resulting date + /*! Generates a date object representing the date of the previous + * weekday from the given date. If the date given is 2004-May-9 + * (a Sunday) and the given weekday is Tuesday then the resulting date * will be 2004-May-4. */ template<class date_type, class weekday_type> inline diff --git a/3rdParty/Boost/src/boost/date_time/date_iterator.hpp b/3rdParty/Boost/src/boost/date_time/date_iterator.hpp index 284dc74..c8ec50e 100644 --- a/3rdParty/Boost/src/boost/date_time/date_iterator.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_iterator.hpp @@ -2,11 +2,11 @@ #define DATE_ITERATOR_HPP___ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include <iterator> @@ -32,7 +32,7 @@ namespace date_time { template<class date_type> class date_itr_base { // works, but benefit unclear at the moment - // class date_itr_base : public std::iterator<std::input_iterator_tag, + // class date_itr_base : public std::iterator<std::input_iterator_tag, // date_type, void, void, void>{ public: typedef typename date_type::duration_type duration_type; @@ -40,31 +40,31 @@ namespace date_time { typedef std::input_iterator_tag iterator_category; date_itr_base(date_type d) : current_(d) {} - virtual ~date_itr_base() {}; - date_itr_base& operator++() + virtual ~date_itr_base() {} + date_itr_base& operator++() { current_ = current_ + get_offset(current_); return *this; } - date_itr_base& operator--() + date_itr_base& operator--() { current_ = current_ + get_neg_offset(current_); return *this; } virtual duration_type get_offset(const date_type& current) const=0; virtual duration_type get_neg_offset(const date_type& current) const=0; - date_type operator*() {return current_;}; - date_type* operator->() {return ¤t_;}; + date_type operator*() {return current_;} + date_type* operator->() {return ¤t_;} bool operator< (const date_type& d) {return current_ < d;} bool operator<= (const date_type& d) {return current_ <= d;} bool operator> (const date_type& d) {return current_ > d;} bool operator>= (const date_type& d) {return current_ >= d;} bool operator== (const date_type& d) {return current_ == d;} - bool operator!= (const date_type& d) {return current_ != d;} + bool operator!= (const date_type& d) {return current_ != d;} private: date_type current_; }; - + //! Overrides the base date iterator providing hook for functors /* * <b>offset_functor</b> @@ -77,9 +77,9 @@ namespace date_time { class date_itr : public date_itr_base<date_type> { public: typedef typename date_type::duration_type duration_type; - date_itr(date_type d, int factor=1) : - date_itr_base<date_type>(d), - of_(factor) + date_itr(date_type d, int factor=1) : + date_itr_base<date_type>(d), + of_(factor) {} private: virtual duration_type get_offset(const date_type& current) const @@ -92,9 +92,9 @@ namespace date_time { } offset_functor of_; }; - - + + } } //namespace date_time diff --git a/3rdParty/Boost/src/boost/date_time/date_names_put.hpp b/3rdParty/Boost/src/boost/date_time/date_names_put.hpp index c6f0ce2..32aeb36 100644 --- a/3rdParty/Boost/src/boost/date_time/date_names_put.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_names_put.hpp @@ -2,11 +2,11 @@ #define DATE_TIME_DATE_NAMES_PUT_HPP___ /* Copyright (c) 2002-2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * Author: Jeff Garland, Bart Garst + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -27,22 +27,22 @@ namespace date_time { //! Output facet base class for gregorian dates. /*! This class is a base class for date facets used to localize the * names of months and the names of days in the week. - * + * * Requirements of Config - * - define an enumeration month_enum that enumerates the months. + * - define an enumeration month_enum that enumerates the months. * The enumeration should be '1' based eg: Jan==1 * - define as_short_string and as_long_string * * (see langer & kreft p334). - * + * */ template<class Config, - class charT = char, + class charT = char, class OutputIterator = std::ostreambuf_iterator<charT> > class date_names_put : public std::locale::facet { public: - date_names_put() {}; + date_names_put() {} typedef OutputIterator iter_type; typedef typename Config::month_type month_type; typedef typename Config::month_enum month_enum; @@ -118,7 +118,7 @@ namespace date_time { put_string(oitr, gm.as_short_string(c)); } //! Default facet implementation uses month_type defaults - virtual void do_put_month_long(iter_type& oitr, + virtual void do_put_month_long(iter_type& oitr, month_enum moy) const { month_type gm(moy); @@ -160,7 +160,7 @@ namespace date_time { string_type s(separator); //put in '-' put_string(oitr, s); } - //! Default for date order + //! Default for date order virtual ymd_order_spec do_date_order() const { return ymd_order_iso; @@ -186,27 +186,27 @@ namespace date_time { } } }; - + template<class Config, class charT, class OutputIterator> - const typename date_names_put<Config, charT, OutputIterator>::char_type - date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = { + const typename date_names_put<Config, charT, OutputIterator>::char_type + date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = { {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'}, {'-','i','n','f','i','n','i','t','y'}, {'+','i','n','f','i','n','i','t','y'} }; template<class Config, class charT, class OutputIterator> - const typename date_names_put<Config, charT, OutputIterator>::char_type - date_names_put<Config, charT, OutputIterator>::separator[2] = + const typename date_names_put<Config, charT, OutputIterator>::char_type + date_names_put<Config, charT, OutputIterator>::separator[2] = {'-', '\0'} ; - - //! Generate storage location for a std::locale::id + + //! Generate storage location for a std::locale::id template<class Config, class charT, class OutputIterator> std::locale::id date_names_put<Config, charT, OutputIterator>::id; //! A date name output facet that takes an array of char* to define strings template<class Config, - class charT = char, + class charT = char, class OutputIterator = std::ostreambuf_iterator<charT> > class all_date_names_put : public date_names_put<Config, charT, OutputIterator> { @@ -230,29 +230,29 @@ namespace date_time { separator_char_[0] = separator_char; separator_char_[1] = '\0'; - }; + } typedef OutputIterator iter_type; typedef typename Config::month_enum month_enum; typedef typename Config::weekday_enum weekday_enum; typedef typename Config::special_value_enum special_value_enum; - const charT* const* get_short_month_names() const + const charT* const* get_short_month_names() const { return month_short_names_; } - const charT* const* get_long_month_names() const + const charT* const* get_long_month_names() const { return month_long_names_; } - const charT* const* get_special_value_names() const + const charT* const* get_special_value_names() const { return special_value_names_; } - const charT* const* get_short_weekday_names()const + const charT* const* get_short_weekday_names()const { return weekday_short_names_; } - const charT* const* get_long_weekday_names()const + const charT* const* get_long_weekday_names()const { return weekday_long_names_; } @@ -263,7 +263,7 @@ namespace date_time { { this->put_string(oitr, month_short_names_[moy-1]); } - //! Long month names + //! Long month names virtual void do_put_month_long(iter_type& oitr, month_enum moy) const { this->put_string(oitr, month_long_names_[moy-1]); @@ -310,7 +310,7 @@ namespace date_time { const charT* const* weekday_long_names_; charT separator_char_[2]; ymd_order_spec order_spec_; - month_format_spec month_format_spec_; + month_format_spec month_format_spec_; }; } } //namespace boost::date_time diff --git a/3rdParty/Boost/src/boost/date_time/date_parsing.hpp b/3rdParty/Boost/src/boost/date_time/date_parsing.hpp index f361bc8..35ec8e4 100644 --- a/3rdParty/Boost/src/boost/date_time/date_parsing.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_parsing.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ #include <string> @@ -148,6 +148,7 @@ namespace date_time { day = boost::lexical_cast<unsigned short>(*beg); break; } + default: break; } //switch } return date_type(year, month, day); @@ -180,6 +181,7 @@ namespace date_time { case 0: y = i; break; case 1: m = i; break; case 2: d = i; break; + default: break; } pos++; } diff --git a/3rdParty/Boost/src/boost/date_time/dst_rules.hpp b/3rdParty/Boost/src/boost/date_time/dst_rules.hpp index 20cb40b..cf65c16 100644 --- a/3rdParty/Boost/src/boost/date_time/dst_rules.hpp +++ b/3rdParty/Boost/src/boost/date_time/dst_rules.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ /*! @file dst_rules.hpp @@ -371,7 +371,7 @@ namespace boost { return is_not_in_dst; } - static bool is_dst_boundary_day(date_type d) + static bool is_dst_boundary_day(date_type /*d*/) { return false; } diff --git a/3rdParty/Boost/src/boost/date_time/dst_transition_generators.hpp b/3rdParty/Boost/src/boost/date_time/dst_transition_generators.hpp index 6c4da1c..16c1fd6 100644 --- a/3rdParty/Boost/src/boost/date_time/dst_transition_generators.hpp +++ b/3rdParty/Boost/src/boost/date_time/dst_transition_generators.hpp @@ -18,7 +18,7 @@ namespace date_time { { public: typedef typename date_type::year_type year_type; - virtual ~dst_day_calc_rule() {}; + virtual ~dst_day_calc_rule() {} virtual date_type start_day(year_type y) const=0; virtual std::string start_rule_as_string() const=0; virtual date_type end_day(year_type y) const=0; diff --git a/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp b/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp index 27ed754..3c7f13f 100644 --- a/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp +++ b/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-06 07:24:09 -0400 (Sat, 06 Jun 2009) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ /*! @file filetime_functions.hpp @@ -73,12 +73,12 @@ namespace winapi { file_time ft_utc; GetSystemTimeAsFileTime(&ft_utc); FileTimeToLocalFileTime(&ft_utc, &ft); -#elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME) +#elif defined(BOOST_HAS_GETSYSTEMTIMEASFILETIME) + GetSystemTimeAsFileTime(&ft); +#else system_time st; GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); -#else - GetSystemTimeAsFileTime(&ft); #endif } diff --git a/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp b/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp index a4a4d0d..0c3503f 100644 --- a/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp +++ b/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ @@ -256,7 +256,6 @@ class format_date_parser // skip leading whitespace while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } - charT current_char = *sitr; short year(0), month(0), day(0), day_of_year(0);// wkday(0); /* Initialized the following to their minimum values. These intermediate @@ -290,7 +289,6 @@ class format_date_parser } wkday = mr.current_match; if (mr.has_remaining()) { - current_char = mr.last_char(); use_current_char = true; } break; @@ -310,7 +308,6 @@ class format_date_parser } wkday = mr.current_match; if (mr.has_remaining()) { - current_char = mr.last_char(); use_current_char = true; } break; @@ -326,7 +323,6 @@ class format_date_parser } t_month = month_type(mr.current_match); if (mr.has_remaining()) { - current_char = mr.last_char(); use_current_char = true; } break; @@ -342,7 +338,6 @@ class format_date_parser } t_month = month_type(mr.current_match); if (mr.has_remaining()) { - current_char = mr.last_char(); use_current_char = true; } break; @@ -438,7 +433,6 @@ class format_date_parser itr++; if (use_current_char) { use_current_char = false; - current_char = *sitr; } else { sitr++; diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp index c505bdd..33f6856 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $ + * $Date: 2010-06-09 11:10:13 -0700 (Wed, 09 Jun 2010) $ */ #include <cstring> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/formatters.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/formatters.hpp index 786e79f..eda7dc3 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/formatters.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/formatters.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/compiler_config.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/formatters_limited.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/formatters_limited.hpp index 4531ebe..8dfd2d0 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/formatters_limited.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/formatters_limited.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp index 483ead5..e9c1852 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ #include <boost/cstdint.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp index ad67c0c..860a407 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ #include <boost/throw_exception.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_day.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_day.hpp index 92ea6ab..4ea829f 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_day.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_day.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_day_of_year.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_day_of_year.hpp index 36b22c2..2f8874d 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_day_of_year.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_day_of_year.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration.hpp index fd75542..a9c0c17 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <boost/date_time/date_duration.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration_types.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration_types.hpp index 3d1ce62..8328ca3 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration_types.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration_types.hpp @@ -5,7 +5,7 @@ * Subject to Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_facet.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_facet.hpp index 9c3877e..9efc619 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_facet.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 2008) $ + * $Date: 2008-11-23 03:13:35 -0800 (Sun, 23 Nov 2008) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_month.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_month.hpp index fc9c861..b48a8a8 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_month.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_month.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_weekday.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_weekday.hpp index 9b566c4..ab68fcd 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_weekday.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_weekday.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_year.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_year.hpp index ef1735f..322f40d 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_year.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_year.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_ymd.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_ymd.hpp index 086e73d..e7d441e 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_ymd.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_ymd.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/year_month_day.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian.hpp index bfafa1b..becbc06 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! @file gregorian.hpp diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_io.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_io.hpp index 62a759f..e6ba01f 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_io.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_io.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <locale> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_types.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_types.hpp index 0c74857..3f4b92f 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_types.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_types.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! @file gregorian_types.hpp diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/parsers.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/parsers.hpp index 95d4f23..a2fa4e1 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/parsers.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/parsers.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp index c27c09e..b645aa4 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp index a281b45..af19394 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp +++ b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp @@ -3,7 +3,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ #ifndef NO_BOOST_DATE_TIME_INLINE @@ -47,7 +47,7 @@ namespace date_time { return week; } - if ((week == 53)) { + if (week == 53) { if((day==6) ||(day == 5 && is_leap_year(ymd.year))) { return week; //under these circumstances week == 53. } else { diff --git a/3rdParty/Boost/src/boost/date_time/int_adapter.hpp b/3rdParty/Boost/src/boost/date_time/int_adapter.hpp index fc98fc1..d1246e7 100644 --- a/3rdParty/Boost/src/boost/date_time/int_adapter.hpp +++ b/3rdParty/Boost/src/boost/date_time/int_adapter.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/iso_format.hpp b/3rdParty/Boost/src/boost/date_time/iso_format.hpp index 8262fa2..1f9e73d 100644 --- a/3rdParty/Boost/src/boost/date_time/iso_format.hpp +++ b/3rdParty/Boost/src/boost/date_time/iso_format.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/parse_format_base.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/local_time/conversion.hpp b/3rdParty/Boost/src/boost/date_time/local_time/conversion.hpp index 13e4d3e..a530de4 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/conversion.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2009-06-04 01:24:49 -0700 (Thu, 04 Jun 2009) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/local_time/custom_time_zone.hpp b/3rdParty/Boost/src/boost/date_time/local_time/custom_time_zone.hpp index a6c1d42..84c59a3 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/custom_time_zone.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/custom_time_zone.hpp @@ -2,10 +2,10 @@ #define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__ /* Copyright (c) 2003-2005 CrystalClear Software, Inc. - * Subject to the Boost Software License, Version 1.0. + * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include "boost/date_time/time_zone_base.hpp" @@ -34,8 +34,8 @@ namespace local_time { typedef typename base_type::stringstream_type stringstream_type; typedef date_time::time_zone_names_base<CharT> time_zone_names; typedef CharT char_type; - - custom_time_zone_base(const time_zone_names& zone_names, + + custom_time_zone_base(const time_zone_names& zone_names, const time_duration_type& utc_offset, const dst_adjustment_offsets& dst_shift, boost::shared_ptr<dst_calc_rule> calc_rule) : @@ -43,8 +43,8 @@ namespace local_time { base_utc_offset_(utc_offset), dst_offsets_(dst_shift), dst_calc_rules_(calc_rule) - {}; - virtual ~custom_time_zone_base() {}; + {} + virtual ~custom_time_zone_base() {} virtual string_type dst_zone_abbrev() const { return zone_names_.dst_zone_abbrev(); diff --git a/3rdParty/Boost/src/boost/date_time/local_time/date_duration_operators.hpp b/3rdParty/Boost/src/boost/date_time/local_time/date_duration_operators.hpp index ee87022..b4c325d 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/date_duration_operators.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/date_duration_operators.hpp @@ -6,7 +6,7 @@ * (See accompanying file LICENSE_1_0.txt or * http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/greg_duration_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/local_time/dst_transition_day_rules.hpp b/3rdParty/Boost/src/boost/date_time/local_time/dst_transition_day_rules.hpp index 3d6cfba..d82731c 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/dst_transition_day_rules.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/dst_transition_day_rules.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/local_time/local_date_time.hpp b/3rdParty/Boost/src/boost/date_time/local_time/local_date_time.hpp index 9c9f623..96b2915 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/local_date_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/local_date_time.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include <string> @@ -208,7 +208,7 @@ namespace local_time { } //! Simple destructor, releases time zone if last referrer - ~local_date_time_base() {}; + ~local_date_time_base() {} //! Copy constructor local_date_time_base(const local_date_time_base& rhs) : diff --git a/3rdParty/Boost/src/boost/date_time/local_time/local_time.hpp b/3rdParty/Boost/src/boost/date_time/local_time/local_time.hpp index f7d4cc6..162cac5 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/local_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/local_time.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/posix_time/posix_time.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/local_time/local_time_io.hpp b/3rdParty/Boost/src/boost/date_time/local_time/local_time_io.hpp index c161ff7..b5e3c3f 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/local_time_io.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/local_time_io.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $ */ #include <locale> diff --git a/3rdParty/Boost/src/boost/date_time/local_time/local_time_types.hpp b/3rdParty/Boost/src/boost/date_time/local_time/local_time_types.hpp index ed58b80..5e04422 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/local_time_types.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/local_time_types.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/local_time/local_date_time.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/local_time/posix_time_zone.hpp b/3rdParty/Boost/src/boost/date_time/local_time/posix_time_zone.hpp index 2a0199f..ee1b553 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/posix_time_zone.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/posix_time_zone.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-06-10 13:24:38 -0400 (Thu, 10 Jun 2010) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include <string> @@ -115,7 +115,7 @@ namespace local_time{ calc_rules(dst_begin, dst_end); } } - virtual ~posix_time_zone_base() {}; + virtual ~posix_time_zone_base() {} //!String for the zone when not in daylight savings (eg: EST) virtual string_type std_zone_abbrev()const { diff --git a/3rdParty/Boost/src/boost/date_time/local_time/tz_database.hpp b/3rdParty/Boost/src/boost/date_time/local_time/tz_database.hpp index 4cfca45..aceda93 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/tz_database.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/tz_database.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include <string> diff --git a/3rdParty/Boost/src/boost/date_time/locale_config.hpp b/3rdParty/Boost/src/boost/date_time/locale_config.hpp index d01e008..194d5dd 100644 --- a/3rdParty/Boost/src/boost/date_time/locale_config.hpp +++ b/3rdParty/Boost/src/boost/date_time/locale_config.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ // This file configures whether the library will support locales and hence diff --git a/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp b/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp index 9396579..177811e 100644 --- a/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp +++ b/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-05-10 05:15:48 -0400 (Mon, 10 May 2010) $ + * $Date: 2010-05-10 02:15:48 -0700 (Mon, 10 May 2010) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/parse_format_base.hpp b/3rdParty/Boost/src/boost/date_time/parse_format_base.hpp index b17a5c8..087baf9 100644 --- a/3rdParty/Boost/src/boost/date_time/parse_format_base.hpp +++ b/3rdParty/Boost/src/boost/date_time/parse_format_base.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ namespace boost { diff --git a/3rdParty/Boost/src/boost/date_time/period.hpp b/3rdParty/Boost/src/boost/date_time/period.hpp index c67bc36..3e34def 100644 --- a/3rdParty/Boost/src/boost/date_time/period.hpp +++ b/3rdParty/Boost/src/boost/date_time/period.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! \file period.hpp diff --git a/3rdParty/Boost/src/boost/date_time/period_formatter.hpp b/3rdParty/Boost/src/boost/date_time/period_formatter.hpp index 08082e1..b6ddc82 100644 --- a/3rdParty/Boost/src/boost/date_time/period_formatter.hpp +++ b/3rdParty/Boost/src/boost/date_time/period_formatter.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -114,10 +114,10 @@ namespace boost { namespace date_time { { m_range_option = option; } - void delimiter_strings(const string_type& separator, - const string_type& start_delim, - const string_type& open_end_delim, - const string_type& closed_end_delim) + void delimiter_strings(const string_type& , + const string_type& , + const string_type& , + const string_type& ) { m_period_separator; m_period_start_delimeter; diff --git a/3rdParty/Boost/src/boost/date_time/period_parser.hpp b/3rdParty/Boost/src/boost/date_time/period_parser.hpp index 9cd57e1..84b9d13 100644 --- a/3rdParty/Boost/src/boost/date_time/period_parser.hpp +++ b/3rdParty/Boost/src/boost/date_time/period_parser.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $ */ #include <boost/throw_exception.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp index 3fb21d7..83ccf60 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $ + * $Date: 2010-06-09 11:10:13 -0700 (Wed, 09 Jun 2010) $ */ #include <cstring> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/date_duration_operators.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/date_duration_operators.hpp index e6899ba..6846a77 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/date_duration_operators.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/date_duration_operators.hpp @@ -6,7 +6,7 @@ * (See accompanying file LICENSE_1_0.txt or * http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/greg_duration_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time.hpp index 4e9294c..3b85ff4 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*!@file posix_time.hpp Global header file to get all of posix time types */ diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp index 60c3f7e..d0b7653 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 07:52:28 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $ */ #include <cstdlib> //for MCW 7.2 std::abs(long long) @@ -81,7 +81,7 @@ namespace posix_time { {} //Give duration access to ticks constructor -- hide from users friend class date_time::time_duration<time_duration, time_res_traits>; - private: + protected: explicit time_duration(impl_type tick_count) : date_time::time_duration<time_duration, time_res_traits>(tick_count) {} diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_duration.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_duration.hpp index db3b85f..9778fd7 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_duration.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/posix_time/posix_time_config.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_io.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_io.hpp index 9a80737..fb63a91 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_io.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_io.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $ */ #include <locale> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_legacy_io.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_legacy_io.hpp index f5b20a8..fcc3fac 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_legacy_io.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_legacy_io.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! @file posix_time_pre133_operators.hpp diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_system.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_system.hpp index 3d44e0f..13626e9 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_system.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_system.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/ptime.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/ptime.hpp index 2abc02d..3f1cb04 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/ptime.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/ptime.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/posix_time/posix_time_system.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp index 466331b..534b952 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ #include <boost/date_time/gregorian/gregorian.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp index d0e959e..8d2ebdc 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ #include <boost/date_time/gregorian/gregorian.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_parsers.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_parsers.hpp index 8a352f6..3dc02b1 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_parsers.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_parsers.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/gregorian.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_period.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_period.hpp index cb7bf07..11f8120 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_period.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_period.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/period.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/special_defs.hpp b/3rdParty/Boost/src/boost/date_time/special_defs.hpp index 56eb6fe..661814e 100644 --- a/3rdParty/Boost/src/boost/date_time/special_defs.hpp +++ b/3rdParty/Boost/src/boost/date_time/special_defs.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ namespace boost { diff --git a/3rdParty/Boost/src/boost/date_time/special_values_formatter.hpp b/3rdParty/Boost/src/boost/date_time/special_values_formatter.hpp index 33542b6..53fe984 100644 --- a/3rdParty/Boost/src/boost/date_time/special_values_formatter.hpp +++ b/3rdParty/Boost/src/boost/date_time/special_values_formatter.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include <vector> diff --git a/3rdParty/Boost/src/boost/date_time/string_convert.hpp b/3rdParty/Boost/src/boost/date_time/string_convert.hpp index 54a979c..a3cc86c 100644 --- a/3rdParty/Boost/src/boost/date_time/string_convert.hpp +++ b/3rdParty/Boost/src/boost/date_time/string_convert.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/compiler_config.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/string_parse_tree.hpp b/3rdParty/Boost/src/boost/date_time/string_parse_tree.hpp index 0d515ff..d67bf6b 100644 --- a/3rdParty/Boost/src/boost/date_time/string_parse_tree.hpp +++ b/3rdParty/Boost/src/boost/date_time/string_parse_tree.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/strings_from_facet.hpp b/3rdParty/Boost/src/boost/date_time/strings_from_facet.hpp index 2bc26fb..7c0765b 100644 --- a/3rdParty/Boost/src/boost/date_time/strings_from_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/strings_from_facet.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2009-02-01 06:29:43 -0500 (Sun, 01 Feb 2009) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ #include <sstream> @@ -50,8 +50,8 @@ gather_month_strings(const std::locale& locale, bool short_strings=true) //grab the needed strings by using the locale to //output each month const charT* p_outfmt = outfmt.c_str(), *p_outfmt_end = p_outfmt + outfmt.size(); + tm tm_value = {}; for (int m=0; m < 12; m++) { - tm tm_value; tm_value.tm_mon = m; stringstream_type ss; ostream_iter_type oitr(ss); @@ -103,8 +103,8 @@ gather_weekday_strings(const std::locale& locale, bool short_strings=true) //grab the needed strings by using the locale to //output each month / weekday const charT* p_outfmt = outfmt.c_str(), *p_outfmt_end = p_outfmt + outfmt.size(); + tm tm_value = {}; for (int i=0; i < 7; i++) { - tm tm_value; tm_value.tm_wday = i; stringstream_type ss; ostream_iter_type oitr(ss); diff --git a/3rdParty/Boost/src/boost/date_time/time.hpp b/3rdParty/Boost/src/boost/date_time/time.hpp index 6a6cbe1..8b21144 100644 --- a/3rdParty/Boost/src/boost/date_time/time.hpp +++ b/3rdParty/Boost/src/boost/date_time/time.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_clock.hpp b/3rdParty/Boost/src/boost/date_time/time_clock.hpp index 1ea5d2e8..9aa2ff0 100644 --- a/3rdParty/Boost/src/boost/date_time/time_clock.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_clock.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! @file time_clock.hpp diff --git a/3rdParty/Boost/src/boost/date_time/time_defs.hpp b/3rdParty/Boost/src/boost/date_time/time_defs.hpp index 55fe42a..d74631d 100644 --- a/3rdParty/Boost/src/boost/date_time/time_defs.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_defs.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_duration.hpp b/3rdParty/Boost/src/boost/date_time/time_duration.hpp index 2fd2590..fc3660b 100644 --- a/3rdParty/Boost/src/boost/date_time/time_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_duration.hpp @@ -2,15 +2,16 @@ #define DATE_TIME_TIME_DURATION_HPP___ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $ */ #include <boost/cstdint.hpp> #include <boost/operators.hpp> +#include <boost/static_assert.hpp> #include <boost/date_time/time_defs.hpp> #include <boost/date_time/special_defs.hpp> #include <boost/date_time/compiler_config.hpp> @@ -179,7 +180,7 @@ namespace date_time { return duration_type(ticks_); } //! Division operations on a duration with an integer. - duration_type operator/=(int divisor) + duration_type operator/=(int divisor) { ticks_ = ticks_ / divisor; return duration_type(ticks_); @@ -251,7 +252,7 @@ namespace date_time { } protected: - explicit time_duration(impl_type in) : ticks_(in) {}; + explicit time_duration(impl_type in) : ticks_(in) {} impl_type ticks_; }; @@ -265,10 +266,20 @@ namespace date_time { class subsecond_duration : public base_duration { public: + typedef typename base_duration::impl_type impl_type; typedef typename base_duration::traits_type traits_type; + + private: + // To avoid integer overflow we precompute the duration resolution conversion coefficient (ticket #3471) + BOOST_STATIC_ASSERT_MSG((traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second % frac_of_second : frac_of_second % traits_type::ticks_per_second) == 0,\ + "The base duration resolution must be a multiple of the subsecond duration resolution"); + BOOST_STATIC_CONSTANT(boost::int64_t, adjustment_ratio = (traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second / frac_of_second : frac_of_second / traits_type::ticks_per_second)); + + public: explicit subsecond_duration(boost::int64_t ss) : - base_duration(0,0,0,ss*traits_type::res_adjust()/frac_of_second) - {} + base_duration(impl_type(traits_type::ticks_per_second >= frac_of_second ? ss * adjustment_ratio : ss / adjustment_ratio)) + { + } }; diff --git a/3rdParty/Boost/src/boost/date_time/time_facet.hpp b/3rdParty/Boost/src/boost/date_time/time_facet.hpp index a456db9..8346ca3 100644 --- a/3rdParty/Boost/src/boost/date_time/time_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_facet.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Martin Andrian, Jeff Garland, Bart Garst - * $Date: 2010-06-09 12:39:31 -0400 (Wed, 09 Jun 2010) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ #include <cctype> @@ -244,22 +244,22 @@ namespace date_time { #endif //! sets default formats for ptime, local_date_time, and time_duration - explicit time_facet(::size_t a_ref = 0) - : base_type(default_time_format, period_formatter_type(), special_values_formatter_type(), date_gen_formatter_type(), a_ref), + explicit time_facet(::size_t ref_arg = 0) + : base_type(default_time_format, period_formatter_type(), special_values_formatter_type(), date_gen_formatter_type(), ref_arg), m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format) {} //! Construct the facet with an explicitly specified format - explicit time_facet(const char_type* a_format, - period_formatter_type period_formatter = period_formatter_type(), + explicit time_facet(const char_type* format_arg, + period_formatter_type period_formatter_arg = period_formatter_type(), const special_values_formatter_type& special_value_formatter = special_values_formatter_type(), date_gen_formatter_type dg_formatter = date_gen_formatter_type(), - ::size_t a_ref = 0) - : base_type(a_format, - period_formatter, + ::size_t ref_arg = 0) + : base_type(format_arg, + period_formatter_arg, special_value_formatter, dg_formatter, - a_ref), + ref_arg), m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format) {} @@ -278,56 +278,56 @@ namespace date_time { this->m_format = iso_time_format_extended_specifier; } - OutItrT put(OutItrT a_next, - std::ios_base& a_ios, - char_type a_fill, - const time_type& a_time) const + OutItrT put(OutItrT next_arg, + std::ios_base& ios_arg, + char_type fill_arg, + const time_type& time_arg) const { - if (a_time.is_special()) { - return this->do_put_special(a_next, a_ios, a_fill, - a_time.date().as_special()); + if (time_arg.is_special()) { + return this->do_put_special(next_arg, ios_arg, fill_arg, + time_arg.date().as_special()); } - string_type format(this->m_format); + string_type local_format(this->m_format); // %T and %R have to be replaced here since they are not standard - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, boost::as_literal(formats_type::full_24_hour_time_format), boost::as_literal(formats_type::full_24_hour_time_expanded_format)); - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, boost::as_literal(formats_type::short_24_hour_time_format), boost::as_literal(formats_type::short_24_hour_time_expanded_format)); string_type frac_str; - if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { + if (local_format.find(seconds_with_fractional_seconds_format) != string_type::npos) { // replace %s with %S.nnn frac_str = - fractional_seconds_as_string(a_time.time_of_day(), false); - char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); + fractional_seconds_as_string(time_arg.time_of_day(), false); + char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point(); string_type replace_string(seconds_format); replace_string += sep; replace_string += frac_str; - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, seconds_with_fractional_seconds_format, replace_string); } /* NOTE: replacing posix_zone_string_format must be done BEFORE * zone_name_format: "%ZP" & "%Z", if Z is checked first it will * incorrectly replace a zone_name where a posix_string should go */ - if (format.find(posix_zone_string_format) != string_type::npos) { - if(a_time.zone_abbrev().empty()) { + if (local_format.find(posix_zone_string_format) != string_type::npos) { + if(time_arg.zone_abbrev().empty()) { // if zone_abbrev() returns an empty string, we want to // erase posix_zone_string_format from format - boost::algorithm::erase_all(format, posix_zone_string_format); + boost::algorithm::erase_all(local_format, posix_zone_string_format); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, posix_zone_string_format, - a_time.zone_as_posix_string()); + time_arg.zone_as_posix_string()); } } - if (format.find(zone_name_format) != string_type::npos) { - if(a_time.zone_name().empty()) { + if (local_format.find(zone_name_format) != string_type::npos) { + if(time_arg.zone_name().empty()) { /* TODO: this'll probably create problems if a user places * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ @@ -336,16 +336,16 @@ namespace date_time { // erase zone_name_format & one preceeding space std::basic_ostringstream<char_type> ss; ss << ' ' << zone_name_format; - boost::algorithm::erase_all(format, ss.str()); + boost::algorithm::erase_all(local_format, ss.str()); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, zone_name_format, - a_time.zone_name()); + time_arg.zone_name()); } } - if (format.find(zone_abbrev_format) != string_type::npos) { - if(a_time.zone_abbrev(false).empty()) { + if (local_format.find(zone_abbrev_format) != string_type::npos) { + if(time_arg.zone_abbrev(false).empty()) { /* TODO: this'll probably create problems if a user places * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ @@ -354,93 +354,93 @@ namespace date_time { // erase zone_abbrev_format & one preceeding space std::basic_ostringstream<char_type> ss; ss << ' ' << zone_abbrev_format; - boost::algorithm::erase_all(format, ss.str()); + boost::algorithm::erase_all(local_format, ss.str()); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, zone_abbrev_format, - a_time.zone_abbrev(false)); + time_arg.zone_abbrev(false)); } } - if (format.find(zone_iso_extended_format) != string_type::npos) { - if(a_time.zone_name(true).empty()) { + if (local_format.find(zone_iso_extended_format) != string_type::npos) { + if(time_arg.zone_name(true).empty()) { /* TODO: this'll probably create problems if a user places * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ // if zone_name() returns an empty string, we want to // erase zone_iso_extended_format from format - boost::algorithm::erase_all(format, zone_iso_extended_format); + boost::algorithm::erase_all(local_format, zone_iso_extended_format); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, zone_iso_extended_format, - a_time.zone_name(true)); + time_arg.zone_name(true)); } } - if (format.find(zone_iso_format) != string_type::npos) { - if(a_time.zone_abbrev(true).empty()) { + if (local_format.find(zone_iso_format) != string_type::npos) { + if(time_arg.zone_abbrev(true).empty()) { /* TODO: this'll probably create problems if a user places * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ // if zone_abbrev() returns an empty string, we want to // erase zone_iso_format from format - boost::algorithm::erase_all(format, zone_iso_format); + boost::algorithm::erase_all(local_format, zone_iso_format); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, zone_iso_format, - a_time.zone_abbrev(true)); + time_arg.zone_abbrev(true)); } } - if (format.find(fractional_seconds_format) != string_type::npos) { + if (local_format.find(fractional_seconds_format) != string_type::npos) { // replace %f with nnnnnnn if (frac_str.empty()) { - frac_str = fractional_seconds_as_string(a_time.time_of_day(), false); + frac_str = fractional_seconds_as_string(time_arg.time_of_day(), false); } - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, fractional_seconds_format, frac_str); } - if (format.find(fractional_seconds_or_none_format) != string_type::npos) { + if (local_format.find(fractional_seconds_or_none_format) != string_type::npos) { // replace %F with nnnnnnn or nothing if fs == 0 frac_str = - fractional_seconds_as_string(a_time.time_of_day(), true); + fractional_seconds_as_string(time_arg.time_of_day(), true); if (frac_str.size()) { - char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); + char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point(); string_type replace_string; replace_string += sep; replace_string += frac_str; - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, fractional_seconds_or_none_format, replace_string); } else { - boost::algorithm::erase_all(format, + boost::algorithm::erase_all(local_format, fractional_seconds_or_none_format); } } - return this->do_put_tm(a_next, a_ios, a_fill, - to_tm(a_time), format); + return this->do_put_tm(next_arg, ios_arg, fill_arg, + to_tm(time_arg), local_format); } //! put function for time_duration - OutItrT put(OutItrT a_next, - std::ios_base& a_ios, - char_type a_fill, - const time_duration_type& a_time_dur) const + OutItrT put(OutItrT next_arg, + std::ios_base& ios_arg, + char_type fill_arg, + const time_duration_type& time_dur_arg) const { - if (a_time_dur.is_special()) { - return this->do_put_special(a_next, a_ios, a_fill, - a_time_dur.get_rep().as_special()); + if (time_dur_arg.is_special()) { + return this->do_put_special(next_arg, ios_arg, fill_arg, + time_dur_arg.get_rep().as_special()); } string_type format(m_time_duration_format); - if (a_time_dur.is_negative()) { + if (time_dur_arg.is_negative()) { // replace %- with minus sign. Should we use the numpunct facet? boost::algorithm::replace_all(format, duration_sign_negative_only, @@ -477,7 +477,7 @@ namespace date_time { */ string_type hours_str; if (format.find(unrestricted_hours_format) != string_type::npos) { - hours_str = hours_as_string(a_time_dur); + hours_str = hours_as_string(time_dur_arg); boost::algorithm::replace_all(format, unrestricted_hours_format, hours_str); } // We still have to process restricted hours format specifier. In order to @@ -485,7 +485,7 @@ namespace date_time { // restrict the stringified hours length to 2 characters. if (format.find(hours_format) != string_type::npos) { if (hours_str.empty()) - hours_str = hours_as_string(a_time_dur); + hours_str = hours_as_string(time_dur_arg); BOOST_ASSERT(hours_str.length() <= 2); boost::algorithm::replace_all(format, hours_format, hours_str); } @@ -494,8 +494,8 @@ namespace date_time { if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { // replace %s with %S.nnn frac_str = - fractional_seconds_as_string(a_time_dur, false); - char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); + fractional_seconds_as_string(time_dur_arg, false); + char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point(); string_type replace_string(seconds_format); replace_string += sep; @@ -507,7 +507,7 @@ namespace date_time { if (format.find(fractional_seconds_format) != string_type::npos) { // replace %f with nnnnnnn if (!frac_str.size()) { - frac_str = fractional_seconds_as_string(a_time_dur, false); + frac_str = fractional_seconds_as_string(time_dur_arg, false); } boost::algorithm::replace_all(format, fractional_seconds_format, @@ -517,9 +517,9 @@ namespace date_time { if (format.find(fractional_seconds_or_none_format) != string_type::npos) { // replace %F with nnnnnnn or nothing if fs == 0 frac_str = - fractional_seconds_as_string(a_time_dur, true); + fractional_seconds_as_string(time_dur_arg, true); if (frac_str.size()) { - char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); + char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point(); string_type replace_string; replace_string += sep; replace_string += frac_str; @@ -533,14 +533,14 @@ namespace date_time { } } - return this->do_put_tm(a_next, a_ios, a_fill, - to_tm(a_time_dur), format); + return this->do_put_tm(next_arg, ios_arg, fill_arg, + to_tm(time_dur_arg), format); } - OutItrT put(OutItrT next, std::ios_base& a_ios, + OutItrT put(OutItrT next, std::ios_base& ios_arg, char_type fill, const period_type& p) const { - return this->m_period_formatter.put_period(next, a_ios, fill,p,*this); + return this->m_period_formatter.put_period(next, ios_arg, fill,p,*this); } @@ -548,11 +548,11 @@ namespace date_time { static string_type - fractional_seconds_as_string(const time_duration_type& a_time, + fractional_seconds_as_string(const time_duration_type& time_arg, bool null_when_zero) { typename time_duration_type::fractional_seconds_type frac_sec = - a_time.fractional_seconds(); + time_arg.fractional_seconds(); if (null_when_zero && (frac_sec == 0)) { return string_type(); @@ -566,9 +566,9 @@ namespace date_time { static string_type - hours_as_string(const time_duration_type& a_time, int width = 2) + hours_as_string(const time_duration_type& time_arg, int width = 2) { - return integral_as_string(date_time::absolute_value(a_time.hours()), width); + return integral_as_string(date_time::absolute_value(time_arg.hours()), width); } template< typename IntT > @@ -731,8 +731,8 @@ namespace date_time { static std::locale::id id; //! Constructor that takes a format string for a ptime - explicit time_input_facet(const string_type& format, ::size_t a_ref = 0) - : base_type(format, a_ref), + explicit time_input_facet(const string_type& format, ::size_t ref_arg = 0) + : base_type(format, ref_arg), m_time_duration_format(default_time_duration_format) { } @@ -741,19 +741,19 @@ namespace date_time { const special_values_parser_type& sv_parser, const period_parser_type& per_parser, const date_gen_parser_type& date_gen_parser, - ::size_t a_ref = 0) + ::size_t ref_arg = 0) : base_type(format, date_parser, sv_parser, per_parser, date_gen_parser, - a_ref), + ref_arg), m_time_duration_format(default_time_duration_format) {} //! sets default formats for ptime, local_date_time, and time_duration - explicit time_input_facet(::size_t a_ref = 0) - : base_type(default_time_input_format, a_ref), + explicit time_input_facet(::size_t ref_arg = 0) + : base_type(default_time_input_format, ref_arg), m_time_duration_format(default_time_duration_format) { } @@ -772,12 +772,12 @@ namespace date_time { InItrT get(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, period_type& p) const { p = this->m_period_parser.get_period(sitr, stream_end, - a_ios, + ios_arg, p, time_duration_type::unit(), *this); @@ -789,7 +789,7 @@ namespace date_time { InItrT get(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, time_duration_type& td) const { // skip leading whitespace @@ -813,10 +813,10 @@ namespace date_time { typename time_duration_type::fractional_seconds_type frac(0); typedef std::num_get<CharT, InItrT> num_get; - if(!std::has_facet<num_get>(a_ios.getloc())) { + if(!std::has_facet<num_get>(ios_arg.getloc())) { num_get* ng = new num_get(); - std::locale loc = std::locale(a_ios.getloc(), ng); - a_ios.imbue(loc); + std::locale loc = std::locale(ios_arg.getloc(), ng); + ios_arg.imbue(loc); } const_itr itr(m_time_duration_format.begin()); @@ -928,27 +928,27 @@ namespace date_time { //! Parses a time object from the input stream InItrT get(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, time_type& t) const { string_type tz_str; - return get(sitr, stream_end, a_ios, t, tz_str, false); + return get(sitr, stream_end, ios_arg, t, tz_str, false); } //! Expects a time_zone in the input stream InItrT get_local_time(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, time_type& t, string_type& tz_str) const { - return get(sitr, stream_end, a_ios, t, tz_str, true); + return get(sitr, stream_end, ios_arg, t, tz_str, true); } protected: InItrT get(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, time_type& t, string_type& tz_str, bool time_is_local) const @@ -985,10 +985,10 @@ namespace date_time { day_type t_day(1); typedef std::num_get<CharT, InItrT> num_get; - if(!std::has_facet<num_get>(a_ios.getloc())) { + if(!std::has_facet<num_get>(ios_arg.getloc())) { num_get* ng = new num_get(); - std::locale loc = std::locale(a_ios.getloc(), ng); - a_ios.imbue(loc); + std::locale loc = std::locale(ios_arg.getloc(), ng); + ios_arg.imbue(loc); } const_itr itr(this->m_format.begin()); diff --git a/3rdParty/Boost/src/boost/date_time/time_formatting_streams.hpp b/3rdParty/Boost/src/boost/date_time/time_formatting_streams.hpp index 3537c10..2d07d34 100644 --- a/3rdParty/Boost/src/boost/date_time/time_formatting_streams.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_formatting_streams.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <boost/date_time/compiler_config.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/time_iterator.hpp b/3rdParty/Boost/src/boost/date_time/time_iterator.hpp index 2258a33..4c33f39 100644 --- a/3rdParty/Boost/src/boost/date_time/time_iterator.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_iterator.hpp @@ -2,50 +2,50 @@ #define DATE_TIME_TIME_ITERATOR_HPP___ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ namespace boost { namespace date_time { - + //! Simple time iterator skeleton class template<class time_type> class time_itr { public: typedef typename time_type::time_duration_type time_duration_type; - time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {}; - time_itr& operator++() + time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {} + time_itr& operator++() { current_ = current_ + offset_; return *this; } - time_itr& operator--() + time_itr& operator--() { current_ = current_ - offset_; return *this; } - time_type operator*() {return current_;}; - time_type* operator->() {return ¤t_;}; - bool operator< (const time_type& t) {return current_ < t;}; - bool operator<= (const time_type& t) {return current_ <= t;}; - bool operator!= (const time_type& t) {return current_ != t;}; - bool operator== (const time_type& t) {return current_ == t;}; - bool operator> (const time_type& t) {return current_ > t;}; - bool operator>= (const time_type& t) {return current_ >= t;}; - + time_type operator*() {return current_;} + time_type* operator->() {return ¤t_;} + bool operator< (const time_type& t) {return current_ < t;} + bool operator<= (const time_type& t) {return current_ <= t;} + bool operator!= (const time_type& t) {return current_ != t;} + bool operator== (const time_type& t) {return current_ == t;} + bool operator> (const time_type& t) {return current_ > t;} + bool operator>= (const time_type& t) {return current_ >= t;} + private: time_type current_; time_duration_type offset_; }; - - + + } }//namespace date_time diff --git a/3rdParty/Boost/src/boost/date_time/time_parsing.hpp b/3rdParty/Boost/src/boost/date_time/time_parsing.hpp index dfccf6a..7b71de0 100644 --- a/3rdParty/Boost/src/boost/date_time/time_parsing.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_parsing.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $ */ #include "boost/tokenizer.hpp" @@ -116,6 +116,7 @@ namespace date_time { break; } + default: break; }//switch pos++; } @@ -153,9 +154,10 @@ namespace date_time { std::string& first, std::string& second) { - int sep_pos = static_cast<int>(s.find(sep)); + std::string::size_type sep_pos = s.find(sep); first = s.substr(0,sep_pos); - second = s.substr(sep_pos+1); + if (sep_pos!=std::string::npos) + second = s.substr(sep_pos+1); return true; } @@ -280,6 +282,7 @@ namespace date_time { break; } + default: break; }; pos++; } diff --git a/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp b/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp index 658f3d2..903830c 100644 --- a/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-06 07:25:55 -0400 (Sat, 06 Jun 2009) $ + * $Date: 2009-06-06 04:25:55 -0700 (Sat, 06 Jun 2009) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_system_counted.hpp b/3rdParty/Boost/src/boost/date_time/time_system_counted.hpp index fa88390..5425f62 100644 --- a/3rdParty/Boost/src/boost/date_time/time_system_counted.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_system_counted.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_system_split.hpp b/3rdParty/Boost/src/boost/date_time/time_system_split.hpp index 08ea1ec..6fc4a33 100644 --- a/3rdParty/Boost/src/boost/date_time/time_system_split.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_system_split.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_zone_base.hpp b/3rdParty/Boost/src/boost/date_time/time_zone_base.hpp index 0d3cb90..f239d54 100644 --- a/3rdParty/Boost/src/boost/date_time/time_zone_base.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_zone_base.hpp @@ -2,10 +2,10 @@ #define _DATE_TIME_TIME_ZONE_BASE__ /* Copyright (c) 2003-2005 CrystalClear Software, Inc. - * Subject to the Boost Software License, Version 1.0. + * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -26,9 +26,9 @@ namespace date_time { * would be to convert from POSIX timezone strings. Regardless of * the construction technique, this is the interface that these * time zone types must provide. - * + * * Note that this class is intended to be used as a shared - * resource (hence the derivation from boost::counted_base. + * resource (hence the derivation from boost::counted_base. */ template<typename time_type, typename CharT> class time_zone_base { @@ -39,8 +39,8 @@ namespace date_time { typedef typename time_type::date_type::year_type year_type; typedef typename time_type::time_duration_type time_duration_type; - time_zone_base() {}; - virtual ~time_zone_base() {}; + time_zone_base() {} + virtual ~time_zone_base() {} //!String for the timezone when in daylight savings (eg: EDT) virtual string_type dst_zone_abbrev() const=0; //!String for the zone when not in daylight savings (eg: EST) @@ -61,9 +61,9 @@ namespace date_time { virtual time_duration_type dst_offset() const=0; //! Returns a POSIX time_zone string for this object virtual string_type to_posix_string() const =0; - + private: - + }; @@ -82,7 +82,7 @@ namespace date_time { dst_start_offset_(dst_start_offset), dst_end_offset_(dst_end_offset) {} - + //! Amount DST adjusts the clock eg: plus one hour time_duration_type dst_adjust_; //! Time past midnight on start transition day that dst starts diff --git a/3rdParty/Boost/src/boost/date_time/time_zone_names.hpp b/3rdParty/Boost/src/boost/date_time/time_zone_names.hpp index 05260c7..a565027 100644 --- a/3rdParty/Boost/src/boost/date_time/time_zone_names.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_zone_names.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include <string> diff --git a/3rdParty/Boost/src/boost/date_time/tz_db_base.hpp b/3rdParty/Boost/src/boost/date_time/tz_db_base.hpp index 2440115..a6d8ea9 100644 --- a/3rdParty/Boost/src/boost/date_time/tz_db_base.hpp +++ b/3rdParty/Boost/src/boost/date_time/tz_db_base.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ #include <map> @@ -167,6 +167,16 @@ namespace boost { tz_db_base() {} //! Process csv data file, may throw exceptions + /*! May throw bad_field_count exceptions */ + void load_from_stream(std::istream &in) + { + std::string buff; + while( std::getline(in, buff)) { + parse_string(buff); + } + } + + //! Process csv data file, may throw exceptions /*! May throw data_not_accessible, or bad_field_count exceptions */ void load_from_file(const std::string& pathspec) { @@ -178,10 +188,7 @@ namespace boost { boost::throw_exception(data_not_accessible(pathspec)); } std::getline(ifs, buff); // first line is column headings - - while( std::getline(ifs, buff)) { - parse_string(buff); - } + this->load_from_stream(ifs); } //! returns true if record successfully added to map diff --git a/3rdParty/Boost/src/boost/date_time/wrapping_int.hpp b/3rdParty/Boost/src/boost/date_time/wrapping_int.hpp index 969b078..e6f87d5 100644 --- a/3rdParty/Boost/src/boost/date_time/wrapping_int.hpp +++ b/3rdParty/Boost/src/boost/date_time/wrapping_int.hpp @@ -2,11 +2,11 @@ #define _DATE_TIME_WRAPPING_INT_HPP__ /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -16,15 +16,15 @@ namespace date_time { //! A wrapping integer used to support time durations (WARNING: only instantiate with a signed type) /*! In composite date and time types this type is used to * wrap at the day boundary. - * Ex: - * A wrapping_int<short, 10> will roll over after nine, and + * Ex: + * A wrapping_int<short, 10> will roll over after nine, and * roll under below zero. This gives a range of [0,9] * - * NOTE: it is strongly recommended that wrapping_int2 be used - * instead of wrapping_int as wrapping_int is to be depricated + * NOTE: it is strongly recommended that wrapping_int2 be used + * instead of wrapping_int as wrapping_int is to be depricated * at some point soon. * - * Also Note that warnings will occur if instantiated with an + * Also Note that warnings will occur if instantiated with an * unsigned type. Only a signed type should be used! */ template<typename int_type_, int_type_ wrap_val> @@ -34,17 +34,17 @@ public: //typedef overflow_type_ overflow_type; static int_type wrap_value() {return wrap_val;} //!Add, return true if wrapped - wrapping_int(int_type v) : value_(v) {}; + wrapping_int(int_type v) : value_(v) {} //! Explicit converion method int_type as_int() const {return value_;} operator int_type() const {return value_;} //!Add, return number of wraps performed - /*! The sign of the returned value will indicate which direction the + /*! The sign of the returned value will indicate which direction the * wraps went. Ex: add a negative number and wrapping under could occur, - * this would be indicated by a negative return value. If wrapping over + * this would be indicated by a negative return value. If wrapping over * took place, a positive value would be returned */ template< typename IntT > - IntT add(IntT v) + IntT add(IntT v) { int_type remainder = static_cast<int_type>(v % (wrap_val)); IntT overflow = static_cast<IntT>(v / (wrap_val)); @@ -53,12 +53,12 @@ public: } //! Subtract will return '+d' if wrapping under took place ('d' is the number of wraps) /*! The sign of the returned value will indicate which direction the - * wraps went (positive indicates wrap under, negative indicates wrap over). - * Ex: subtract a negative number and wrapping over could - * occur, this would be indicated by a negative return value. If + * wraps went (positive indicates wrap under, negative indicates wrap over). + * Ex: subtract a negative number and wrapping over could + * occur, this would be indicated by a negative return value. If * wrapping under took place, a positive value would be returned. */ template< typename IntT > - IntT subtract(IntT v) + IntT subtract(IntT v) { int_type remainder = static_cast<int_type>(v % (wrap_val)); IntT underflow = static_cast<IntT>(-(v / (wrap_val))); @@ -71,19 +71,19 @@ private: template< typename IntT > IntT calculate_wrap(IntT wrap) { - if ((value_) >= wrap_val) + if ((value_) >= wrap_val) { ++wrap; value_ -= (wrap_val); } - else if(value_ < 0) + else if(value_ < 0) { --wrap; value_ += (wrap_val); } return wrap; } - + }; @@ -113,12 +113,12 @@ public: int_type as_int() const {return value_;} operator int_type() const {return value_;} //!Add, return number of wraps performed - /*! The sign of the returned value will indicate which direction the + /*! The sign of the returned value will indicate which direction the * wraps went. Ex: add a negative number and wrapping under could occur, - * this would be indicated by a negative return value. If wrapping over + * this would be indicated by a negative return value. If wrapping over * took place, a positive value would be returned */ template< typename IntT > - IntT add(IntT v) + IntT add(IntT v) { int_type remainder = static_cast<int_type>(v % (wrap_max - wrap_min + 1)); IntT overflow = static_cast<IntT>(v / (wrap_max - wrap_min + 1)); @@ -127,30 +127,30 @@ public: } //! Subtract will return '-d' if wrapping under took place ('d' is the number of wraps) /*! The sign of the returned value will indicate which direction the - * wraps went. Ex: subtract a negative number and wrapping over could - * occur, this would be indicated by a positive return value. If + * wraps went. Ex: subtract a negative number and wrapping over could + * occur, this would be indicated by a positive return value. If * wrapping under took place, a negative value would be returned */ template< typename IntT > - IntT subtract(IntT v) + IntT subtract(IntT v) { int_type remainder = static_cast<int_type>(v % (wrap_max - wrap_min + 1)); IntT underflow = static_cast<IntT>(-(v / (wrap_max - wrap_min + 1))); value_ = static_cast<int_type>(value_ - remainder); return calculate_wrap(underflow); } - + private: int_type value_; template< typename IntT > IntT calculate_wrap(IntT wrap) { - if ((value_) > wrap_max) + if ((value_) > wrap_max) { ++wrap; value_ -= (wrap_max - wrap_min + 1); } - else if((value_) < wrap_min) + else if((value_) < wrap_min) { --wrap; value_ += (wrap_max - wrap_min + 1); diff --git a/3rdParty/Boost/src/boost/date_time/year_month_day.hpp b/3rdParty/Boost/src/boost/date_time/year_month_day.hpp index 802ce42..9340e53 100644 --- a/3rdParty/Boost/src/boost/date_time/year_month_day.hpp +++ b/3rdParty/Boost/src/boost/date_time/year_month_day.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ namespace boost { diff --git a/3rdParty/Boost/src/boost/detail/allocator_utilities.hpp b/3rdParty/Boost/src/boost/detail/allocator_utilities.hpp deleted file mode 100644 index 5d6ef48..0000000 --- a/3rdParty/Boost/src/boost/detail/allocator_utilities.hpp +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright 2003-2009 Joaquin M Lopez Munoz. - * 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) - * - * See Boost website at http://www.boost.org/ - */ - -#ifndef BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP -#define BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP - -#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ -#include <boost/detail/workaround.hpp> -#include <boost/mpl/aux_/msvc_never_true.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <cstddef> -#include <memory> -#include <new> - -namespace boost{ - -namespace detail{ - -/* Allocator adaption layer. Some stdlibs provide allocators without rebind - * and template ctors. These facilities are simulated with the external - * template class rebind_to and the aid of partial_std_allocator_wrapper. - */ - -namespace allocator{ - -/* partial_std_allocator_wrapper inherits the functionality of a std - * allocator while providing a templatized ctor and other bits missing - * in some stdlib implementation or another. - */ - -template<typename Type> -class partial_std_allocator_wrapper:public std::allocator<Type> -{ -public: - /* Oddly enough, STLport does not define std::allocator<void>::value_type - * when configured to work without partial template specialization. - * No harm in supplying the definition here unconditionally. - */ - - typedef Type value_type; - - partial_std_allocator_wrapper(){}; - - template<typename Other> - partial_std_allocator_wrapper(const partial_std_allocator_wrapper<Other>&){} - - partial_std_allocator_wrapper(const std::allocator<Type>& x): - std::allocator<Type>(x) - { - }; - -#if defined(BOOST_DINKUMWARE_STDLIB) - /* Dinkumware guys didn't provide a means to call allocate() without - * supplying a hint, in disagreement with the standard. - */ - - Type* allocate(std::size_t n,const void* hint=0) - { - std::allocator<Type>& a=*this; - return a.allocate(n,hint); - } -#endif - -}; - -/* Detects whether a given allocator belongs to a defective stdlib not - * having the required member templates. - * Note that it does not suffice to check the Boost.Config stdlib - * macros, as the user might have passed a custom, compliant allocator. - * The checks also considers partial_std_allocator_wrapper to be - * a standard defective allocator. - */ - -#if defined(BOOST_NO_STD_ALLOCATOR)&&\ - (defined(BOOST_HAS_PARTIAL_STD_ALLOCATOR)||defined(BOOST_DINKUMWARE_STDLIB)) - -template<typename Allocator> -struct is_partial_std_allocator -{ - BOOST_STATIC_CONSTANT(bool, - value= - (is_same< - std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>, - Allocator - >::value)|| - (is_same< - partial_std_allocator_wrapper< - BOOST_DEDUCED_TYPENAME Allocator::value_type>, - Allocator - >::value)); -}; - -#else - -template<typename Allocator> -struct is_partial_std_allocator -{ - BOOST_STATIC_CONSTANT(bool,value=false); -}; - -#endif - -/* rebind operations for defective std allocators */ - -template<typename Allocator,typename Type> -struct partial_std_allocator_rebind_to -{ - typedef partial_std_allocator_wrapper<Type> type; -}; - -/* rebind operation in all other cases */ - -#if BOOST_WORKAROUND(BOOST_MSVC,<1300) -/* Workaround for a problem in MSVC with dependent template typedefs - * when doing rebinding of allocators. - * Modeled after <boost/mpl/aux_/msvc_dtw.hpp> (thanks, Aleksey!) - */ - -template<typename Allocator> -struct rebinder -{ - template<bool> struct fake_allocator:Allocator{}; - template<> struct fake_allocator<true> - { - template<typename Type> struct rebind{}; - }; - - template<typename Type> - struct result: - fake_allocator<mpl::aux::msvc_never_true<Allocator>::value>:: - template rebind<Type> - { - }; -}; -#else -template<typename Allocator> -struct rebinder -{ - template<typename Type> - struct result - { - typedef typename Allocator::BOOST_NESTED_TEMPLATE - rebind<Type>::other other; - }; -}; -#endif - -template<typename Allocator,typename Type> -struct compliant_allocator_rebind_to -{ - typedef typename rebinder<Allocator>:: - BOOST_NESTED_TEMPLATE result<Type>::other type; -}; - -/* rebind front-end */ - -template<typename Allocator,typename Type> -struct rebind_to: - mpl::eval_if_c< - is_partial_std_allocator<Allocator>::value, - partial_std_allocator_rebind_to<Allocator,Type>, - compliant_allocator_rebind_to<Allocator,Type> - > -{ -}; - -/* allocator-independent versions of construct and destroy */ - -template<typename Type> -void construct(void* p,const Type& t) -{ - new (p) Type(t); -} - -#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) -/* MSVC++ issues spurious warnings about unreferencend formal parameters - * in destroy<Type> when Type is a class with trivial dtor. - */ - -#pragma warning(push) -#pragma warning(disable:4100) -#endif - -template<typename Type> -void destroy(const Type* p) -{ - -#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590)) - const_cast<Type*>(p)->~Type(); -#else - p->~Type(); -#endif - -} - -#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) -#pragma warning(pop) -#endif - -} /* namespace boost::detail::allocator */ - -} /* namespace boost::detail */ - -} /* namespace boost */ - -#endif diff --git a/3rdParty/Boost/src/boost/detail/call_traits.hpp b/3rdParty/Boost/src/boost/detail/call_traits.hpp index 6ad646e..36dea00 100644 --- a/3rdParty/Boost/src/boost/detail/call_traits.hpp +++ b/3rdParty/Boost/src/boost/detail/call_traits.hpp @@ -24,6 +24,7 @@ #include <cstddef> #include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_enum.hpp> #include <boost/type_traits/is_pointer.hpp> #include <boost/detail/workaround.hpp> @@ -43,20 +44,26 @@ struct ct_imp2<T, true> typedef const T param_type; }; -template <typename T, bool isp, bool b1> +template <typename T, bool isp, bool b1, bool b2> struct ct_imp { typedef const T& param_type; }; -template <typename T, bool isp> -struct ct_imp<T, isp, true> +template <typename T, bool isp, bool b2> +struct ct_imp<T, isp, true, b2> +{ + typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type; +}; + +template <typename T, bool isp, bool b1> +struct ct_imp<T, isp, b1, true> { typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type; }; -template <typename T, bool b1> -struct ct_imp<T, true, b1> +template <typename T, bool b1, bool b2> +struct ct_imp<T, true, b1, b2> { typedef const T param_type; }; @@ -79,7 +86,8 @@ public: typedef typename boost::detail::ct_imp< T, ::boost::is_pointer<T>::value, - ::boost::is_arithmetic<T>::value + ::boost::is_arithmetic<T>::value, + ::boost::is_enum<T>::value >::param_type param_type; }; diff --git a/3rdParty/Boost/src/boost/detail/compressed_pair.hpp b/3rdParty/Boost/src/boost/detail/compressed_pair.hpp deleted file mode 100644 index 3f32645..0000000 --- a/3rdParty/Boost/src/boost/detail/compressed_pair.hpp +++ /dev/null @@ -1,443 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to 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). -// -// See http://www.boost.org/libs/utility for most recent version including documentation. - -// compressed_pair: pair that "compresses" empty members -// (see libs/utility/compressed_pair.htm) -// -// JM changes 25 Jan 2004: -// For the case where T1 == T2 and both are empty, then first() and second() -// should return different objects. -// JM changes 25 Jan 2000: -// Removed default arguments from compressed_pair_switch to get -// C++ Builder 4 to accept them -// rewriten swap to get gcc and C++ builder to compile. -// added partial specialisations for case T1 == T2 to avoid duplicate constructor defs. - -#ifndef BOOST_DETAIL_COMPRESSED_PAIR_HPP -#define BOOST_DETAIL_COMPRESSED_PAIR_HPP - -#include <algorithm> - -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/is_empty.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/call_traits.hpp> - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable:4512) -#endif -namespace boost -{ - -template <class T1, class T2> -class compressed_pair; - - -// compressed_pair - -namespace details -{ - // JM altered 26 Jan 2000: - template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty> - struct compressed_pair_switch; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, false, false, false> - {static const int value = 0;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, false, true, true> - {static const int value = 3;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, false, true, false> - {static const int value = 1;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, false, false, true> - {static const int value = 2;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, true, true, true> - {static const int value = 4;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, true, false, false> - {static const int value = 5;}; - - template <class T1, class T2, int Version> class compressed_pair_imp; - -#ifdef __GNUC__ - // workaround for GCC (JM): - using std::swap; -#endif - // - // can't call unqualified swap from within classname::swap - // as Koenig lookup rules will find only the classname::swap - // member function not the global declaration, so use cp_swap - // as a forwarding function (JM): - template <typename T> - inline void cp_swap(T& t1, T& t2) - { -#ifndef __GNUC__ - using std::swap; -#endif - swap(t1, t2); - } - - // 0 derive from neither - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 0> - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_(x), second_(y) {} - - compressed_pair_imp(first_param_type x) - : first_(x) {} - - compressed_pair_imp(second_param_type y) - : second_(y) {} - - first_reference first() {return first_;} - first_const_reference first() const {return first_;} - - second_reference second() {return second_;} - second_const_reference second() const {return second_;} - - void swap(::boost::compressed_pair<T1, T2>& y) - { - cp_swap(first_, y.first()); - cp_swap(second_, y.second()); - } - private: - first_type first_; - second_type second_; - }; - - // 1 derive from T1 - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 1> - : protected ::boost::remove_cv<T1>::type - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_type(x), second_(y) {} - - compressed_pair_imp(first_param_type x) - : first_type(x) {} - - compressed_pair_imp(second_param_type y) - : second_(y) {} - - first_reference first() {return *this;} - first_const_reference first() const {return *this;} - - second_reference second() {return second_;} - second_const_reference second() const {return second_;} - - void swap(::boost::compressed_pair<T1,T2>& y) - { - // no need to swap empty base class: - cp_swap(second_, y.second()); - } - private: - second_type second_; - }; - - // 2 derive from T2 - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 2> - : protected ::boost::remove_cv<T2>::type - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : second_type(y), first_(x) {} - - compressed_pair_imp(first_param_type x) - : first_(x) {} - - compressed_pair_imp(second_param_type y) - : second_type(y) {} - - first_reference first() {return first_;} - first_const_reference first() const {return first_;} - - second_reference second() {return *this;} - second_const_reference second() const {return *this;} - - void swap(::boost::compressed_pair<T1,T2>& y) - { - // no need to swap empty base class: - cp_swap(first_, y.first()); - } - - private: - first_type first_; - }; - - // 3 derive from T1 and T2 - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 3> - : protected ::boost::remove_cv<T1>::type, - protected ::boost::remove_cv<T2>::type - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_type(x), second_type(y) {} - - compressed_pair_imp(first_param_type x) - : first_type(x) {} - - compressed_pair_imp(second_param_type y) - : second_type(y) {} - - first_reference first() {return *this;} - first_const_reference first() const {return *this;} - - second_reference second() {return *this;} - second_const_reference second() const {return *this;} - // - // no need to swap empty bases: - void swap(::boost::compressed_pair<T1,T2>&) {} - }; - - // JM - // 4 T1 == T2, T1 and T2 both empty - // Originally this did not store an instance of T2 at all - // but that led to problems beause it meant &x.first() == &x.second() - // which is not true for any other kind of pair, so now we store an instance - // of T2 just in case the user is relying on first() and second() returning - // different objects (albeit both empty). - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 4> - : protected ::boost::remove_cv<T1>::type - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_type(x), m_second(y) {} - - compressed_pair_imp(first_param_type x) - : first_type(x), m_second(x) {} - - first_reference first() {return *this;} - first_const_reference first() const {return *this;} - - second_reference second() {return m_second;} - second_const_reference second() const {return m_second;} - - void swap(::boost::compressed_pair<T1,T2>&) {} - private: - T2 m_second; - }; - - // 5 T1 == T2 and are not empty: //JM - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 5> - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_(x), second_(y) {} - - compressed_pair_imp(first_param_type x) - : first_(x), second_(x) {} - - first_reference first() {return first_;} - first_const_reference first() const {return first_;} - - second_reference second() {return second_;} - second_const_reference second() const {return second_;} - - void swap(::boost::compressed_pair<T1, T2>& y) - { - cp_swap(first_, y.first()); - cp_swap(second_, y.second()); - } - private: - first_type first_; - second_type second_; - }; - -} // details - -template <class T1, class T2> -class compressed_pair - : private ::boost::details::compressed_pair_imp<T1, T2, - ::boost::details::compressed_pair_switch< - T1, - T2, - ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value, - ::boost::is_empty<T1>::value, - ::boost::is_empty<T2>::value>::value> -{ -private: - typedef details::compressed_pair_imp<T1, T2, - ::boost::details::compressed_pair_switch< - T1, - T2, - ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value, - ::boost::is_empty<T1>::value, - ::boost::is_empty<T2>::value>::value> base; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair() : base() {} - compressed_pair(first_param_type x, second_param_type y) : base(x, y) {} - explicit compressed_pair(first_param_type x) : base(x) {} - explicit compressed_pair(second_param_type y) : base(y) {} - - first_reference first() {return base::first();} - first_const_reference first() const {return base::first();} - - second_reference second() {return base::second();} - second_const_reference second() const {return base::second();} - - void swap(compressed_pair& y) { base::swap(y); } -}; - -// JM -// Partial specialisation for case where T1 == T2: -// -template <class T> -class compressed_pair<T, T> - : private details::compressed_pair_imp<T, T, - ::boost::details::compressed_pair_switch< - T, - T, - ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value, - ::boost::is_empty<T>::value, - ::boost::is_empty<T>::value>::value> -{ -private: - typedef details::compressed_pair_imp<T, T, - ::boost::details::compressed_pair_switch< - T, - T, - ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value, - ::boost::is_empty<T>::value, - ::boost::is_empty<T>::value>::value> base; -public: - typedef T first_type; - typedef T second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair() : base() {} - compressed_pair(first_param_type x, second_param_type y) : base(x, y) {} -#if !(defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) - explicit -#endif - compressed_pair(first_param_type x) : base(x) {} - - first_reference first() {return base::first();} - first_const_reference first() const {return base::first();} - - second_reference second() {return base::second();} - second_const_reference second() const {return base::second();} - - void swap(::boost::compressed_pair<T,T>& y) { base::swap(y); } -}; - -template <class T1, class T2> -inline -void -swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) -{ - x.swap(y); -} - -} // boost - -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - -#endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP - diff --git a/3rdParty/Boost/src/boost/detail/container_fwd.hpp b/3rdParty/Boost/src/boost/detail/container_fwd.hpp index 9a21252..ef17498 100644 --- a/3rdParty/Boost/src/boost/detail/container_fwd.hpp +++ b/3rdParty/Boost/src/boost/detail/container_fwd.hpp @@ -1,24 +1,92 @@ -// Copyright 2005-2008 Daniel James. +// Copyright 2005-2011 Daniel James. // 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) +// Note: if you change this include guard, you also need to change +// container_fwd_compile_fail.cpp #if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP) #define BOOST_DETAIL_CONTAINER_FWD_HPP -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) && (_MSC_VER >= 1020) && \ + !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) # pragma once #endif #include <boost/config.hpp> #include <boost/detail/workaround.hpp> -#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) \ - || ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) \ - && (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \ - || BOOST_WORKAROUND(__BORLANDC__, > 0x551) \ - || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \ - || (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) +//////////////////////////////////////////////////////////////////////////////// +// // +// Define BOOST_DETAIL_NO_CONTAINER_FWD if you don't want this header to // +// forward declare standard containers. // +// // +// BOOST_DETAIL_CONTAINER_FWD to make it foward declare containers even if it // +// normally doesn't. // +// // +// BOOST_DETAIL_NO_CONTAINER_FWD overrides BOOST_DETAIL_CONTAINER_FWD. // +// // +//////////////////////////////////////////////////////////////////////////////// + +#if !defined(BOOST_DETAIL_NO_CONTAINER_FWD) +# if defined(BOOST_DETAIL_CONTAINER_FWD) + // Force forward declarations. +# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) + // STLport +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(__LIBCOMO__) + // Comeau STL: +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) + // Rogue Wave library: +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(_LIBCPP_VERSION) + // libc++ +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(__GLIBCPP__) || defined(__GLIBCXX__) + // GNU libstdc++ 3 + // + // Disable forwarding for all recent versions, as the library has a + // versioned namespace mode, and I don't know how to detect it. +# if __GLIBCXX__ >= 20070513 \ + || defined(_GLIBCXX_DEBUG) \ + || defined(_GLIBCXX_PARALLEL) \ + || defined(_GLIBCXX_PROFILE) +# define BOOST_DETAIL_NO_CONTAINER_FWD +# else +# if defined(__GLIBCXX__) && __GLIBCXX__ >= 20040530 +# define BOOST_CONTAINER_FWD_COMPLEX_STRUCT +# endif +# endif +# elif defined(__STL_CONFIG_H) + // generic SGI STL + // + // Forward declaration seems to be okay, but it has a couple of odd + // implementations. +# define BOOST_CONTAINER_FWD_BAD_BITSET +# if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) +# define BOOST_CONTAINER_FWD_BAD_DEQUE +# endif +# elif defined(__MSL_CPP__) + // MSL standard lib: +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(__IBMCPP__) + // The default VACPP std lib, forward declaration seems to be fine. +# elif defined(MSIPL_COMPILE_H) + // Modena C++ standard library +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) + // Dinkumware Library (this has to appear after any possible replacement + // libraries) +# else +# define BOOST_DETAIL_NO_CONTAINER_FWD +# endif +#endif + +#if !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) + +#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) && \ + !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD) #include <deque> #include <list> @@ -33,17 +101,6 @@ #include <cstddef> -#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && \ - defined(__STL_CONFIG_H) - -#define BOOST_CONTAINER_FWD_BAD_BITSET - -#if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) -#define BOOST_CONTAINER_FWD_BAD_DEQUE -#endif - -#endif - #if defined(BOOST_CONTAINER_FWD_BAD_DEQUE) #include <deque> #endif @@ -63,21 +120,18 @@ namespace std template <class charT, class traits, class Allocator> class basic_string; #if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + template <class charT> struct string_char_traits; #else template <class charT> struct char_traits; #endif - #if BOOST_CLANG - template <class T> struct complex; - #else - template <class T> class complex; - #endif -} +#if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT) + template <class T> struct complex; +#else + template <class T> class complex; +#endif -// gcc 3.4 and greater -namespace std -{ #if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE) template <class T, class Allocator> class deque; #endif @@ -100,6 +154,9 @@ namespace std #pragma warning(pop) #endif -#endif +#endif // BOOST_DETAIL_NO_CONTAINER_FWD && + // !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD) + +#endif // BOOST_DETAIL_TEST_CONFIG_ONLY #endif diff --git a/3rdParty/Boost/src/boost/detail/fenv.hpp b/3rdParty/Boost/src/boost/detail/fenv.hpp new file mode 100644 index 0000000..f048706 --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/fenv.hpp @@ -0,0 +1,74 @@ +/*============================================================================= + Copyright (c) 2010 Bryce Lelbach + + 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) +=============================================================================*/ + +#include <boost/config.hpp> + +#if defined(BOOST_NO_FENV_H) + #error This platform does not have a floating point environment +#endif + +#if !defined(BOOST_DETAIL_FENV_HPP) +#define BOOST_DETAIL_FENV_HPP + +/* If we're using clang + glibc, we have to get hacky. + * See http://llvm.org/bugs/show_bug.cgi?id=6907 */ +#if defined(__clang__) && (__clang_major__ < 3) && \ + defined(__GNU_LIBRARY__) && /* up to version 5 */ \ + defined(__GLIBC__) && /* version 6 + */ \ + !defined(_FENV_H) + #define _FENV_H + + #include <features.h> + #include <bits/fenv.h> + + extern "C" { + extern int fegetexceptflag (fexcept_t*, int) __THROW; + extern int fesetexceptflag (__const fexcept_t*, int) __THROW; + extern int feclearexcept (int) __THROW; + extern int feraiseexcept (int) __THROW; + extern int fetestexcept (int) __THROW; + extern int fegetround (void) __THROW; + extern int fesetround (int) __THROW; + extern int fegetenv (fenv_t*) __THROW; + extern int fesetenv (__const fenv_t*) __THROW; + extern int feupdateenv (__const fenv_t*) __THROW; + extern int feholdexcept (fenv_t*) __THROW; + + #ifdef __USE_GNU + extern int feenableexcept (int) __THROW; + extern int fedisableexcept (int) __THROW; + extern int fegetexcept (void) __THROW; + #endif + } + + namespace std { namespace tr1 { + using ::fenv_t; + using ::fexcept_t; + using ::fegetexceptflag; + using ::fesetexceptflag; + using ::feclearexcept; + using ::feraiseexcept; + using ::fetestexcept; + using ::fegetround; + using ::fesetround; + using ::fegetenv; + using ::fesetenv; + using ::feupdateenv; + using ::feholdexcept; + } } + +#else /* if we're not using GNU's C stdlib, fenv.h should work with clang */ + #if defined(__SUNPRO_CC) /* lol suncc */ + #include <stdio.h> + #endif + + #include <fenv.h> + +#endif + +#endif /* BOOST_DETAIL_FENV_HPP */ + diff --git a/3rdParty/Boost/src/boost/detail/interlocked.hpp b/3rdParty/Boost/src/boost/detail/interlocked.hpp index fccebc3..75e5a30 100644 --- a/3rdParty/Boost/src/boost/detail/interlocked.hpp +++ b/3rdParty/Boost/src/boost/detail/interlocked.hpp @@ -33,6 +33,21 @@ #elif defined(_WIN32_WCE) +#if _WIN32_WCE >= 0x600 + +extern "C" long __cdecl _InterlockedIncrement( long volatile * ); +extern "C" long __cdecl _InterlockedDecrement( long volatile * ); +extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); + +# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#else // under Windows CE we still have old-style Interlocked* functions extern "C" long __cdecl InterlockedIncrement( long* ); @@ -47,6 +62,8 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); # define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd +#endif + # define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare))) # define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ @@ -54,7 +71,11 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); #elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) -#if defined( __CLRCALL_PURE_OR_CDECL ) +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 + +#include <intrin.h> + +#elif defined( __CLRCALL_PURE_OR_CDECL ) extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); @@ -106,17 +127,29 @@ extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) +#if defined(__MINGW64__) +#define BOOST_INTERLOCKED_IMPORT +#else +#define BOOST_INTERLOCKED_IMPORT __declspec(dllimport) +#endif + + namespace boost { namespace detail { -extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); -extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); -extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); -extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); -extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedIncrement( long volatile * ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedDecrement( long volatile * ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedCompareExchange( long volatile *, long, long ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedExchange( long volatile *, long ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedExchangeAdd( long volatile *, long ); + +# if defined(_M_IA64) || defined(_M_AMD64) +extern "C" BOOST_INTERLOCKED_IMPORT void* __stdcall InterlockedCompareExchangePointer( void* volatile *, void*, void* ); +extern "C" BOOST_INTERLOCKED_IMPORT void* __stdcall InterlockedExchangePointer( void* volatile *, void* ); +# endif } // namespace detail @@ -128,10 +161,15 @@ extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long vol # define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd -# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ +# if defined(_M_IA64) || defined(_M_AMD64) +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER ::boost::detail::InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER ::boost::detail::InterlockedExchangePointer +# else +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) -# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) +# endif #else diff --git a/3rdParty/Boost/src/boost/detail/is_incrementable.hpp b/3rdParty/Boost/src/boost/detail/is_incrementable.hpp new file mode 100644 index 0000000..e7ef9dc --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/is_incrementable.hpp @@ -0,0 +1,134 @@ +// Copyright David Abrahams 2004. Use, modification and distribution is +// subject to 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 IS_INCREMENTABLE_DWA200415_HPP +# define IS_INCREMENTABLE_DWA200415_HPP + +# include <boost/type_traits/detail/template_arity_spec.hpp> +# include <boost/type_traits/remove_cv.hpp> +# include <boost/mpl/aux_/lambda_support.hpp> +# include <boost/mpl/bool.hpp> +# include <boost/detail/workaround.hpp> + +// Must be the last include +# include <boost/type_traits/detail/bool_trait_def.hpp> + +namespace boost { namespace detail { + +// is_incrementable<T> metafunction +// +// Requires: Given x of type T&, if the expression ++x is well-formed +// it must have complete type; otherwise, it must neither be ambiguous +// nor violate access. + +// This namespace ensures that ADL doesn't mess things up. +namespace is_incrementable_ +{ + // a type returned from operator++ when no increment is found in the + // type's own namespace + struct tag {}; + + // any soaks up implicit conversions and makes the following + // operator++ less-preferred than any other such operator that + // might be found via ADL. + struct any { template <class T> any(T const&); }; + + // This is a last-resort operator++ for when none other is found +# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 + +} + +namespace is_incrementable_2 +{ + is_incrementable_::tag operator++(is_incrementable_::any const&); + is_incrementable_::tag operator++(is_incrementable_::any const&,int); +} +using namespace is_incrementable_2; + +namespace is_incrementable_ +{ + +# else + + tag operator++(any const&); + tag operator++(any const&,int); + +# endif + +# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ + || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# define BOOST_comma(a,b) (a) +# else + // In case an operator++ is found that returns void, we'll use ++x,0 + tag operator,(tag,int); +# define BOOST_comma(a,b) (a,b) +# endif + +# if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4913) // Warning about operator, +# endif + + // two check overloads help us identify which operator++ was picked + char (& check_(tag) )[2]; + + template <class T> + char check_(T const&); + + + template <class T> + struct impl + { + static typename boost::remove_cv<T>::type& x; + + BOOST_STATIC_CONSTANT( + bool + , value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1 + ); + }; + + template <class T> + struct postfix_impl + { + static typename boost::remove_cv<T>::type& x; + + BOOST_STATIC_CONSTANT( + bool + , value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1 + ); + }; + +# if defined(BOOST_MSVC) +# pragma warning(pop) +# endif + +} + +# undef BOOST_comma + +template<typename T> +struct is_incrementable +BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value) + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T)) +}; + +template<typename T> +struct is_postfix_incrementable +BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value) + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T)) +}; + +} // namespace detail + +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_incrementable) +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable) + +} // namespace boost + +# include <boost/type_traits/detail/bool_trait_undef.hpp> + +#endif // IS_INCREMENTABLE_DWA200415_HPP diff --git a/3rdParty/Boost/src/boost/detail/ob_compressed_pair.hpp b/3rdParty/Boost/src/boost/detail/ob_compressed_pair.hpp deleted file mode 100644 index 727acab..0000000 --- a/3rdParty/Boost/src/boost/detail/ob_compressed_pair.hpp +++ /dev/null @@ -1,510 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to 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). -// -// See http://www.boost.org/libs/utility for most recent version including documentation. -// see libs/utility/compressed_pair.hpp -// -/* Release notes: - 20 Jan 2001: - Fixed obvious bugs (David Abrahams) - 07 Oct 2000: - Added better single argument constructor support. - 03 Oct 2000: - Added VC6 support (JM). - 23rd July 2000: - Additional comments added. (JM) - Jan 2000: - Original version: this version crippled for use with crippled compilers - - John Maddock Jan 2000. -*/ - - -#ifndef BOOST_OB_COMPRESSED_PAIR_HPP -#define BOOST_OB_COMPRESSED_PAIR_HPP - -#include <algorithm> -#ifndef BOOST_OBJECT_TYPE_TRAITS_HPP -#include <boost/type_traits/object_traits.hpp> -#endif -#ifndef BOOST_SAME_TRAITS_HPP -#include <boost/type_traits/same_traits.hpp> -#endif -#ifndef BOOST_CALL_TRAITS_HPP -#include <boost/call_traits.hpp> -#endif - -namespace boost -{ -#ifdef BOOST_MSVC6_MEMBER_TEMPLATES -// -// use member templates to emulate -// partial specialisation. Note that due to -// problems with overload resolution with VC6 -// each of the compressed_pair versions that follow -// have one template single-argument constructor -// in place of two specific constructors: -// - -template <class T1, class T2> -class compressed_pair; - -namespace detail{ - -template <class A, class T1, class T2> -struct best_conversion_traits -{ - typedef char one; - typedef char (&two)[2]; - static A a; - static one test(T1); - static two test(T2); - - enum { value = sizeof(test(a)) }; -}; - -template <int> -struct init_one; - -template <> -struct init_one<1> -{ - template <class A, class T1, class T2> - static void init(const A& a, T1* p1, T2*) - { - *p1 = a; - } -}; - -template <> -struct init_one<2> -{ - template <class A, class T1, class T2> - static void init(const A& a, T1*, T2* p2) - { - *p2 = a; - } -}; - - -// T1 != T2, both non-empty -template <class T1, class T2> -class compressed_pair_0 -{ -private: - T1 _first; - T2 _second; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_0() : _first(), _second() {} - compressed_pair_0(first_param_type x, second_param_type y) : _first(x), _second(y) {} - template <class A> - explicit compressed_pair_0(const A& val) - { - init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, &_second); - } - compressed_pair_0(const ::boost::compressed_pair<T1,T2>& x) - : _first(x.first()), _second(x.second()) {} - -#if 0 - compressed_pair_0& operator=(const compressed_pair_0& x) { - cout << "assigning compressed pair 0" << endl; - _first = x._first; - _second = x._second; - cout << "finished assigning compressed pair 0" << endl; - return *this; - } -#endif - - first_reference first() { return _first; } - first_const_reference first() const { return _first; } - - second_reference second() { return _second; } - second_const_reference second() const { return _second; } - - void swap(compressed_pair_0& y) - { - using std::swap; - swap(_first, y._first); - swap(_second, y._second); - } -}; - -// T1 != T2, T2 empty -template <class T1, class T2> -class compressed_pair_1 : T2 -{ -private: - T1 _first; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_1() : T2(), _first() {} - compressed_pair_1(first_param_type x, second_param_type y) : T2(y), _first(x) {} - - template <class A> - explicit compressed_pair_1(const A& val) - { - init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, static_cast<T2*>(this)); - } - - compressed_pair_1(const ::boost::compressed_pair<T1,T2>& x) - : T2(x.second()), _first(x.first()) {} - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // Total weirdness. If the assignment to _first is moved after - // the call to the inherited operator=, then this breaks graph/test/graph.cpp - // by way of iterator_adaptor. - compressed_pair_1& operator=(const compressed_pair_1& x) { - _first = x._first; - T2::operator=(x); - return *this; - } -#endif - - first_reference first() { return _first; } - first_const_reference first() const { return _first; } - - second_reference second() { return *this; } - second_const_reference second() const { return *this; } - - void swap(compressed_pair_1& y) - { - // no need to swap empty base class: - using std::swap; - swap(_first, y._first); - } -}; - -// T1 != T2, T1 empty -template <class T1, class T2> -class compressed_pair_2 : T1 -{ -private: - T2 _second; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_2() : T1(), _second() {} - compressed_pair_2(first_param_type x, second_param_type y) : T1(x), _second(y) {} - template <class A> - explicit compressed_pair_2(const A& val) - { - init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), &_second); - } - compressed_pair_2(const ::boost::compressed_pair<T1,T2>& x) - : T1(x.first()), _second(x.second()) {} - -#if 0 - compressed_pair_2& operator=(const compressed_pair_2& x) { - cout << "assigning compressed pair 2" << endl; - T1::operator=(x); - _second = x._second; - cout << "finished assigning compressed pair 2" << endl; - return *this; - } -#endif - first_reference first() { return *this; } - first_const_reference first() const { return *this; } - - second_reference second() { return _second; } - second_const_reference second() const { return _second; } - - void swap(compressed_pair_2& y) - { - // no need to swap empty base class: - using std::swap; - swap(_second, y._second); - } -}; - -// T1 != T2, both empty -template <class T1, class T2> -class compressed_pair_3 : T1, T2 -{ -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_3() : T1(), T2() {} - compressed_pair_3(first_param_type x, second_param_type y) : T1(x), T2(y) {} - template <class A> - explicit compressed_pair_3(const A& val) - { - init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), static_cast<T2*>(this)); - } - compressed_pair_3(const ::boost::compressed_pair<T1,T2>& x) - : T1(x.first()), T2(x.second()) {} - - first_reference first() { return *this; } - first_const_reference first() const { return *this; } - - second_reference second() { return *this; } - second_const_reference second() const { return *this; } - - void swap(compressed_pair_3& y) - { - // no need to swap empty base classes: - } -}; - -// T1 == T2, and empty -template <class T1, class T2> -class compressed_pair_4 : T1 -{ -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_4() : T1() {} - compressed_pair_4(first_param_type x, second_param_type y) : T1(x), m_second(y) {} - // only one single argument constructor since T1 == T2 - explicit compressed_pair_4(first_param_type x) : T1(x), m_second(x) {} - compressed_pair_4(const ::boost::compressed_pair<T1,T2>& x) - : T1(x.first()), m_second(x.second()) {} - - first_reference first() { return *this; } - first_const_reference first() const { return *this; } - - second_reference second() { return m_second; } - second_const_reference second() const { return m_second; } - - void swap(compressed_pair_4& y) - { - // no need to swap empty base classes: - } -private: - T2 m_second; -}; - -// T1 == T2, not empty -template <class T1, class T2> -class compressed_pair_5 -{ -private: - T1 _first; - T2 _second; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_5() : _first(), _second() {} - compressed_pair_5(first_param_type x, second_param_type y) : _first(x), _second(y) {} - // only one single argument constructor since T1 == T2 - explicit compressed_pair_5(first_param_type x) : _first(x), _second(x) {} - compressed_pair_5(const ::boost::compressed_pair<T1,T2>& c) - : _first(c.first()), _second(c.second()) {} - - first_reference first() { return _first; } - first_const_reference first() const { return _first; } - - second_reference second() { return _second; } - second_const_reference second() const { return _second; } - - void swap(compressed_pair_5& y) - { - using std::swap; - swap(_first, y._first); - swap(_second, y._second); - } -}; - -template <bool e1, bool e2, bool same> -struct compressed_pair_chooser -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_0<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<false, true, false> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_1<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<true, false, false> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_2<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<true, true, false> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_3<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<true, true, true> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_4<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<false, false, true> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_5<T1, T2> type; - }; -}; - -template <class T1, class T2> -struct compressed_pair_traits -{ -private: - typedef compressed_pair_chooser<is_empty<T1>::value, is_empty<T2>::value, is_same<T1,T2>::value> chooser; - typedef typename chooser::template rebind<T1, T2> bound_type; -public: - typedef typename bound_type::type type; -}; - -} // namespace detail - -template <class T1, class T2> -class compressed_pair : public detail::compressed_pair_traits<T1, T2>::type -{ -private: - typedef typename detail::compressed_pair_traits<T1, T2>::type base_type; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair() : base_type() {} - compressed_pair(first_param_type x, second_param_type y) : base_type(x, y) {} - template <class A> - explicit compressed_pair(const A& x) : base_type(x){} - - first_reference first() { return base_type::first(); } - first_const_reference first() const { return base_type::first(); } - - second_reference second() { return base_type::second(); } - second_const_reference second() const { return base_type::second(); } -}; - -template <class T1, class T2> -inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) -{ - x.swap(y); -} - -#else -// no partial specialisation, no member templates: - -template <class T1, class T2> -class compressed_pair -{ -private: - T1 _first; - T2 _second; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair() : _first(), _second() {} - compressed_pair(first_param_type x, second_param_type y) : _first(x), _second(y) {} - explicit compressed_pair(first_param_type x) : _first(x), _second() {} - // can't define this in case T1 == T2: - // explicit compressed_pair(second_param_type y) : _first(), _second(y) {} - - first_reference first() { return _first; } - first_const_reference first() const { return _first; } - - second_reference second() { return _second; } - second_const_reference second() const { return _second; } - - void swap(compressed_pair& y) - { - using std::swap; - swap(_first, y._first); - swap(_second, y._second); - } -}; - -template <class T1, class T2> -inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) -{ - x.swap(y); -} - -#endif - -} // boost - -#endif // BOOST_OB_COMPRESSED_PAIR_HPP - - - diff --git a/3rdParty/Boost/src/boost/detail/scoped_enum_emulation.hpp b/3rdParty/Boost/src/boost/detail/scoped_enum_emulation.hpp index e695a20..80394cf 100644 --- a/3rdParty/Boost/src/boost/detail/scoped_enum_emulation.hpp +++ b/3rdParty/Boost/src/boost/detail/scoped_enum_emulation.hpp @@ -1,56 +1,337 @@ // scoped_enum_emulation.hpp ---------------------------------------------------------// // Copyright Beman Dawes, 2009 +// Copyright (C) 2011-2012 Vicente J. Botet Escriba +// Copyright (C) 2012 Anthony Williams // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt -// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x -// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS -// macro is used to detect feature support. -// -// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a -// description of the scoped enum feature. Note that the committee changed the name -// from strongly typed enum to scoped enum. -// -// Caution: only the syntax is emulated; the semantics are not emulated and -// the syntax emulation doesn't include being able to specify the underlying -// representation type. -// -// The emulation is via struct rather than namespace to allow use within classes. -// Thanks to Andrey Semashev for pointing that out. -// -// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott, -// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente -// Botet, and Daniel James. -// -// Sample usage: -// -// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END -// ... -// BOOST_SCOPED_ENUM(algae) sample( algae::red ); -// void foo( BOOST_SCOPED_ENUM(algae) color ); -// ... -// sample = algae::green; -// foo( algae::cyan ); +/* +[section:scoped_enums Scoped Enums] + +Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x +scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS +macro is used to detect feature support. + +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a +description of the scoped enum feature. Note that the committee changed the name +from strongly typed enum to scoped enum. + +Some of the enumerations defined in the standard library are scoped enums. + + enum class future_errc + { + broken_promise, + future_already_retrieved, + promise_already_satisfied, + no_state + }; + +On compilers that don't support them, the library provides two emulations: + +[heading Strict] + +* Able to specify the underlying type. +* explicit conversion to/from underlying type. +* The wrapper is not a C++03 enum type. + +The user can declare declare these types as + + BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc) + { + broken_promise, + future_already_retrieved, + promise_already_satisfied, + no_state + } + BOOST_SCOPED_ENUM_DECLARE_END(future_errc) + +These macros allows to use 'future_errc' in almost all the cases as an scoped enum. + + future_errc err = future_errc::no_state; + +There are however some limitations: + +* The type is not a C++ enum, so 'is_enum<future_errc>' will be false_type. +* The emulated scoped enum can not be used in switch nor in template arguments. For these cases the user needs to use some macros. + +Instead of + + switch (ev) + { + case future_errc::broken_promise: + // ... + +use + + switch (boost::native_value(ev)) + { + case future_errc::broken_promise: + +And instead of + + #ifdef BOOST_NO_SCOPED_ENUMS + template <> + struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type { }; + #endif + +use + + #ifdef BOOST_NO_SCOPED_ENUMS + template <> + struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type > : public true_type { }; + #endif + + +Sample usage: + + BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(algae, char) { green, red, cyan }; BOOST_SCOPED_ENUM_DECLARE_END(algae) + ... + algae sample( algae::red ); + void foo( algae color ); + ... + sample = algae::green; + foo( algae::cyan ); + + Light + Caution: only the syntax is emulated; the semantics are not emulated and + the syntax emulation doesn't include being able to specify the underlying + representation type. + + The literal scoped emulation is via struct rather than namespace to allow use within classes. + Thanks to Andrey Semashev for pointing that out. + However the type is an real C++03 enum and so convertible implicitly to an int. + + Sample usage: + + BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END + ... + BOOST_SCOPED_ENUM(algae) sample( algae::red ); + void foo( BOOST_SCOPED_ENUM(algae) color ); + ... + sample = algae::green; + foo( algae::cyan ); + + Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott, + Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vicente + Botet, and Daniel James. + +[endsect] +*/ + #ifndef BOOST_SCOPED_ENUM_EMULATION_HPP #define BOOST_SCOPED_ENUM_EMULATION_HPP #include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +namespace boost +{ #ifdef BOOST_NO_SCOPED_ENUMS + /** + * Meta-function to get the underlying type of a scoped enum. + * + * Requires EnumType must be an enum type or the emulation of a scoped enum + */ + template <typename EnumType> + struct underlying_type + { + /** + * The member typedef type names the underlying type of EnumType. It is EnumType::underlying_type when the EnumType is an emulated scoped enum, + * std::underlying_type<EnumType>::type when the standard library std::underlying_type is provided. + * + * The user will need to specialize it when the compiler supports scoped enums but don't provides std::underlying_type. + */ + typedef typename EnumType::underlying_type type; + }; + + /** + * Meta-function to get the native enum type associated to an enum class or its emulation. + */ + template <typename EnumType> + struct native_type + { + /** + * The member typedef type names the native enum type associated to the scoped enum, + * which is it self if the compiler supports scoped enums or EnumType::enum_type if it is an emulated scoped enum. + */ + typedef typename EnumType::enum_type type; + }; + + /** + * Casts a scoped enum to its underlying type. + * + * This function is useful when working with scoped enum classes, which doens't implicitly convert to the underlying type. + * @param v A scoped enum. + * @returns The underlying type. + * @throws No-throws. + */ + template <typename UnderlyingType, typename EnumType> + UnderlyingType underlying_cast(EnumType v) + { + return v.get_underlying_value_(); + } + + /** + * Casts a scoped enum to its native enum type. + * + * This function is useful to make programs portable when the scoped enum emulation can not be use where native enums can. + * + * EnumType the scoped enum type + * + * @param v A scoped enum. + * @returns The native enum value. + * @throws No-throws. + */ + template <typename EnumType> + inline + typename EnumType::enum_type native_value(EnumType e) + { + return e.native_value_(); + } + +#else // BOOST_NO_SCOPED_ENUMS -# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type -# define BOOST_SCOPED_ENUM_END }; -# define BOOST_SCOPED_ENUM(name) name::enum_type + template <typename EnumType> + struct underlying_type + { + //typedef typename std::underlying_type<EnumType>::type type; + }; + + template <typename EnumType> + struct native_type + { + typedef EnumType type; + }; + + template <typename UnderlyingType, typename EnumType> + UnderlyingType underlying_cast(EnumType v) + { + return static_cast<UnderlyingType>(v); + } + + template <typename EnumType> + inline + EnumType native_value(EnumType e) + { + return e; + } + +#endif +} + + +#ifdef BOOST_NO_SCOPED_ENUMS + +#ifndef BOOST_NO_EXPLICIT_CONVERSION_OPERATORS + +#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \ + explicit operator underlying_type() const { return get_underlying_value_(); } #else -# define BOOST_SCOPED_ENUM_START(name) enum class name -# define BOOST_SCOPED_ENUM_END -# define BOOST_SCOPED_ENUM(name) name +#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR #endif +/** + * Start a declaration of a scoped enum. + * + * @param EnumType The new scoped enum. + * @param UnderlyingType The underlying type. + */ +#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType, UnderlyingType) \ + struct EnumType { \ + typedef UnderlyingType underlying_type; \ + EnumType() BOOST_NOEXCEPT {} \ + explicit EnumType(underlying_type v) : v_(v) {} \ + underlying_type get_underlying_value_() const { return v_; } \ + BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \ + private: \ + underlying_type v_; \ + typedef EnumType self_type; \ + public: \ + enum enum_type + +#define BOOST_SCOPED_ENUM_DECLARE_END2() \ + enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \ + operator enum_type() const BOOST_NOEXCEPT { return get_native_value_(); } \ + friend bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \ + friend bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \ + friend bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \ + friend bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \ + friend bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \ + friend bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \ + friend bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<enum_type(rhs.v_); } \ + friend bool operator <(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<rhs; } \ + friend bool operator <(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<enum_type(rhs.v_); } \ + friend bool operator <=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=enum_type(rhs.v_); } \ + friend bool operator <=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=rhs; } \ + friend bool operator <=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<=enum_type(rhs.v_); } \ + friend bool operator >(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \ + friend bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \ + friend bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \ + friend bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \ + friend bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \ + friend bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \ + }; + +#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \ + ; \ + EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \ + BOOST_SCOPED_ENUM_DECLARE_END2() + +/** + * Starts a declaration of a scoped enum with the default int underlying type. + * + * @param EnumType The new scoped enum. + */ +#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) \ + BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,int) + +/** + * Name of the native enum type. + * + * @param NT The new scoped enum. + */ +#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType::enum_type +/** + * Forward declares an scoped enum. + * + * @param NT The scoped enum. + */ +#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType + +#else // BOOST_NO_SCOPED_ENUMS + +#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType:UnderlyingType +#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType +#define BOOST_SCOPED_ENUM_DECLARE_END2() +#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) ; + +#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType +#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType + +#endif // BOOST_NO_SCOPED_ENUMS + +#define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name) +#define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2() +#define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name) + +//#ifdef BOOST_NO_SCOPED_ENUMS +// +//# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type +//# define BOOST_SCOPED_ENUM_END }; +//# define BOOST_SCOPED_ENUM(name) name::enum_type +// +//#else +// +//# define BOOST_SCOPED_ENUM_START(name) enum class name +//# define BOOST_SCOPED_ENUM_END +//# define BOOST_SCOPED_ENUM(name) name +// +//#endif #endif // BOOST_SCOPED_ENUM_EMULATION_HPP diff --git a/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp b/3rdParty/Boost/src/boost/detail/utf8_codecvt_facet.ipp index 7ea5eeb..064fdaf 100644 --- a/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp +++ b/3rdParty/Boost/src/boost/detail/utf8_codecvt_facet.ipp @@ -1,5 +1,5 @@ /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// utf8_codecvt_facet.cpp +// utf8_codecvt_facet.ipp // Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) // Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). diff --git a/3rdParty/Boost/src/boost/detail/win/GetLastError.hpp b/3rdParty/Boost/src/boost/detail/win/GetLastError.hpp new file mode 100644 index 0000000..d040abf --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/win/GetLastError.hpp @@ -0,0 +1,27 @@ +// GetLastError.hpp --------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WIN_GETLASTERROR_HPP +#define BOOST_DETAIL_WIN_GETLASTERROR_HPP + +#include <boost/detail/win/basic_types.hpp> + +namespace boost { +namespace detail { +namespace win32 { +#if defined( BOOST_USE_WINDOWS_H ) + using ::GetLastError; +#else + extern "C" __declspec(dllimport) DWORD_ WINAPI + GetLastError(); +#endif +} +} +} + +#endif // BOOST_DETAIL_WIN_TIME_HPP diff --git a/3rdParty/Boost/src/boost/detail/win/basic_types.hpp b/3rdParty/Boost/src/boost/detail/win/basic_types.hpp new file mode 100644 index 0000000..f4e3472 --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/win/basic_types.hpp @@ -0,0 +1,111 @@ +// basic_types.hpp --------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WIN_BASIC_TYPES_HPP +#define BOOST_DETAIL_WIN_BASIC_TYPES_HPP +#include <boost/config.hpp> +#include <cstdarg> +#include <boost/cstdint.hpp> +#if defined( BOOST_USE_WINDOWS_H ) +# include <windows.h> +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) +# include <WinError.h> +// @FIXME Which condition must be tested +# ifdef UNDER_CE +# ifndef WINAPI +# ifndef _WIN32_WCE_EMULATION +# define WINAPI __cdecl // Note this doesn't match the desktop definition +# else +# define WINAPI __stdcall +# endif +# endif +# else +# ifndef WINAPI +# define WINAPI __stdcall +# endif +# endif +#else +# error "Win32 functions not available" +#endif + +namespace boost { +namespace detail { +namespace win32 { +#if defined( BOOST_USE_WINDOWS_H ) + typedef ::BOOL BOOL_; + typedef ::WORD WORD_; + typedef ::DWORD DWORD_; + typedef ::HANDLE HANDLE_; + typedef ::LONG LONG_; + typedef ::LONGLONG LONGLONG_; + typedef ::ULONG_PTR ULONG_PTR_; + typedef ::LARGE_INTEGER LARGE_INTEGER_; + typedef ::PLARGE_INTEGER PLARGE_INTEGER_; + typedef ::PVOID PVOID_; + typedef ::LPVOID LPVOID_; + typedef ::CHAR CHAR_; + typedef ::LPSTR LPSTR_; + typedef ::LPCSTR LPCSTR_; + typedef ::WCHAR WCHAR_; + typedef ::LPWSTR LPWSTR_; + typedef ::LPCWSTR LPCWSTR_; +#else +extern "C" { + typedef int BOOL_; + typedef unsigned short WORD_; + typedef unsigned long DWORD_; + typedef void* HANDLE_; + + typedef long LONG_; + +// @FIXME Which condition must be tested +//~ #if !defined(_M_IX86) +//~ #if defined(BOOST_NO_INT64_T) + //~ typedef double LONGLONG_; +//~ #else + //~ typedef __int64 LONGLONG_; +//~ #endif +//~ #else + //~ typedef double LONGLONG_; +//~ #endif + typedef boost::int64_t LONGLONG_; + +// @FIXME Which condition must be tested +# ifdef _WIN64 +#if defined(__CYGWIN__) + typedef unsigned long ULONG_PTR_; +#else + typedef unsigned __int64 ULONG_PTR_; +#endif +# else + typedef unsigned long ULONG_PTR_; +# endif + + typedef struct _LARGE_INTEGER { + LONGLONG_ QuadPart; + } LARGE_INTEGER_; + typedef LARGE_INTEGER_ *PLARGE_INTEGER_; + + typedef void *PVOID_; + typedef void *LPVOID_; + typedef const void *LPCVOID_; + + typedef char CHAR_; + typedef CHAR_ *LPSTR_; + typedef const CHAR_ *LPCSTR_; + + typedef wchar_t WCHAR_; + typedef WCHAR_ *LPWSTR_; + typedef const WCHAR_ *LPCWSTR_; + +} +#endif +} +} +} +#endif // BOOST_DETAIL_WIN_TIME_HPP diff --git a/3rdParty/Boost/src/boost/detail/win/time.hpp b/3rdParty/Boost/src/boost/detail/win/time.hpp new file mode 100644 index 0000000..7f636ed --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/win/time.hpp @@ -0,0 +1,72 @@ +// time.hpp --------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WIN_TIME_HPP +#define BOOST_DETAIL_WIN_TIME_HPP + +#include <boost/detail/win/basic_types.hpp> + + +namespace boost { +namespace detail { +namespace win32 { +#if defined( BOOST_USE_WINDOWS_H ) + typedef FILETIME FILETIME_; + typedef PFILETIME PFILETIME_; + typedef LPFILETIME LPFILETIME_; + + typedef SYSTEMTIME SYSTEMTIME_; + typedef SYSTEMTIME* PSYSTEMTIME_; + + #ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime + using ::GetSystemTimeAsFileTime; + #endif + using ::FileTimeToLocalFileTime; + using ::GetSystemTime; + using ::SystemTimeToFileTime; + using ::GetTickCount; + +#else +extern "C" { + typedef struct _FILETIME { + DWORD_ dwLowDateTime; + DWORD_ dwHighDateTime; + } FILETIME_, *PFILETIME_, *LPFILETIME_; + + typedef struct _SYSTEMTIME { + WORD_ wYear; + WORD_ wMonth; + WORD_ wDayOfWeek; + WORD_ wDay; + WORD_ wHour; + WORD_ wMinute; + WORD_ wSecond; + WORD_ wMilliseconds; + } SYSTEMTIME_, *PSYSTEMTIME_; + + #ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime + __declspec(dllimport) void WINAPI + GetSystemTimeAsFileTime(FILETIME_* lpFileTime); + #endif + __declspec(dllimport) int WINAPI + FileTimeToLocalFileTime(const FILETIME_* lpFileTime, + FILETIME_* lpLocalFileTime); + __declspec(dllimport) void WINAPI + GetSystemTime(SYSTEMTIME_* lpSystemTime); + __declspec(dllimport) int WINAPI + SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime, + FILETIME_* lpFileTime); + __declspec(dllimport) unsigned long __stdcall + GetTickCount(); +} +#endif +} +} +} + +#endif // BOOST_DETAIL_WIN_TIME_HPP diff --git a/3rdParty/Boost/src/boost/detail/win/timers.hpp b/3rdParty/Boost/src/boost/detail/win/timers.hpp new file mode 100644 index 0000000..753c91f --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/win/timers.hpp @@ -0,0 +1,41 @@ +// timers.hpp --------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WIN_TIMERS_HPP +#define BOOST_DETAIL_WIN_TIMERS_HPP + +#include <boost/detail/win/basic_types.hpp> + + +namespace boost +{ +namespace detail +{ +namespace win32 +{ +#if defined( BOOST_USE_WINDOWS_H ) + using ::QueryPerformanceCounter; + using ::QueryPerformanceFrequency; +#else +extern "C" { + __declspec(dllimport) BOOL_ WINAPI + QueryPerformanceCounter( + LARGE_INTEGER_ *lpPerformanceCount + ); + + __declspec(dllimport) BOOL_ WINAPI + QueryPerformanceFrequency( + LARGE_INTEGER_ *lpFrequency + ); +} +#endif +} +} +} + +#endif // BOOST_DETAIL_WIN_TIMERS_HPP diff --git a/3rdParty/Boost/src/boost/exception/detail/attribute_noreturn.hpp b/3rdParty/Boost/src/boost/exception/detail/attribute_noreturn.hpp index f6a0b59..ae9f031 100644 --- a/3rdParty/Boost/src/boost/exception/detail/attribute_noreturn.hpp +++ b/3rdParty/Boost/src/boost/exception/detail/attribute_noreturn.hpp @@ -9,7 +9,7 @@ #if defined(_MSC_VER) #define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn) #elif defined(__GNUC__) -#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn)) +#define BOOST_ATTRIBUTE_NORETURN __attribute__((__noreturn__)) #else #define BOOST_ATTRIBUTE_NORETURN #endif diff --git a/3rdParty/Boost/src/boost/exception/detail/clone_current_exception.hpp b/3rdParty/Boost/src/boost/exception/detail/clone_current_exception.hpp new file mode 100644 index 0000000..cc201b9 --- /dev/null +++ b/3rdParty/Boost/src/boost/exception/detail/clone_current_exception.hpp @@ -0,0 +1,47 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_81522C0EB56511DFAB613DB0DFD72085 +#define UUID_81522C0EB56511DFAB613DB0DFD72085 + +#ifdef BOOST_NO_EXCEPTIONS +# error This header requires exception handling to be enabled. +#endif + +namespace +boost + { + namespace + exception_detail + { + class clone_base; + +#ifdef BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR + int clone_current_exception_non_intrusive( clone_base const * & cloned ); +#endif + + namespace + clone_current_exception_result + { + int const success=0; + int const bad_alloc=1; + int const bad_exception=2; + int const not_supported=3; + } + + inline + int + clone_current_exception( clone_base const * & cloned ) + { +#ifdef BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR + return clone_current_exception_non_intrusive(cloned); +#else + return clone_current_exception_result::not_supported; +#endif + } + } + } + +#endif diff --git a/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp b/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp index 883d313..a8d1aa7 100644 --- a/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp +++ b/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp @@ -30,6 +30,7 @@ boost protected: + virtual ~error_info_base() throw() { } diff --git a/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp b/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp index 0510fe2..5e5a267 100644 --- a/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp +++ b/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp @@ -20,18 +20,52 @@ #include <boost/exception/info.hpp> #include <boost/exception/diagnostic_information.hpp> #include <boost/exception/detail/type_info.hpp> +#include <boost/exception/detail/clone_current_exception.hpp> #include <boost/shared_ptr.hpp> #include <stdexcept> #include <new> #include <ios> +#include <stdlib.h> namespace boost { - typedef shared_ptr<exception_detail::clone_base const> exception_ptr; - + class exception_ptr; + BOOST_ATTRIBUTE_NORETURN void rethrow_exception( exception_ptr const & ); exception_ptr current_exception(); + class + exception_ptr + { + typedef boost::shared_ptr<exception_detail::clone_base const> impl; + impl ptr_; + friend void rethrow_exception( exception_ptr const & ); + typedef exception_detail::clone_base const * (impl::*unspecified_bool_type)() const; + public: + exception_ptr() + { + } + explicit + exception_ptr( impl const & ptr ): + ptr_(ptr) + { + } + bool + operator==( exception_ptr const & other ) const + { + return ptr_==other.ptr_; + } + bool + operator!=( exception_ptr const & other ) const + { + return ptr_!=other.ptr_; + } + operator unspecified_bool_type() const + { + return ptr_?&impl::get:0; + } + }; + template <class T> inline exception_ptr @@ -67,35 +101,49 @@ boost boost::exception, std::bad_alloc { + ~bad_alloc_() throw() { } }; - template <int Dummy> + struct + bad_exception_: + boost::exception, + std::bad_exception + { + ~bad_exception_() throw() { } + }; + + template <class Exception> exception_ptr - get_bad_alloc() + get_static_exception_object() { - bad_alloc_ ba; - exception_detail::clone_impl<bad_alloc_> c(ba); + Exception ba; + exception_detail::clone_impl<Exception> c(ba); c << throw_function(BOOST_CURRENT_FUNCTION) << throw_file(__FILE__) << throw_line(__LINE__); - static exception_ptr ep(new exception_detail::clone_impl<bad_alloc_>(c)); + static exception_ptr ep(shared_ptr<exception_detail::clone_base const>(new exception_detail::clone_impl<Exception>(c))); return ep; } - template <int Dummy> + template <class Exception> struct - exception_ptr_bad_alloc + exception_ptr_static_exception_object { static exception_ptr const e; }; - template <int Dummy> + template <class Exception> exception_ptr const - exception_ptr_bad_alloc<Dummy>:: - e = get_bad_alloc<Dummy>(); + exception_ptr_static_exception_object<Exception>:: + e = get_static_exception_object<Exception>(); } +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif class unknown_exception: public boost::exception, @@ -135,6 +183,11 @@ boost #endif } }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif namespace exception_detail @@ -244,101 +297,131 @@ boost exception_ptr current_exception_impl() { - try - { - throw; - } - catch( - exception_detail::clone_base & e ) - { - return exception_ptr(e.clone()); - } - catch( - std::domain_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::invalid_argument & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::length_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::out_of_range & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::logic_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::range_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::overflow_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::underflow_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::ios_base::failure & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::runtime_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::bad_alloc & e ) - { - return exception_detail::current_exception_std_exception(e); - } + exception_detail::clone_base const * e=0; + switch( + exception_detail::clone_current_exception(e) ) + { + case exception_detail::clone_current_exception_result:: + success: + { + BOOST_ASSERT(e!=0); + return exception_ptr(shared_ptr<exception_detail::clone_base const>(e)); + } + case exception_detail::clone_current_exception_result:: + bad_alloc: + { + BOOST_ASSERT(!e); + return exception_detail::exception_ptr_static_exception_object<bad_alloc_>::e; + } + case exception_detail::clone_current_exception_result:: + bad_exception: + { + BOOST_ASSERT(!e); + return exception_detail::exception_ptr_static_exception_object<bad_exception_>::e; + } + default: + BOOST_ASSERT(0); + case exception_detail::clone_current_exception_result:: + not_supported: + { + BOOST_ASSERT(!e); + try + { + throw; + } + catch( + exception_detail::clone_base & e ) + { + return exception_ptr(shared_ptr<exception_detail::clone_base const>(e.clone())); + } + catch( + std::domain_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::invalid_argument & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::length_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::out_of_range & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::logic_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::range_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::overflow_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::underflow_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::ios_base::failure & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::runtime_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_alloc & e ) + { + return exception_detail::current_exception_std_exception(e); + } #ifndef BOOST_NO_TYPEID - catch( - std::bad_cast & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::bad_typeid & e ) - { - return exception_detail::current_exception_std_exception(e); - } + catch( + std::bad_cast & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_typeid & e ) + { + return exception_detail::current_exception_std_exception(e); + } #endif - catch( - std::bad_exception & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::exception & e ) - { - return exception_detail::current_exception_unknown_std_exception(e); - } - catch( - boost::exception & e ) - { - return exception_detail::current_exception_unknown_boost_exception(e); - } - catch( - ... ) - { - return exception_detail::current_exception_unknown_exception(); + catch( + std::bad_exception & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::exception & e ) + { + return exception_detail::current_exception_unknown_std_exception(e); + } + catch( + boost::exception & e ) + { + return exception_detail::current_exception_unknown_boost_exception(e); + } + catch( + ... ) + { + return exception_detail::current_exception_unknown_exception(); + } + } } } } @@ -348,7 +431,6 @@ boost current_exception() { exception_ptr ret; - BOOST_ASSERT(!ret); try { ret=exception_detail::current_exception_impl(); @@ -356,36 +438,31 @@ boost catch( std::bad_alloc & ) { - ret=exception_detail::exception_ptr_bad_alloc<42>::e; + ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_alloc_>::e; } catch( ... ) { - try - { - ret=exception_detail::current_exception_std_exception(std::bad_exception()); - } - catch( - std::bad_alloc & ) - { - ret=exception_detail::exception_ptr_bad_alloc<42>::e; - } - catch( - ... ) - { - BOOST_ASSERT(0); - } + ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_exception_>::e; } BOOST_ASSERT(ret); return ret; } + BOOST_ATTRIBUTE_NORETURN inline void rethrow_exception( exception_ptr const & p ) { BOOST_ASSERT(p); - p->rethrow(); + p.ptr_->rethrow(); + BOOST_ASSERT(0); + #if defined(UNDER_CE) + // some CE platforms don't define ::abort() + exit(-1); + #else + abort(); + #endif } inline diff --git a/3rdParty/Boost/src/boost/exception/detail/type_info.hpp b/3rdParty/Boost/src/boost/exception/detail/type_info.hpp index 9ab1c57..92f8464 100644 --- a/3rdParty/Boost/src/boost/exception/detail/type_info.hpp +++ b/3rdParty/Boost/src/boost/exception/detail/type_info.hpp @@ -53,11 +53,11 @@ boost struct type_info_ { - detail::sp_typeinfo const & type_; + detail::sp_typeinfo const * type_; explicit type_info_( detail::sp_typeinfo const & type ): - type_(type) + type_(&type) { } @@ -65,7 +65,7 @@ boost bool operator<( type_info_ const & a, type_info_ const & b ) { - return 0!=(a.type_.before(b.type_)); + return 0!=(a.type_->before(*b.type_)); } }; } diff --git a/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp b/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp index 2297676..ef89d73 100644 --- a/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp +++ b/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp @@ -14,6 +14,7 @@ #include <boost/config.hpp> #include <boost/exception/get_error_info.hpp> +#include <boost/exception/info.hpp> #include <boost/utility/enable_if.hpp> #ifndef BOOST_NO_RTTI #include <boost/units/detail/utility.hpp> @@ -85,19 +86,23 @@ boost char const * get_diagnostic_information( exception const & x, char const * header ) { - if( error_info_container * c=x.data_.get() ) #ifndef BOOST_NO_EXCEPTIONS - try - { + try + { #endif - return c->diagnostic_information(header); + error_info_container * c=x.data_.get(); + if( !c ) + x.data_.adopt(c=new exception_detail::error_info_container_impl); + char const * di=c->diagnostic_information(header); + BOOST_ASSERT(di!=0); + return di; #ifndef BOOST_NO_EXCEPTIONS - } - catch(...) - { - } + } + catch(...) + { + return 0; + } #endif - return 0; } inline @@ -122,22 +127,30 @@ boost std::ostringstream tmp; if( be ) { - if( char const * const * f=get_error_info<throw_file>(*be) ) + char const * const * f=get_error_info<throw_file>(*be); + int const * l=get_error_info<throw_line>(*be); + char const * const * fn=get_error_info<throw_function>(*be); + if( !f && !l && !fn ) + tmp << "Throw location unknown (consider using BOOST_THROW_EXCEPTION)\n"; + else { - tmp << *f; - if( int const * l=get_error_info<throw_line>(*be) ) - tmp << '(' << *l << "): "; + if( f ) + { + tmp << *f; + if( int const * l=get_error_info<throw_line>(*be) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( char const * const * fn=get_error_info<throw_function>(*be) ) + tmp << *fn; + else + tmp << "(unknown)"; + tmp << '\n'; } - tmp << "Throw in function "; - if( char const * const * fn=get_error_info<throw_function>(*be) ) - tmp << *fn; - else - tmp << "(unknown)"; - tmp << '\n'; } #ifndef BOOST_NO_RTTI tmp << std::string("Dynamic exception type: ") << - units::detail::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_.name()) << '\n'; + units::detail::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n'; #endif if( with_what && se ) tmp << "std::exception::what: " << wh << '\n'; @@ -166,7 +179,10 @@ boost { #endif (void) exception_detail::diagnostic_information_impl(&e,0,false); - return exception_detail::get_diagnostic_information(e,0); + if( char const * di=exception_detail::get_diagnostic_information(e,0) ) + return di; + else + return "Failed to produce boost::diagnostic_information_what()"; #ifndef BOOST_NO_EXCEPTIONS } catch( diff --git a/3rdParty/Boost/src/boost/exception/exception.hpp b/3rdParty/Boost/src/boost/exception/exception.hpp index adaac68..42d2787 100644 --- a/3rdParty/Boost/src/boost/exception/exception.hpp +++ b/3rdParty/Boost/src/boost/exception/exception.hpp @@ -132,7 +132,17 @@ boost } }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif class exception; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif template <class T> class shared_ptr; @@ -189,6 +199,11 @@ boost E const & set_info( E const &, throw_line const & ); } +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif class exception { @@ -250,6 +265,11 @@ boost mutable char const * throw_file_; mutable int throw_line_; }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif inline exception:: @@ -290,6 +310,11 @@ boost namespace exception_detail { +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif template <class T> struct error_info_injector: @@ -306,6 +331,11 @@ boost { } }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif struct large_size { char c[256]; }; large_size dispatch_boost_exception( exception const * ); @@ -334,7 +364,7 @@ boost struct enable_error_info_return_type { - typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception((T*)0))>::type type; + typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception(static_cast<T *>(0)))>::type type; }; } @@ -353,6 +383,11 @@ boost namespace exception_detail { +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif class clone_base { @@ -366,6 +401,11 @@ boost { } }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif inline void @@ -390,8 +430,15 @@ boost class clone_impl: public T, - public clone_base + public virtual clone_base { + struct clone_tag { }; + clone_impl( clone_impl const & x, clone_tag ): + T(x) + { + copy_boost_exception(this,&x); + } + public: explicit @@ -410,7 +457,7 @@ boost clone_base const * clone() const { - return new clone_impl(*this); + return new clone_impl(*this,clone_tag()); } void diff --git a/3rdParty/Boost/src/boost/exception/info.hpp b/3rdParty/Boost/src/boost/exception/info.hpp index c918dbd..7b56076 100644 --- a/3rdParty/Boost/src/boost/exception/info.hpp +++ b/3rdParty/Boost/src/boost/exception/info.hpp @@ -97,7 +97,7 @@ boost { shared_ptr<error_info_base> const & p = i->second; #ifndef BOOST_NO_RTTI - BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ ); + BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==*ti.type_ ); #endif return p; } @@ -109,7 +109,6 @@ boost { if( header ) { - BOOST_ASSERT(*header!=0); std::ostringstream tmp; tmp << header; for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i ) diff --git a/3rdParty/Boost/src/boost/filesystem.hpp b/3rdParty/Boost/src/boost/filesystem.hpp index d64d760..1a75302 100644 --- a/3rdParty/Boost/src/boost/filesystem.hpp +++ b/3rdParty/Boost/src/boost/filesystem.hpp @@ -12,30 +12,9 @@ #ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP #define BOOST_FILESYSTEM_FILESYSTEM_HPP -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there - -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 -# endif - -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif - -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/config.hpp> -# include <boost/filesystem/v2/path.hpp> -# include <boost/filesystem/v2/operations.hpp> -# include <boost/filesystem/v2/convenience.hpp> - -# else -# include <boost/filesystem/v3/config.hpp> -# include <boost/filesystem/v3/path.hpp> -# include <boost/filesystem/v3/operations.hpp> -# include <boost/filesystem/v3/convenience.hpp> - -# endif +# include <boost/filesystem/config.hpp> +# include <boost/filesystem/path.hpp> +# include <boost/filesystem/operations.hpp> +# include <boost/filesystem/convenience.hpp> #endif // BOOST_FILESYSTEM_FILESYSTEM_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/config.hpp b/3rdParty/Boost/src/boost/filesystem/config.hpp index c813bf5..ca695f4 100644 --- a/3rdParty/Boost/src/boost/filesystem/config.hpp +++ b/3rdParty/Boost/src/boost/filesystem/config.hpp @@ -1,6 +1,6 @@ -// boost/filesystem/config.hpp -------------------------------------------------------// +// boost/filesystem/v3/config.hpp ----------------------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes 2003 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt @@ -9,27 +9,101 @@ //--------------------------------------------------------------------------------------// -#ifndef BOOST_FILESYSTEM_CONFIGX_HPP -#define BOOST_FILESYSTEM_CONFIGX_HPP +#ifndef BOOST_FILESYSTEM3_CONFIG_HPP +#define BOOST_FILESYSTEM3_CONFIG_HPP -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there - -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 +# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 +# error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3 # endif # if !defined(BOOST_FILESYSTEM_VERSION) # define BOOST_FILESYSTEM_VERSION 3 # endif -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/config.hpp> +#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include <boost/config.hpp> +#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API +#include <boost/detail/workaround.hpp> + +// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------// + +# ifdef BOOST_FILESYSTEM_SOURCE +# define BOOST_FILESYSTEM_DEPRECATED +# endif + +// throw an exception ----------------------------------------------------------------// +// +// Exceptions were originally thrown via boost::throw_exception(). +// As throw_exception() became more complex, it caused user error reporting +// to be harder to interpret, since the exception reported became much more complex. +// The immediate fix was to throw directly, wrapped in a macro to make any later change +// easier. + +#define BOOST_FILESYSTEM_THROW(EX) throw EX + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +// normalize macros ------------------------------------------------------------------// + +#if !defined(BOOST_FILESYSTEM_DYN_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) \ + && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK) +# define BOOST_FILESYSTEM_STATIC_LINK +#endif + +#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_FILESYSTEM_DYN_LINK) +# define BOOST_FILESYSTEM_DYN_LINK +#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) +# define BOOST_FILESYSTEM_STATIC_LINK +#endif -# else -# include <boost/filesystem/v3/config.hpp> +#if defined(BOOST_FILESYSTEM_DYN_LINK) && defined(BOOST_FILESYSTEM_STATIC_LINK) +# error Must not define both BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK +#endif +#if defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB) +# define BOOST_FILESYSTEM_NO_LIB +#endif + +// enable dynamic linking ------------------------------------------------------------// + +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) +# if defined(BOOST_FILESYSTEM_SOURCE) +# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT +# else +# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT # endif +#else +# define BOOST_FILESYSTEM_DECL +#endif + +// enable automatic library variant selection ----------------------------------------// + +#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \ + && !defined(BOOST_FILESYSTEM_NO_LIB) +// +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_filesystem +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include <boost/config/auto_link.hpp> +#endif // auto-linking disabled -#endif // BOOST_FILESYSTEM_CONFIGX_HPP +#endif // BOOST_FILESYSTEM3_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/convenience.hpp b/3rdParty/Boost/src/boost/filesystem/convenience.hpp index 1a1f943..f0bd986 100644 --- a/3rdParty/Boost/src/boost/filesystem/v3/convenience.hpp +++ b/3rdParty/Boost/src/boost/filesystem/convenience.hpp @@ -19,14 +19,14 @@ # error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support # endif -#include <boost/filesystem/v3/operations.hpp> +#include <boost/filesystem/operations.hpp> #include <boost/system/error_code.hpp> #include <boost/config/abi_prefix.hpp> // must be the last #include namespace boost { - namespace filesystem3 + namespace filesystem { # ifndef BOOST_FILESYSTEM_NO_DEPRECATED @@ -51,24 +51,8 @@ namespace boost # endif - } // namespace filesystem3 + } // namespace filesystem } // namespace boost -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem3::extension; - using filesystem3::basename; - using filesystem3::change_extension; -# endif - } -} - -//----------------------------------------------------------------------------// - #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas #endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/exception.hpp b/3rdParty/Boost/src/boost/filesystem/exception.hpp index 6ba8466..985cd8f 100644 --- a/3rdParty/Boost/src/boost/filesystem/exception.hpp +++ b/3rdParty/Boost/src/boost/filesystem/exception.hpp @@ -1,35 +1,9 @@ -// boost/filesystem/exception.hpp ----------------------------------------------------// +// boost/filesystem/exception.hpp -----------------------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes 2003 +// Use, modification, and distribution is subject to 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) -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM_EXCEPTIONX_HPP -#define BOOST_FILESYSTEM_EXCEPTIONX_HPP - -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there - -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 -# endif - -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif - -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/exception.hpp> - -# else -# include <boost/filesystem/v3/exception.hpp> - -# endif - -#endif // BOOST_FILESYSTEM_EXCEPTIONX_HPP +// This header is no longer used. The contents have been moved to path.hpp. +// It is provided so that user code #includes do not have to be changed. diff --git a/3rdParty/Boost/src/boost/filesystem/fstream.hpp b/3rdParty/Boost/src/boost/filesystem/fstream.hpp index e159e58..0727238 100644 --- a/3rdParty/Boost/src/boost/filesystem/fstream.hpp +++ b/3rdParty/Boost/src/boost/filesystem/fstream.hpp @@ -1,6 +1,6 @@ // boost/filesystem/fstream.hpp ------------------------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes 2002 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt @@ -9,27 +9,174 @@ //--------------------------------------------------------------------------------------// -#ifndef BOOST_FILESYSTEM_FSTREAMX_HPP -#define BOOST_FILESYSTEM_FSTREAMX_HPP +#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP +#define BOOST_FILESYSTEM3_FSTREAM_HPP -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there +#include <boost/config.hpp> -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support # endif -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif +#include <boost/filesystem/path.hpp> +#include <iosfwd> +#include <fstream> -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/fstream.hpp> +#include <boost/config/abi_prefix.hpp> // must be the last #include -# else -# include <boost/filesystem/v3/fstream.hpp> +// on Windows, except for standard libaries known to have wchar_t overloads for +// file stream I/O, use path::string() to get a narrow character c_str() +#if defined(BOOST_WINDOWS_API) \ + && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION)) + // !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware +# define BOOST_FILESYSTEM_C_STR string().c_str() // use narrow, since wide not available +#else // use the native c_str, which will be narrow on POSIX, wide on Windows +# define BOOST_FILESYSTEM_C_STR c_str() +#endif -# endif +namespace boost +{ +namespace filesystem +{ + +//--------------------------------------------------------------------------------------// +// basic_filebuf // +//--------------------------------------------------------------------------------------// + + template < class charT, class traits = std::char_traits<charT> > + class basic_filebuf : public std::basic_filebuf<charT,traits> + { + private: // disallow copying + basic_filebuf(const basic_filebuf&); + const basic_filebuf& operator=(const basic_filebuf&); + + public: + basic_filebuf() {} + virtual ~basic_filebuf() {} + + basic_filebuf<charT,traits>* + open(const path& p, std::ios_base::openmode mode) + { + return std::basic_filebuf<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode) + ? this : 0; + } + }; + +//--------------------------------------------------------------------------------------// +// basic_ifstream // +//--------------------------------------------------------------------------------------// + + template < class charT, class traits = std::char_traits<charT> > + class basic_ifstream : public std::basic_ifstream<charT,traits> + { + private: // disallow copying + basic_ifstream(const basic_ifstream&); + const basic_ifstream& operator=(const basic_ifstream&); + + public: + basic_ifstream() {} + + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + + explicit basic_ifstream(const path& p) + : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {} + + basic_ifstream(const path& p, std::ios_base::openmode mode) + : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} + + void open(const path& p) + { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); } + + void open(const path& p, std::ios_base::openmode mode) + { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } + + virtual ~basic_ifstream() {} + }; + +//--------------------------------------------------------------------------------------// +// basic_ofstream // +//--------------------------------------------------------------------------------------// + + template < class charT, class traits = std::char_traits<charT> > + class basic_ofstream : public std::basic_ofstream<charT,traits> + { + private: // disallow copying + basic_ofstream(const basic_ofstream&); + const basic_ofstream& operator=(const basic_ofstream&); + + public: + basic_ofstream() {} + + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + + explicit basic_ofstream(const path& p) + : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {} + + basic_ofstream(const path& p, std::ios_base::openmode mode) + : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} + + void open(const path& p) + { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); } + + void open(const path& p, std::ios_base::openmode mode) + { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } + + virtual ~basic_ofstream() {} + }; + +//--------------------------------------------------------------------------------------// +// basic_fstream // +//--------------------------------------------------------------------------------------// + + template < class charT, class traits = std::char_traits<charT> > + class basic_fstream : public std::basic_fstream<charT,traits> + { + private: // disallow copying + basic_fstream(const basic_fstream&); + const basic_fstream & operator=(const basic_fstream&); + + public: + basic_fstream() {} + + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + + explicit basic_fstream(const path& p) + : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, + std::ios_base::in | std::ios_base::out) {} + + basic_fstream(const path& p, std::ios_base::openmode mode) + : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} + + void open(const path& p) + { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, + std::ios_base::in | std::ios_base::out); } + + void open(const path& p, std::ios_base::openmode mode) + { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } + + virtual ~basic_fstream() {} + + }; + +//--------------------------------------------------------------------------------------// +// typedefs // +//--------------------------------------------------------------------------------------// + + typedef basic_filebuf<char> filebuf; + typedef basic_ifstream<char> ifstream; + typedef basic_ofstream<char> ofstream; + typedef basic_fstream<char> fstream; + + typedef basic_filebuf<wchar_t> wfilebuf; + typedef basic_ifstream<wchar_t> wifstream; + typedef basic_ofstream<wchar_t> wofstream; + typedef basic_fstream<wchar_t> wfstream; + +} // namespace filesystem +} // namespace boost -#endif // BOOST_FILESYSTEM_FSTREAMX_HPP +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_FSTREAM_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/operations.hpp b/3rdParty/Boost/src/boost/filesystem/operations.hpp index db7b123..dc01b7d 100644 --- a/3rdParty/Boost/src/boost/filesystem/operations.hpp +++ b/3rdParty/Boost/src/boost/filesystem/operations.hpp @@ -1,35 +1,1096 @@ // boost/filesystem/operations.hpp ---------------------------------------------------// -// Copyright Beman Dawes 2010 - +// Copyright Beman Dawes 2002-2009 +// Copyright Jan Langer 2002 +// Copyright Dietmar Kuehl 2001 +// Copyright Vladimir Prus 2002 + // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // Library home page: http://www.boost.org/libs/filesystem -//--------------------------------------------------------------------------------------// +//--------------------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP +#define BOOST_FILESYSTEM3_OPERATIONS_HPP + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path.hpp> + +#include <boost/detail/scoped_enum_emulation.hpp> +#include <boost/detail/bitmask.hpp> +#include <boost/system/error_code.hpp> +#include <boost/system/system_error.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/iterator.hpp> +#include <boost/cstdint.hpp> +#include <boost/assert.hpp> + +#include <string> +#include <utility> // for pair +#include <ctime> +#include <vector> +#include <stack> + +#ifdef BOOST_WINDOWS_API +# include <fstream> +#endif + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +//--------------------------------------------------------------------------------------// + +namespace boost +{ + namespace filesystem + { + +//--------------------------------------------------------------------------------------// +// file_type // +//--------------------------------------------------------------------------------------// + + enum file_type + { + status_error, +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + status_unknown = status_error, +# endif + file_not_found, + regular_file, + directory_file, + // the following may not apply to some operating systems or file systems + symlink_file, + block_file, + character_file, + fifo_file, + socket_file, + reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink + type_unknown, // file does exist, but isn't one of the above types or + // we don't have strong enough permission to find its type + + _detail_directory_symlink // internal use only; never exposed to users + }; + +//--------------------------------------------------------------------------------------// +// perms // +//--------------------------------------------------------------------------------------// + + enum perms + { + no_perms = 0, // file_not_found is no_perms rather than perms_not_known + + // POSIX equivalent macros given in comments. + // Values are from POSIX and are given in octal per the POSIX standard. + + // permission bits + + owner_read = 0400, // S_IRUSR, Read permission, owner + owner_write = 0200, // S_IWUSR, Write permission, owner + owner_exe = 0100, // S_IXUSR, Execute/search permission, owner + owner_all = 0700, // S_IRWXU, Read, write, execute/search by owner + + group_read = 040, // S_IRGRP, Read permission, group + group_write = 020, // S_IWGRP, Write permission, group + group_exe = 010, // S_IXGRP, Execute/search permission, group + group_all = 070, // S_IRWXG, Read, write, execute/search by group + + others_read = 04, // S_IROTH, Read permission, others + others_write = 02, // S_IWOTH, Write permission, others + others_exe = 01, // S_IXOTH, Execute/search permission, others + others_all = 07, // S_IRWXO, Read, write, execute/search by others + + all_all = owner_all|group_all|others_all, // 0777 + + // other POSIX bits + + set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution + set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution + sticky_bit = 01000, // S_ISVTX, + // (POSIX XSI) On directories, restricted deletion flag + // (V7) 'sticky bit': save swapped text even after use + // (SunOS) On non-directories: don't cache this file + // (SVID-v4.2) On directories: restricted deletion flag + // Also see http://en.wikipedia.org/wiki/Sticky_bit + + perms_mask = all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit, // 07777 + + perms_not_known = 0xFFFF, // present when directory_entry cache not loaded + + // options for permissions() function + + add_perms = 0x1000, // adds the given permission bits to the current bits + remove_perms = 0x2000, // removes the given permission bits from the current bits; + // choose add_perms or remove_perms, not both; if neither add_perms + // nor remove_perms is given, replace the current bits with + // the given bits. + + symlink_perms = 0x4000 // on POSIX, don't resolve symlinks; implied on Windows + }; + + BOOST_BITMASK(perms) + +//--------------------------------------------------------------------------------------// +// file_status // +//--------------------------------------------------------------------------------------// + + class BOOST_FILESYSTEM_DECL file_status + { + public: + file_status() : m_value(status_error), m_perms(perms_not_known) {} + explicit file_status(file_type v, perms prms = perms_not_known) + : m_value(v), m_perms(prms) {} + + // observers + file_type type() const { return m_value; } + perms permissions() const { return m_perms; } + + // modifiers + void type(file_type v) { m_value = v; } + void permissions(perms prms) { m_perms = prms; } + + bool operator==(const file_status& rhs) const { return type() == rhs.type() && + permissions() == rhs.permissions(); } + bool operator!=(const file_status& rhs) const { return !(*this == rhs); } + + private: + file_type m_value; + enum perms m_perms; + }; + + inline bool type_present(file_status f) { return f.type() != status_error; } + inline bool permissions_present(file_status f) + {return f.permissions() != perms_not_known;} + inline bool status_known(file_status f) { return type_present(f) && permissions_present(f); } + inline bool exists(file_status f) { return f.type() != status_error + && f.type() != file_not_found; } + inline bool is_regular_file(file_status f){ return f.type() == regular_file; } + inline bool is_directory(file_status f) { return f.type() == directory_file; } + inline bool is_symlink(file_status f) { return f.type() == symlink_file; } + inline bool is_other(file_status f) { return exists(f) && !is_regular_file(f) + && !is_directory(f) && !is_symlink(f); } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline bool is_regular(file_status f) { return f.type() == regular_file; } +# endif + + struct space_info + { + // all values are byte counts + boost::uintmax_t capacity; + boost::uintmax_t free; // <= capacity + boost::uintmax_t available; // <= free + }; -#ifndef BOOST_FILESYSTEM_OPERATIONSX_HPP -#define BOOST_FILESYSTEM_OPERATIONSX_HPP + BOOST_SCOPED_ENUM_START(copy_option) + {none, fail_if_exists = none, overwrite_if_exists}; + BOOST_SCOPED_ENUM_END -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there +//--------------------------------------------------------------------------------------// +// implementation details // +//--------------------------------------------------------------------------------------// -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 + namespace detail + { + BOOST_FILESYSTEM_DECL + file_status status(const path&p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + file_status symlink_status(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + bool is_empty(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path initial_path(system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path canonical(const path& p, const path& base, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void copy(const path& from, const path& to, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void copy_directory(const path& from, const path& to, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void copy_file(const path& from, const path& to, + BOOST_SCOPED_ENUM(copy_option) option, // See ticket #2925 + system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + bool create_directories(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + bool create_directory(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void create_directory_symlink(const path& to, const path& from, + system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void create_hard_link(const path& to, const path& from, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void create_symlink(const path& to, const path& from, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path current_path(system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void current_path(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + bool equivalent(const path& p1, const path& p2, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + boost::uintmax_t file_size(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + std::time_t last_write_time(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void last_write_time(const path& p, const std::time_t new_time, + system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void permissions(const path& p, perms prms, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path read_symlink(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + // For standardization, if the committee doesn't like "remove", consider "eliminate" + bool remove(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + boost::uintmax_t remove_all(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void rename(const path& old_p, const path& new_p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void resize_file(const path& p, uintmax_t size, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + space_info space(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path system_complete(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path temp_directory_path(system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path unique_path(const path& p, system::error_code* ec=0); + } // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// status query functions // +// // +//--------------------------------------------------------------------------------------// + + inline + file_status status(const path& p) {return detail::status(p);} + inline + file_status status(const path& p, system::error_code& ec) + {return detail::status(p, &ec);} + inline + file_status symlink_status(const path& p) {return detail::symlink_status(p);} + inline + file_status symlink_status(const path& p, system::error_code& ec) + {return detail::symlink_status(p, &ec);} + inline + bool exists(const path& p) {return exists(detail::status(p));} + inline + bool exists(const path& p, system::error_code& ec) + {return exists(detail::status(p, &ec));} + inline + bool is_directory(const path& p) {return is_directory(detail::status(p));} + inline + bool is_directory(const path& p, system::error_code& ec) + {return is_directory(detail::status(p, &ec));} + inline + bool is_regular_file(const path& p) {return is_regular_file(detail::status(p));} + inline + bool is_regular_file(const path& p, system::error_code& ec) + {return is_regular_file(detail::status(p, &ec));} + inline + bool is_other(const path& p) {return is_other(detail::status(p));} + inline + bool is_other(const path& p, system::error_code& ec) + {return is_other(detail::status(p, &ec));} + inline + bool is_symlink(const path& p) {return is_symlink(detail::symlink_status(p));} + inline + bool is_symlink(const path& p, system::error_code& ec) + {return is_symlink(detail::symlink_status(p, &ec));} +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline + bool is_regular(const path& p) {return is_regular(detail::status(p));} + inline + bool is_regular(const path& p, system::error_code& ec) + {return is_regular(detail::status(p, &ec));} +# endif + + inline + bool is_empty(const path& p) {return detail::is_empty(p);} + inline + bool is_empty(const path& p, system::error_code& ec) + {return detail::is_empty(p, &ec);} + +//--------------------------------------------------------------------------------------// +// // +// operational functions // +// in alphabetical order, unless otherwise noted // +// // +//--------------------------------------------------------------------------------------// + + // forward declarations + path current_path(); // fwd declaration + path initial_path(); + + BOOST_FILESYSTEM_DECL + path absolute(const path& p, const path& base=current_path()); + // If base.is_absolute(), throws nothing. Thus no need for ec argument + + inline + path canonical(const path& p, const path& base=current_path()) + {return detail::canonical(p, base);} + inline + path canonical(const path& p, system::error_code& ec) + {return detail::canonical(p, current_path(), &ec);} + inline + path canonical(const path& p, const path& base, system::error_code& ec) + {return detail::canonical(p, base, &ec);} + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline + path complete(const path& p) + { + return absolute(p, initial_path()); + } + + inline + path complete(const path& p, const path& base) + { + return absolute(p, base); + } +# endif + + inline + void copy(const path& from, const path& to) {detail::copy(from, to);} + + inline + void copy(const path& from, const path& to, system::error_code& ec) + {detail::copy(from, to, &ec);} + inline + void copy_directory(const path& from, const path& to) + {detail::copy_directory(from, to);} + inline + void copy_directory(const path& from, const path& to, system::error_code& ec) + {detail::copy_directory(from, to, &ec);} + inline + void copy_file(const path& from, const path& to, // See ticket #2925 + BOOST_SCOPED_ENUM(copy_option) option) + {detail::copy_file(from, to, option);} + inline + void copy_file(const path& from, const path& to) + {detail::copy_file(from, to, copy_option::fail_if_exists);} + inline + void copy_file(const path& from, const path& to, // See ticket #2925 + BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec) + {detail::copy_file(from, to, option, &ec);} + inline + void copy_file(const path& from, const path& to, system::error_code& ec) + {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);} + inline + void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);} + + inline + void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec) + {detail::copy_symlink(existing_symlink, new_symlink, &ec);} + inline + bool create_directories(const path& p) {return detail::create_directories(p);} + + inline + bool create_directories(const path& p, system::error_code& ec) + {return detail::create_directories(p, &ec);} + inline + bool create_directory(const path& p) {return detail::create_directory(p);} + + inline + bool create_directory(const path& p, system::error_code& ec) + {return detail::create_directory(p, &ec);} + inline + void create_directory_symlink(const path& to, const path& from) + {detail::create_directory_symlink(to, from);} + inline + void create_directory_symlink(const path& to, const path& from, system::error_code& ec) + {detail::create_directory_symlink(to, from, &ec);} + inline + void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);} + + inline + void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec) + {detail::create_hard_link(to, new_hard_link, &ec);} + inline + void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);} + + inline + void create_symlink(const path& to, const path& new_symlink, system::error_code& ec) + {detail::create_symlink(to, new_symlink, &ec);} + inline + path current_path() {return detail::current_path();} + + inline + path current_path(system::error_code& ec) {return detail::current_path(&ec);} + + inline + void current_path(const path& p) {detail::current_path(p);} + + inline + void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);} + + inline + bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);} + + inline + bool equivalent(const path& p1, const path& p2, system::error_code& ec) + {return detail::equivalent(p1, p2, &ec);} + inline + boost::uintmax_t file_size(const path& p) {return detail::file_size(p);} + + inline + boost::uintmax_t file_size(const path& p, system::error_code& ec) + {return detail::file_size(p, &ec);} + inline + boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);} + + inline + boost::uintmax_t hard_link_count(const path& p, system::error_code& ec) + {return detail::hard_link_count(p, &ec);} + inline + path initial_path() {return detail::initial_path();} + + inline + path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} + + template <class Path> + path initial_path() {return initial_path();} + template <class Path> + path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} + + inline + std::time_t last_write_time(const path& p) {return detail::last_write_time(p);} + + inline + std::time_t last_write_time(const path& p, system::error_code& ec) + {return detail::last_write_time(p, &ec);} + inline + void last_write_time(const path& p, const std::time_t new_time) + {detail::last_write_time(p, new_time);} + inline + void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec) + {detail::last_write_time(p, new_time, &ec);} + inline + void permissions(const path& p, perms prms) + {detail::permissions(p, prms);} + inline + void permissions(const path& p, perms prms, system::error_code& ec) + {detail::permissions(p, prms, &ec);} + + inline + path read_symlink(const path& p) {return detail::read_symlink(p);} + + inline + path read_symlink(const path& p, system::error_code& ec) + {return detail::read_symlink(p, &ec);} + inline + // For standardization, if the committee doesn't like "remove", consider "eliminate" + bool remove(const path& p) {return detail::remove(p);} + + inline + bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);} + + inline + boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);} + + inline + boost::uintmax_t remove_all(const path& p, system::error_code& ec) + {return detail::remove_all(p, &ec);} + inline + void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);} + + inline + void rename(const path& old_p, const path& new_p, system::error_code& ec) + {detail::rename(old_p, new_p, &ec);} + inline // name suggested by Scott McMurray + void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);} + + inline + void resize_file(const path& p, uintmax_t size, system::error_code& ec) + {detail::resize_file(p, size, &ec);} + inline + space_info space(const path& p) {return detail::space(p);} + + inline + space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);} + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline bool symbolic_link_exists(const path& p) + { return is_symlink(symlink_status(p)); } # endif -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 + inline + path system_complete(const path& p) {return detail::system_complete(p);} + + inline + path system_complete(const path& p, system::error_code& ec) + {return detail::system_complete(p, &ec);} + inline + path temp_directory_path() {return detail::temp_directory_path();} + + inline + path temp_directory_path(system::error_code& ec) + {return detail::temp_directory_path(&ec);} + inline + path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%") + { return detail::unique_path(p); } + inline + path unique_path(const path& p, system::error_code& ec) + { return detail::unique_path(p, &ec); } + +//--------------------------------------------------------------------------------------// +// // +// directory_entry // +// // +//--------------------------------------------------------------------------------------// + +// GCC has a problem with a member function named path within a namespace or +// sub-namespace that also has a class named path. The workaround is to always +// fully qualify the name path when it refers to the class name. + +class BOOST_FILESYSTEM_DECL directory_entry +{ +public: + + // compiler generated copy constructor, copy assignment, and destructor apply + + directory_entry() {} + explicit directory_entry(const boost::filesystem::path& p, + file_status st = file_status(), file_status symlink_st=file_status()) + : m_path(p), m_status(st), m_symlink_status(symlink_st) + {} + + void assign(const boost::filesystem::path& p, + file_status st = file_status(), file_status symlink_st = file_status()) + { m_path = p; m_status = st; m_symlink_status = symlink_st; } + + void replace_filename(const boost::filesystem::path& p, + file_status st = file_status(), file_status symlink_st = file_status()) + { + m_path.remove_filename(); + m_path /= p; + m_status = st; + m_symlink_status = symlink_st; + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + void replace_leaf(const boost::filesystem::path& p, + file_status st, file_status symlink_st) + { replace_filename(p, st, symlink_st); } # endif -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/operations.hpp> + const boost::filesystem::path& path() const {return m_path;} + file_status status() const {return m_get_status();} + file_status status(system::error_code& ec) const {return m_get_status(&ec);} + file_status symlink_status() const {return m_get_symlink_status();} + file_status symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);} + + bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;} + bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;} + bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;} + bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;} + bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;} + bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;} + +private: + boost::filesystem::path m_path; + mutable file_status m_status; // stat()-like + mutable file_status m_symlink_status; // lstat()-like + + file_status m_get_status(system::error_code* ec=0) const; + file_status m_get_symlink_status(system::error_code* ec=0) const; +}; // directory_entry + +//--------------------------------------------------------------------------------------// +// // +// directory_iterator helpers // +// // +//--------------------------------------------------------------------------------------// + +class directory_iterator; + +namespace detail +{ + BOOST_FILESYSTEM_DECL + system::error_code dir_itr_close(// never throws() + void *& handle +# if defined(BOOST_POSIX_API) + , void *& buffer +# endif + ); + + struct dir_itr_imp + { + directory_entry dir_entry; + void* handle; + +# ifdef BOOST_POSIX_API + void* buffer; // see dir_itr_increment implementation +# endif + + dir_itr_imp() : handle(0) +# ifdef BOOST_POSIX_API + , buffer(0) +# endif + {} + + ~dir_itr_imp() // never throws + { + dir_itr_close(handle +# if defined(BOOST_POSIX_API) + , buffer +# endif + ); + } + }; + + // see path::iterator: comment below + BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it, + const path& p, system::error_code* ec); + BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it, + system::error_code* ec); + +} // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// directory_iterator // +// // +//--------------------------------------------------------------------------------------// + + class directory_iterator + : public boost::iterator_facade< directory_iterator, + directory_entry, + boost::single_pass_traversal_tag > + { + public: + + directory_iterator(){} // creates the "end" iterator + + // iterator_facade derived classes don't seem to like implementations in + // separate translation unit dll's, so forward to detail functions + explicit directory_iterator(const path& p) + : m_imp(new detail::dir_itr_imp) + { detail::directory_iterator_construct(*this, p, 0); } + + directory_iterator(const path& p, system::error_code& ec) + : m_imp(new detail::dir_itr_imp) + { detail::directory_iterator_construct(*this, p, &ec); } + + ~directory_iterator() {} // never throws + + directory_iterator& increment(system::error_code& ec) + { + detail::directory_iterator_increment(*this, &ec); + return *this; + } + + private: + friend struct detail::dir_itr_imp; + friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it, + const path& p, system::error_code* ec); + friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it, + system::error_code* ec); + + // shared_ptr provides shallow-copy semantics required for InputIterators. + // m_imp.get()==0 indicates the end iterator. + boost::shared_ptr< detail::dir_itr_imp > m_imp; + + friend class boost::iterator_core_access; + + boost::iterator_facade< + directory_iterator, + directory_entry, + boost::single_pass_traversal_tag >::reference dereference() const + { + BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator"); + return m_imp->dir_entry; + } + + void increment() { detail::directory_iterator_increment(*this, 0); } + + bool equal(const directory_iterator& rhs) const + { return m_imp == rhs.m_imp; } + }; + +//--------------------------------------------------------------------------------------// +// // +// recursive_directory_iterator helpers // +// // +//--------------------------------------------------------------------------------------// + + BOOST_SCOPED_ENUM_START(symlink_option) + { + none, + no_recurse = none, // don't follow directory symlinks (default behavior) + recurse, // follow directory symlinks + _detail_no_push = recurse << 1 // internal use only + }; + BOOST_SCOPED_ENUM_END + + BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option)) + + namespace detail + { + struct recur_dir_itr_imp + { + typedef directory_iterator element_type; + std::stack< element_type, std::vector< element_type > > m_stack; + int m_level; + BOOST_SCOPED_ENUM(symlink_option) m_options; + + recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {} + + void increment(system::error_code* ec); // ec == 0 means throw on error + + void pop(); + + }; + + // Implementation is inline to avoid dynamic linking difficulties with m_stack: + // Microsoft warning C4251, m_stack needs to have dll-interface to be used by + // clients of struct 'boost::filesystem::detail::recur_dir_itr_imp' -# else -# include <boost/filesystem/v3/operations.hpp> + inline + void recur_dir_itr_imp::increment(system::error_code* ec) + // ec == 0 means throw on error + { + if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push) + m_options &= ~symlink_option::_detail_no_push; + else + { + // Logic for following predicate was contributed by Daniel Aarno to handle cyclic + // symlinks correctly and efficiently, fixing ticket #5652. + // if (((m_options & symlink_option::recurse) == symlink_option::recurse + // || !is_symlink(m_stack.top()->symlink_status())) + // && is_directory(m_stack.top()->status())) ... + // The predicate code has since been rewritten to pass error_code arguments, + // per ticket #5653. + bool or_pred = (m_options & symlink_option::recurse) == symlink_option::recurse + || (ec == 0 ? !is_symlink(m_stack.top()->symlink_status()) + : !is_symlink(m_stack.top()->symlink_status(*ec))); + if (ec != 0 && *ec) + return; + bool and_pred = or_pred && (ec == 0 ? is_directory(m_stack.top()->status()) + : is_directory(m_stack.top()->status(*ec))); + if (ec != 0 && *ec) + return; + + if (and_pred) + { + if (ec == 0) + m_stack.push(directory_iterator(m_stack.top()->path())); + else + { + m_stack.push(directory_iterator(m_stack.top()->path(), *ec)); + if (*ec) + return; + } + if (m_stack.top() != directory_iterator()) + { + ++m_level; + return; + } + m_stack.pop(); + } + } + + while (!m_stack.empty() && ++m_stack.top() == directory_iterator()) + { + m_stack.pop(); + --m_level; + } + } + + inline + void recur_dir_itr_imp::pop() + { + BOOST_ASSERT_MSG(m_level > 0, + "pop() on recursive_directory_iterator with level < 1"); + + do + { + m_stack.pop(); + --m_level; + } + while (!m_stack.empty() && ++m_stack.top() == directory_iterator()); + } + } // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// recursive_directory_iterator // +// // +//--------------------------------------------------------------------------------------// + + class recursive_directory_iterator + : public boost::iterator_facade< + recursive_directory_iterator, + directory_entry, + boost::single_pass_traversal_tag > + { + public: + + recursive_directory_iterator(){} // creates the "end" iterator + + explicit recursive_directory_iterator(const path& dir_path, + BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none) + : m_imp(new detail::recur_dir_itr_imp) + { + m_imp->m_options = opt; + m_imp->m_stack.push(directory_iterator(dir_path)); + if (m_imp->m_stack.top() == directory_iterator()) + { m_imp.reset (); } + } + + recursive_directory_iterator(const path& dir_path, + BOOST_SCOPED_ENUM(symlink_option) opt, + system::error_code & ec) + : m_imp(new detail::recur_dir_itr_imp) + { + m_imp->m_options = opt; + m_imp->m_stack.push(directory_iterator(dir_path, ec)); + if (m_imp->m_stack.top() == directory_iterator()) + { m_imp.reset (); } + } + + recursive_directory_iterator(const path& dir_path, + system::error_code & ec) + : m_imp(new detail::recur_dir_itr_imp) + { + m_imp->m_options = symlink_option::none; + m_imp->m_stack.push(directory_iterator(dir_path, ec)); + if (m_imp->m_stack.top() == directory_iterator()) + { m_imp.reset (); } + } + + recursive_directory_iterator& increment(system::error_code& ec) + { + BOOST_ASSERT_MSG(m_imp.get(), + "increment() on end recursive_directory_iterator"); + m_imp->increment(&ec); + if (m_imp->m_stack.empty()) + m_imp.reset(); // done, so make end iterator + return *this; + } + + int level() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "level() on end recursive_directory_iterator"); + return m_imp->m_level; + } + + bool no_push_pending() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "is_no_push_requested() on end recursive_directory_iterator"); + return (m_imp->m_options & symlink_option::_detail_no_push) + == symlink_option::_detail_no_push; + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + bool no_push_request() const { return no_push_pending(); } +# endif + + void pop() + { + BOOST_ASSERT_MSG(m_imp.get(), + "pop() on end recursive_directory_iterator"); + m_imp->pop(); + if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator + } + + void no_push(bool value=true) + { + BOOST_ASSERT_MSG(m_imp.get(), + "no_push() on end recursive_directory_iterator"); + if (value) + m_imp->m_options |= symlink_option::_detail_no_push; + else + m_imp->m_options &= ~symlink_option::_detail_no_push; + } + + file_status status() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "status() on end recursive_directory_iterator"); + return m_imp->m_stack.top()->status(); + } + + file_status symlink_status() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "symlink_status() on end recursive_directory_iterator"); + return m_imp->m_stack.top()->symlink_status(); + } + + private: + + // shared_ptr provides shallow-copy semantics required for InputIterators. + // m_imp.get()==0 indicates the end iterator. + boost::shared_ptr< detail::recur_dir_itr_imp > m_imp; + + friend class boost::iterator_core_access; + + boost::iterator_facade< + recursive_directory_iterator, + directory_entry, + boost::single_pass_traversal_tag >::reference + dereference() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "dereference of end recursive_directory_iterator"); + return *m_imp->m_stack.top(); + } + + void increment() + { + BOOST_ASSERT_MSG(m_imp.get(), + "increment of end recursive_directory_iterator"); + m_imp->increment(0); + if (m_imp->m_stack.empty()) + m_imp.reset(); // done, so make end iterator + } + + bool equal(const recursive_directory_iterator& rhs) const + { return m_imp == rhs.m_imp; } + + }; + +# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) + typedef recursive_directory_iterator wrecursive_directory_iterator; # endif -#endif // BOOST_FILESYSTEM_OPERATIONSX_HPP +//--------------------------------------------------------------------------------------// +// // +// class filesystem_error // +// // +//--------------------------------------------------------------------------------------// + + class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error + { + // see http://www.boost.org/more/error_handling.html for design rationale + + // all functions are inline to avoid issues with crossing dll boundaries + + public: + // compiler generates copy constructor and copy assignment + + filesystem_error( + const std::string & what_arg, system::error_code ec) + : system::system_error(ec, what_arg) + { + try + { + m_imp_ptr.reset(new m_imp); + } + catch (...) { m_imp_ptr.reset(); } + } + + filesystem_error( + const std::string & what_arg, const path& path1_arg, + system::error_code ec) + : system::system_error(ec, what_arg) + { + try + { + m_imp_ptr.reset(new m_imp); + m_imp_ptr->m_path1 = path1_arg; + } + catch (...) { m_imp_ptr.reset(); } + } + + filesystem_error( + const std::string & what_arg, const path& path1_arg, + const path& path2_arg, system::error_code ec) + : system::system_error(ec, what_arg) + { + try + { + m_imp_ptr.reset(new m_imp); + m_imp_ptr->m_path1 = path1_arg; + m_imp_ptr->m_path2 = path2_arg; + } + catch (...) { m_imp_ptr.reset(); } + } + + ~filesystem_error() throw() {} + + const path& path1() const + { + static const path empty_path; + return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ; + } + const path& path2() const + { + static const path empty_path; + return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ; + } + + const char* what() const throw() + { + if (!m_imp_ptr.get()) + return system::system_error::what(); + + try + { + if (m_imp_ptr->m_what.empty()) + { + m_imp_ptr->m_what = system::system_error::what(); + if (!m_imp_ptr->m_path1.empty()) + { + m_imp_ptr->m_what += ": \""; + m_imp_ptr->m_what += m_imp_ptr->m_path1.string(); + m_imp_ptr->m_what += "\""; + } + if (!m_imp_ptr->m_path2.empty()) + { + m_imp_ptr->m_what += ", \""; + m_imp_ptr->m_what += m_imp_ptr->m_path2.string(); + m_imp_ptr->m_what += "\""; + } + } + return m_imp_ptr->m_what.c_str(); + } + catch (...) + { + return system::system_error::what(); + } + } + + private: + struct m_imp + { + path m_path1; // may be empty() + path m_path2; // may be empty() + std::string m_what; // not built until needed + }; + boost::shared_ptr<m_imp> m_imp_ptr; + }; + +// test helper -----------------------------------------------------------------------// + +// Not part of the documented interface since false positives are possible; +// there is no law that says that an OS that has large stat.st_size +// actually supports large file sizes. + + namespace detail + { + BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); + } + + } // namespace filesystem +} // namespace boost + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/path.hpp b/3rdParty/Boost/src/boost/filesystem/path.hpp index 3bed7d2..2dd1b00 100644 --- a/3rdParty/Boost/src/boost/filesystem/path.hpp +++ b/3rdParty/Boost/src/boost/filesystem/path.hpp @@ -1,35 +1,758 @@ -// boost/filesystem/path.hpp ---------------------------------------------------------// +// filesystem path.hpp ---------------------------------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes 2002-2005, 2009 +// Copyright Vladimir Prus 2002 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // Library home page: http://www.boost.org/libs/filesystem -//--------------------------------------------------------------------------------------// +// path::stem(), extension(), and replace_extension() are based on +// basename(), extension(), and change_extension() from the original +// filesystem/convenience.hpp header by Vladimir Prus. -#ifndef BOOST_FILESYSTEM_PATHX_HPP -#define BOOST_FILESYSTEM_PATHX_HPP +#ifndef BOOST_FILESYSTEM_PATH_HPP +#define BOOST_FILESYSTEM_PATH_HPP -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there +#include <boost/config.hpp> -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support # endif -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path_traits.hpp> // includes <cwchar> +#include <boost/system/error_code.hpp> +#include <boost/system/system_error.hpp> +#include <boost/iterator/iterator_facade.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/io/detail/quoted_manip.hpp> +#include <boost/static_assert.hpp> +#include <boost/functional/hash_fwd.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <string> +#include <iterator> +#include <cstring> +#include <iosfwd> +#include <stdexcept> +#include <cassert> +#include <locale> +#include <algorithm> + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +namespace boost +{ +namespace filesystem +{ + //------------------------------------------------------------------------------------// + // // + // class path // + // // + //------------------------------------------------------------------------------------// + + class BOOST_FILESYSTEM_DECL path + { + public: + + // value_type is the character type used by the operating system API to + // represent paths. + +# ifdef BOOST_WINDOWS_API + typedef wchar_t value_type; + BOOST_STATIC_CONSTEXPR value_type preferred_separator = L'\\'; +# else + typedef char value_type; + BOOST_STATIC_CONSTEXPR value_type preferred_separator = '/'; # endif + typedef std::basic_string<value_type> string_type; + typedef std::codecvt<wchar_t, char, + std::mbstate_t> codecvt_type; + + + // ----- character encoding conversions ----- + + // Following the principle of least astonishment, path input arguments + // passed to or obtained from the operating system via objects of + // class path behave as if they were directly passed to or + // obtained from the O/S API, unless conversion is explicitly requested. + // + // POSIX specfies that path strings are passed unchanged to and from the + // API. Note that this is different from the POSIX command line utilities, + // which convert according to a locale. + // + // Thus for POSIX, char strings do not undergo conversion. wchar_t strings + // are converted to/from char using the path locale or, if a conversion + // argument is given, using a conversion object modeled on + // std::wstring_convert. + // + // The path locale, which is global to the thread, can be changed by the + // imbue() function. It is initialized to an implementation defined locale. + // + // For Windows, wchar_t strings do not undergo conversion. char strings + // are converted using the "ANSI" or "OEM" code pages, as determined by + // the AreFileApisANSI() function, or, if a conversion argument is given, + // using a conversion object modeled on std::wstring_convert. + // + // See m_pathname comments for further important rationale. + + // TODO: rules needed for operating systems that use / or . + // differently, or format directory paths differently from file paths. + // + // ********************************************************************************** + // + // More work needed: How to handle an operating system that may have + // slash characters or dot characters in valid filenames, either because + // it doesn't follow the POSIX standard, or because it allows MBCS + // filename encodings that may contain slash or dot characters. For + // example, ISO/IEC 2022 (JIS) encoding which allows switching to + // JIS x0208-1983 encoding. A valid filename in this set of encodings is + // 0x1B 0x24 0x42 [switch to X0208-1983] 0x24 0x2F [U+304F Kiragana letter KU] + // ^^^^ + // Note that 0x2F is the ASCII slash character + // + // ********************************************************************************** + + // Supported source arguments: half-open iterator range, container, c-array, + // and single pointer to null terminated string. + + // All source arguments except pointers to null terminated byte strings support + // multi-byte character strings which may have embedded nulls. Embedded null + // support is required for some Asian languages on Windows. + + // [defaults] "const codecvt_type& cvt=codecvt()" default arguments are not used + // because some compilers, such as Microsoft prior to VC++ 10, do not handle defaults + // correctly in templates. + + // ----- constructors ----- + + path(){} + + path(const path& p) : m_pathname(p.m_pathname) {} + + template <class Source> + path(Source const& source, + typename boost::enable_if<path_traits::is_pathable< + typename boost::decay<Source>::type> >::type* =0) + { + path_traits::dispatch(source, m_pathname, codecvt()); + } + + // Overloads for the operating system API's native character type. Rationale: + // - Avoids use of codecvt() for native value_type strings. This limits the + // impact of locale("") initialization failures on POSIX systems to programs + // that actually depend on locale(""). It further ensures that exceptions thrown + // as a result of such failues occur after main() has started, so can be caught. + // This is a partial resolution of tickets 4688, 5100, and 5289. + // - A slight optimization for a common use case, particularly on POSIX since + // value_type is char and that is the most common useage. + path(const value_type* s) : m_pathname(s) {} + path(const std::basic_string<value_type>& s) : m_pathname(s) {} + + template <class Source> + path(Source const& source, const codecvt_type& cvt) + // see [defaults] note above explaining why codecvt() default arguments are not used + { + path_traits::dispatch(source, m_pathname, cvt); + } + + template <class InputIterator> + path(InputIterator begin, InputIterator end) + { + if (begin != end) + { + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt()); + } + } + + template <class InputIterator> + path(InputIterator begin, InputIterator end, const codecvt_type& cvt) + { + if (begin != end) + { + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); + } + } + + // ----- assignments ----- + + path& operator=(const path& p) + { + m_pathname = p.m_pathname; + return *this; + } + + path& operator=(const value_type* ptr) // required in case ptr overlaps *this + { + m_pathname = ptr; + return *this; + } + + template <class Source> + typename boost::enable_if<path_traits::is_pathable< + typename boost::decay<Source>::type>, path&>::type + operator=(Source const& source) + { + m_pathname.clear(); + path_traits::dispatch(source, m_pathname, codecvt()); + return *this; + } + + path& assign(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this + { + m_pathname = ptr; + return *this; + } + + template <class Source> + path& assign(Source const& source, const codecvt_type& cvt) + { + m_pathname.clear(); + path_traits::dispatch(source, m_pathname, cvt); + return *this; + } + + template <class InputIterator> + path& assign(InputIterator begin, InputIterator end) + { + return assign(begin, end, codecvt()); + } + + template <class InputIterator> + path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt) + { + m_pathname.clear(); + if (begin != end) + { + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); + } + return *this; + } + + // ----- concatenation ----- + + path& operator+=(const path& p) {m_pathname += p.m_pathname; return *this;} + path& operator+=(const string_type& s) {m_pathname += s; return *this;} + path& operator+=(const value_type* ptr) {m_pathname += ptr; return *this;} + path& operator+=(value_type c) {m_pathname += c; return *this;} + + template <class Source> + typename boost::enable_if<path_traits::is_pathable< + typename boost::decay<Source>::type>, path&>::type + operator+=(Source const& source) + { + return concat(source, codecvt()); + } + + template <class CharT> + typename boost::enable_if<is_integral<CharT>, path&>::type + operator+=(CharT c) + { + CharT tmp[2]; + tmp[0] = c; + tmp[1] = 0; + return concat(tmp, codecvt()); + } + + template <class Source> + path& concat(Source const& source, const codecvt_type& cvt) + { + path_traits::dispatch(source, m_pathname, cvt); + return *this; + } + + template <class InputIterator> + path& concat(InputIterator begin, InputIterator end) + { + return concat(begin, end, codecvt()); + } + + template <class InputIterator> + path& concat(InputIterator begin, InputIterator end, const codecvt_type& cvt) + { + if (begin == end) + return *this; + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); + return *this; + } + + // ----- appends ----- + + // if a separator is added, it is the preferred separator for the platform; + // slash for POSIX, backslash for Windows + + path& operator/=(const path& p); + + path& operator/=(const value_type* ptr); + + template <class Source> + typename boost::enable_if<path_traits::is_pathable< + typename boost::decay<Source>::type>, path&>::type + operator/=(Source const& source) + { + return append(source, codecvt()); + } + + path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this + { + this->operator/=(ptr); + return *this; + } + + template <class Source> + path& append(Source const& source, const codecvt_type& cvt); + + template <class InputIterator> + path& append(InputIterator begin, InputIterator end) + { + return append(begin, end, codecvt()); + } + + template <class InputIterator> + path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt); + + // ----- modifiers ----- + + void clear() { m_pathname.clear(); } + path& make_preferred() +# ifdef BOOST_POSIX_API + { return *this; } // POSIX no effect +# else // BOOST_WINDOWS_API + ; // change slashes to backslashes +# endif + path& remove_filename(); + path& replace_extension(const path& new_extension = path()); + void swap(path& rhs) { m_pathname.swap(rhs.m_pathname); } + + // ----- observers ----- + + // For operating systems that format file paths differently than directory + // paths, return values from observers are formatted as file names unless there + // is a trailing separator, in which case returns are formatted as directory + // paths. POSIX and Windows make no such distinction. + + // Implementations are permitted to return const values or const references. + + // The string or path returned by an observer are specified as being formatted + // as "native" or "generic". + // + // For POSIX, these are all the same format; slashes and backslashes are as input and + // are not modified. + // + // For Windows, native: as input; slashes and backslashes are not modified; + // this is the format of the internally stored string. + // generic: backslashes are converted to slashes + + // ----- native format observers ----- + + const string_type& native() const { return m_pathname; } // Throws: nothing + const value_type* c_str() const { return m_pathname.c_str(); } // Throws: nothing + + template <class String> + String string() const; + + template <class String> + String string(const codecvt_type& cvt) const; + +# ifdef BOOST_WINDOWS_API + const std::string string() const { return string(codecvt()); } + const std::string string(const codecvt_type& cvt) const + { + std::string tmp; + if (!m_pathname.empty()) + path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(), + tmp, cvt); + return tmp; + } + + // string_type is std::wstring, so there is no conversion + const std::wstring& wstring() const { return m_pathname; } + const std::wstring& wstring(const codecvt_type&) const { return m_pathname; } + +# else // BOOST_POSIX_API + // string_type is std::string, so there is no conversion + const std::string& string() const { return m_pathname; } + const std::string& string(const codecvt_type&) const { return m_pathname; } + + const std::wstring wstring() const { return wstring(codecvt()); } + const std::wstring wstring(const codecvt_type& cvt) const + { + std::wstring tmp; + if (!m_pathname.empty()) + path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(), + tmp, cvt); + return tmp; + } + +# endif + + // ----- generic format observers ----- + + template <class String> + String generic_string() const; + + template <class String> + String generic_string(const codecvt_type& cvt) const; + +# ifdef BOOST_WINDOWS_API + const std::string generic_string() const { return generic_string(codecvt()); } + const std::string generic_string(const codecvt_type& cvt) const; + const std::wstring generic_wstring() const; + const std::wstring generic_wstring(const codecvt_type&) const { return generic_wstring(); }; -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/path.hpp> +# else // BOOST_POSIX_API + // On POSIX-like systems, the generic format is the same as the native format + const std::string& generic_string() const { return m_pathname; } + const std::string& generic_string(const codecvt_type&) const { return m_pathname; } + const std::wstring generic_wstring() const { return wstring(codecvt()); } + const std::wstring generic_wstring(const codecvt_type& cvt) const { return wstring(cvt); } -# else -# include <boost/filesystem/v3/path.hpp> +# endif + // ----- compare ----- + + int compare(const path& p) const BOOST_NOEXCEPT; // generic, lexicographical + int compare(const std::string& s) const { return compare(path(s)); } + int compare(const value_type* s) const { return compare(path(s)); } + + // ----- decomposition ----- + + path root_path() const; + path root_name() const; // returns 0 or 1 element path + // even on POSIX, root_name() is non-empty() for network paths + path root_directory() const; // returns 0 or 1 element path + path relative_path() const; + path parent_path() const; + path filename() const; // returns 0 or 1 element path + path stem() const; // returns 0 or 1 element path + path extension() const; // returns 0 or 1 element path + + // ----- query ----- + + bool empty() const { return m_pathname.empty(); } // name consistent with std containers + bool has_root_path() const { return has_root_directory() || has_root_name(); } + bool has_root_name() const { return !root_name().empty(); } + bool has_root_directory() const { return !root_directory().empty(); } + bool has_relative_path() const { return !relative_path().empty(); } + bool has_parent_path() const { return !parent_path().empty(); } + bool has_filename() const { return !m_pathname.empty(); } + bool has_stem() const { return !stem().empty(); } + bool has_extension() const { return !extension().empty(); } + bool is_absolute() const + { +# ifdef BOOST_WINDOWS_API + return has_root_name() && has_root_directory(); +# else + return has_root_directory(); +# endif + } + bool is_relative() const { return !is_absolute(); } + + // ----- iterators ----- + + class iterator; + typedef iterator const_iterator; + + iterator begin() const; + iterator end() const; + + // ----- static member functions ----- + + static std::locale imbue(const std::locale& loc); + static const codecvt_type& codecvt(); + + // ----- deprecated functions ----- + +# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED) +# error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined +# endif + +# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) + // recently deprecated functions supplied by default + path& normalize() { return m_normalize(); } + path& remove_leaf() { return remove_filename(); } + path leaf() const { return filename(); } + path branch_path() const { return parent_path(); } + bool has_leaf() const { return !m_pathname.empty(); } + bool has_branch_path() const { return !parent_path().empty(); } + bool is_complete() const { return is_absolute(); } +# endif + +# if defined(BOOST_FILESYSTEM_DEPRECATED) + // deprecated functions with enough signature or semantic changes that they are + // not supplied by default + const std::string file_string() const { return string(); } + const std::string directory_string() const { return string(); } + const std::string native_file_string() const { return string(); } + const std::string native_directory_string() const { return string(); } + const string_type external_file_string() const { return native(); } + const string_type external_directory_string() const { return native(); } + + // older functions no longer supported + //typedef bool (*name_check)(const std::string & name); + //basic_path(const string_type& str, name_check) { operator/=(str); } + //basic_path(const typename string_type::value_type* s, name_check) + // { operator/=(s);} + //static bool default_name_check_writable() { return false; } + //static void default_name_check(name_check) {} + //static name_check default_name_check() { return 0; } + //basic_path& canonize(); +# endif + +//--------------------------------------------------------------------------------------// +// class path private members // +//--------------------------------------------------------------------------------------// + + private: +# if defined(_MSC_VER) +# pragma warning(push) // Save warning settings +# pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>' +# endif // needs to have dll-interface... +/* + m_pathname has the type, encoding, and format required by the native + operating system. Thus for POSIX and Windows there is no conversion for + passing m_pathname.c_str() to the O/S API or when obtaining a path from the + O/S API. POSIX encoding is unspecified other than for dot and slash + characters; POSIX just treats paths as a sequence of bytes. Windows + encoding is UCS-2 or UTF-16 depending on the version. +*/ + string_type m_pathname; // Windows: as input; backslashes NOT converted to slashes, + // slashes NOT converted to backslashes +# if defined(_MSC_VER) +# pragma warning(pop) // restore warning settings. +# endif + + string_type::size_type m_append_separator_if_needed(); + // Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0. + // Note: An append is never performed if size()==0, so a returned 0 is unambiguous. + + void m_erase_redundant_separator(string_type::size_type sep_pos); + string_type::size_type m_parent_path_end() const; + + path& m_normalize(); + + // Was qualified; como433beta8 reports: + // warning #427-D: qualified name is not allowed in member declaration + friend class iterator; + friend bool operator<(const path& lhs, const path& rhs); + + // see path::iterator::increment/decrement comment below + static void m_path_iterator_increment(path::iterator & it); + static void m_path_iterator_decrement(path::iterator & it); + + }; // class path + + namespace detail + { + BOOST_FILESYSTEM_DECL + int lex_compare(path::iterator first1, path::iterator last1, + path::iterator first2, path::iterator last2); + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + typedef path wpath; +# endif + + //------------------------------------------------------------------------------------// + // class path::iterator // + //------------------------------------------------------------------------------------// + + class path::iterator + : public boost::iterator_facade< + path::iterator, + path const, + boost::bidirectional_traversal_tag > + { + private: + friend class boost::iterator_core_access; + friend class boost::filesystem::path; + friend void m_path_iterator_increment(path::iterator & it); + friend void m_path_iterator_decrement(path::iterator & it); + + const path& dereference() const { return m_element; } + + bool equal(const iterator & rhs) const + { + return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; + } + + // iterator_facade derived classes don't seem to like implementations in + // separate translation unit dll's, so forward to class path static members + void increment() { m_path_iterator_increment(*this); } + void decrement() { m_path_iterator_decrement(*this); } + + path m_element; // current element + const path* m_path_ptr; // path being iterated over + string_type::size_type m_pos; // position of m_element in + // m_path_ptr->m_pathname. + // if m_element is implicit dot, m_pos is the + // position of the last separator in the path. + // end() iterator is indicated by + // m_pos == m_path_ptr->m_pathname.size() + }; // path::iterator + + //------------------------------------------------------------------------------------// + // // + // non-member functions // + // // + //------------------------------------------------------------------------------------// + + // std::lexicographical_compare would infinately recurse because path iterators + // yield paths, so provide a path aware version + inline bool lexicographical_compare(path::iterator first1, path::iterator last1, + path::iterator first2, path::iterator last2) + { return detail::lex_compare(first1, last1, first2, last2) < 0; } + + inline bool operator==(const path& lhs, const path& rhs) {return lhs.compare(rhs) == 0;} + inline bool operator==(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) == 0;} + inline bool operator==(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) == 0;} + inline bool operator==(const path& lhs, const path::value_type* rhs) {return lhs.compare(rhs) == 0;} + inline bool operator==(const path::value_type* lhs, const path& rhs) {return rhs.compare(lhs) == 0;} + + inline bool operator!=(const path& lhs, const path& rhs) {return lhs.compare(rhs) != 0;} + inline bool operator!=(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) != 0;} + inline bool operator!=(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) != 0;} + inline bool operator!=(const path& lhs, const path::value_type* rhs) {return lhs.compare(rhs) != 0;} + inline bool operator!=(const path::value_type* lhs, const path& rhs) {return rhs.compare(lhs) != 0;} + + // TODO: why do == and != have additional overloads, but the others don't? + + inline bool operator<(const path& lhs, const path& rhs) {return lhs.compare(rhs) < 0;} + inline bool operator<=(const path& lhs, const path& rhs) {return !(rhs < lhs);} + inline bool operator> (const path& lhs, const path& rhs) {return rhs < lhs;} + inline bool operator>=(const path& lhs, const path& rhs) {return !(lhs < rhs);} + + inline std::size_t hash_value(const path& x) + { +# ifdef BOOST_WINDOWS_API + std::size_t seed = 0; + for(const path::value_type* it = x.c_str(); *it; ++it) + hash_combine(seed, *it == '/' ? L'\\' : *it); + return seed; +# else // BOOST_POSIX_API + return hash_range(x.native().begin(), x.native().end()); # endif + } + + inline void swap(path& lhs, path& rhs) { lhs.swap(rhs); } + + inline path operator/(const path& lhs, const path& rhs) { return path(lhs) /= rhs; } + + // inserters and extractors + // use boost::io::quoted() to handle spaces in paths + // use '&' as escape character to ease use for Windows paths + + template <class Char, class Traits> + inline std::basic_ostream<Char, Traits>& + operator<<(std::basic_ostream<Char, Traits>& os, const path& p) + { + return os + << boost::io::quoted(p.template string<std::basic_string<Char> >(), static_cast<Char>('&')); + } + + template <class Char, class Traits> + inline std::basic_istream<Char, Traits>& + operator>>(std::basic_istream<Char, Traits>& is, path& p) + { + std::basic_string<Char> str; + is >> boost::io::quoted(str, static_cast<Char>('&')); + p = str; + return is; + } + + // name_checks + + // These functions are holdovers from version 1. It isn't clear they have much + // usefulness, or how to generalize them for later versions. + + BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool native(const std::string & name); + +//--------------------------------------------------------------------------------------// +// class path member template implementation // +//--------------------------------------------------------------------------------------// + + template <class InputIterator> + path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt) + { + if (begin == end) + return *this; + string_type::size_type sep_pos(m_append_separator_if_needed()); + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); + if (sep_pos) + m_erase_redundant_separator(sep_pos); + return *this; + } + + template <class Source> + path& path::append(Source const& source, const codecvt_type& cvt) + { + if (path_traits::empty(source)) + return *this; + string_type::size_type sep_pos(m_append_separator_if_needed()); + path_traits::dispatch(source, m_pathname, cvt); + if (sep_pos) + m_erase_redundant_separator(sep_pos); + return *this; + } + +//--------------------------------------------------------------------------------------// +// class path member template specializations // +//--------------------------------------------------------------------------------------// + + template <> inline + std::string path::string<std::string>() const + { return string(); } + + template <> inline + std::wstring path::string<std::wstring>() const + { return wstring(); } + + template <> inline + std::string path::string<std::string>(const codecvt_type& cvt) const + { return string(cvt); } + + template <> inline + std::wstring path::string<std::wstring>(const codecvt_type& cvt) const + { return wstring(cvt); } + + template <> inline + std::string path::generic_string<std::string>() const + { return generic_string(); } + + template <> inline + std::wstring path::generic_string<std::wstring>() const + { return generic_wstring(); } + + template <> inline + std::string path::generic_string<std::string>(const codecvt_type& cvt) const + { return generic_string(cvt); } + + template <> inline + std::wstring path::generic_string<std::wstring>(const codecvt_type& cvt) const + { return generic_wstring(cvt); } + + +} // namespace filesystem +} // namespace boost + +//----------------------------------------------------------------------------// + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM_PATHX_HPP +#endif // BOOST_FILESYSTEM_PATH_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/path_traits.hpp b/3rdParty/Boost/src/boost/filesystem/path_traits.hpp index 71e80e2..a6a2505 100644 --- a/3rdParty/Boost/src/boost/filesystem/v3/path_traits.hpp +++ b/3rdParty/Boost/src/boost/filesystem/path_traits.hpp @@ -16,7 +16,7 @@ # error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support # endif -#include <boost/filesystem/v3/config.hpp> +#include <boost/filesystem/config.hpp> #include <boost/utility/enable_if.hpp> #include <boost/type_traits/is_array.hpp> #include <boost/type_traits/decay.hpp> @@ -32,7 +32,7 @@ #include <boost/config/abi_prefix.hpp> // must be the last #include -namespace boost { namespace filesystem3 { +namespace boost { namespace filesystem { BOOST_FILESYSTEM_DECL const system::error_category& codecvt_error_category(); // uses std::codecvt_base::result used for error codes: @@ -85,8 +85,8 @@ namespace path_traits { } template <typename T, size_t N> inline - bool empty(T (&)[N]) - { return N <= 1; } + bool empty(T (&x)[N]) + { return !x[0]; } // value types differ ---------------------------------------------------------------// // @@ -164,7 +164,7 @@ namespace path_traits { to += from; } - // Source dispatch + // Source dispatch -----------------------------------------------------------------// // contiguous containers template <class U> inline @@ -230,18 +230,6 @@ namespace path_traits { }}} // namespace boost::filesystem::path_traits -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem3::codecvt_error_category; -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED -# endif - } -} - #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas #endif // BOOST_FILESYSTEM_PATH_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/config.hpp b/3rdParty/Boost/src/boost/filesystem/v2/config.hpp deleted file mode 100644 index 7116de5..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/config.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// boost/filesystem/v2/config.hpp ------------------------------------------// - -// Copyright Beman Dawes 2003 - -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_CONFIG_HPP -#define BOOST_FILESYSTEM2_CONFIG_HPP - -# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 2 -# error Compiling Filesystem version 2 file with BOOST_FILESYSTEM_VERSION defined != 2 -# endif - -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 2 -# endif - -#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions - -// ability to change namespace aids path_table.cpp ------------------------// -#ifndef BOOST_FILESYSTEM2_NAMESPACE -# define BOOST_FILESYSTEM2_NAMESPACE filesystem2 -#endif - -#include <boost/config.hpp> -#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API -#include <boost/detail/workaround.hpp> - -// BOOST_POSIX_PATH or BOOST_WINDOWS_PATH specify which path syntax to recognise - -# if defined(BOOST_WINDOWS_API) && defined(BOOST_POSIX_PATH) -# error builds with Windows API do not support BOOST_POSIX_PATH -# endif - -# if !defined(_WIN32) && !defined(__CYGWIN__) && defined(BOOST_WINDOWS_PATH) -# error builds on non-Windows platforms do not support BOOST_WINDOWS_PATH -# endif - -# if defined(BOOST_WINDOWS_PATH) && defined(BOOST_POSIX_PATH) -# error both BOOST_WINDOWS_PATH and BOOST_POSIX_PATH are defined -# elif !defined(BOOST_WINDOWS_PATH) && !defined(BOOST_POSIX_PATH) -# if !defined(BOOST_POSIX_PATH) && (defined(_WIN32) || defined(__CYGWIN__)) -# define BOOST_WINDOWS_PATH -# else -# define BOOST_POSIX_PATH -# endif -# endif - -// throw an exception ----------------------------------------------------------------// -// -// Exceptions were originally thrown via boost::throw_exception(). -// As throw_exception() became more complex, it caused user error reporting -// to be harder to interpret, since the exception reported became much more complex. -// The immediate fix was to throw directly, wrapped in a macro to make any later change -// easier. - -#define BOOST_FILESYSTEM_THROW(EX) throw EX - -// narrow support only for badly broken compilers or libraries -------------// - -# if defined(BOOST_NO_STD_WSTRING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STD_LOCALE) || BOOST_WORKAROUND(__BORLANDC__, <0x610) -# define BOOST_FILESYSTEM2_NARROW_ONLY -# endif - -// This header implements separate compilation features as described in -// http://www.boost.org/more/separate_compilation.html - -// enable dynamic linking ---------------------------------------------------// - -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) -# if defined(BOOST_FILESYSTEM_SOURCE) -# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT -# else -# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT -# endif -#else -# define BOOST_FILESYSTEM_DECL -#endif - -// enable automatic library variant selection ------------------------------// - -#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \ - && !defined(BOOST_FILESYSTEM_NO_LIB) -// -// Set the name of our library, this will get undef'ed by auto_link.hpp -// once it's done with it: -// -#define BOOST_LIB_NAME boost_filesystem -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) -# define BOOST_DYN_LINK -#endif -// -// And include the header that does the work: -// -#include <boost/config/auto_link.hpp> -#endif // auto-linking disabled - -#endif // BOOST_FILESYSTEM2_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/convenience.hpp b/3rdParty/Boost/src/boost/filesystem/v2/convenience.hpp deleted file mode 100644 index 30b6ade..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/convenience.hpp +++ /dev/null @@ -1,339 +0,0 @@ -// boost/filesystem/convenience.hpp ----------------------------------------// - -// Copyright Beman Dawes, 2002-2005 -// Copyright Vladimir Prus, 2002 -// Use, modification, and distribution is subject to 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_CONVENIENCE_HPP -#define BOOST_FILESYSTEM2_CONVENIENCE_HPP - -#include <boost/filesystem/v2/config.hpp> -#include <boost/filesystem/v2/operations.hpp> -#include <boost/system/error_code.hpp> -#include <vector> -#include <stack> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY -# define BOOST_FS_FUNC(BOOST_FS_TYPE) \ - template<class Path> typename boost::enable_if<is_basic_path<Path>, \ - BOOST_FS_TYPE>::type -# define BOOST_FS_FUNC_STRING BOOST_FS_FUNC(typename Path::string_type) -# define BOOST_FS_TYPENAME typename -# else -# define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE - typedef boost::filesystem::path Path; -# define BOOST_FS_FUNC_STRING inline std::string -# define BOOST_FS_TYPENAME -# endif - -namespace boost -{ - namespace filesystem2 - { - - BOOST_FS_FUNC(bool) create_directories(const Path& ph) - { - if (ph.empty() || exists(ph)) - { - if ( !ph.empty() && !is_directory(ph) ) - boost::throw_exception( basic_filesystem_error<Path>( - "boost::filesystem::create_directories", ph, - make_error_code( boost::system::errc::file_exists ) ) ); - return false; - } - - // First create branch, by calling ourself recursively - create_directories(ph.parent_path()); - // Now that parent's path exists, create the directory - create_directory(ph); - return true; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - - BOOST_FS_FUNC_STRING extension(const Path& ph) - { - typedef BOOST_FS_TYPENAME Path::string_type string_type; - string_type filename = ph.filename(); - - BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.'); - if (n != string_type::npos) - return filename.substr(n); - else - return string_type(); - } - - BOOST_FS_FUNC_STRING basename(const Path& ph) - { - typedef BOOST_FS_TYPENAME Path::string_type string_type; - string_type filename = ph.filename(); - BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.'); - return filename.substr(0, n); - } - - - BOOST_FS_FUNC(Path) change_extension( const Path & ph, - const BOOST_FS_TYPENAME Path::string_type & new_extension ) - { -# if !defined(_STLPORT_VERSION) - return ph.parent_path() / (basename(ph) + new_extension); -# else - typedef BOOST_FS_TYPENAME Path::string_type string_type; - string_type filename = basename(ph) + new_extension; - return ph.parent_path() / filename; -# endif - } -# endif - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - // "do-the-right-thing" overloads ---------------------------------------// - - inline bool create_directories(const path& ph) - { return create_directories<path>(ph); } - inline bool create_directories(const wpath& ph) - { return create_directories<wpath>(ph); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline std::string extension(const path& ph) - { return extension<path>(ph); } - inline std::wstring extension(const wpath& ph) - { return extension<wpath>(ph); } - - inline std::string basename(const path& ph) - { return basename<path>( ph ); } - inline std::wstring basename(const wpath& ph) - { return basename<wpath>( ph ); } - - inline path change_extension( const path & ph, const std::string& new_ex ) - { return change_extension<path>( ph, new_ex ); } - inline wpath change_extension( const wpath & ph, const std::wstring& new_ex ) - { return change_extension<wpath>( ph, new_ex ); } -# endif - -# endif - - - // basic_recursive_directory_iterator helpers --------------------------// - - namespace detail - { - template< class Path > - struct recur_dir_itr_imp - { - typedef basic_directory_iterator< Path > element_type; - std::stack< element_type, std::vector< element_type > > m_stack; - int m_level; - bool m_no_push; - bool m_no_throw; - - recur_dir_itr_imp() : m_level(0), m_no_push(false), m_no_throw(false) {} - }; - - } // namespace detail - - // basic_recursive_directory_iterator ----------------------------------// - - template< class Path > - class basic_recursive_directory_iterator - : public boost::iterator_facade< - basic_recursive_directory_iterator<Path>, - basic_directory_entry<Path>, - boost::single_pass_traversal_tag > - { - public: - typedef Path path_type; - - basic_recursive_directory_iterator(){} // creates the "end" iterator - - explicit basic_recursive_directory_iterator( const Path & dir_path ); - basic_recursive_directory_iterator( const Path & dir_path, - system::error_code & ec ); - - int level() const { return m_imp->m_level; } - - void pop(); - void no_push() - { - BOOST_ASSERT( m_imp.get() && "attempt to no_push() on end iterator" ); - m_imp->m_no_push = true; - } - - file_status status() const - { - BOOST_ASSERT( m_imp.get() - && "attempt to call status() on end recursive_iterator" ); - return m_imp->m_stack.top()->status(); - } - - file_status symlink_status() const - { - BOOST_ASSERT( m_imp.get() - && "attempt to call symlink_status() on end recursive_iterator" ); - return m_imp->m_stack.top()->symlink_status(); - } - - private: - - // shared_ptr provides shallow-copy semantics required for InputIterators. - // m_imp.get()==0 indicates the end iterator. - boost::shared_ptr< detail::recur_dir_itr_imp< Path > > m_imp; - - friend class boost::iterator_core_access; - - typename boost::iterator_facade< - basic_recursive_directory_iterator<Path>, - basic_directory_entry<Path>, - boost::single_pass_traversal_tag >::reference - dereference() const - { - BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" ); - return *m_imp->m_stack.top(); - } - - void increment(); - - bool equal( const basic_recursive_directory_iterator & rhs ) const - { return m_imp == rhs.m_imp; } - - }; - - typedef basic_recursive_directory_iterator<path> recursive_directory_iterator; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_recursive_directory_iterator<wpath> wrecursive_directory_iterator; -# endif - - // basic_recursive_directory_iterator implementation -------------------// - - // constructors - template<class Path> - basic_recursive_directory_iterator<Path>:: - basic_recursive_directory_iterator( const Path & dir_path ) - : m_imp( new detail::recur_dir_itr_imp<Path> ) - { - m_imp->m_stack.push( basic_directory_iterator<Path>( dir_path ) ); - if ( m_imp->m_stack.top () == basic_directory_iterator<Path>() ) - { m_imp.reset (); } - } - - template<class Path> - basic_recursive_directory_iterator<Path>:: - basic_recursive_directory_iterator( const Path & dir_path, - system::error_code & ec ) - : m_imp( new detail::recur_dir_itr_imp<Path> ) - { - m_imp->m_no_throw = true; - m_imp->m_stack.push( basic_directory_iterator<Path>( dir_path, ec ) ); - if ( m_imp->m_stack.top () == basic_directory_iterator<Path>() ) - { m_imp.reset (); } - } - - // increment - template<class Path> - void basic_recursive_directory_iterator<Path>::increment() - { - BOOST_ASSERT( m_imp.get() && "increment on end iterator" ); - - static const basic_directory_iterator<Path> end_itr; - - if ( m_imp->m_no_push ) - { m_imp->m_no_push = false; } - else if ( is_directory( m_imp->m_stack.top()->status() ) ) - { - system::error_code ec; -#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) - if( m_imp->m_no_throw ) { - m_imp->m_stack.push( - basic_directory_iterator<Path>( *m_imp->m_stack.top(), ec ) - ); - } - else { - m_imp->m_stack.push( - basic_directory_iterator<Path>( *m_imp->m_stack.top() ) - ); - } -#else - m_imp->m_stack.push( - m_imp->m_no_throw - ? basic_directory_iterator<Path>( *m_imp->m_stack.top(), ec ) - : basic_directory_iterator<Path>( *m_imp->m_stack.top() ) ); -#endif - if ( m_imp->m_stack.top() != end_itr ) - { - ++m_imp->m_level; - return; - } - m_imp->m_stack.pop(); - } - - while ( !m_imp->m_stack.empty() - && ++m_imp->m_stack.top() == end_itr ) - { - m_imp->m_stack.pop(); - --m_imp->m_level; - } - - if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator - } - - // pop - template<class Path> - void basic_recursive_directory_iterator<Path>::pop() - { - BOOST_ASSERT( m_imp.get() && "pop on end iterator" ); - BOOST_ASSERT( m_imp->m_level > 0 && "pop with level < 1" ); - - static const basic_directory_iterator<Path> end_itr; - - do - { - m_imp->m_stack.pop(); - --m_imp->m_level; - } - while ( !m_imp->m_stack.empty() - && ++m_imp->m_stack.top() == end_itr ); - - if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator - } - - } // namespace filesystem2 -} // namespace boost - -#undef BOOST_FS_FUNC_STRING -#undef BOOST_FS_FUNC - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem2::create_directories; - using filesystem2::basic_recursive_directory_iterator; - using filesystem2::recursive_directory_iterator; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem2::extension; - using filesystem2::basename; - using filesystem2::change_extension; -# endif - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - using filesystem2::wrecursive_directory_iterator; -# endif - - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM2_CONVENIENCE_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/exception.hpp b/3rdParty/Boost/src/boost/filesystem/v2/exception.hpp deleted file mode 100644 index edea663..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/exception.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// boost/filesystem/exception.hpp -------------------------------------------// - -// Copyright Beman Dawes 2003 -// Use, modification, and distribution is subject to 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) - -// This header is no long used. The contents have been moved to path.hpp. -// It is provided so that user code #includes do not have to be changed. diff --git a/3rdParty/Boost/src/boost/filesystem/v2/fstream.hpp b/3rdParty/Boost/src/boost/filesystem/v2/fstream.hpp deleted file mode 100644 index 887d59d..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/fstream.hpp +++ /dev/null @@ -1,613 +0,0 @@ -// boost/filesystem/fstream.hpp --------------------------------------------// - -// Copyright Beman Dawes 2002. -// Use, modification, and distribution is subject to 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_FSTREAM_HPP -#define BOOST_FILESYSTEM2_FSTREAM_HPP - -#include <boost/filesystem/v2/config.hpp> -#include <boost/filesystem/v2/operations.hpp> // for 8.3 hack (see below) -#include <boost/utility/enable_if.hpp> -#include <boost/detail/workaround.hpp> - -#include <iosfwd> -#include <fstream> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -// NOTE: fstream.hpp for Boost 1.32.0 and earlier supplied workarounds for -// various compiler problems. They have been removed to ease development of the -// basic i18n functionality. Once the new interface is stable, the workarounds -// will be reinstated for any compilers that otherwise can support the rest of -// the library after internationalization. - -namespace boost -{ - namespace filesystem2 - { - namespace detail - { -# if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM2_NARROW_ONLY) -# if !defined(BOOST_DINKUMWARE_STDLIB) || BOOST_DINKUMWARE_STDLIB < 405 - // The 8.3 hack: - // C++98 does not supply a wchar_t open, so try to get an equivalent - // narrow char name based on the short, so-called 8.3, name. - // Not needed for Dinkumware 405 and later as they do supply wchar_t open. - BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph, - std::ios_base::openmode mode ); // true if succeeds - BOOST_FILESYSTEM_DECL std::string narrow_path_api( - const std::wstring & ph ); // return is empty if fails - - inline std::string path_proxy( const std::wstring & file_ph, - std::ios_base::openmode mode ) - // Return a non-existant path if cannot supply narrow short path. - // An empty path doesn't work because some Dinkumware versions - // assert the path is non-empty. - { - std::string narrow_ph; - bool created_file( false ); - if ( !exists( file_ph ) - && (mode & std::ios_base::out) != 0 - && create_file_api( file_ph, mode ) ) - { - created_file = true; - } - narrow_ph = narrow_path_api( file_ph ); - if ( narrow_ph.empty() ) - { - if ( created_file ) remove_api( file_ph ); - narrow_ph = "\x01"; - } - return narrow_ph; - } -# else - // Dinkumware 405 and later does supply wchar_t functions - inline const std::wstring & path_proxy( const std::wstring & file_ph, - std::ios_base::openmode ) - { return file_ph; } -# endif -# endif - - inline const std::string & path_proxy( const std::string & file_ph, - std::ios_base::openmode ) - { return file_ph; } - - } // namespace detail - - template < class charT, class traits = std::char_traits<charT> > - class basic_filebuf : public std::basic_filebuf<charT,traits> - { - private: // disallow copying - basic_filebuf( const basic_filebuf & ); - const basic_filebuf & operator=( const basic_filebuf & ); - public: - basic_filebuf() {} - virtual ~basic_filebuf() {} - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<class Path> - typename boost::enable_if<is_basic_path<Path>, - basic_filebuf<charT,traits> *>::type - open( const Path & file_ph, std::ios_base::openmode mode ); - - basic_filebuf<charT,traits> * - open( const wpath & file_ph, std::ios_base::openmode mode ); -# endif - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - basic_filebuf<charT,traits> * - open( const path & file_ph, std::ios_base::openmode mode ); -# endif - }; - - template < class charT, class traits = std::char_traits<charT> > - class basic_ifstream : public std::basic_ifstream<charT,traits> - { - private: // disallow copying - basic_ifstream( const basic_ifstream & ); - const basic_ifstream & operator=( const basic_ifstream & ); - public: - basic_ifstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<class Path> - explicit basic_ifstream( const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - - template<class Path> - basic_ifstream( const Path & file_ph, std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph, std::ios_base::openmode mode ); - - explicit basic_ifstream( const wpath & file_ph ); - basic_ifstream( const wpath & file_ph, std::ios_base::openmode mode ); - void open( const wpath & file_ph ); - void open( const wpath & file_ph, std::ios_base::openmode mode ); -# endif - - explicit basic_ifstream( const path & file_ph ); - basic_ifstream( const path & file_ph, std::ios_base::openmode mode ); -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph ); - void open( const path & file_ph, std::ios_base::openmode mode ); -# endif - virtual ~basic_ifstream() {} - }; - - template < class charT, class traits = std::char_traits<charT> > - class basic_ofstream : public std::basic_ofstream<charT,traits> - { - private: // disallow copying - basic_ofstream( const basic_ofstream & ); - const basic_ofstream & operator=( const basic_ofstream & ); - public: - basic_ofstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - template<class Path> - explicit basic_ofstream( const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - explicit basic_ofstream( const wpath & file_ph ); - - template<class Path> - basic_ofstream( const Path & file_ph, std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - basic_ofstream( const wpath & file_ph, std::ios_base::openmode mode ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph ); - void open( const wpath & file_ph ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph, std::ios_base::openmode mode ); - void open( const wpath & file_ph, std::ios_base::openmode mode ); - -# endif - - explicit basic_ofstream( const path & file_ph ); - basic_ofstream( const path & file_ph, std::ios_base::openmode mode ); -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph ); - void open( const path & file_ph, std::ios_base::openmode mode ); -# endif - virtual ~basic_ofstream() {} - }; - - template < class charT, class traits = std::char_traits<charT> > - class basic_fstream : public std::basic_fstream<charT,traits> - { - private: // disallow copying - basic_fstream( const basic_fstream & ); - const basic_fstream & operator=( const basic_fstream & ); - public: - basic_fstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - template<class Path> - explicit basic_fstream( const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - explicit basic_fstream( const wpath & file_ph ); - - template<class Path> - basic_fstream( const Path & file_ph, std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - basic_fstream( const wpath & file_ph, std::ios_base::openmode mode ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph ); - void open( const wpath & file_ph ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph, std::ios_base::openmode mode ); - void open( const wpath & file_ph, std::ios_base::openmode mode ); - -# endif - - explicit basic_fstream( const path & file_ph ); - basic_fstream( const path & file_ph, std::ios_base::openmode mode ); -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph ); - void open( const path & file_ph, std::ios_base::openmode mode ); -# endif - virtual ~basic_fstream() {} - - }; - - typedef basic_filebuf<char> filebuf; - typedef basic_ifstream<char> ifstream; - typedef basic_ofstream<char> ofstream; - typedef basic_fstream<char> fstream; - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_filebuf<wchar_t> wfilebuf; - typedef basic_ifstream<wchar_t> wifstream; - typedef basic_fstream<wchar_t> wfstream; - typedef basic_ofstream<wchar_t> wofstream; -# endif - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - -// basic_filebuf definitions -----------------------------------------------// - - template <class charT, class traits> - template<class Path> - typename boost::enable_if<is_basic_path<Path>, - basic_filebuf<charT,traits> *>::type - basic_filebuf<charT,traits>::open( const Path & file_ph, - std::ios_base::openmode mode ) - { - return (std::basic_filebuf<charT,traits>::open( detail::path_proxy( - file_ph.external_file_string(), mode ).c_str(), mode ) - == 0) ? 0 : this; - } - - template <class charT, class traits> - basic_filebuf<charT,traits> * - basic_filebuf<charT, traits>::open( const wpath & file_ph, - std::ios_base::openmode mode ) - { - return this->BOOST_NESTED_TEMPLATE open<wpath>( file_ph, mode ); - } - -// basic_ifstream definitions ----------------------------------------------// - - template <class charT, class traits> template<class Path> - basic_ifstream<charT,traits>::basic_ifstream(const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_ifstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in ).c_str(), std::ios_base::in ) {} - - template <class charT, class traits> - basic_ifstream<charT,traits>::basic_ifstream( const wpath & file_ph ) - : std::basic_ifstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in ).c_str(), std::ios_base::in ) {} - - template <class charT, class traits> template<class Path> - basic_ifstream<charT,traits>::basic_ifstream( const Path & file_ph, - std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_ifstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> - basic_ifstream<charT,traits>::basic_ifstream( const wpath & file_ph, - std::ios_base::openmode mode ) - : std::basic_ifstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_ifstream<charT,traits>::open( const Path & file_ph ) - { - std::basic_ifstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in ).c_str(), std::ios_base::in ); - } - - template <class charT, class traits> - void basic_ifstream<charT,traits>::open( const wpath & file_ph ) - { - std::basic_ifstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in ).c_str(), std::ios_base::in ); - } - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_ifstream<charT,traits>::open( const Path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ifstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - - template <class charT, class traits> - void basic_ifstream<charT,traits>::open( const wpath & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ifstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - -// basic_ofstream definitions ----------------------------------------------// - - template <class charT, class traits> template<class Path> - basic_ofstream<charT,traits>::basic_ofstream(const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_ofstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::out ).c_str(), std::ios_base::out ) {} - - template <class charT, class traits> - basic_ofstream<charT,traits>::basic_ofstream( const wpath & file_ph ) - : std::basic_ofstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::out ).c_str(), std::ios_base::out ) {} - - template <class charT, class traits> template<class Path> - basic_ofstream<charT,traits>::basic_ofstream( const Path & file_ph, - std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_ofstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> - basic_ofstream<charT,traits>::basic_ofstream( const wpath & file_ph, - std::ios_base::openmode mode ) - : std::basic_ofstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_ofstream<charT,traits>::open( const Path & file_ph ) - { - std::basic_ofstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::out ).c_str(), std::ios_base::out ); - } - - template <class charT, class traits> - void basic_ofstream<charT,traits>::open( const wpath & file_ph ) - { - std::basic_ofstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::out ).c_str(), std::ios_base::out ); - } - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_ofstream<charT,traits>::open( const Path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ofstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - - template <class charT, class traits> - void basic_ofstream<charT,traits>::open( const wpath & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ofstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - -// basic_fstream definitions -----------------------------------------------// - - template <class charT, class traits> template<class Path> - basic_fstream<charT,traits>::basic_fstream(const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_fstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in|std::ios_base::out ).c_str(), - std::ios_base::in|std::ios_base::out ) {} - - template <class charT, class traits> - basic_fstream<charT,traits>::basic_fstream( const wpath & file_ph ) - : std::basic_fstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in|std::ios_base::out ).c_str(), - std::ios_base::in|std::ios_base::out ) {} - - template <class charT, class traits> template<class Path> - basic_fstream<charT,traits>::basic_fstream( const Path & file_ph, - std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_fstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> - basic_fstream<charT,traits>::basic_fstream( const wpath & file_ph, - std::ios_base::openmode mode ) - : std::basic_fstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_fstream<charT,traits>::open( const Path & file_ph ) - { - std::basic_fstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in|std::ios_base::out ).c_str(), - std::ios_base::in|std::ios_base::out ); - } - - template <class charT, class traits> - void basic_fstream<charT,traits>::open( const wpath & file_ph ) - { - std::basic_fstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in|std::ios_base::out ).c_str(), - std::ios_base::in|std::ios_base::out ); - } - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_fstream<charT,traits>::open( const Path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_fstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - - template <class charT, class traits> - void basic_fstream<charT,traits>::open( const wpath & file_ph, - std::ios_base::openmode mode ) - { - std::basic_fstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - -# endif - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - template <class charT, class traits> - basic_filebuf<charT,traits> * - basic_filebuf<charT, traits>::open( const path & file_ph, - std::ios_base::openmode mode ) - { - return std::basic_filebuf<charT,traits>::open( - file_ph.file_string().c_str(), mode ) == 0 ? 0 : this; - } -# endif - - template <class charT, class traits> - basic_ifstream<charT,traits>::basic_ifstream( const path & file_ph ) - : std::basic_ifstream<charT,traits>( - file_ph.file_string().c_str(), std::ios_base::in ) {} - - template <class charT, class traits> - basic_ifstream<charT,traits>::basic_ifstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_ifstream<charT,traits>( - file_ph.file_string().c_str(), mode ) {} - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - template <class charT, class traits> - void basic_ifstream<charT,traits>::open( const path & file_ph ) - { - std::basic_ifstream<charT,traits>::open( - file_ph.file_string().c_str(), std::ios_base::in ); - } - - template <class charT, class traits> - void basic_ifstream<charT,traits>::open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ifstream<charT,traits>::open( - file_ph.file_string().c_str(), mode ); - } -# endif - - template <class charT, class traits> - basic_ofstream<charT,traits>::basic_ofstream( const path & file_ph ) - : std::basic_ofstream<charT,traits>( - file_ph.file_string().c_str(), std::ios_base::out ) {} - - template <class charT, class traits> - basic_ofstream<charT,traits>::basic_ofstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_ofstream<charT,traits>( - file_ph.file_string().c_str(), mode ) {} - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - template <class charT, class traits> - void basic_ofstream<charT,traits>::open( const path & file_ph ) - { - std::basic_ofstream<charT,traits>::open( - file_ph.file_string().c_str(), std::ios_base::out ); - } - - template <class charT, class traits> - void basic_ofstream<charT,traits>::open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ofstream<charT,traits>::open( - file_ph.file_string().c_str(), mode ); - } -# endif - - template <class charT, class traits> - basic_fstream<charT,traits>::basic_fstream( const path & file_ph ) - : std::basic_fstream<charT,traits>( - file_ph.file_string().c_str(), - std::ios_base::in|std::ios_base::out ) {} - - - template <class charT, class traits> - basic_fstream<charT,traits>::basic_fstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_fstream<charT,traits>( - file_ph.file_string().c_str(), mode ) {} - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - template <class charT, class traits> - void basic_fstream<charT,traits>::open( const path & file_ph ) - { - std::basic_fstream<charT,traits>::open( - file_ph.file_string().c_str(), std::ios_base::in|std::ios_base::out ); - } - - template <class charT, class traits> - void basic_fstream<charT,traits>::open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_fstream<charT,traits>::open( - file_ph.file_string().c_str(), mode ); - } -# endif - } // namespace filesystem2 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - using filesystem2::wfilebuf; - using filesystem2::wifstream; - using filesystem2::wfstream; - using filesystem2::wofstream; -# endif - using filesystem2::filebuf; - using filesystem2::ifstream; - using filesystem2::ofstream; - using filesystem2::fstream; - using filesystem2::basic_filebuf; - using filesystem2::basic_ifstream; - using filesystem2::basic_ofstream; - using filesystem2::basic_fstream; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED -# endif - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM2_FSTREAM_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/operations.hpp b/3rdParty/Boost/src/boost/filesystem/v2/operations.hpp deleted file mode 100644 index 57c406d..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/operations.hpp +++ /dev/null @@ -1,1245 +0,0 @@ -// boost/filesystem/operations.hpp -----------------------------------------// - -// Copyright 2002-2005 Beman Dawes -// Copyright 2002 Jan Langer -// Copyright 2001 Dietmar Kuehl -// -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_OPERATIONS_HPP -#define BOOST_FILESYSTEM2_OPERATIONS_HPP - -#include <boost/filesystem/v2/config.hpp> -#include <boost/filesystem/v2/path.hpp> -#include <boost/detail/scoped_enum_emulation.hpp> - -#include <boost/shared_ptr.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/iterator.hpp> -#include <boost/cstdint.hpp> -#include <boost/assert.hpp> - -#include <string> -#include <utility> // for pair -#include <ctime> - -#ifdef BOOST_WINDOWS_API -# include <fstream> -# if !defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x0500 -# define BOOST_FS_HARD_LINK // Default for Windows 2K or later -# endif -#endif - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -# ifdef BOOST_NO_STDC_NAMESPACE - namespace std { using ::time_t; } -# endif - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem2 - { - -// typedef boost::filesystem::path Path; needs to be in namespace boost::filesystem -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY -# define BOOST_FS_FUNC(BOOST_FS_TYPE) \ - template<class Path> typename boost::enable_if<is_basic_path<Path>, \ - BOOST_FS_TYPE>::type -# define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) \ - template<class Path> inline typename boost::enable_if<is_basic_path<Path>, \ - BOOST_FS_TYPE>::type -# define BOOST_FS_TYPENAME typename -# else -# define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE -# define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE - typedef boost::filesystem2::path Path; -# define BOOST_FS_TYPENAME -# endif - - template<class Path> class basic_directory_iterator; - - // BOOST_FILESYSTEM2_NARROW_ONLY needs this: - typedef basic_directory_iterator<path> directory_iterator; - - template<class Path> class basic_directory_entry; - - enum file_type - { - status_unknown, - file_not_found, - regular_file, - directory_file, - // the following will never be reported by some operating or file systems - symlink_file, - block_file, - character_file, - fifo_file, - socket_file, - type_unknown // file does exist, but isn't one of the above types or - // we don't have strong enough permission to find its type - }; - - class file_status - { - public: - explicit file_status( file_type v = status_unknown ) : m_value(v) {} - - void type( file_type v ) { m_value = v; } - file_type type() const { return m_value; } - - private: - // the internal representation is unspecified so that additional state - // information such as permissions can be added in the future; this - // implementation just uses status_type as the internal representation - - file_type m_value; - }; - - inline bool status_known( file_status f ) { return f.type() != status_unknown; } - inline bool exists( file_status f ) { return f.type() != status_unknown && f.type() != file_not_found; } - inline bool is_regular_file(file_status f){ return f.type() == regular_file; } - inline bool is_directory( file_status f ) { return f.type() == directory_file; } - inline bool is_symlink( file_status f ) { return f.type() == symlink_file; } - inline bool is_other( file_status f ) { return exists(f) && !is_regular_file(f) && !is_directory(f) && !is_symlink(f); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool is_regular( file_status f ) { return f.type() == regular_file; } -# endif - - struct space_info - { - // all values are byte counts - boost::uintmax_t capacity; - boost::uintmax_t free; // <= capacity - boost::uintmax_t available; // <= free - }; - - namespace detail - { - typedef std::pair< system::error_code, bool > - query_pair; - - typedef std::pair< system::error_code, boost::uintmax_t > - uintmax_pair; - - typedef std::pair< system::error_code, std::time_t > - time_pair; - - typedef std::pair< system::error_code, space_info > - space_pair; - - template< class Path > - struct directory_pair - { - typedef std::pair< system::error_code, - typename Path::external_string_type > type; - }; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - BOOST_FILESYSTEM_DECL bool - symbolic_link_exists_api( const std::string & ); // deprecated -# endif - - BOOST_FILESYSTEM_DECL file_status - status_api( const std::string & ph, system::error_code & ec ); -# ifndef BOOST_WINDOWS_API - BOOST_FILESYSTEM_DECL file_status - symlink_status_api( const std::string & ph, system::error_code & ec ); -# endif - BOOST_FILESYSTEM_DECL query_pair - is_empty_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL query_pair - equivalent_api( const std::string & ph1, const std::string & ph2 ); - BOOST_FILESYSTEM_DECL uintmax_pair - file_size_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL space_pair - space_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL time_pair - last_write_time_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL system::error_code - last_write_time_api( const std::string & ph, std::time_t new_value ); - BOOST_FILESYSTEM_DECL system::error_code - get_current_path_api( std::string & ph ); - BOOST_FILESYSTEM_DECL system::error_code - set_current_path_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL query_pair - create_directory_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL system::error_code - create_hard_link_api( const std::string & to_ph, - const std::string & from_ph ); - BOOST_FILESYSTEM_DECL system::error_code - create_symlink_api( const std::string & to_ph, - const std::string & from_ph ); - BOOST_FILESYSTEM_DECL system::error_code - remove_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL system::error_code - rename_api( const std::string & from, const std::string & to ); - BOOST_FILESYSTEM_DECL system::error_code - copy_file_api( const std::string & from, const std::string & to, bool fail_if_exists ); - -# if defined(BOOST_WINDOWS_API) - - BOOST_FILESYSTEM_DECL system::error_code - get_full_path_name_api( const std::string & ph, std::string & target ); - -# if !defined(BOOST_FILESYSTEM2_NARROW_ONLY) - - BOOST_FILESYSTEM_DECL boost::filesystem2::file_status - status_api( const std::wstring & ph, system::error_code & ec ); - BOOST_FILESYSTEM_DECL query_pair - is_empty_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL query_pair - equivalent_api( const std::wstring & ph1, const std::wstring & ph2 ); - BOOST_FILESYSTEM_DECL uintmax_pair - file_size_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL space_pair - space_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL system::error_code - get_full_path_name_api( const std::wstring & ph, std::wstring & target ); - BOOST_FILESYSTEM_DECL time_pair - last_write_time_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL system::error_code - last_write_time_api( const std::wstring & ph, std::time_t new_value ); - BOOST_FILESYSTEM_DECL system::error_code - get_current_path_api( std::wstring & ph ); - BOOST_FILESYSTEM_DECL system::error_code - set_current_path_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL query_pair - create_directory_api( const std::wstring & ph ); -# ifdef BOOST_FS_HARD_LINK - BOOST_FILESYSTEM_DECL system::error_code - create_hard_link_api( const std::wstring & existing_ph, - const std::wstring & new_ph ); -# endif - BOOST_FILESYSTEM_DECL system::error_code - create_symlink_api( const std::wstring & to_ph, - const std::wstring & from_ph ); - BOOST_FILESYSTEM_DECL system::error_code - remove_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL system::error_code - rename_api( const std::wstring & from, const std::wstring & to ); - BOOST_FILESYSTEM_DECL system::error_code - copy_file_api( const std::wstring & from, const std::wstring & to, bool fail_if_exists ); - -# endif -# endif - - template<class Path> - bool remove_aux( const Path & ph, file_status f ); - - template<class Path> - unsigned long remove_all_aux( const Path & ph, file_status f ); - - } // namespace detail - -// operations functions ----------------------------------------------------// - - // The non-template overloads enable automatic conversion from std and - // C-style strings. See basic_path constructors. The enable_if for the - // templates implements the famous "do-the-right-thing" rule. - -// query functions ---------------------------------------------------------// - - BOOST_INLINE_FS_FUNC(file_status) - status( const Path & ph, system::error_code & ec ) - { return detail::status_api( ph.external_file_string(), ec ); } - - BOOST_FS_FUNC(file_status) - status( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::status", ph, ec ) ); - return result; - } - - BOOST_INLINE_FS_FUNC(file_status) - symlink_status( const Path & ph, system::error_code & ec ) -# ifdef BOOST_WINDOWS_API - { return detail::status_api( ph.external_file_string(), ec ); } -# else - { return detail::symlink_status_api( ph.external_file_string(), ec ); } -# endif - - BOOST_FS_FUNC(file_status) - symlink_status( const Path & ph ) - { - system::error_code ec; - file_status result( symlink_status( ph, ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::symlink_status", ph, ec ) ); - return result; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool symbolic_link_exists( const path & ph ) - { return is_symlink( symlink_status(ph) ); } -# endif - - BOOST_FS_FUNC(bool) exists( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::exists", ph, ec ) ); - return exists( result ); - } - - BOOST_FS_FUNC(bool) is_directory( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_directory", ph, ec ) ); - return is_directory( result ); - } - - BOOST_FS_FUNC(bool) is_regular_file( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_regular_file", ph, ec ) ); - return is_regular_file( result ); - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - BOOST_FS_FUNC(bool) is_regular( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_regular", ph, ec ) ); - return is_regular( result ); - } -# endif - - BOOST_FS_FUNC(bool) is_other( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_other", ph, ec ) ); - return is_other( result ); - } - - BOOST_FS_FUNC(bool) is_symlink( -# ifdef BOOST_WINDOWS_API - const Path & ) - { - return false; -# else - const Path & ph) - { - system::error_code ec; - file_status result( detail::symlink_status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_symlink", ph, ec ) ); - return is_symlink( result ); -# endif - } - - // VC++ 7.0 and earlier has a serious namespace bug that causes a clash - // between boost::filesystem2::is_empty and the unrelated type trait - // boost::is_empty. - -# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 - BOOST_FS_FUNC(bool) is_empty( const Path & ph ) -# else - BOOST_FS_FUNC(bool) _is_empty( const Path & ph ) -# endif - { - detail::query_pair result( - detail::is_empty_api( ph.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_empty", ph, result.first ) ); - return result.second; - } - - BOOST_FS_FUNC(bool) equivalent( const Path & ph1, const Path & ph2 ) - { - detail::query_pair result( detail::equivalent_api( - ph1.external_file_string(), ph2.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::equivalent", ph1, ph2, result.first ) ); - return result.second; - } - - BOOST_FS_FUNC(boost::uintmax_t) file_size( const Path & ph ) - { - detail::uintmax_pair result - ( detail::file_size_api( ph.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::file_size", ph, result.first ) ); - return result.second; - } - - BOOST_FS_FUNC(space_info) space( const Path & ph ) - { - detail::space_pair result - ( detail::space_api( ph.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::space", ph, result.first ) ); - return result.second; - } - - BOOST_FS_FUNC(std::time_t) last_write_time( const Path & ph ) - { - detail::time_pair result - ( detail::last_write_time_api( ph.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::last_write_time", ph, result.first ) ); - return result.second; - } - - -// operations --------------------------------------------------------------// - - BOOST_FS_FUNC(bool) create_directory( const Path & dir_ph ) - { - detail::query_pair result( - detail::create_directory_api( dir_ph.external_directory_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::create_directory", - dir_ph, result.first ) ); - return result.second; - } - -#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) - BOOST_FS_FUNC(void) - create_hard_link( const Path & to_ph, const Path & from_ph ) - { - system::error_code ec( - detail::create_hard_link_api( - to_ph.external_file_string(), - from_ph.external_file_string() ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::create_hard_link", - to_ph, from_ph, ec ) ); - } - - BOOST_FS_FUNC(system::error_code) - create_hard_link( const Path & to_ph, const Path & from_ph, - system::error_code & ec ) - { - ec = detail::create_hard_link_api( - to_ph.external_file_string(), - from_ph.external_file_string() ); - return ec; - } -#endif - - BOOST_FS_FUNC(void) - create_symlink( const Path & to_ph, const Path & from_ph ) - { - system::error_code ec( - detail::create_symlink_api( - to_ph.external_file_string(), - from_ph.external_file_string() ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::create_symlink", - to_ph, from_ph, ec ) ); - } - - BOOST_FS_FUNC(system::error_code) - create_symlink( const Path & to_ph, const Path & from_ph, - system::error_code & ec ) - { - ec = detail::create_symlink_api( - to_ph.external_file_string(), - from_ph.external_file_string() ); - return ec; - } - - BOOST_FS_FUNC(bool) remove( const Path & ph ) - { - system::error_code ec; - file_status f = symlink_status( ph, ec ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::remove", ph, ec ) ); - return detail::remove_aux( ph, f ); - } - - BOOST_FS_FUNC(unsigned long) remove_all( const Path & ph ) - { - system::error_code ec; - file_status f = symlink_status( ph, ec ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::remove_all", ph, ec ) ); - return exists( f ) ? detail::remove_all_aux( ph, f ) : 0; - } - - BOOST_FS_FUNC(void) rename( const Path & from_path, const Path & to_path ) - { - system::error_code ec( detail::rename_api( - from_path.external_directory_string(), - to_path.external_directory_string() ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::rename", - from_path, to_path, ec ) ); - } - - BOOST_SCOPED_ENUM_START(copy_option) - { fail_if_exists, overwrite_if_exists }; - BOOST_SCOPED_ENUM_END - - BOOST_FS_FUNC(void) copy_file( const Path & from_path, const Path & to_path, - BOOST_SCOPED_ENUM(copy_option) option = copy_option::fail_if_exists ) - { - system::error_code ec( detail::copy_file_api( - from_path.external_directory_string(), - to_path.external_directory_string(), option == copy_option::fail_if_exists ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::copy_file", - from_path, to_path, ec ) ); - } - - template< class Path > - Path current_path() - { - typename Path::external_string_type ph; - system::error_code ec( detail::get_current_path_api( ph ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::current_path", ec ) ); - return Path( Path::traits_type::to_internal( ph ) ); - } - - BOOST_FS_FUNC(void) current_path( const Path & ph ) - { - system::error_code ec( detail::set_current_path_api( - ph.external_directory_string() ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::current_path", ph, ec ) ); - } - - template< class Path > - const Path & initial_path() - { - static Path init_path; - if ( init_path.empty() ) init_path = current_path<Path>(); - return init_path; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - // legacy support - inline path current_path() // overload supports pre-i18n apps - { return current_path<boost::filesystem2::path>(); } - inline const path & initial_path() // overload supports pre-i18n apps - { return initial_path<boost::filesystem2::path>(); } -# endif - - BOOST_FS_FUNC(Path) system_complete( const Path & ph ) - { -# ifdef BOOST_WINDOWS_API - if ( ph.empty() ) return ph; - BOOST_FS_TYPENAME Path::external_string_type sys_ph; - system::error_code ec( detail::get_full_path_name_api( ph.external_file_string(), - sys_ph ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::system_complete", ph, ec ) ); - return Path( Path::traits_type::to_internal( sys_ph ) ); -# else - return (ph.empty() || ph.is_complete()) - ? ph : current_path<Path>() / ph; -# endif - } - - BOOST_FS_FUNC(Path) - complete( const Path & ph, - const Path & base/* = initial_path<Path>() */) - { - BOOST_ASSERT( base.is_complete() - && (ph.is_complete() || !ph.has_root_name()) - && "boost::filesystem::complete() precondition not met" ); -# ifdef BOOST_WINDOWS_PATH - if (ph.empty() || ph.is_complete()) return ph; - if ( !ph.has_root_name() ) - return ph.has_root_directory() - ? Path( base.root_name() ) / ph - : base / ph; - return base / ph; -# else - return (ph.empty() || ph.is_complete()) ? ph : base / ph; -# endif - } - - // VC++ 7.1 had trouble with default arguments, so separate one argument - // signatures are provided as workarounds; the effect is the same. - BOOST_FS_FUNC(Path) complete( const Path & ph ) - { return complete( ph, initial_path<Path>() ); } - - BOOST_FS_FUNC(void) - last_write_time( const Path & ph, const std::time_t new_time ) - { - system::error_code ec( detail::last_write_time_api( ph.external_file_string(), - new_time ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::last_write_time", ph, ec ) ); - } - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - // "do-the-right-thing" overloads ---------------------------------------// - - inline file_status status( const path & ph ) - { return status<path>( ph ); } - inline file_status status( const wpath & ph ) - { return status<wpath>( ph ); } - - inline file_status status( const path & ph, system::error_code & ec ) - { return status<path>( ph, ec ); } - inline file_status status( const wpath & ph, system::error_code & ec ) - { return status<wpath>( ph, ec ); } - - inline file_status symlink_status( const path & ph ) - { return symlink_status<path>( ph ); } - inline file_status symlink_status( const wpath & ph ) - { return symlink_status<wpath>( ph ); } - - inline file_status symlink_status( const path & ph, system::error_code & ec ) - { return symlink_status<path>( ph, ec ); } - inline file_status symlink_status( const wpath & ph, system::error_code & ec ) - { return symlink_status<wpath>( ph, ec ); } - - inline bool exists( const path & ph ) { return exists<path>( ph ); } - inline bool exists( const wpath & ph ) { return exists<wpath>( ph ); } - - inline bool is_directory( const path & ph ) - { return is_directory<path>( ph ); } - inline bool is_directory( const wpath & ph ) - { return is_directory<wpath>( ph ); } - - inline bool is_regular_file( const path & ph ) - { return is_regular_file<path>( ph ); } - inline bool is_regular_file( const wpath & ph ) - { return is_regular_file<wpath>( ph ); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool is_regular( const path & ph ) - { return is_regular<path>( ph ); } - inline bool is_regular( const wpath & ph ) - { return is_regular<wpath>( ph ); } -# endif - - inline bool is_other( const path & ph ) - { return is_other<path>( ph ); } - inline bool is_other( const wpath & ph ) - { return is_other<wpath>( ph ); } - - inline bool is_symlink( const path & ph ) - { return is_symlink<path>( ph ); } - inline bool is_symlink( const wpath & ph ) - { return is_symlink<wpath>( ph ); } - - inline bool is_empty( const path & ph ) - { return boost::filesystem2::is_empty<path>( ph ); } - inline bool is_empty( const wpath & ph ) - { return boost::filesystem2::is_empty<wpath>( ph ); } - - inline bool equivalent( const path & ph1, const path & ph2 ) - { return equivalent<path>( ph1, ph2 ); } - inline bool equivalent( const wpath & ph1, const wpath & ph2 ) - { return equivalent<wpath>( ph1, ph2 ); } - - inline boost::uintmax_t file_size( const path & ph ) - { return file_size<path>( ph ); } - inline boost::uintmax_t file_size( const wpath & ph ) - { return file_size<wpath>( ph ); } - - inline space_info space( const path & ph ) - { return space<path>( ph ); } - inline space_info space( const wpath & ph ) - { return space<wpath>( ph ); } - - inline std::time_t last_write_time( const path & ph ) - { return last_write_time<path>( ph ); } - inline std::time_t last_write_time( const wpath & ph ) - { return last_write_time<wpath>( ph ); } - - inline bool create_directory( const path & dir_ph ) - { return create_directory<path>( dir_ph ); } - inline bool create_directory( const wpath & dir_ph ) - { return create_directory<wpath>( dir_ph ); } - -#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) - inline void create_hard_link( const path & to_ph, - const path & from_ph ) - { return create_hard_link<path>( to_ph, from_ph ); } - inline void create_hard_link( const wpath & to_ph, - const wpath & from_ph ) - { return create_hard_link<wpath>( to_ph, from_ph ); } - - inline system::error_code create_hard_link( const path & to_ph, - const path & from_ph, system::error_code & ec ) - { return create_hard_link<path>( to_ph, from_ph, ec ); } - inline system::error_code create_hard_link( const wpath & to_ph, - const wpath & from_ph, system::error_code & ec ) - { return create_hard_link<wpath>( to_ph, from_ph, ec ); } -#endif - - inline void create_symlink( const path & to_ph, - const path & from_ph ) - { return create_symlink<path>( to_ph, from_ph ); } - inline void create_symlink( const wpath & to_ph, - const wpath & from_ph ) - { return create_symlink<wpath>( to_ph, from_ph ); } - - inline system::error_code create_symlink( const path & to_ph, - const path & from_ph, system::error_code & ec ) - { return create_symlink<path>( to_ph, from_ph, ec ); } - inline system::error_code create_symlink( const wpath & to_ph, - const wpath & from_ph, system::error_code & ec ) - { return create_symlink<wpath>( to_ph, from_ph, ec ); } - - inline bool remove( const path & ph ) - { return remove<path>( ph ); } - inline bool remove( const wpath & ph ) - { return remove<wpath>( ph ); } - - inline unsigned long remove_all( const path & ph ) - { return remove_all<path>( ph ); } - inline unsigned long remove_all( const wpath & ph ) - { return remove_all<wpath>( ph ); } - - inline void rename( const path & from_path, const path & to_path ) - { return rename<path>( from_path, to_path ); } - inline void rename( const wpath & from_path, const wpath & to_path ) - { return rename<wpath>( from_path, to_path ); } - - inline void copy_file( const path & from_path, const path & to_path ) - { return copy_file<path>( from_path, to_path ); } - inline void copy_file( const wpath & from_path, const wpath & to_path ) - { return copy_file<wpath>( from_path, to_path ); } - - inline path system_complete( const path & ph ) - { return system_complete<path>( ph ); } - inline wpath system_complete( const wpath & ph ) - { return system_complete<wpath>( ph ); } - - inline path complete( const path & ph, - const path & base/* = initial_path<path>()*/ ) - { return complete<path>( ph, base ); } - inline wpath complete( const wpath & ph, - const wpath & base/* = initial_path<wpath>()*/ ) - { return complete<wpath>( ph, base ); } - - inline path complete( const path & ph ) - { return complete<path>( ph, initial_path<path>() ); } - inline wpath complete( const wpath & ph ) - { return complete<wpath>( ph, initial_path<wpath>() ); } - - inline void last_write_time( const path & ph, const std::time_t new_time ) - { last_write_time<path>( ph, new_time ); } - inline void last_write_time( const wpath & ph, const std::time_t new_time ) - { last_write_time<wpath>( ph, new_time ); } - - inline void current_path( const path & ph ) - { current_path<path>( ph ); } - inline void current_path( const wpath & ph ) - { current_path<wpath>( ph ); } - -# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - namespace detail - { - template<class Path> - bool remove_aux( const Path & ph, file_status f ) - { - if ( exists( f ) ) - { - system::error_code ec = remove_api( ph.external_file_string() ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::remove", ph, ec ) ); - return true; - } - return false; - } - - template<class Path> - unsigned long remove_all_aux( const Path & ph, file_status f ) - { - static const boost::filesystem2::basic_directory_iterator<Path> end_itr; - unsigned long count = 1; - if ( !boost::filesystem2::is_symlink( f ) // don't recurse symbolic links - && boost::filesystem2::is_directory( f ) ) - { - for ( boost::filesystem2::basic_directory_iterator<Path> itr( ph ); - itr != end_itr; ++itr ) - { - boost::system::error_code ec; - boost::filesystem2::file_status fn = boost::filesystem2::symlink_status( itr->path(), ec ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem:remove_all", ph, ec ) ); - count += remove_all_aux( itr->path(), fn ); - } - } - remove_aux( ph, f ); - return count; - } - -// test helper -------------------------------------------------------------// - - // not part of the documented interface because false positives are possible; - // there is no law that says that an OS that has large stat.st_size - // actually supports large file sizes. - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); - -// directory_iterator helpers ----------------------------------------------// - -// forwarding functions avoid need for BOOST_FILESYSTEM_DECL for class -// basic_directory_iterator, and so avoid iterator_facade DLL template -// problems. They also overload to the proper external path character type. - - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_first( void *& handle, -#if defined(BOOST_POSIX_API) - void *& buffer, -#endif - const std::string & dir_path, - std::string & target, file_status & fs, file_status & symlink_fs ); - // eof: return==0 && handle==0 - - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_increment( void *& handle, -#if defined(BOOST_POSIX_API) - void *& buffer, -#endif - std::string & target, file_status & fs, file_status & symlink_fs ); - // eof: return==0 && handle==0 - - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_close( void *& handle -#if defined(BOOST_POSIX_API) - , void *& buffer -#endif - ); - // Effects: none if handle==0, otherwise close handle, set handle=0 - -# if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM2_NARROW_ONLY) - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_first( void *& handle, const std::wstring & ph, - std::wstring & target, file_status & fs, file_status & symlink_fs ); - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_increment( void *& handle, std::wstring & target, - file_status & fs, file_status & symlink_fs ); -# endif - - template< class Path > - class dir_itr_imp - { - public: - basic_directory_entry<Path> m_directory_entry; - void * m_handle; -# ifdef BOOST_POSIX_API - void * m_buffer; // see dir_itr_increment implementation -# endif - dir_itr_imp() : m_handle(0) -# ifdef BOOST_POSIX_API - , m_buffer(0) -# endif - {} - - ~dir_itr_imp() { dir_itr_close( m_handle -#if defined(BOOST_POSIX_API) - , m_buffer -#endif - ); } - }; - - BOOST_FILESYSTEM_DECL system::error_code not_found_error(); - - } // namespace detail - -// basic_directory_iterator ------------------------------------------------// - - template< class Path > - class basic_directory_iterator - : public boost::iterator_facade< - basic_directory_iterator<Path>, - basic_directory_entry<Path>, - boost::single_pass_traversal_tag > - { - public: - typedef Path path_type; - - basic_directory_iterator(){} // creates the "end" iterator - - explicit basic_directory_iterator( const Path & dir_path ); - basic_directory_iterator( const Path & dir_path, system::error_code & ec ); - - private: - - // shared_ptr provides shallow-copy semantics required for InputIterators. - // m_imp.get()==0 indicates the end iterator. - boost::shared_ptr< detail::dir_itr_imp< Path > > m_imp; - - friend class boost::iterator_core_access; - - typename boost::iterator_facade< - basic_directory_iterator<Path>, - basic_directory_entry<Path>, - boost::single_pass_traversal_tag >::reference dereference() const - { - BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" ); - return m_imp->m_directory_entry; - } - - void increment(); - - bool equal( const basic_directory_iterator & rhs ) const - { return m_imp == rhs.m_imp; } - - system::error_code m_init( const Path & dir_path ); - }; - - typedef basic_directory_iterator< path > directory_iterator; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_directory_iterator< wpath > wdirectory_iterator; -# endif - - // basic_directory_iterator implementation ---------------------------// - - template<class Path> - system::error_code basic_directory_iterator<Path>::m_init( - const Path & dir_path ) - { - if ( dir_path.empty() ) - { - m_imp.reset(); - return detail::not_found_error(); - } - typename Path::external_string_type name; - file_status fs, symlink_fs; - system::error_code ec( detail::dir_itr_first( m_imp->m_handle, -#if defined(BOOST_POSIX_API) - m_imp->m_buffer, -#endif - dir_path.external_directory_string(), - name, fs, symlink_fs ) ); - - if ( ec ) - { - m_imp.reset(); - return ec; - } - - if ( m_imp->m_handle == 0 ) m_imp.reset(); // eof, so make end iterator - else // not eof - { - m_imp->m_directory_entry.assign( dir_path - / Path::traits_type::to_internal( name ), fs, symlink_fs ); - if ( name[0] == dot<Path>::value // dot or dot-dot - && (name.size() == 1 - || (name[1] == dot<Path>::value - && name.size() == 2)) ) - { increment(); } - } - return boost::system::error_code(); - } - - template<class Path> - basic_directory_iterator<Path>::basic_directory_iterator( - const Path & dir_path ) - : m_imp( new detail::dir_itr_imp<Path> ) - { - system::error_code ec( m_init(dir_path) ); - if ( ec ) - { - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::basic_directory_iterator constructor", - dir_path, ec ) ); - } - } - - template<class Path> - basic_directory_iterator<Path>::basic_directory_iterator( - const Path & dir_path, system::error_code & ec ) - : m_imp( new detail::dir_itr_imp<Path> ) - { - ec = m_init(dir_path); - } - - template<class Path> - void basic_directory_iterator<Path>::increment() - { - BOOST_ASSERT( m_imp.get() && "attempt to increment end iterator" ); - BOOST_ASSERT( m_imp->m_handle != 0 && "internal program error" ); - - typename Path::external_string_type name; - file_status fs, symlink_fs; - system::error_code ec; - - for (;;) - { - ec = detail::dir_itr_increment( m_imp->m_handle, -#if defined(BOOST_POSIX_API) - m_imp->m_buffer, -#endif - name, fs, symlink_fs ); - if ( ec ) - { - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::basic_directory_iterator increment", - m_imp->m_directory_entry.path().parent_path(), ec ) ); - } - if ( m_imp->m_handle == 0 ) { m_imp.reset(); return; } // eof, make end - if ( !(name[0] == dot<Path>::value // !(dot or dot-dot) - && (name.size() == 1 - || (name[1] == dot<Path>::value - && name.size() == 2))) ) - { - m_imp->m_directory_entry.replace_filename( - Path::traits_type::to_internal( name ), fs, symlink_fs ); - return; - } - } - } - - // basic_directory_entry -----------------------------------------------// - - template<class Path> - class basic_directory_entry - { - public: - typedef Path path_type; - typedef typename Path::string_type string_type; - - // compiler generated copy-ctor, copy assignment, and destructor apply - - basic_directory_entry() {} - explicit basic_directory_entry( const path_type & p, - file_status st = file_status(), file_status symlink_st=file_status() ) - : m_path(p), m_status(st), m_symlink_status(symlink_st) - {} - - void assign( const path_type & p, - file_status st, file_status symlink_st ) - { m_path = p; m_status = st; m_symlink_status = symlink_st; } - - void replace_filename( const string_type & s, - file_status st, file_status symlink_st ) - { - m_path.remove_filename(); - m_path /= s; - m_status = st; - m_symlink_status = symlink_st; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - void replace_leaf( const string_type & s, - file_status st, file_status symlink_st ) - { replace_filename( s, st, symlink_st ); } -# endif - - const Path & path() const { return m_path; } - file_status status() const; - file_status status( system::error_code & ec ) const; - file_status symlink_status() const; - file_status symlink_status( system::error_code & ec ) const; - - // conversion simplifies the most common use of basic_directory_entry - operator const path_type &() const { return m_path; } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - // deprecated functions preserve common use cases in legacy code - typename Path::string_type filename() const - { - return path().filename(); - } - typename Path::string_type leaf() const - { - return path().filename(); - } - typename Path::string_type string() const - { - return path().string(); - } -# endif - - private: - path_type m_path; - mutable file_status m_status; // stat()-like - mutable file_status m_symlink_status; // lstat()-like - // note: m_symlink_status is not used by Windows implementation - - }; // basic_directory_status - - typedef basic_directory_entry<path> directory_entry; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_directory_entry<wpath> wdirectory_entry; -# endif - - // basic_directory_entry implementation --------------------------------// - - template<class Path> - file_status - basic_directory_entry<Path>::status() const - { - if ( !status_known( m_status ) ) - { -# ifndef BOOST_WINDOWS_API - if ( status_known( m_symlink_status ) - && !is_symlink( m_symlink_status ) ) - { m_status = m_symlink_status; } - else { m_status = boost::filesystem2::status( m_path ); } -# else - m_status = boost::filesystem2::status( m_path ); -# endif - } - return m_status; - } - - template<class Path> - file_status - basic_directory_entry<Path>::status( system::error_code & ec ) const - { - if ( !status_known( m_status ) ) - { -# ifndef BOOST_WINDOWS_API - if ( status_known( m_symlink_status ) - && !is_symlink( m_symlink_status ) ) - { ec = boost::system::error_code();; m_status = m_symlink_status; } - else { m_status = boost::filesystem2::status( m_path, ec ); } -# else - m_status = boost::filesystem2::status( m_path, ec ); -# endif - } - else ec = boost::system::error_code();; - return m_status; - } - - template<class Path> - file_status - basic_directory_entry<Path>::symlink_status() const - { -# ifndef BOOST_WINDOWS_API - if ( !status_known( m_symlink_status ) ) - { m_symlink_status = boost::filesystem2::symlink_status( m_path ); } - return m_symlink_status; -# else - return status(); -# endif - } - - template<class Path> - file_status - basic_directory_entry<Path>::symlink_status( system::error_code & ec ) const - { -# ifndef BOOST_WINDOWS_API - if ( !status_known( m_symlink_status ) ) - { m_symlink_status = boost::filesystem2::symlink_status( m_path, ec ); } - else ec = boost::system::error_code();; - return m_symlink_status; -# else - return status( ec ); -# endif - } - } // namespace filesystem2 -} // namespace boost - -#undef BOOST_FS_FUNC - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem2::basic_directory_entry; - using filesystem2::basic_directory_iterator; - using filesystem2::block_file; - using filesystem2::character_file; - using filesystem2::complete; - using filesystem2::copy_file; - using filesystem2::copy_option; - using filesystem2::create_directory; -# if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) - using filesystem2::create_hard_link; -# endif - using filesystem2::create_symlink; - using filesystem2::current_path; - using filesystem2::directory_entry; - using filesystem2::directory_file; - using filesystem2::directory_iterator; - using filesystem2::equivalent; - using filesystem2::exists; - using filesystem2::fifo_file; - using filesystem2::file_not_found; - using filesystem2::file_size; - using filesystem2::file_status; - using filesystem2::file_type; - using filesystem2::initial_path; - using filesystem2::is_directory; - using filesystem2::is_directory; - using filesystem2::is_empty; - using filesystem2::is_other; - using filesystem2::is_regular_file; - using filesystem2::is_symlink; - using filesystem2::last_write_time; - using filesystem2::regular_file; - using filesystem2::remove; - using filesystem2::remove_all; - using filesystem2::rename; - using filesystem2::socket_file; - using filesystem2::space; - using filesystem2::space_info; - using filesystem2::status; - using filesystem2::status_known; - using filesystem2::symlink_file; - using filesystem2::symlink_status; - using filesystem2::system_complete; - using filesystem2::type_unknown; -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem2::is_regular; - using filesystem2::symbolic_link_exists; -# endif -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - using filesystem2::wdirectory_iterator; - using filesystem2::wdirectory_entry; -# endif - namespace detail - { - using filesystem2::detail::not_found_error; - using filesystem2::detail::possible_large_file_size_support; - } - } -} - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM2_OPERATIONS_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/path.hpp b/3rdParty/Boost/src/boost/filesystem/v2/path.hpp deleted file mode 100644 index 615b89c..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/path.hpp +++ /dev/null @@ -1,1571 +0,0 @@ -// boost/filesystem/path.hpp -----------------------------------------------// - -// Copyright Beman Dawes 2002-2005 -// Copyright Vladimir Prus 2002 - -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -// basic_path's stem(), extension(), and replace_extension() are based on -// basename(), extension(), and change_extension() from the original -// filesystem/convenience.hpp header by Vladimir Prus. - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_PATH_HPP -#define BOOST_FILESYSTEM2_PATH_HPP - -#include <boost/filesystem/v2/config.hpp> -#include <boost/system/system_error.hpp> -#include <boost/iterator/iterator_facade.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/static_assert.hpp> -#include <boost/assert.hpp> - -#include <string> -#include <algorithm> // for lexicographical_compare -#include <iosfwd> // needed by basic_path inserter and extractor -#include <stdexcept> - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY -# include <locale> -# endif - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -namespace boost -{ - namespace BOOST_FILESYSTEM2_NAMESPACE - { - template<class String, class Traits> class basic_path; - - struct path_traits; - typedef basic_path< std::string, path_traits > path; - - struct path_traits - { - typedef std::string internal_string_type; - typedef std::string external_string_type; - static external_string_type to_external( const path &, - const internal_string_type & src ) { return src; } - static internal_string_type to_internal( - const external_string_type & src ) { return src; } - }; - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - struct BOOST_FILESYSTEM_DECL wpath_traits; - - typedef basic_path< std::wstring, wpath_traits > wpath; - - struct BOOST_FILESYSTEM_DECL wpath_traits - { - typedef std::wstring internal_string_type; -# ifdef BOOST_WINDOWS_API - typedef std::wstring external_string_type; - static external_string_type to_external( const wpath &, - const internal_string_type & src ) { return src; } - static internal_string_type to_internal( - const external_string_type & src ) { return src; } -# else - typedef std::string external_string_type; - static external_string_type to_external( const wpath & ph, - const internal_string_type & src ); - static internal_string_type to_internal( - const external_string_type & src ); -# endif - static void imbue( const std::locale & loc ); - static bool imbue( const std::locale & loc, const std::nothrow_t & ); - }; - -# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - // path traits ---------------------------------------------------------// - - template<class Path> struct is_basic_path - { BOOST_STATIC_CONSTANT( bool, value = false ); }; - template<> struct is_basic_path<path> - { BOOST_STATIC_CONSTANT( bool, value = true ); }; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<> struct is_basic_path<wpath> - { BOOST_STATIC_CONSTANT( bool, value = true ); }; -# endif - - // These only have to be specialized if Path::string_type::value_type - // is not convertible from char, although specializations may eliminate - // compiler warnings. See ticket 2543. - template<class Path> struct slash - { BOOST_STATIC_CONSTANT( char, value = '/' ); }; - - template<class Path> struct dot - { BOOST_STATIC_CONSTANT( char, value = '.' ); }; - - template<class Path> struct colon - { BOOST_STATIC_CONSTANT( char, value = ':' ); }; - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<> struct slash<wpath> - { BOOST_STATIC_CONSTANT( wchar_t, value = L'/' ); }; - template<> struct dot<wpath> - { BOOST_STATIC_CONSTANT( wchar_t, value = L'.' ); }; - template<> struct colon<wpath> - { BOOST_STATIC_CONSTANT( wchar_t, value = L':' ); }; -# endif - -# ifdef BOOST_WINDOWS_PATH - template<class Path> struct path_alt_separator - { BOOST_STATIC_CONSTANT( char, value = '\\' ); }; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<> struct path_alt_separator<wpath> - { BOOST_STATIC_CONSTANT( wchar_t, value = L'\\' ); }; -# endif -# endif - - // workaround for VC++ 7.0 and earlier issues with nested classes - namespace detail - { - template<class Path> - class iterator_helper - { - public: - typedef typename Path::iterator iterator; - static void do_increment( iterator & ph ); - static void do_decrement( iterator & ph ); - }; - } - - // basic_path ----------------------------------------------------------// - - template<class String, class Traits> - class basic_path - { - // invariant: m_path valid according to the portable generic path grammar - - // validate template arguments -// TODO: get these working -// BOOST_STATIC_ASSERT( ::boost::is_same<String,typename Traits::internal_string_type>::value ); -// BOOST_STATIC_ASSERT( ::boost::is_same<typename Traits::external_string_type,std::string>::value || ::boost::is_same<typename Traits::external_string_type,std::wstring>::value ); - - public: - // compiler generates copy constructor and copy assignment - - typedef basic_path<String, Traits> path_type; - typedef String string_type; - typedef typename String::value_type value_type; - typedef Traits traits_type; - typedef typename Traits::external_string_type external_string_type; - - // constructors/destructor - basic_path() {} - basic_path( const string_type & s ) { operator/=( s ); } - basic_path( const value_type * s ) { operator/=( s ); } -# ifndef BOOST_NO_MEMBER_TEMPLATES - template <class InputIterator> - basic_path( InputIterator first, InputIterator last ) - { append( first, last ); } -# endif - ~basic_path() {} - - // assignments - basic_path & operator=( const string_type & s ) - { -# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) - m_path.clear(); -# else - m_path.erase( m_path.begin(), m_path.end() ); -# endif - operator/=( s ); - return *this; - } - basic_path & operator=( const value_type * s ) - { -# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) - m_path.clear(); -# else - m_path.erase( m_path.begin(), m_path.end() ); -# endif - operator/=( s ); - return *this; - } -# ifndef BOOST_NO_MEMBER_TEMPLATES - template <class InputIterator> - basic_path & assign( InputIterator first, InputIterator last ) - { m_path.clear(); append( first, last ); return *this; } -# endif - - // modifiers - basic_path & operator/=( const basic_path & rhs ) { return operator /=( rhs.string().c_str() ); } - basic_path & operator/=( const string_type & rhs ) { return operator /=( rhs.c_str() ); } - basic_path & operator/=( const value_type * s ); -# ifndef BOOST_NO_MEMBER_TEMPLATES - template <class InputIterator> - basic_path & append( InputIterator first, InputIterator last ); -# endif - - void clear() - { -# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) - m_path.clear(); -# else - m_path.erase( m_path.begin(), m_path.end() ); -# endif - } - - void swap( basic_path & rhs ) - { - m_path.swap( rhs.m_path ); -# ifdef BOOST_CYGWIN_PATH - std::swap( m_cygwin_root, rhs.m_cygwin_root ); -# endif - } - - basic_path & remove_filename(); - basic_path & replace_extension( const string_type & new_extension = string_type() ); - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - basic_path & remove_leaf() { return remove_filename(); } -# endif - - // observers - const string_type & string() const { return m_path; } - const string_type file_string() const; - const string_type directory_string() const { return file_string(); } - - const external_string_type external_file_string() const { return Traits::to_external( *this, file_string() ); } - const external_string_type external_directory_string() const { return Traits::to_external( *this, directory_string() ); } - - basic_path root_path() const; - string_type root_name() const; - string_type root_directory() const; - basic_path relative_path() const; - basic_path parent_path() const; - string_type filename() const; - string_type stem() const; - string_type extension() const; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - string_type leaf() const { return filename(); } - basic_path branch_path() const { return parent_path(); } - bool has_leaf() const { return !m_path.empty(); } - bool has_branch_path() const { return !parent_path().empty(); } -# endif - - bool empty() const { return m_path.empty(); } // name consistent with std containers - bool is_complete() const; - bool has_root_path() const; - bool has_root_name() const; - bool has_root_directory() const; - bool has_relative_path() const { return !relative_path().empty(); } - bool has_filename() const { return !m_path.empty(); } - bool has_parent_path() const { return !parent_path().empty(); } - - // iterators - class iterator : public boost::iterator_facade< - iterator, - string_type const, - boost::bidirectional_traversal_tag > - { - private: - friend class boost::iterator_core_access; - friend class boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits>; - - const string_type & dereference() const - { return m_name; } - bool equal( const iterator & rhs ) const - { return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; } - - friend class boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper<path_type>; - - void increment() - { - boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper<path_type>::do_increment( - *this ); - } - void decrement() - { - boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper<path_type>::do_decrement( - *this ); - } - - string_type m_name; // current element - const basic_path * m_path_ptr; // path being iterated over - typename string_type::size_type m_pos; // position of name in - // path_ptr->string(). The - // end() iterator is indicated by - // pos == path_ptr->m_path.size() - }; // iterator - - typedef iterator const_iterator; - - iterator begin() const; - iterator end() const; - - private: - // Note: This is an implementation for POSIX and Windows, where there - // are only minor differences between generic and native path grammars. - // Private members might be quite different in other implementations, - // particularly where there were wide differences between portable and - // native path formats, or between file_string() and - // directory_string() formats, or simply that the implementation - // was willing expend additional memory to achieve greater speed for - // some operations at the expense of other operations. - - string_type m_path; // invariant: portable path grammar - // on Windows, backslashes converted to slashes - -# ifdef BOOST_CYGWIN_PATH - bool m_cygwin_root; // if present, m_path[0] was slash. note: initialization - // done by append -# endif - - void m_append_separator_if_needed(); - void m_append( value_type value ); // converts Windows alt_separator - - // Was qualified; como433beta8 reports: - // warning #427-D: qualified name is not allowed in member declaration - friend class iterator; - friend class boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper<path_type>; - - // Deprecated features ease transition for existing code. Don't use these - // in new code. -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - public: - typedef bool (*name_check)( const std::string & name ); - basic_path( const string_type & str, name_check ) { operator/=( str ); } - basic_path( const typename string_type::value_type * s, name_check ) - { operator/=( s );} - string_type native_file_string() const { return file_string(); } - string_type native_directory_string() const { return directory_string(); } - static bool default_name_check_writable() { return false; } - static void default_name_check( name_check ) {} - static name_check default_name_check() { return 0; } - basic_path & canonize(); - basic_path & normalize(); -# endif - }; - - // basic_path non-member functions ---------------------------------------// - - template< class String, class Traits > - inline void swap( basic_path<String, Traits> & lhs, - basic_path<String, Traits> & rhs ) { lhs.swap( rhs ); } - - template< class String, class Traits > - bool operator<( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) - { - return std::lexicographical_compare( - lhs.begin(), lhs.end(), rhs.begin(), rhs.end() ); - } - - template< class String, class Traits > - bool operator<( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) - { - basic_path<String, Traits> tmp( lhs ); - return std::lexicographical_compare( - tmp.begin(), tmp.end(), rhs.begin(), rhs.end() ); - } - - template< class String, class Traits > - bool operator<( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) - { - basic_path<String, Traits> tmp( lhs ); - return std::lexicographical_compare( - tmp.begin(), tmp.end(), rhs.begin(), rhs.end() ); - } - - template< class String, class Traits > - bool operator<( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { - basic_path<String, Traits> tmp( rhs ); - return std::lexicographical_compare( - lhs.begin(), lhs.end(), tmp.begin(), tmp.end() ); - } - - template< class String, class Traits > - bool operator<( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { - basic_path<String, Traits> tmp( rhs ); - return std::lexicographical_compare( - lhs.begin(), lhs.end(), tmp.begin(), tmp.end() ); - } - - // operator == uses hand-written compare rather than !(lhs < rhs) && !(rhs < lhs) - // because the result is the same yet the direct compare is much more efficient - // than lexicographical_compare, which would also be called twice. - - template< class String, class Traits > - inline bool operator==( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { - typedef typename - boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> path_type; - const typename path_type::string_type::value_type * l (lhs.string().c_str()); - while ( (*l == *rhs -# ifdef BOOST_WINDOWS_PATH - || (*l == path_alt_separator<path_type>::value && *rhs == slash<path_type>::value) - || (*l == slash<path_type>::value && *rhs == path_alt_separator<path_type>::value) -# endif - ) && *l ) { ++l; ++rhs; } - return *l == *rhs -# ifdef BOOST_WINDOWS_PATH - || (*l == path_alt_separator<path_type>::value && *rhs == slash<path_type>::value) - || (*l == slash<path_type>::value && *rhs == path_alt_separator<path_type>::value) -# endif - ; - } - - template< class String, class Traits > - inline bool operator==( const basic_path<String, Traits> & lhs, - const basic_path<String, Traits> & rhs ) - { - return lhs == rhs.string().c_str(); - } - - template< class String, class Traits > - inline bool operator==( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) - { - return rhs == lhs; - } - - template< class String, class Traits > - inline bool operator==( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) - { - return rhs == lhs.c_str(); - } - - template< class String, class Traits > - inline bool operator==( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { - return lhs == rhs.c_str(); - } - - template< class String, class Traits > - inline bool operator!=( const basic_path<String, Traits> & lhs, - const basic_path<String, Traits> & rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator!=( const typename basic_path<String, - Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator!=( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator!=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator!=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator>( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return rhs < lhs; } - - template< class String, class Traits > - inline bool operator>( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) { return rhs < basic_path<String, Traits>(lhs); } - - template< class String, class Traits > - inline bool operator>( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) { return rhs < basic_path<String, Traits>(lhs); } - - template< class String, class Traits > - inline bool operator>( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { return basic_path<String, Traits>(rhs) < lhs; } - - template< class String, class Traits > - inline bool operator>( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { return basic_path<String, Traits>(rhs) < lhs; } - - template< class String, class Traits > - inline bool operator<=( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return !(rhs < lhs); } - - template< class String, class Traits > - inline bool operator<=( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) { return !(rhs < basic_path<String, Traits>(lhs)); } - - template< class String, class Traits > - inline bool operator<=( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) { return !(rhs < basic_path<String, Traits>(lhs)); } - - template< class String, class Traits > - inline bool operator<=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { return !(basic_path<String, Traits>(rhs) < lhs); } - - template< class String, class Traits > - inline bool operator<=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { return !(basic_path<String, Traits>(rhs) < lhs); } - - template< class String, class Traits > - inline bool operator>=( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return !(lhs < rhs); } - - template< class String, class Traits > - inline bool operator>=( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) { return !(lhs < basic_path<String, Traits>(rhs)); } - - template< class String, class Traits > - inline bool operator>=( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) { return !(lhs < basic_path<String, Traits>(rhs)); } - - template< class String, class Traits > - inline bool operator>=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { return !(basic_path<String, Traits>(lhs) < rhs); } - - template< class String, class Traits > - inline bool operator>=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { return !(basic_path<String, Traits>(lhs) < rhs); } - - // operator / - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const basic_path<String, Traits> & lhs, - const basic_path<String, Traits> & rhs ) - { return basic_path<String, Traits>( lhs ) /= rhs; } - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const basic_path<String, Traits> & lhs, - const typename String::value_type * rhs ) - { return basic_path<String, Traits>( lhs ) /= - basic_path<String, Traits>( rhs ); } - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const basic_path<String, Traits> & lhs, const String & rhs ) - { return basic_path<String, Traits>( lhs ) /= - basic_path<String, Traits>( rhs ); } - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const typename String::value_type * lhs, - const basic_path<String, Traits> & rhs ) - { return basic_path<String, Traits>( lhs ) /= rhs; } - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const String & lhs, const basic_path<String, Traits> & rhs ) - { return basic_path<String, Traits>( lhs ) /= rhs; } - - // inserters and extractors --------------------------------------------// - -// bypass VC++ 7.0 and earlier, and broken Borland compilers -# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__BORLANDC__, < 0x610) - template< class Path > - std::basic_ostream< typename Path::string_type::value_type, - typename Path::string_type::traits_type > & - operator<< - ( std::basic_ostream< typename Path::string_type::value_type, - typename Path::string_type::traits_type >& os, const Path & ph ) - { - os << ph.string(); - return os; - } - - template< class Path > - std::basic_istream< typename Path::string_type::value_type, - typename Path::string_type::traits_type > & - operator>> - ( std::basic_istream< typename Path::string_type::value_type, - typename Path::string_type::traits_type >& is, Path & ph ) - { - typename Path::string_type str; - std::getline(is, str); // See ticket 3863 - ph = str; - return is; - } -# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - template< class String, class Traits > - std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type, - BOOST_DEDUCED_TYPENAME String::traits_type > & - operator<< - ( std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type, - BOOST_DEDUCED_TYPENAME String::traits_type >& os, - const basic_path< String, Traits > & ph ) - { - os << ph.string(); - return os; - } - - template< class String, class Traits > - std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, - BOOST_DEDUCED_TYPENAME String::traits_type > & - operator>> - ( std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, - BOOST_DEDUCED_TYPENAME String::traits_type> & is, - basic_path< String, Traits > & ph ) - { - String str; - std::getline(is, str); // See ticket 3863 - ph = str; - return is; - } -# endif - - // basic_filesystem_error helpers --------------------------------------// - - // Originally choice of implementation was done via specialization of - // basic_filesystem_error::what(). Several compilers (GCC, aCC, etc.) - // couldn't handle that, so the choice is now accomplished by overloading. - - namespace detail - { - // BOOST_FILESYSTEM_DECL version works for VC++ but not GCC. Go figure! - inline - const char * what( const char * sys_err_what, - const path & path1_arg, const path & path2_arg, std::string & target ) - { - try - { - if ( target.empty() ) - { - target = sys_err_what; - if ( !path1_arg.empty() ) - { - target += ": \""; - target += path1_arg.file_string(); - target += "\""; - } - if ( !path2_arg.empty() ) - { - target += ", \""; - target += path2_arg.file_string(); - target += "\""; - } - } - return target.c_str(); - } - catch (...) - { - return sys_err_what; - } - } - - template<class Path> - const char * what( const char * sys_err_what, - const Path & /*path1_arg*/, const Path & /*path2_arg*/, std::string & /*target*/ ) - { - return sys_err_what; - } - } - - // basic_filesystem_error ----------------------------------------------// - - template<class Path> - class basic_filesystem_error : public system::system_error - { - // see http://www.boost.org/more/error_handling.html for design rationale - public: - // compiler generates copy constructor and copy assignment - - typedef Path path_type; - - basic_filesystem_error( const std::string & what_arg, - system::error_code ec ); - - basic_filesystem_error( const std::string & what_arg, - const path_type & path1_arg, system::error_code ec ); - - basic_filesystem_error( const std::string & what_arg, const path_type & path1_arg, - const path_type & path2_arg, system::error_code ec ); - - ~basic_filesystem_error() throw() {} - - const path_type & path1() const - { - static const path_type empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ; - } - const path_type & path2() const - { - static const path_type empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ; - } - - const char * what() const throw() - { - if ( !m_imp_ptr.get() ) - return system::system_error::what(); - return detail::what( system::system_error::what(), m_imp_ptr->m_path1, - m_imp_ptr->m_path2, m_imp_ptr->m_what ); - } - - private: - struct m_imp - { - path_type m_path1; // may be empty() - path_type m_path2; // may be empty() - std::string m_what; // not built until needed - }; - boost::shared_ptr<m_imp> m_imp_ptr; - }; - - typedef basic_filesystem_error<path> filesystem_error; - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_filesystem_error<wpath> wfilesystem_error; -# endif - - // path::name_checks -----------------------------------------------------// - - BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool native( const std::string & name ); - inline bool no_check( const std::string & ) - { return true; } - -// implementation -----------------------------------------------------------// - - namespace detail - { - - // is_separator helper ------------------------------------------------// - - template<class Path> - inline bool is_separator( typename Path::string_type::value_type c ) - { - return c == slash<Path>::value -# ifdef BOOST_WINDOWS_PATH - || c == path_alt_separator<Path>::value -# endif - ; - } - - // filename_pos helper ----------------------------------------------------// - - template<class String, class Traits> - typename String::size_type filename_pos( - const String & str, // precondition: portable generic path grammar - typename String::size_type end_pos ) // end_pos is past-the-end position - // return 0 if str itself is filename (or empty) - { - typedef typename - boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> path_type; - - // case: "//" - if ( end_pos == 2 - && str[0] == slash<path_type>::value - && str[1] == slash<path_type>::value ) return 0; - - // case: ends in "/" - if ( end_pos && str[end_pos-1] == slash<path_type>::value ) - return end_pos-1; - - // set pos to start of last element - typename String::size_type pos( - str.find_last_of( slash<path_type>::value, end_pos-1 ) ); -# ifdef BOOST_WINDOWS_PATH - if ( pos == String::npos ) - pos = str.find_last_of( path_alt_separator<path_type>::value, end_pos-1 ); - if ( pos == String::npos ) - pos = str.find_last_of( colon<path_type>::value, end_pos-2 ); -# endif - - return ( pos == String::npos // path itself must be a filename (or empty) - || (pos == 1 && str[0] == slash<path_type>::value) ) // or net - ? 0 // so filename is entire string - : pos + 1; // or starts after delimiter - } - - // first_element helper -----------------------------------------------// - // sets pos and len of first element, excluding extra separators - // if src.empty(), sets pos,len, to 0,0. - - template<class String, class Traits> - void first_element( - const String & src, // precondition: portable generic path grammar - typename String::size_type & element_pos, - typename String::size_type & element_size, -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1310 ) // VC++ 7.1 - typename String::size_type size = String::npos -# else - typename String::size_type size = -1 -# endif - ) - { - if ( size == String::npos ) size = src.size(); - element_pos = 0; - element_size = 0; - if ( src.empty() ) return; - - typedef typename boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> path_type; - - typename String::size_type cur(0); - - // deal with // [network] - if ( size >= 2 && src[0] == slash<path_type>::value - && src[1] == slash<path_type>::value - && (size == 2 - || src[2] != slash<path_type>::value) ) - { - cur += 2; - element_size += 2; - } - - // leading (not non-network) separator - else if ( src[0] == slash<path_type>::value ) - { - ++element_size; - // bypass extra leading separators - while ( cur+1 < size - && src[cur+1] == slash<path_type>::value ) - { - ++cur; - ++element_pos; - } - return; - } - - // at this point, we have either a plain name, a network name, - // or (on Windows only) a device name - - // find the end - while ( cur < size -# ifdef BOOST_WINDOWS_PATH - && src[cur] != colon<path_type>::value -# endif - && src[cur] != slash<path_type>::value ) - { - ++cur; - ++element_size; - } - -# ifdef BOOST_WINDOWS_PATH - if ( cur == size ) return; - // include device delimiter - if ( src[cur] == colon<path_type>::value ) - { ++element_size; } -# endif - - return; - } - - // root_directory_start helper ----------------------------------------// - - template<class String, class Traits> - typename String::size_type root_directory_start( - const String & s, // precondition: portable generic path grammar - typename String::size_type size ) - // return npos if no root_directory found - { - typedef typename boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> path_type; - -# ifdef BOOST_WINDOWS_PATH - // case "c:/" - if ( size > 2 - && s[1] == colon<path_type>::value - && s[2] == slash<path_type>::value ) return 2; -# endif - - // case "//" - if ( size == 2 - && s[0] == slash<path_type>::value - && s[1] == slash<path_type>::value ) return String::npos; - - // case "//net {/}" - if ( size > 3 - && s[0] == slash<path_type>::value - && s[1] == slash<path_type>::value - && s[2] != slash<path_type>::value ) - { - typename String::size_type pos( - s.find( slash<path_type>::value, 2 ) ); - return pos < size ? pos : String::npos; - } - - // case "/" - if ( size > 0 && s[0] == slash<path_type>::value ) return 0; - - return String::npos; - } - - // is_non_root_slash helper -------------------------------------------// - - template<class String, class Traits> - bool is_non_root_slash( const String & str, - typename String::size_type pos ) // pos is position of the slash - { - typedef typename - boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> - path_type; - - BOOST_ASSERT( !str.empty() && str[pos] == slash<path_type>::value - && "precondition violation" ); - - // subsequent logic expects pos to be for leftmost slash of a set - while ( pos > 0 && str[pos-1] == slash<path_type>::value ) - --pos; - - return pos != 0 - && (pos <= 2 || str[1] != slash<path_type>::value - || str.find( slash<path_type>::value, 2 ) != pos) -# ifdef BOOST_WINDOWS_PATH - && (pos !=2 || str[1] != colon<path_type>::value) -# endif - ; - } - } // namespace detail - - // decomposition functions ----------------------------------------------// - - template<class String, class Traits> - String basic_path<String, Traits>::filename() const - { - typename String::size_type end_pos( - detail::filename_pos<String, Traits>( m_path, m_path.size() ) ); - return (m_path.size() - && end_pos - && m_path[end_pos] == slash<path_type>::value - && detail::is_non_root_slash< String, Traits >(m_path, end_pos)) - ? String( 1, dot<path_type>::value ) - : m_path.substr( end_pos ); - } - - template<class String, class Traits> - String basic_path<String, Traits>::stem() const - { - string_type name = filename(); - typename string_type::size_type n = name.rfind(dot<path_type>::value); - return name.substr(0, n); - } - - template<class String, class Traits> - String basic_path<String, Traits>::extension() const - { - string_type name = filename(); - typename string_type::size_type n = name.rfind(dot<path_type>::value); - if (n != string_type::npos) - return name.substr(n); - else - return string_type(); - } - - template<class String, class Traits> - basic_path<String, Traits> basic_path<String, Traits>::parent_path() const - { - typename String::size_type end_pos( - detail::filename_pos<String, Traits>( m_path, m_path.size() ) ); - - bool filename_was_separator( m_path.size() - && m_path[end_pos] == slash<path_type>::value ); - - // skip separators unless root directory - typename string_type::size_type root_dir_pos( detail::root_directory_start - <string_type, traits_type>( m_path, end_pos ) ); - for ( ; - end_pos > 0 - && (end_pos-1) != root_dir_pos - && m_path[end_pos-1] == slash<path_type>::value - ; - --end_pos ) {} - - return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator) - ? path_type() - : path_type( m_path.substr( 0, end_pos ) ); - } - - template<class String, class Traits> - basic_path<String, Traits> basic_path<String, Traits>::relative_path() const - { - iterator itr( begin() ); - for ( ; itr.m_pos != m_path.size() - && (itr.m_name[0] == slash<path_type>::value -# ifdef BOOST_WINDOWS_PATH - || itr.m_name[itr.m_name.size()-1] - == colon<path_type>::value -# endif - ); ++itr ) {} - - return basic_path<String, Traits>( m_path.substr( itr.m_pos ) ); - } - - template<class String, class Traits> - String basic_path<String, Traits>::root_name() const - { - iterator itr( begin() ); - - return ( itr.m_pos != m_path.size() - && ( - ( itr.m_name.size() > 1 - && itr.m_name[0] == slash<path_type>::value - && itr.m_name[1] == slash<path_type>::value - ) -# ifdef BOOST_WINDOWS_PATH - || itr.m_name[itr.m_name.size()-1] - == colon<path_type>::value -# endif - ) ) - ? *itr - : String(); - } - - template<class String, class Traits> - String basic_path<String, Traits>::root_directory() const - { - typename string_type::size_type start( - detail::root_directory_start<String, Traits>( m_path, m_path.size() ) ); - - return start == string_type::npos - ? string_type() - : m_path.substr( start, 1 ); - } - - template<class String, class Traits> - basic_path<String, Traits> basic_path<String, Traits>::root_path() const - { - // even on POSIX, root_name() is non-empty() on network paths - return basic_path<String, Traits>( root_name() ) /= root_directory(); - } - - // path query functions -------------------------------------------------// - - template<class String, class Traits> - inline bool basic_path<String, Traits>::is_complete() const - { -# ifdef BOOST_WINDOWS_PATH - return has_root_name() && has_root_directory(); -# else - return has_root_directory(); -# endif - } - - template<class String, class Traits> - inline bool basic_path<String, Traits>::has_root_path() const - { - return !root_path().empty(); - } - - template<class String, class Traits> - inline bool basic_path<String, Traits>::has_root_name() const - { - return !root_name().empty(); - } - - template<class String, class Traits> - inline bool basic_path<String, Traits>::has_root_directory() const - { - return !root_directory().empty(); - } - - // append ---------------------------------------------------------------// - - template<class String, class Traits> - void basic_path<String, Traits>::m_append_separator_if_needed() - // requires: !empty() - { - if ( -# ifdef BOOST_WINDOWS_PATH - *(m_path.end()-1) != colon<path_type>::value && -# endif - *(m_path.end()-1) != slash<path_type>::value ) - { - m_path += slash<path_type>::value; - } - } - - template<class String, class Traits> - void basic_path<String, Traits>::m_append( value_type value ) - { -# ifdef BOOST_CYGWIN_PATH - if ( m_path.empty() ) m_cygwin_root = (value == slash<path_type>::value); -# endif - -# ifdef BOOST_WINDOWS_PATH - // for BOOST_WINDOWS_PATH, convert alt_separator ('\') to separator ('/') - m_path += ( value == path_alt_separator<path_type>::value - ? slash<path_type>::value - : value ); -# else - m_path += value; -# endif - } - - // except that it wouldn't work for BOOST_NO_MEMBER_TEMPLATES compilers, - // the append() member template could replace this code. - template<class String, class Traits> - basic_path<String, Traits> & basic_path<String, Traits>::operator /= - ( const value_type * next_p ) - { - // ignore escape sequence on POSIX or Windows - if ( *next_p == slash<path_type>::value - && *(next_p+1) == slash<path_type>::value - && *(next_p+2) == colon<path_type>::value ) next_p += 3; - - // append slash<path_type>::value if needed - if ( !empty() && *next_p != 0 - && !detail::is_separator<path_type>( *next_p ) ) - { m_append_separator_if_needed(); } - - for ( ; *next_p != 0; ++next_p ) m_append( *next_p ); - return *this; - } - -# ifndef BOOST_NO_MEMBER_TEMPLATES - template<class String, class Traits> template <class InputIterator> - basic_path<String, Traits> & basic_path<String, Traits>::append( - InputIterator first, InputIterator last ) - { - // append slash<path_type>::value if needed - if ( !empty() && first != last - && !detail::is_separator<path_type>( *first ) ) - { m_append_separator_if_needed(); } - - // song-and-dance to avoid violating InputIterator requirements - // (which prohibit lookahead) in detecting a possible escape sequence - // (escape sequences are simply ignored on POSIX and Windows) - bool was_escape_sequence(true); - std::size_t append_count(0); - typename String::size_type initial_pos( m_path.size() ); - - for ( ; first != last && *first; ++first ) - { - if ( append_count == 0 && *first != slash<path_type>::value ) - was_escape_sequence = false; - if ( append_count == 1 && *first != slash<path_type>::value ) - was_escape_sequence = false; - if ( append_count == 2 && *first != colon<path_type>::value ) - was_escape_sequence = false; - m_append( *first ); - ++append_count; - } - - // erase escape sequence if any - if ( was_escape_sequence && append_count >= 3 ) - m_path.erase( initial_pos, 3 ); - - return *this; - } -# endif - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - - // canonize ------------------------------------------------------------// - - template<class String, class Traits> - basic_path<String, Traits> & basic_path<String, Traits>::canonize() - { - static const typename string_type::value_type dot_str[] - = { dot<path_type>::value, 0 }; - - if ( m_path.empty() ) return *this; - - path_type temp; - - for ( iterator itr( begin() ); itr != end(); ++itr ) - { - temp /= *itr; - }; - - if ( temp.empty() ) temp /= dot_str; - m_path = temp.m_path; - return *this; - } - - // normalize ------------------------------------------------------------// - - template<class String, class Traits> - basic_path<String, Traits> & basic_path<String, Traits>::normalize() - { - static const typename string_type::value_type dot_str[] - = { dot<path_type>::value, 0 }; - - if ( m_path.empty() ) return *this; - - path_type temp; - iterator start( begin() ); - iterator last( end() ); - iterator stop( last-- ); - for ( iterator itr( start ); itr != stop; ++itr ) - { - // ignore "." except at start and last - if ( itr->size() == 1 - && (*itr)[0] == dot<path_type>::value - && itr != start - && itr != last ) continue; - - // ignore a name and following ".." - if ( !temp.empty() - && itr->size() == 2 - && (*itr)[0] == dot<path_type>::value - && (*itr)[1] == dot<path_type>::value ) // dot dot - { - string_type lf( temp.filename() ); - if ( lf.size() > 0 - && (lf.size() != 1 - || (lf[0] != dot<path_type>::value - && lf[0] != slash<path_type>::value)) - && (lf.size() != 2 - || (lf[0] != dot<path_type>::value - && lf[1] != dot<path_type>::value -# ifdef BOOST_WINDOWS_PATH - && lf[1] != colon<path_type>::value -# endif - ) - ) - ) - { - temp.remove_filename(); - // if not root directory, must also remove "/" if any - if ( temp.m_path.size() > 0 - && temp.m_path[temp.m_path.size()-1] - == slash<path_type>::value ) - { - typename string_type::size_type rds( - detail::root_directory_start<String,Traits>( temp.m_path, - temp.m_path.size() ) ); - if ( rds == string_type::npos - || rds != temp.m_path.size()-1 ) - { temp.m_path.erase( temp.m_path.size()-1 ); } - } - - iterator next( itr ); - if ( temp.empty() && ++next != stop - && next == last && *last == dot_str ) temp /= dot_str; - continue; - } - } - - temp /= *itr; - }; - - if ( temp.empty() ) temp /= dot_str; - m_path = temp.m_path; - return *this; - } - -# endif - - // modifiers ------------------------------------------------------------// - - template<class String, class Traits> - basic_path<String, Traits> & basic_path<String, Traits>::remove_filename() - { - m_path.erase( - detail::filename_pos<String, Traits>( m_path, m_path.size() ) ); - return *this; - } - - template<class String, class Traits> - basic_path<String, Traits> & - basic_path<String, Traits>::replace_extension( const string_type & new_ext ) - { - // erase existing extension if any - string_type old_ext = extension(); - if ( !old_ext.empty() ) - m_path.erase( m_path.size() - old_ext.size() ); - - if ( !new_ext.empty() && new_ext[0] != dot<path_type>::value ) - m_path += dot<path_type>::value; - - m_path += new_ext; - - return *this; - } - - - // path conversion functions --------------------------------------------// - - template<class String, class Traits> - const String - basic_path<String, Traits>::file_string() const - { -# ifdef BOOST_WINDOWS_PATH - // for Windows, use the alternate separator, and bypass extra - // root separators - - typename string_type::size_type root_dir_start( - detail::root_directory_start<String, Traits>( m_path, m_path.size() ) ); - bool in_root( root_dir_start != string_type::npos ); - String s; - for ( typename string_type::size_type pos( 0 ); - pos != m_path.size(); ++pos ) - { - // special case // [net] - if ( pos == 0 && m_path.size() > 1 - && m_path[0] == slash<path_type>::value - && m_path[1] == slash<path_type>::value - && ( m_path.size() == 2 - || !detail::is_separator<path_type>( m_path[2] ) - ) ) - { - ++pos; - s += path_alt_separator<path_type>::value; - s += path_alt_separator<path_type>::value; - continue; - } - - // bypass extra root separators - if ( in_root ) - { - if ( s.size() > 0 - && s[s.size()-1] == path_alt_separator<path_type>::value - && m_path[pos] == slash<path_type>::value - ) continue; - } - - if ( m_path[pos] == slash<path_type>::value ) - s += path_alt_separator<path_type>::value; - else - s += m_path[pos]; - - if ( pos > root_dir_start - && m_path[pos] == slash<path_type>::value ) - { in_root = false; } - } -# ifdef BOOST_CYGWIN_PATH - if ( m_cygwin_root ) s[0] = slash<path_type>::value; -# endif - return s; -# else - return m_path; -# endif - } - - // iterator functions ---------------------------------------------------// - - template<class String, class Traits> - typename basic_path<String, Traits>::iterator basic_path<String, Traits>::begin() const - { - iterator itr; - itr.m_path_ptr = this; - typename string_type::size_type element_size; - detail::first_element<String, Traits>( m_path, itr.m_pos, element_size ); - itr.m_name = m_path.substr( itr.m_pos, element_size ); - return itr; - } - - template<class String, class Traits> - typename basic_path<String, Traits>::iterator basic_path<String, Traits>::end() const - { - iterator itr; - itr.m_path_ptr = this; - itr.m_pos = m_path.size(); - return itr; - } - - namespace detail - { - // do_increment ------------------------------------------------------// - - template<class Path> - void iterator_helper<Path>::do_increment( iterator & itr ) - { - typedef typename Path::string_type string_type; - typedef typename Path::traits_type traits_type; - - BOOST_ASSERT( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" ); - - bool was_net( itr.m_name.size() > 2 - && itr.m_name[0] == slash<Path>::value - && itr.m_name[1] == slash<Path>::value - && itr.m_name[2] != slash<Path>::value ); - - // increment to position past current element - itr.m_pos += itr.m_name.size(); - - // if end reached, create end iterator - if ( itr.m_pos == itr.m_path_ptr->m_path.size() ) - { - itr.m_name.erase( itr.m_name.begin(), itr.m_name.end() ); // VC++ 6.0 lib didn't supply clear() - return; - } - - // process separator (Windows drive spec is only case not a separator) - if ( itr.m_path_ptr->m_path[itr.m_pos] == slash<Path>::value ) - { - // detect root directory - if ( was_net - # ifdef BOOST_WINDOWS_PATH - // case "c:/" - || itr.m_name[itr.m_name.size()-1] == colon<Path>::value - # endif - ) - { - itr.m_name = slash<Path>::value; - return; - } - - // bypass separators - while ( itr.m_pos != itr.m_path_ptr->m_path.size() - && itr.m_path_ptr->m_path[itr.m_pos] == slash<Path>::value ) - { ++itr.m_pos; } - - // detect trailing separator, and treat it as ".", per POSIX spec - if ( itr.m_pos == itr.m_path_ptr->m_path.size() - && detail::is_non_root_slash< string_type, traits_type >( - itr.m_path_ptr->m_path, itr.m_pos-1 ) ) - { - --itr.m_pos; - itr.m_name = dot<Path>::value; - return; - } - } - - // get next element - typename string_type::size_type end_pos( - itr.m_path_ptr->m_path.find( slash<Path>::value, itr.m_pos ) ); - itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos ); - } - - // do_decrement ------------------------------------------------------// - - template<class Path> - void iterator_helper<Path>::do_decrement( iterator & itr ) - { - BOOST_ASSERT( itr.m_pos && "basic_path::iterator decrement past begin()" ); - - typedef typename Path::string_type string_type; - typedef typename Path::traits_type traits_type; - - typename string_type::size_type end_pos( itr.m_pos ); - - typename string_type::size_type root_dir_pos( - detail::root_directory_start<string_type, traits_type>( - itr.m_path_ptr->m_path, end_pos ) ); - - // if at end and there was a trailing non-root '/', return "." - if ( itr.m_pos == itr.m_path_ptr->m_path.size() - && itr.m_path_ptr->m_path.size() > 1 - && itr.m_path_ptr->m_path[itr.m_pos-1] == slash<Path>::value - && detail::is_non_root_slash< string_type, traits_type >( - itr.m_path_ptr->m_path, itr.m_pos-1 ) - ) - { - --itr.m_pos; - itr.m_name = dot<Path>::value; - return; - } - - // skip separators unless root directory - for ( - ; - end_pos > 0 - && (end_pos-1) != root_dir_pos - && itr.m_path_ptr->m_path[end_pos-1] == slash<Path>::value - ; - --end_pos ) {} - - itr.m_pos = detail::filename_pos<string_type, traits_type> - ( itr.m_path_ptr->m_path, end_pos ); - itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos ); - } - } // namespace detail - - // basic_filesystem_error implementation --------------------------------// - - template<class Path> - basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what_arg, system::error_code ec ) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset( new m_imp ); - } - catch (...) { m_imp_ptr.reset(); } - } - - template<class Path> - basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what_arg, const path_type & path1_arg, - system::error_code ec ) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_path1 = path1_arg; - } - catch (...) { m_imp_ptr.reset(); } - } - - template<class Path> - basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what_arg, const path_type & path1_arg, - const path_type & path2_arg, system::error_code ec ) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_path1 = path1_arg; - m_imp_ptr->m_path2 = path2_arg; - } - catch (...) { m_imp_ptr.reset(); } - } - - } // namespace BOOST_FILESYSTEM2_NAMESPACE -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem2::basic_path; - using filesystem2::path_traits; - - using filesystem2::slash; - using filesystem2::dot; - using filesystem2::colon; - - using filesystem2::path; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - using filesystem2::wpath_traits; - using filesystem2::wpath; - using filesystem2::wfilesystem_error; -# endif - using filesystem2::basic_filesystem_error; - using filesystem2::filesystem_error; - using filesystem2::portable_posix_name; - using filesystem2::windows_name; - using filesystem2::portable_name; - using filesystem2::portable_directory_name; - using filesystem2::portable_file_name; - using filesystem2::native; - using filesystem2::no_check; - using filesystem2::swap; - using filesystem2::operator<; - using filesystem2::operator==; - using filesystem2::operator!=; - using filesystem2::operator>; - using filesystem2::operator<=; - using filesystem2::operator>=; - using filesystem2::operator/; - using filesystem2::operator<<; - using filesystem2::operator>>; - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas - -#endif // BOOST_FILESYSTEM2_PATH_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/config.hpp b/3rdParty/Boost/src/boost/filesystem/v3/config.hpp deleted file mode 100644 index 13fc308..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/config.hpp +++ /dev/null @@ -1,85 +0,0 @@ -// boost/filesystem/v3/config.hpp ----------------------------------------------------// - -// Copyright Beman Dawes 2003 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM3_CONFIG_HPP -#define BOOST_FILESYSTEM3_CONFIG_HPP - -# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 -# error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3 -# endif - -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif - -#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions - -// This header implements separate compilation features as described in -// http://www.boost.org/more/separate_compilation.html - -#include <boost/config.hpp> -#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API -#include <boost/detail/workaround.hpp> - -// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------// - -# ifdef BOOST_FILESYSTEM_SOURCE -# define BOOST_FILESYSTEM_DEPRECATED -# endif - -// throw an exception ----------------------------------------------------------------// -// -// Exceptions were originally thrown via boost::throw_exception(). -// As throw_exception() became more complex, it caused user error reporting -// to be harder to interpret, since the exception reported became much more complex. -// The immediate fix was to throw directly, wrapped in a macro to make any later change -// easier. - -#define BOOST_FILESYSTEM_THROW(EX) throw EX - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -// enable dynamic linking -------------------------------------------------------------// - -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) -# if defined(BOOST_FILESYSTEM_SOURCE) -# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT -# else -# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT -# endif -#else -# define BOOST_FILESYSTEM_DECL -#endif - -// enable automatic library variant selection ----------------------------------------// - -#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \ - && !defined(BOOST_FILESYSTEM_NO_LIB) -// -// Set the name of our library, this will get undef'ed by auto_link.hpp -// once it's done with it: -// -#define BOOST_LIB_NAME boost_filesystem -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) -# define BOOST_DYN_LINK -#endif -// -// And include the header that does the work: -// -#include <boost/config/auto_link.hpp> -#endif // auto-linking disabled - -#endif // BOOST_FILESYSTEM3_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/exception.hpp b/3rdParty/Boost/src/boost/filesystem/v3/exception.hpp deleted file mode 100644 index 985cd8f..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/exception.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// boost/filesystem/exception.hpp -----------------------------------------------------// - -// Copyright Beman Dawes 2003 -// Use, modification, and distribution is subject to 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) - -// This header is no longer used. The contents have been moved to path.hpp. -// It is provided so that user code #includes do not have to be changed. diff --git a/3rdParty/Boost/src/boost/filesystem/v3/fstream.hpp b/3rdParty/Boost/src/boost/filesystem/v3/fstream.hpp deleted file mode 100644 index 60a2a3b..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/fstream.hpp +++ /dev/null @@ -1,208 +0,0 @@ -// boost/filesystem/fstream.hpp ------------------------------------------------------// - -// Copyright Beman Dawes 2002 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP -#define BOOST_FILESYSTEM3_FSTREAM_HPP - -#include <boost/config.hpp> - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -#include <boost/filesystem/v3/path.hpp> -#include <iosfwd> -#include <fstream> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -// on Windows, except for standard libaries known to have wchar_t overloads for -// file stream I/O, use path::string() to get a narrow character c_str() -#if defined(BOOST_WINDOWS_API) \ - && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION)) - // !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware -# define BOOST_FILESYSTEM_C_STR string().c_str() // use narrow, since wide not available -#else // use the native c_str, which will be narrow on POSIX, wide on Windows -# define BOOST_FILESYSTEM_C_STR c_str() -#endif - -namespace boost -{ -namespace filesystem3 -{ - -//--------------------------------------------------------------------------------------// -// basic_filebuf // -//--------------------------------------------------------------------------------------// - - template < class charT, class traits = std::char_traits<charT> > - class basic_filebuf : public std::basic_filebuf<charT,traits> - { - private: // disallow copying - basic_filebuf(const basic_filebuf&); - const basic_filebuf& operator=(const basic_filebuf&); - - public: - basic_filebuf() {} - virtual ~basic_filebuf() {} - - basic_filebuf<charT,traits>* - open(const path& p, std::ios_base::openmode mode) - { - return std::basic_filebuf<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode) - ? this : 0; - } - }; - -//--------------------------------------------------------------------------------------// -// basic_ifstream // -//--------------------------------------------------------------------------------------// - - template < class charT, class traits = std::char_traits<charT> > - class basic_ifstream : public std::basic_ifstream<charT,traits> - { - private: // disallow copying - basic_ifstream(const basic_ifstream&); - const basic_ifstream& operator=(const basic_ifstream&); - - public: - basic_ifstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - - explicit basic_ifstream(const path& p) - : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {} - - basic_ifstream(const path& p, std::ios_base::openmode mode) - : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} - - void open(const path& p) - { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); } - - void open(const path& p, std::ios_base::openmode mode) - { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } - - virtual ~basic_ifstream() {} - }; - -//--------------------------------------------------------------------------------------// -// basic_ofstream // -//--------------------------------------------------------------------------------------// - - template < class charT, class traits = std::char_traits<charT> > - class basic_ofstream : public std::basic_ofstream<charT,traits> - { - private: // disallow copying - basic_ofstream(const basic_ofstream&); - const basic_ofstream& operator=(const basic_ofstream&); - - public: - basic_ofstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - - explicit basic_ofstream(const path& p) - : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {} - - basic_ofstream(const path& p, std::ios_base::openmode mode) - : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} - - void open(const path& p) - { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); } - - void open(const path& p, std::ios_base::openmode mode) - { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } - - virtual ~basic_ofstream() {} - }; - -//--------------------------------------------------------------------------------------// -// basic_fstream // -//--------------------------------------------------------------------------------------// - - template < class charT, class traits = std::char_traits<charT> > - class basic_fstream : public std::basic_fstream<charT,traits> - { - private: // disallow copying - basic_fstream(const basic_fstream&); - const basic_fstream & operator=(const basic_fstream&); - - public: - basic_fstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - - explicit basic_fstream(const path& p) - : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, - std::ios_base::in | std::ios_base::out) {} - - basic_fstream(const path& p, std::ios_base::openmode mode) - : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} - - void open(const path& p) - { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, - std::ios_base::in | std::ios_base::out); } - - void open(const path& p, std::ios_base::openmode mode) - { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } - - virtual ~basic_fstream() {} - - }; - -//--------------------------------------------------------------------------------------// -// typedefs // -//--------------------------------------------------------------------------------------// - - typedef basic_filebuf<char> filebuf; - typedef basic_ifstream<char> ifstream; - typedef basic_ofstream<char> ofstream; - typedef basic_fstream<char> fstream; - - typedef basic_filebuf<wchar_t> wfilebuf; - typedef basic_ifstream<wchar_t> wifstream; - typedef basic_ofstream<wchar_t> wofstream; - typedef basic_fstream<wchar_t> wfstream; - -} // namespace filesystem3 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem3::filebuf; - using filesystem3::ifstream; - using filesystem3::ofstream; - using filesystem3::fstream; - using filesystem3::wfilebuf; - using filesystem3::wifstream; - using filesystem3::wfstream; - using filesystem3::wofstream; - using filesystem3::basic_filebuf; - using filesystem3::basic_ifstream; - using filesystem3::basic_ofstream; - using filesystem3::basic_fstream; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED -# endif - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM3_FSTREAM_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/operations.hpp b/3rdParty/Boost/src/boost/filesystem/v3/operations.hpp deleted file mode 100644 index 7d1608d..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/operations.hpp +++ /dev/null @@ -1,1052 +0,0 @@ -// boost/filesystem/operations.hpp ---------------------------------------------------// - -// Copyright Beman Dawes 2002-2009 -// Copyright Jan Langer 2002 -// Copyright Dietmar Kuehl 2001 -// Copyright Vladimir Prus 2002 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP -#define BOOST_FILESYSTEM3_OPERATIONS_HPP - -#include <boost/config.hpp> - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path.hpp> - -#include <boost/detail/scoped_enum_emulation.hpp> -#include <boost/detail/bitmask.hpp> -#include <boost/system/error_code.hpp> -#include <boost/system/system_error.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/iterator.hpp> -#include <boost/cstdint.hpp> -#include <boost/assert.hpp> - -#include <string> -#include <utility> // for pair -#include <ctime> -#include <vector> -#include <stack> - -#ifdef BOOST_WINDOWS_API -# include <fstream> -#endif - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -//--------------------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem3 - { - -//--------------------------------------------------------------------------------------// -// // -// support classes and enums // -// // -//--------------------------------------------------------------------------------------// - - enum file_type - { - status_error, -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - status_unknown = status_error, -# endif - file_not_found, - regular_file, - directory_file, - // the following may not apply to some operating systems or file systems - symlink_file, - block_file, - character_file, - fifo_file, - socket_file, - reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink - type_unknown, // file does exist, but isn't one of the above types or - // we don't have strong enough permission to find its type - - _detail_directory_symlink // internal use only; never exposed to users - }; - - class BOOST_FILESYSTEM_DECL file_status - { - public: - file_status() : m_value(status_error) {} - explicit file_status(file_type v) : m_value(v) {} - - void type(file_type v) { m_value = v; } - file_type type() const { return m_value; } - - bool operator==(const file_status& rhs) const { return type() == rhs.type(); } - bool operator!=(const file_status& rhs) const { return !(*this == rhs); } - - private: - // the internal representation is unspecified so that additional state - // information such as permissions can be added in the future; this - // implementation just uses file_type as the internal representation - - file_type m_value; - }; - - inline bool status_known(file_status f) { return f.type() != status_error; } - inline bool exists(file_status f) { return f.type() != status_error - && f.type() != file_not_found; } - inline bool is_regular_file(file_status f){ return f.type() == regular_file; } - inline bool is_directory(file_status f) { return f.type() == directory_file; } - inline bool is_symlink(file_status f) { return f.type() == symlink_file; } - inline bool is_other(file_status f) { return exists(f) && !is_regular_file(f) - && !is_directory(f) && !is_symlink(f); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool is_regular(file_status f) { return f.type() == regular_file; } -# endif - - struct space_info - { - // all values are byte counts - boost::uintmax_t capacity; - boost::uintmax_t free; // <= capacity - boost::uintmax_t available; // <= free - }; - - BOOST_SCOPED_ENUM_START(copy_option) - {none, fail_if_exists = none, overwrite_if_exists}; - BOOST_SCOPED_ENUM_END - -//--------------------------------------------------------------------------------------// -// implementation details // -//--------------------------------------------------------------------------------------// - - namespace detail - { - BOOST_FILESYSTEM_DECL - file_status status(const path&p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - file_status symlink_status(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool is_empty(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path initial_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy(const path& from, const path& to, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_directory(const path& from, const path& to, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_file(const path& from, const path& to, - BOOST_SCOPED_ENUM(copy_option) option, // See ticket #2925 - system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool create_directories(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool create_directory(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_directory_symlink(const path& to, const path& from, - system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_hard_link(const path& to, const path& from, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_symlink(const path& to, const path& from, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path current_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void current_path(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool equivalent(const path& p1, const path& p2, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t file_size(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - std::time_t last_write_time(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void last_write_time(const path& p, const std::time_t new_time, - system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path read_symlink(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - // For standardization, if the committee doesn't like "remove", consider "eliminate" - bool remove(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t remove_all(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void rename(const path& old_p, const path& new_p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void resize_file(const path& p, uintmax_t size, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - space_info space(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path system_complete(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path temp_directory_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path unique_path(const path& p, system::error_code* ec=0); - } // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// status query functions // -// // -//--------------------------------------------------------------------------------------// - - inline - file_status status(const path& p) {return detail::status(p);} - inline - file_status status(const path& p, system::error_code& ec) - {return detail::status(p, &ec);} - inline - file_status symlink_status(const path& p) {return detail::symlink_status(p);} - inline - file_status symlink_status(const path& p, system::error_code& ec) - {return detail::symlink_status(p, &ec);} - inline - bool exists(const path& p) {return exists(detail::status(p));} - inline - bool exists(const path& p, system::error_code& ec) - {return exists(detail::status(p, &ec));} - inline - bool is_directory(const path& p) {return is_directory(detail::status(p));} - inline - bool is_directory(const path& p, system::error_code& ec) - {return is_directory(detail::status(p, &ec));} - inline - bool is_regular_file(const path& p) {return is_regular_file(detail::status(p));} - inline - bool is_regular_file(const path& p, system::error_code& ec) - {return is_regular_file(detail::status(p, &ec));} - inline - bool is_other(const path& p) {return is_other(detail::status(p));} - inline - bool is_other(const path& p, system::error_code& ec) - {return is_other(detail::status(p, &ec));} - inline - bool is_symlink(const path& p) {return is_symlink(detail::symlink_status(p));} - inline - bool is_symlink(const path& p, system::error_code& ec) - {return is_symlink(detail::symlink_status(p, &ec));} -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline - bool is_regular(const path& p) {return is_regular(detail::status(p));} - inline - bool is_regular(const path& p, system::error_code& ec) - {return is_regular(detail::status(p, &ec));} -# endif - - inline - bool is_empty(const path& p) {return detail::is_empty(p);} - inline - bool is_empty(const path& p, system::error_code& ec) - {return detail::is_empty(p, &ec);} - -//--------------------------------------------------------------------------------------// -// // -// operational functions // -// in alphabetical order, unless otherwise noted // -// // -//--------------------------------------------------------------------------------------// - - // forward declarations - path current_path(); // fwd declaration - path initial_path(); - - BOOST_FILESYSTEM_DECL - path absolute(const path& p, const path& base=current_path()); - // If base.is_absolute(), throws nothing. Thus no need for ec argument - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline - path complete(const path& p) - { - return absolute(p, initial_path()); - } - - inline - path complete(const path& p, const path& base) - { - return absolute(p, base); - } -# endif - - inline - void copy(const path& from, const path& to) {detail::copy(from, to);} - - inline - void copy(const path& from, const path& to, system::error_code& ec) - {detail::copy(from, to, &ec);} - inline - void copy_directory(const path& from, const path& to) - {detail::copy_directory(from, to);} - inline - void copy_directory(const path& from, const path& to, system::error_code& ec) - {detail::copy_directory(from, to, &ec);} - inline - void copy_file(const path& from, const path& to, // See ticket #2925 - BOOST_SCOPED_ENUM(copy_option) option) - {detail::copy_file(from, to, option);} - inline - void copy_file(const path& from, const path& to) - {detail::copy_file(from, to, copy_option::fail_if_exists);} - inline - void copy_file(const path& from, const path& to, // See ticket #2925 - BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec) - {detail::copy_file(from, to, option, &ec);} - inline - void copy_file(const path& from, const path& to, system::error_code& ec) - {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);} - inline - void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);} - - inline - void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec) - {detail::copy_symlink(existing_symlink, new_symlink, &ec);} - inline - bool create_directories(const path& p) {return detail::create_directories(p);} - - inline - bool create_directories(const path& p, system::error_code& ec) - {return detail::create_directories(p, &ec);} - inline - bool create_directory(const path& p) {return detail::create_directory(p);} - - inline - bool create_directory(const path& p, system::error_code& ec) - {return detail::create_directory(p, &ec);} - inline - void create_directory_symlink(const path& to, const path& from) - {detail::create_directory_symlink(to, from);} - inline - void create_directory_symlink(const path& to, const path& from, system::error_code& ec) - {detail::create_directory_symlink(to, from, &ec);} - inline - void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);} - - inline - void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec) - {detail::create_hard_link(to, new_hard_link, &ec);} - inline - void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);} - - inline - void create_symlink(const path& to, const path& new_symlink, system::error_code& ec) - {detail::create_symlink(to, new_symlink, &ec);} - inline - path current_path() {return detail::current_path();} - - inline - path current_path(system::error_code& ec) {return detail::current_path(&ec);} - - inline - void current_path(const path& p) {detail::current_path(p);} - - inline - void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);} - - inline - bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);} - - inline - bool equivalent(const path& p1, const path& p2, system::error_code& ec) - {return detail::equivalent(p1, p2, &ec);} - inline - boost::uintmax_t file_size(const path& p) {return detail::file_size(p);} - - inline - boost::uintmax_t file_size(const path& p, system::error_code& ec) - {return detail::file_size(p, &ec);} - inline - boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);} - - inline - boost::uintmax_t hard_link_count(const path& p, system::error_code& ec) - {return detail::hard_link_count(p, &ec);} - inline - path initial_path() {return detail::initial_path();} - - inline - path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} - - template <class Path> - path initial_path() {return initial_path();} - template <class Path> - path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} - - inline - std::time_t last_write_time(const path& p) {return detail::last_write_time(p);} - - inline - std::time_t last_write_time(const path& p, system::error_code& ec) - {return detail::last_write_time(p, &ec);} - inline - void last_write_time(const path& p, const std::time_t new_time) - {detail::last_write_time(p, new_time);} - inline - void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec) - {detail::last_write_time(p, new_time, &ec);} - inline - path read_symlink(const path& p) {return detail::read_symlink(p);} - - inline - path read_symlink(const path& p, system::error_code& ec) - {return detail::read_symlink(p, &ec);} - inline - // For standardization, if the committee doesn't like "remove", consider "eliminate" - bool remove(const path& p) {return detail::remove(p);} - - inline - bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);} - - inline - boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);} - - inline - boost::uintmax_t remove_all(const path& p, system::error_code& ec) - {return detail::remove_all(p, &ec);} - inline - void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);} - - inline - void rename(const path& old_p, const path& new_p, system::error_code& ec) - {detail::rename(old_p, new_p, &ec);} - inline // name suggested by Scott McMurray - void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);} - - inline - void resize_file(const path& p, uintmax_t size, system::error_code& ec) - {detail::resize_file(p, size, &ec);} - inline - space_info space(const path& p) {return detail::space(p);} - - inline - space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);} - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool symbolic_link_exists(const path& p) - { return is_symlink(symlink_status(p)); } -# endif - - inline - path system_complete(const path& p) {return detail::system_complete(p);} - - inline - path system_complete(const path& p, system::error_code& ec) - {return detail::system_complete(p, &ec);} - inline - path temp_directory_path() {return detail::temp_directory_path();} - - inline - path temp_directory_path(system::error_code& ec) - {return detail::temp_directory_path(&ec);} - inline - path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%") - { return detail::unique_path(p); } - inline - path unique_path(const path& p, system::error_code& ec) - { return detail::unique_path(p, &ec); } - -//--------------------------------------------------------------------------------------// -// // -// directory_entry // -// // -//--------------------------------------------------------------------------------------// - -// GCC has a problem with a member function named path within a namespace or -// sub-namespace that also has a class named path. The workaround is to always -// fully qualify the name path when it refers to the class name. - -class BOOST_FILESYSTEM_DECL directory_entry -{ -public: - - // compiler generated copy constructor, copy assignment, and destructor apply - - directory_entry() {} - explicit directory_entry(const boost::filesystem::path& p, - file_status st = file_status(), file_status symlink_st=file_status()) - : m_path(p), m_status(st), m_symlink_status(symlink_st) - {} - - void assign(const boost::filesystem::path& p, - file_status st = file_status(), file_status symlink_st = file_status()) - { m_path = p; m_status = st; m_symlink_status = symlink_st; } - - void replace_filename(const boost::filesystem::path& p, - file_status st = file_status(), file_status symlink_st = file_status()) - { - m_path.remove_filename(); - m_path /= p; - m_status = st; - m_symlink_status = symlink_st; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - void replace_leaf(const boost::filesystem::path& p, - file_status st, file_status symlink_st) - { replace_filename(p, st, symlink_st); } -# endif - - const boost::filesystem::path& path() const {return m_path;} - file_status status() const {return m_get_status();} - file_status status(system::error_code& ec) const {return m_get_status(&ec);} - file_status symlink_status() const {return m_get_symlink_status();} - file_status symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);} - - bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;} - bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;} - bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;} - bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;} - bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;} - bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;} - -private: - boost::filesystem::path m_path; - mutable file_status m_status; // stat()-like - mutable file_status m_symlink_status; // lstat()-like - - file_status m_get_status(system::error_code* ec=0) const; - file_status m_get_symlink_status(system::error_code* ec=0) const; -}; // directory_entry - -//--------------------------------------------------------------------------------------// -// // -// directory_iterator helpers // -// // -//--------------------------------------------------------------------------------------// - -class directory_iterator; - -namespace detail -{ - BOOST_FILESYSTEM_DECL - system::error_code dir_itr_close(// never throws() - void *& handle -# if defined(BOOST_POSIX_API) - , void *& buffer -# endif - ); - - struct dir_itr_imp - { - directory_entry dir_entry; - void* handle; - -# ifdef BOOST_POSIX_API - void* buffer; // see dir_itr_increment implementation -# endif - - dir_itr_imp() : handle(0) -# ifdef BOOST_POSIX_API - , buffer(0) -# endif - {} - - ~dir_itr_imp() // never throws - { - dir_itr_close(handle -# if defined(BOOST_POSIX_API) - , buffer -# endif - ); - } - }; - - // see path::iterator: comment below - BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it, - const path& p, system::error_code* ec); - BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it, - system::error_code* ec); - -} // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// directory_iterator // -// // -//--------------------------------------------------------------------------------------// - - class directory_iterator - : public boost::iterator_facade< directory_iterator, - directory_entry, - boost::single_pass_traversal_tag > - { - public: - - directory_iterator(){} // creates the "end" iterator - - // iterator_facade derived classes don't seem to like implementations in - // separate translation unit dll's, so forward to detail functions - explicit directory_iterator(const path& p) - : m_imp(new detail::dir_itr_imp) - { detail::directory_iterator_construct(*this, p, 0); } - - directory_iterator(const path& p, system::error_code& ec) - : m_imp(new detail::dir_itr_imp) - { detail::directory_iterator_construct(*this, p, &ec); } - - ~directory_iterator() {} // never throws - - directory_iterator& increment(system::error_code& ec) - { - detail::directory_iterator_increment(*this, &ec); - return *this; - } - - private: - friend struct detail::dir_itr_imp; - friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it, - const path& p, system::error_code* ec); - friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it, - system::error_code* ec); - - // shared_ptr provides shallow-copy semantics required for InputIterators. - // m_imp.get()==0 indicates the end iterator. - boost::shared_ptr< detail::dir_itr_imp > m_imp; - - friend class boost::iterator_core_access; - - boost::iterator_facade< - directory_iterator, - directory_entry, - boost::single_pass_traversal_tag >::reference dereference() const - { - BOOST_ASSERT(m_imp.get() && "attempt to dereference end iterator"); - return m_imp->dir_entry; - } - - void increment() { detail::directory_iterator_increment(*this, 0); } - - bool equal(const directory_iterator& rhs) const - { return m_imp == rhs.m_imp; } - }; - -//--------------------------------------------------------------------------------------// -// // -// recursive_directory_iterator helpers // -// // -//--------------------------------------------------------------------------------------// - - BOOST_SCOPED_ENUM_START(symlink_option) - { - none, - no_recurse = none, // don't follow directory symlinks (default behavior) - recurse, // follow directory symlinks - _detail_no_push = recurse << 1 // internal use only - }; - BOOST_SCOPED_ENUM_END - - BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option)) - - namespace detail - { - struct recur_dir_itr_imp - { - typedef directory_iterator element_type; - std::stack< element_type, std::vector< element_type > > m_stack; - int m_level; - BOOST_SCOPED_ENUM(symlink_option) m_options; - - recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {} - - void increment(system::error_code* ec); // ec == 0 means throw on error - - void pop(); - - }; - - // Implementation is inline to avoid dynamic linking difficulties with m_stack: - // Microsoft warning C4251, m_stack needs to have dll-interface to be used by - // clients of struct 'boost::filesystem::detail::recur_dir_itr_imp' - - inline - void recur_dir_itr_imp::increment(system::error_code* ec) - // ec == 0 means throw on error - { - if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push) - m_options &= ~symlink_option::_detail_no_push; - else if (is_directory(m_stack.top()->status()) - && (!is_symlink(m_stack.top()->symlink_status()) - || (m_options & symlink_option::recurse) == symlink_option::recurse)) - { - if (ec == 0) - m_stack.push(directory_iterator(m_stack.top()->path())); - else - { - m_stack.push(directory_iterator(m_stack.top()->path(), *ec)); - if (*ec) return; - } - if (m_stack.top() != directory_iterator()) - { - ++m_level; - return; - } - m_stack.pop(); - } - - while (!m_stack.empty() && ++m_stack.top() == directory_iterator()) - { - m_stack.pop(); - --m_level; - } - } - - inline - void recur_dir_itr_imp::pop() - { - BOOST_ASSERT(m_level > 0 && "pop() on recursive_directory_iterator with level < 1"); - - do - { - m_stack.pop(); - --m_level; - } - while (!m_stack.empty() && ++m_stack.top() == directory_iterator()); - } - } // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// recursive_directory_iterator // -// // -//--------------------------------------------------------------------------------------// - - class recursive_directory_iterator - : public boost::iterator_facade< - recursive_directory_iterator, - directory_entry, - boost::single_pass_traversal_tag > - { - public: - - recursive_directory_iterator(){} // creates the "end" iterator - - explicit recursive_directory_iterator(const path& dir_path, - BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none) - : m_imp(new detail::recur_dir_itr_imp) - { - m_imp->m_options = opt; - m_imp->m_stack.push(directory_iterator(dir_path)); - if (m_imp->m_stack.top() == directory_iterator()) - { m_imp.reset (); } - } - - recursive_directory_iterator(const path& dir_path, - BOOST_SCOPED_ENUM(symlink_option) opt, - system::error_code & ec) - : m_imp(new detail::recur_dir_itr_imp) - { - m_imp->m_options = opt; - m_imp->m_stack.push(directory_iterator(dir_path, ec)); - if (m_imp->m_stack.top() == directory_iterator()) - { m_imp.reset (); } - } - - recursive_directory_iterator(const path& dir_path, - system::error_code & ec) - : m_imp(new detail::recur_dir_itr_imp) - { - m_imp->m_options = symlink_option::none; - m_imp->m_stack.push(directory_iterator(dir_path, ec)); - if (m_imp->m_stack.top() == directory_iterator()) - { m_imp.reset (); } - } - - recursive_directory_iterator& increment(system::error_code& ec) - { - BOOST_ASSERT(m_imp.get() && "increment() on end recursive_directory_iterator"); - m_imp->increment(&ec); - return *this; - } - - int level() const - { - BOOST_ASSERT(m_imp.get() && "level() on end recursive_directory_iterator"); - return m_imp->m_level; - } - - bool no_push_pending() const - { - BOOST_ASSERT(m_imp.get() && "is_no_push_requested() on end recursive_directory_iterator"); - return (m_imp->m_options & symlink_option::_detail_no_push) - == symlink_option::_detail_no_push; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - bool no_push_request() const { return no_push_pending(); } -# endif - - void pop() - { - BOOST_ASSERT(m_imp.get() && "pop() on end recursive_directory_iterator"); - m_imp->pop(); - if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator - } - - void no_push(bool value=true) - { - BOOST_ASSERT(m_imp.get() && "no_push() on end recursive_directory_iterator"); - if (value) - m_imp->m_options |= symlink_option::_detail_no_push; - else - m_imp->m_options &= ~symlink_option::_detail_no_push; - } - - file_status status() const - { - BOOST_ASSERT(m_imp.get() - && "status() on end recursive_directory_iterator"); - return m_imp->m_stack.top()->status(); - } - - file_status symlink_status() const - { - BOOST_ASSERT(m_imp.get() - && "symlink_status() on end recursive_directory_iterator"); - return m_imp->m_stack.top()->symlink_status(); - } - - private: - - // shared_ptr provides shallow-copy semantics required for InputIterators. - // m_imp.get()==0 indicates the end iterator. - boost::shared_ptr< detail::recur_dir_itr_imp > m_imp; - - friend class boost::iterator_core_access; - - boost::iterator_facade< - recursive_directory_iterator, - directory_entry, - boost::single_pass_traversal_tag >::reference - dereference() const - { - BOOST_ASSERT(m_imp.get() && "dereference of end recursive_directory_iterator"); - return *m_imp->m_stack.top(); - } - - void increment() - { - BOOST_ASSERT(m_imp.get() && "increment of end recursive_directory_iterator"); - m_imp->increment(0); - if (m_imp->m_stack.empty()) - m_imp.reset(); // done, so make end iterator - } - - bool equal(const recursive_directory_iterator& rhs) const - { return m_imp == rhs.m_imp; } - - }; - -# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - typedef recursive_directory_iterator wrecursive_directory_iterator; -# endif - -//--------------------------------------------------------------------------------------// -// // -// class filesystem_error // -// // -//--------------------------------------------------------------------------------------// - - class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error - { - // see http://www.boost.org/more/error_handling.html for design rationale - - // all functions are inline to avoid issues with crossing dll boundaries - - public: - // compiler generates copy constructor and copy assignment - - filesystem_error( - const std::string & what_arg, system::error_code ec) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new m_imp); - } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error( - const std::string & what_arg, const path& path1_arg, - system::error_code ec) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new m_imp); - m_imp_ptr->m_path1 = path1_arg; - } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error( - const std::string & what_arg, const path& path1_arg, - const path& path2_arg, system::error_code ec) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new m_imp); - m_imp_ptr->m_path1 = path1_arg; - m_imp_ptr->m_path2 = path2_arg; - } - catch (...) { m_imp_ptr.reset(); } - } - - ~filesystem_error() throw() {} - - const path& path1() const - { - static const path empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ; - } - const path& path2() const - { - static const path empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ; - } - - const char* what() const throw() - { - if (!m_imp_ptr.get()) - return system::system_error::what(); - - try - { - if (m_imp_ptr->m_what.empty()) - { - m_imp_ptr->m_what = system::system_error::what(); - if (!m_imp_ptr->m_path1.empty()) - { - m_imp_ptr->m_what += ": \""; - m_imp_ptr->m_what += m_imp_ptr->m_path1.string(); - m_imp_ptr->m_what += "\""; - } - if (!m_imp_ptr->m_path2.empty()) - { - m_imp_ptr->m_what += ", \""; - m_imp_ptr->m_what += m_imp_ptr->m_path2.string(); - m_imp_ptr->m_what += "\""; - } - } - return m_imp_ptr->m_what.c_str(); - } - catch (...) - { - return system::system_error::what(); - } - } - - private: - struct m_imp - { - path m_path1; // may be empty() - path m_path2; // may be empty() - std::string m_what; // not built until needed - }; - boost::shared_ptr<m_imp> m_imp_ptr; - }; - -// test helper -----------------------------------------------------------------------// - -// Not part of the documented interface since false positives are possible; -// there is no law that says that an OS that has large stat.st_size -// actually supports large file sizes. - - namespace detail - { - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); - } - - } // namespace filesystem3 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem3::absolute; - using filesystem3::block_file; - using filesystem3::character_file; -// using filesystem3::copy; - using filesystem3::copy_file; - using filesystem3::copy_option; - using filesystem3::copy_symlink; - using filesystem3::create_directories; - using filesystem3::create_directory; - using filesystem3::create_hard_link; - using filesystem3::create_symlink; - using filesystem3::create_directory_symlink; - using filesystem3::current_path; - using filesystem3::directory_entry; - using filesystem3::directory_file; - using filesystem3::directory_iterator; - using filesystem3::equivalent; - using filesystem3::exists; - using filesystem3::fifo_file; - using filesystem3::file_not_found; - using filesystem3::file_size; - using filesystem3::file_status; - using filesystem3::file_type; - using filesystem3::filesystem_error; - using filesystem3::hard_link_count; - using filesystem3::initial_path; - using filesystem3::is_directory; - using filesystem3::is_directory; - using filesystem3::is_empty; - using filesystem3::is_other; - using filesystem3::is_regular_file; - using filesystem3::is_symlink; - using filesystem3::last_write_time; - using filesystem3::read_symlink; - using filesystem3::recursive_directory_iterator; - using filesystem3::regular_file; - using filesystem3::reparse_file; - using filesystem3::remove; - using filesystem3::remove_all; - using filesystem3::rename; - using filesystem3::resize_file; - using filesystem3::socket_file; - using filesystem3::space; - using filesystem3::space_info; - using filesystem3::status; - using filesystem3::status_error; - using filesystem3::status_known; - using filesystem3::symlink_file; - using filesystem3::symlink_option; - using filesystem3::symlink_status; - using filesystem3::system_complete; - using filesystem3::temp_directory_path; - using filesystem3::type_unknown; - using filesystem3::unique_path; -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem3::is_regular; - using filesystem3::status_unknown; - using filesystem3::symbolic_link_exists; - //using filesystem3::wdirectory_iterator; - //using filesystem3::wdirectory_entry; -# endif - namespace detail - { - using filesystem3::detail::possible_large_file_size_support; - } - } -} - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/path.hpp b/3rdParty/Boost/src/boost/filesystem/v3/path.hpp deleted file mode 100644 index f81b631..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/path.hpp +++ /dev/null @@ -1,713 +0,0 @@ -// filesystem path.hpp ---------------------------------------------------------------// - -// Copyright Beman Dawes 2002-2005, 2009 -// Copyright Vladimir Prus 2002 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -// path::stem(), extension(), and replace_extension() are based on -// basename(), extension(), and change_extension() from the original -// filesystem/convenience.hpp header by Vladimir Prus. - -#ifndef BOOST_FILESYSTEM_PATH_HPP -#define BOOST_FILESYSTEM_PATH_HPP - -#include <boost/config.hpp> - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path_traits.hpp> // includes <cwchar> -#include <boost/system/error_code.hpp> -#include <boost/system/system_error.hpp> -#include <boost/iterator/iterator_facade.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/io/detail/quoted_manip.hpp> -#include <boost/static_assert.hpp> -#include <string> -#include <iterator> -#include <cstring> -#include <iosfwd> -#include <stdexcept> -#include <cassert> -#include <locale> -#include <algorithm> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -namespace boost -{ -namespace filesystem3 -{ - //------------------------------------------------------------------------------------// - // // - // class path // - // // - //------------------------------------------------------------------------------------// - - class BOOST_FILESYSTEM_DECL path - { - public: - - // value_type is the character type used by the operating system API to - // represent paths. - -# ifdef BOOST_WINDOWS_API - typedef wchar_t value_type; -# else - typedef char value_type; -# endif - typedef std::basic_string<value_type> string_type; - typedef std::codecvt<wchar_t, char, std::mbstate_t> codecvt_type; - - - // ----- character encoding conversions ----- - - // Following the principle of least astonishment, path input arguments - // passed to or obtained from the operating system via objects of - // class path behave as if they were directly passed to or - // obtained from the O/S API, unless conversion is explicitly requested. - // - // POSIX specfies that path strings are passed unchanged to and from the - // API. Note that this is different from the POSIX command line utilities, - // which convert according to a locale. - // - // Thus for POSIX, char strings do not undergo conversion. wchar_t strings - // are converted to/from char using the path locale or, if a conversion - // argument is given, using a conversion object modeled on - // std::wstring_convert. - // - // The path locale, which is global to the thread, can be changed by the - // imbue() function. It is initialized to an implementation defined locale. - // - // For Windows, wchar_t strings do not undergo conversion. char strings - // are converted using the "ANSI" or "OEM" code pages, as determined by - // the AreFileApisANSI() function, or, if a conversion argument is given, - // using a conversion object modeled on std::wstring_convert. - // - // See m_pathname comments for further important rationale. - - // TODO: rules needed for operating systems that use / or . - // differently, or format directory paths differently from file paths. - // - // ************************************************************************ - // - // More work needed: How to handle an operating system that may have - // slash characters or dot characters in valid filenames, either because - // it doesn't follow the POSIX standard, or because it allows MBCS - // filename encodings that may contain slash or dot characters. For - // example, ISO/IEC 2022 (JIS) encoding which allows switching to - // JIS x0208-1983 encoding. A valid filename in this set of encodings is - // 0x1B 0x24 0x42 [switch to X0208-1983] 0x24 0x2F [U+304F Kiragana letter KU] - // ^^^^ - // Note that 0x2F is the ASCII slash character - // - // ************************************************************************ - - // Supported source arguments: half-open iterator range, container, c-array, - // and single pointer to null terminated string. - - // All source arguments except pointers to null terminated byte strings support - // multi-byte character strings which may have embedded nulls. Embedded null - // support is required for some Asian languages on Windows. - - // "const codecvt_type& cvt=codecvt()" default arguments are not used because some - // compilers, such as Microsoft prior to VC++ 10, do not handle defaults correctly - // in templates. - - // ----- constructors ----- - - path(){} - - path(const path& p) : m_pathname(p.m_pathname) {} - - template <class Source> - path(Source const& source, - typename boost::enable_if<path_traits::is_pathable< - typename boost::decay<Source>::type> >::type* =0) - { - path_traits::dispatch(source, m_pathname, codecvt()); - } - - template <class Source> - path(Source const& source, const codecvt_type& cvt) - // see note above explaining why codecvt() default arguments are not used - { - path_traits::dispatch(source, m_pathname, cvt); - } - - template <class InputIterator> - path(InputIterator begin, InputIterator end) - { - if (begin != end) - { - std::basic_string<typename std::iterator_traits<InputIterator>::value_type> - s(begin, end); - path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt()); - } - } - - template <class InputIterator> - path(InputIterator begin, InputIterator end, const codecvt_type& cvt) - { - if (begin != end) - { - std::basic_string<typename std::iterator_traits<InputIterator>::value_type> - s(begin, end); - path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); - } - } - - // ----- assignments ----- - - path& operator=(const path& p) - { - m_pathname = p.m_pathname; - return *this; - } - - template <class Source> - typename boost::enable_if<path_traits::is_pathable< - typename boost::decay<Source>::type>, path&>::type - operator=(Source const& source) - { - m_pathname.clear(); - path_traits::dispatch(source, m_pathname, codecvt()); - return *this; - } - - template <class Source> - path& assign(Source const& source, const codecvt_type& cvt) - { - m_pathname.clear(); - path_traits::dispatch(source, m_pathname, cvt); - return *this; - } - - template <class InputIterator> - path& assign(InputIterator begin, InputIterator end) - { - return assign(begin, end, codecvt()); - } - - template <class InputIterator> - path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt) - { - m_pathname.clear(); - if (begin != end) - { - std::basic_string<typename std::iterator_traits<InputIterator>::value_type> - s(begin, end); - path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); - } - return *this; - } - - // ----- appends ----- - - // if a separator is added, it is the preferred separator for the platform; - // slash for POSIX, backslash for Windows - - path& operator/=(const path& p); - - template <class Source> - typename boost::enable_if<path_traits::is_pathable< - typename boost::decay<Source>::type>, path&>::type - operator/=(Source const& source) - { - return append(source, codecvt()); - } - - template <class Source> - path& append(Source const& source, const codecvt_type& cvt); - - template <class InputIterator> - path& append(InputIterator begin, InputIterator end) - { - return append(begin, end, codecvt()); - } - - template <class InputIterator> - path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt); - - // ----- modifiers ----- - - void clear() { m_pathname.clear(); } - path& make_preferred() -# ifdef BOOST_POSIX_API - { return *this; } // POSIX no effect -# else // BOOST_WINDOWS_API - ; // change slashes to backslashes -# endif - path& remove_filename(); - path& replace_extension(const path& new_extension = path()); - void swap(path& rhs) { m_pathname.swap(rhs.m_pathname); } - - // ----- observers ----- - - // For operating systems that format file paths differently than directory - // paths, return values from observers are formatted as file names unless there - // is a trailing separator, in which case returns are formatted as directory - // paths. POSIX and Windows make no such distinction. - - // Implementations are permitted to return const values or const references. - - // The string or path returned by an observer are specified as being formatted - // as "native" or "generic". - // - // For POSIX, these are all the same format; slashes and backslashes are as input and - // are not modified. - // - // For Windows, native: as input; slashes and backslashes are not modified; - // this is the format of the internally stored string. - // generic: backslashes are converted to slashes - - // ----- native format observers ----- - - const string_type& native() const { return m_pathname; } // Throws: nothing - const value_type* c_str() const { return m_pathname.c_str(); } // Throws: nothing - - template <class String> - String string() const; - - template <class String> - String string(const codecvt_type& cvt) const; - -# ifdef BOOST_WINDOWS_API - const std::string string() const { return string(codecvt()); } - const std::string string(const codecvt_type& cvt) const - { - std::string tmp; - if (!m_pathname.empty()) - path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(), - tmp, cvt); - return tmp; - } - - // string_type is std::wstring, so there is no conversion - const std::wstring& wstring() const { return m_pathname; } - const std::wstring& wstring(const codecvt_type&) const { return m_pathname; } - -# else // BOOST_POSIX_API - // string_type is std::string, so there is no conversion - const std::string& string() const { return m_pathname; } - const std::string& string(const codecvt_type&) const { return m_pathname; } - - const std::wstring wstring() const { return wstring(codecvt()); } - const std::wstring wstring(const codecvt_type& cvt) const - { - std::wstring tmp; - if (!m_pathname.empty()) - path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(), - tmp, cvt); - return tmp; - } - -# endif - - // ----- generic format observers ----- - - template <class String> - String generic_string() const; - - template <class String> - String generic_string(const codecvt_type& cvt) const; - -# ifdef BOOST_WINDOWS_API - const std::string generic_string() const { return generic_string(codecvt()); } - const std::string generic_string(const codecvt_type& cvt) const; - const std::wstring generic_wstring() const; - const std::wstring generic_wstring(const codecvt_type&) const { return generic_wstring(); }; - -# else // BOOST_POSIX_API - // On POSIX-like systems, the generic format is the same as the native format - const std::string& generic_string() const { return m_pathname; } - const std::string& generic_string(const codecvt_type&) const { return m_pathname; } - const std::wstring generic_wstring() const { return wstring(codecvt()); } - const std::wstring generic_wstring(const codecvt_type& cvt) const { return wstring(cvt); } - -# endif - - // ----- decomposition ----- - - path root_path() const; - path root_name() const; // returns 0 or 1 element path - // even on POSIX, root_name() is non-empty() for network paths - path root_directory() const; // returns 0 or 1 element path - path relative_path() const; - path parent_path() const; - path filename() const; // returns 0 or 1 element path - path stem() const; // returns 0 or 1 element path - path extension() const; // returns 0 or 1 element path - - // ----- query ----- - - bool empty() const { return m_pathname.empty(); } // name consistent with std containers - bool has_root_path() const { return has_root_directory() || has_root_name(); } - bool has_root_name() const { return !root_name().empty(); } - bool has_root_directory() const { return !root_directory().empty(); } - bool has_relative_path() const { return !relative_path().empty(); } - bool has_parent_path() const { return !parent_path().empty(); } - bool has_filename() const { return !m_pathname.empty(); } - bool has_stem() const { return !stem().empty(); } - bool has_extension() const { return !extension().empty(); } - bool is_absolute() const - { -# ifdef BOOST_WINDOWS_API - return has_root_name() && has_root_directory(); -# else - return has_root_directory(); -# endif - } - bool is_relative() const { return !is_absolute(); } - - // ----- imbue ----- - - static std::locale imbue(const std::locale& loc); - - // ----- codecvt ----- - - static const codecvt_type& codecvt() - { - return *wchar_t_codecvt_facet(); - } - - // ----- iterators ----- - - class iterator; - typedef iterator const_iterator; - - iterator begin() const; - iterator end() const; - - // ----- deprecated functions ----- - -# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED) -# error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined -# endif - -# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - // recently deprecated functions supplied by default - path& normalize() { return m_normalize(); } - path& remove_leaf() { return remove_filename(); } - path leaf() const { return filename(); } - path branch_path() const { return parent_path(); } - bool has_leaf() const { return !m_pathname.empty(); } - bool has_branch_path() const { return !parent_path().empty(); } - bool is_complete() const { return is_absolute(); } -# endif - -# if defined(BOOST_FILESYSTEM_DEPRECATED) - // deprecated functions with enough signature or semantic changes that they are - // not supplied by default - const std::string file_string() const { return string(); } - const std::string directory_string() const { return string(); } - const std::string native_file_string() const { return string(); } - const std::string native_directory_string() const { return string(); } - const string_type external_file_string() const { return native(); } - const string_type external_directory_string() const { return native(); } - - // older functions no longer supported - //typedef bool (*name_check)(const std::string & name); - //basic_path(const string_type& str, name_check) { operator/=(str); } - //basic_path(const typename string_type::value_type* s, name_check) - // { operator/=(s);} - //static bool default_name_check_writable() { return false; } - //static void default_name_check(name_check) {} - //static name_check default_name_check() { return 0; } - //basic_path& canonize(); -# endif - -//--------------------------------------------------------------------------------------// -// class path private members // -//--------------------------------------------------------------------------------------// - - private: -# if defined(_MSC_VER) -# pragma warning(push) // Save warning settings -# pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>' -# endif // needs to have dll-interface... -/* - m_pathname has the type, encoding, and format required by the native - operating system. Thus for POSIX and Windows there is no conversion for - passing m_pathname.c_str() to the O/S API or when obtaining a path from the - O/S API. POSIX encoding is unspecified other than for dot and slash - characters; POSIX just treats paths as a sequence of bytes. Windows - encoding is UCS-2 or UTF-16 depending on the version. -*/ - string_type m_pathname; // Windows: as input; backslashes NOT converted to slashes, - // slashes NOT converted to backslashes -# if defined(_MSC_VER) -# pragma warning(pop) // restore warning settings. -# endif - - string_type::size_type m_append_separator_if_needed(); - // Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0. - // Note: An append is never performed if size()==0, so a returned 0 is unambiguous. - - void m_erase_redundant_separator(string_type::size_type sep_pos); - string_type::size_type m_parent_path_end() const; - - path& m_normalize(); - - // Was qualified; como433beta8 reports: - // warning #427-D: qualified name is not allowed in member declaration - friend class iterator; - friend bool operator<(const path& lhs, const path& rhs); - - // see path::iterator::increment/decrement comment below - static void m_path_iterator_increment(path::iterator & it); - static void m_path_iterator_decrement(path::iterator & it); - - static const codecvt_type *& wchar_t_codecvt_facet(); - - }; // class path - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - typedef path wpath; -# endif - - //------------------------------------------------------------------------------------// - // class path::iterator // - //------------------------------------------------------------------------------------// - - class path::iterator - : public boost::iterator_facade< - path::iterator, - path const, - boost::bidirectional_traversal_tag > - { - private: - friend class boost::iterator_core_access; - friend class boost::filesystem3::path; - friend void m_path_iterator_increment(path::iterator & it); - friend void m_path_iterator_decrement(path::iterator & it); - - const path& dereference() const { return m_element; } - - bool equal(const iterator & rhs) const - { - return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; - } - - // iterator_facade derived classes don't seem to like implementations in - // separate translation unit dll's, so forward to class path static members - void increment() { m_path_iterator_increment(*this); } - void decrement() { m_path_iterator_decrement(*this); } - - path m_element; // current element - const path * m_path_ptr; // path being iterated over - string_type::size_type m_pos; // position of name in - // m_path_ptr->m_pathname. The - // end() iterator is indicated by - // m_pos == m_path_ptr->m_pathname.size() - }; // path::iterator - - //------------------------------------------------------------------------------------// - // // - // non-member functions // - // // - //------------------------------------------------------------------------------------// - - // std::lexicographical_compare would infinately recurse because path iterators - // yield paths, so provide a path aware version - inline bool lexicographical_compare(path::iterator first1, path::iterator last1, - path::iterator first2, path::iterator last2) - { - for (; first1 != last1 && first2 != last2 ; ++first1, ++first2) - { - if (first1->native() < first2->native()) return true; - if (first2->native() < first1->native()) return false; - } - return first1 == last1 && first2 != last2; - } - - inline bool operator<(const path& lhs, const path& rhs) - { - return lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); - } - - inline bool operator<=(const path& lhs, const path& rhs) { return !(rhs < lhs); } - inline bool operator> (const path& lhs, const path& rhs) { return rhs < lhs; } - inline bool operator>=(const path& lhs, const path& rhs) { return !(lhs < rhs); } - - // equality operators act as if comparing generic format strings, to achieve the - // effect of lexicographical_compare element by element compare. - // operator==() efficiency is a concern; a user reported the original version 2 - // !(lhs < rhs) && !(rhs < lhs) implementation caused a serious performance problem - // for a map of 10,000 paths. - -# ifdef BOOST_WINDOWS_API - inline bool operator==(const path& lhs, const path::value_type* rhs) - { - const path::value_type* l(lhs.c_str()); - while ((*l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\')) - && *l) { ++l; ++rhs; } - return *l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\'); - } - inline bool operator==(const path& lhs, const path& rhs) { return lhs == rhs.c_str(); } - inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs == rhs.c_str(); } - inline bool operator==(const path::string_type& lhs, const path& rhs) { return rhs == lhs.c_str(); } - inline bool operator==(const path::value_type* lhs, const path& rhs) { return rhs == lhs; } -# else // BOOST_POSIX_API - inline bool operator==(const path& lhs, const path& rhs) { return lhs.native() == rhs.native(); } - inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs.native() == rhs; } - inline bool operator==(const path& lhs, const path::value_type* rhs) { return lhs.native() == rhs; } - inline bool operator==(const path::string_type& lhs, const path& rhs) { return lhs == rhs.native(); } - inline bool operator==(const path::value_type* lhs, const path& rhs) { return lhs == rhs.native(); } -# endif - - inline bool operator!=(const path& lhs, const path& rhs) { return !(lhs == rhs); } - inline bool operator!=(const path& lhs, const path::string_type& rhs) { return !(lhs == rhs); } - inline bool operator!=(const path& lhs, const path::value_type* rhs) { return !(lhs == rhs); } - inline bool operator!=(const path::string_type& lhs, const path& rhs) { return !(lhs == rhs); } - inline bool operator!=(const path::value_type* lhs, const path& rhs) { return !(lhs == rhs); } - - inline void swap(path& lhs, path& rhs) { lhs.swap(rhs); } - - inline path operator/(const path& lhs, const path& rhs) { return path(lhs) /= rhs; } - - // inserters and extractors - // use boost::io::quoted() to handle spaces in paths - // use '&' as escape character to ease use for Windows paths - - template <class Char, class Traits> - inline std::basic_ostream<Char, Traits>& - operator<<(std::basic_ostream<Char, Traits>& os, const path& p) - { - return os - << boost::io::quoted(p.string<std::basic_string<Char> >(), static_cast<Char>('&')); - } - - template <class Char, class Traits> - inline std::basic_istream<Char, Traits>& - operator>>(std::basic_istream<Char, Traits>& is, path& p) - { - std::basic_string<Char> str; - is >> boost::io::quoted(str, static_cast<Char>('&')); - p = str; - return is; - } - - // name_checks - - // These functions are holdovers from version 1. It isn't clear they have much - // usefulness, or how to generalize them for later versions. - - BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool native(const std::string & name); - -//--------------------------------------------------------------------------------------// -// class path member template implementation // -//--------------------------------------------------------------------------------------// - - template <class InputIterator> - path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt) - { - if (begin == end) - return *this; - string_type::size_type sep_pos(m_append_separator_if_needed()); - std::basic_string<typename std::iterator_traits<InputIterator>::value_type> - s(begin, end); - path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); - if (sep_pos) - m_erase_redundant_separator(sep_pos); - return *this; - } - - template <class Source> - path& path::append(Source const & source, const codecvt_type& cvt) - { - if (path_traits::empty(source)) - return *this; - string_type::size_type sep_pos(m_append_separator_if_needed()); - path_traits::dispatch(source, m_pathname, cvt); - if (sep_pos) - m_erase_redundant_separator(sep_pos); - return *this; - } - -//--------------------------------------------------------------------------------------// -// class path member template specializations // -//--------------------------------------------------------------------------------------// - - template <> inline - std::string path::string<std::string>() const - { return string(); } - - template <> inline - std::wstring path::string<std::wstring>() const - { return wstring(); } - - template <> inline - std::string path::string<std::string>(const codecvt_type& cvt) const - { return string(cvt); } - - template <> inline - std::wstring path::string<std::wstring>(const codecvt_type& cvt) const - { return wstring(cvt); } - - template <> inline - std::string path::generic_string<std::string>() const - { return generic_string(); } - - template <> inline - std::wstring path::generic_string<std::wstring>() const - { return generic_wstring(); } - - template <> inline - std::string path::generic_string<std::string>(const codecvt_type& cvt) const - { return generic_string(cvt); } - - template <> inline - std::wstring path::generic_string<std::wstring>(const codecvt_type& cvt) const - { return generic_wstring(cvt); } - - -} // namespace filesystem3 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem3::path; -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem3::wpath; -# endif - using filesystem3::lexicographical_compare; - using filesystem3::portable_posix_name; - using filesystem3::windows_name; - using filesystem3::portable_name; - using filesystem3::portable_directory_name; - using filesystem3::portable_file_name; - using filesystem3::native; - using filesystem3::swap; - using filesystem3::operator<; - using filesystem3::operator==; - using filesystem3::operator!=; - using filesystem3::operator>; - using filesystem3::operator<=; - using filesystem3::operator>=; - using filesystem3::operator/; - using filesystem3::operator<<; - using filesystem3::operator>>; - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas - -#endif // BOOST_FILESYSTEM_PATH_HPP diff --git a/3rdParty/Boost/src/boost/foreach.hpp b/3rdParty/Boost/src/boost/foreach.hpp index db5b203..571b45c 100644 --- a/3rdParty/Boost/src/boost/foreach.hpp +++ b/3rdParty/Boost/src/boost/foreach.hpp @@ -15,6 +15,7 @@ // Alisdair Meredith - For help porting to Borland // Stefan Slapeta - For help porting to Intel // David Jenkins - For help finding a Microsoft Code Analysis bug +// mimomorin@... - For a patch to use rvalue refs on supporting compilers #ifndef BOOST_FOREACH @@ -30,8 +31,10 @@ #include <boost/detail/workaround.hpp> // Some compilers let us detect even const-qualified rvalues at compile-time -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ - || (BOOST_WORKAROUND(__GNUC__, >= 4) && !defined(BOOST_INTEL) && !defined(BOOST_CLANG)) \ +#if !defined(BOOST_NO_RVALUE_REFERENCES) \ + || BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ + || (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) && \ + !defined(BOOST_CLANG)) \ || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL) && \ !defined(BOOST_CLANG)) # define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION @@ -80,6 +83,7 @@ #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_abstract.hpp> #include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_rvalue_reference.hpp> #include <boost/iterator/iterator_traits.hpp> #include <boost/utility/addressof.hpp> #include <boost/foreach_fwd.hpp> @@ -214,12 +218,6 @@ template<typename Bool1> inline boost::mpl::not_<Bool1> *not_(Bool1 *) { return 0; } template<typename T> -inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } - -template<typename T> -inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; } - -template<typename T> inline boost::is_array<T> *is_array_(T const &) { return 0; } template<typename T> @@ -230,6 +228,17 @@ template<typename T> inline boost::mpl::true_ *is_const_(T const &) { return 0; } #endif +#ifdef BOOST_NO_RVALUE_REFERENCES +template<typename T> +inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } + +template<typename T> +inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; } +#else +template<typename T> +inline boost::is_rvalue_reference<T &&> *is_rvalue_(T &&, int) { return 0; } +#endif + /////////////////////////////////////////////////////////////////////////////// // auto_any_t/auto_any // General utility for putting an object of any type into automatic storage @@ -428,7 +437,6 @@ inline T (*&to_ptr(T (&)[N]))[N] static T (*t)[N] = 0; return t; } -#endif /////////////////////////////////////////////////////////////////////////////// // derefof @@ -445,7 +453,23 @@ inline T &derefof(T *t) ); } -#ifdef BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION +# define BOOST_FOREACH_DEREFOF(T) boost::foreach_detail_::derefof(*T) +#else +# define BOOST_FOREACH_DEREFOF(T) (*T) +#endif + +#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ + && !defined(BOOST_NO_RVALUE_REFERENCES) +/////////////////////////////////////////////////////////////////////////////// +// Rvalue references makes it drop-dead simple to detect at compile time +// whether an expression is an rvalue. +/////////////////////////////////////////////////////////////////////////////// + +# define BOOST_FOREACH_IS_RVALUE(COL) \ + boost::foreach_detail_::is_rvalue_((COL), 0) + +#elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ + && defined(BOOST_NO_RVALUE_REFERENCES) /////////////////////////////////////////////////////////////////////////////// // Detect at compile-time whether an expression yields an rvalue or // an lvalue. This is rather non-standard, but some popular compilers @@ -647,7 +671,7 @@ begin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator; return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>( - iterator(boost::begin(derefof(auto_any_cast<type *, boost::mpl::false_>(col))))); + iterator(boost::begin(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION @@ -687,7 +711,7 @@ end(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator; return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>( - iterator(boost::end(derefof(auto_any_cast<type *, boost::mpl::false_>(col))))); + iterator(boost::end(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION @@ -766,7 +790,7 @@ rbegin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator; return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>( - iterator(boost::rbegin(derefof(auto_any_cast<type *, boost::mpl::false_>(col))))); + iterator(boost::rbegin(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION @@ -809,7 +833,7 @@ rend(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator; return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>( - iterator(boost::rend(derefof(auto_any_cast<type *, boost::mpl::false_>(col))))); + iterator(boost::rend(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION @@ -902,7 +926,7 @@ rderef(auto_any_t cur, type2type<T, C> *) boost::foreach_detail_::to_ptr(COL) \ , boost_foreach_argument_dependent_lookup_hack_value)) -#ifdef BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION +#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) /////////////////////////////////////////////////////////////////////////////// // R-values and const R-values supported here with zero runtime overhead /////////////////////////////////////////////////////////////////////////////// diff --git a/3rdParty/Boost/src/boost/function.hpp b/3rdParty/Boost/src/boost/function.hpp index bdb2769..b72842b 100644 --- a/3rdParty/Boost/src/boost/function.hpp +++ b/3rdParty/Boost/src/boost/function.hpp @@ -23,8 +23,8 @@ // in anything that may be included by function_template.hpp doesn't break #include <boost/function/detail/prologue.hpp> -// Visual Age C++ doesn't handle the file iteration well -#if BOOST_WORKAROUND(__IBMCPP__, >= 500) +// Older Visual Age C++ version do not handle the file iteration well +#if BOOST_WORKAROUND(__IBMCPP__, >= 500) && BOOST_WORKAROUND(__IBMCPP__, < 800) # if BOOST_FUNCTION_MAX_ARGS >= 0 # include <boost/function/function0.hpp> # endif diff --git a/3rdParty/Boost/src/boost/function/function_base.hpp b/3rdParty/Boost/src/boost/function/function_base.hpp index fe9bbbe..78b7dd1 100644 --- a/3rdParty/Boost/src/boost/function/function_base.hpp +++ b/3rdParty/Boost/src/boost/function/function_base.hpp @@ -203,11 +203,11 @@ namespace boost { { switch (op) { case clone_functor_tag: - out_buffer.obj_ref.obj_ptr = in_buffer.obj_ref.obj_ptr; + out_buffer.obj_ref = in_buffer.obj_ref; return; case move_functor_tag: - out_buffer.obj_ref.obj_ptr = in_buffer.obj_ref.obj_ptr; + out_buffer.obj_ref = in_buffer.obj_ref; in_buffer.obj_ref.obj_ptr = 0; return; @@ -315,14 +315,18 @@ namespace boost { if (op == clone_functor_tag || op == move_functor_tag) { const functor_type* in_functor = reinterpret_cast<const functor_type*>(&in_buffer.data); - new ((void*)&out_buffer.data) functor_type(*in_functor); + new (reinterpret_cast<void*>(&out_buffer.data)) functor_type(*in_functor); if (op == move_functor_tag) { - reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor(); + functor_type* f = reinterpret_cast<functor_type*>(&in_buffer.data); + (void)f; // suppress warning about the value of f not being used (MSVC) + f->~Functor(); } } else if (op == destroy_functor_tag) { // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. - reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor(); + functor_type* f = reinterpret_cast<functor_type*>(&out_buffer.data); + (void)f; // suppress warning about the value of f not being used (MSVC) + f->~Functor(); } else if (op == check_functor_type_tag) { const detail::sp_typeinfo& check_type = *out_buffer.type.type; @@ -369,8 +373,10 @@ namespace boost { // Clone the functor // GCC 2.95.3 gets the CV qualifiers wrong here, so we // can't do the static_cast that we should do. + // jewillco: Changing this to static_cast because GCC 2.95.3 is + // obsolete. const functor_type* f = - (const functor_type*)(in_buffer.obj_ptr); + static_cast<const functor_type*>(in_buffer.obj_ptr); functor_type* new_f = new functor_type(*f); out_buffer.obj_ptr = new_f; } else if (op == move_functor_tag) { @@ -474,7 +480,7 @@ namespace boost { // GCC 2.95.3 gets the CV qualifiers wrong here, so we // can't do the static_cast that we should do. const functor_wrapper_type* f = - (const functor_wrapper_type*)(in_buffer.obj_ptr); + static_cast<const functor_wrapper_type*>(in_buffer.obj_ptr); wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*f)); wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); wrapper_allocator.construct(copy, *f); @@ -671,7 +677,7 @@ public: detail::function::check_functor_type_tag); // GCC 2.95.3 gets the CV qualifiers wrong here, so we // can't do the static_cast that we should do. - return (const Functor*)(type_result.obj_ptr); + return static_cast<const Functor*>(type_result.obj_ptr); } template<typename F> @@ -715,7 +721,7 @@ public: public: // should be protected, but GCC 2.95.3 will fail to allow access detail::function::vtable_base* get_vtable() const { return reinterpret_cast<detail::function::vtable_base*>( - reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01); + reinterpret_cast<std::size_t>(vtable) & ~static_cast<std::size_t>(0x01)); } bool has_trivial_copy_and_destroy() const { diff --git a/3rdParty/Boost/src/boost/function/function_template.hpp b/3rdParty/Boost/src/boost/function/function_template.hpp index 6a99109..f9699d0 100644 --- a/3rdParty/Boost/src/boost/function/function_template.hpp +++ b/3rdParty/Boost/src/boost/function/function_template.hpp @@ -486,19 +486,19 @@ namespace boost { BOOST_FUNCTION_TEMPLATE_ARGS); template<typename F> - bool assign_to(F f, function_buffer& functor) + bool assign_to(F f, function_buffer& functor) const { typedef typename get_function_tag<F>::type tag; return assign_to(f, functor, tag()); } template<typename F,typename Allocator> - bool assign_to_a(F f, function_buffer& functor, Allocator a) + bool assign_to_a(F f, function_buffer& functor, Allocator a) const { typedef typename get_function_tag<F>::type tag; return assign_to_a(f, functor, a, tag()); } - void clear(function_buffer& functor) + void clear(function_buffer& functor) const { if (base.manager) base.manager(functor, functor, destroy_functor_tag); @@ -508,13 +508,13 @@ namespace boost { // Function pointers template<typename FunctionPtr> bool - assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) + assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) const { this->clear(functor); if (f) { // should be a reinterpret cast, but some compilers insist // on giving cv-qualifiers to free functions - functor.func_ptr = (void (*)())(f); + functor.func_ptr = reinterpret_cast<void (*)()>(f); return true; } else { return false; @@ -522,7 +522,7 @@ namespace boost { } template<typename FunctionPtr,typename Allocator> bool - assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) + assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) const { return assign_to(f,functor,function_ptr_tag()); } @@ -530,26 +530,26 @@ namespace boost { // Member pointers #if BOOST_FUNCTION_NUM_ARGS > 0 template<typename MemberPtr> - bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) + bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) const { // DPG TBD: Add explicit support for member function // objects, so we invoke through mem_fn() but we retain the // right target_type() values. if (f) { - this->assign_to(mem_fn(f), functor); + this->assign_to(boost::mem_fn(f), functor); return true; } else { return false; } } template<typename MemberPtr,typename Allocator> - bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag) + bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag) const { // DPG TBD: Add explicit support for member function // objects, so we invoke through mem_fn() but we retain the // right target_type() values. if (f) { - this->assign_to_a(mem_fn(f), functor, a); + this->assign_to_a(boost::mem_fn(f), functor, a); return true; } else { return false; @@ -561,13 +561,13 @@ namespace boost { // Assign to a function object using the small object optimization template<typename FunctionObj> void - assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) + assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) const { - new ((void*)&functor.data) FunctionObj(f); + new (reinterpret_cast<void*>(&functor.data)) FunctionObj(f); } template<typename FunctionObj,typename Allocator> void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) const { assign_functor(f,functor,mpl::true_()); } @@ -575,13 +575,13 @@ namespace boost { // Assign to a function object allocated on the heap. template<typename FunctionObj> void - assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) + assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) const { functor.obj_ptr = new FunctionObj(f); } template<typename FunctionObj,typename Allocator> void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) const { typedef functor_wrapper<FunctionObj,Allocator> functor_wrapper_type; typedef typename Allocator::template rebind<functor_wrapper_type>::other @@ -596,7 +596,7 @@ namespace boost { template<typename FunctionObj> bool - assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) + assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) const { if (!boost::detail::function::has_empty_target(boost::addressof(f))) { assign_functor(f, functor, @@ -608,7 +608,7 @@ namespace boost { } template<typename FunctionObj,typename Allocator> bool - assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) + assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) const { if (!boost::detail::function::has_empty_target(boost::addressof(f))) { assign_functor_a(f, functor, a, @@ -623,9 +623,9 @@ namespace boost { template<typename FunctionObj> bool assign_to(const reference_wrapper<FunctionObj>& f, - function_buffer& functor, function_obj_ref_tag) + function_buffer& functor, function_obj_ref_tag) const { - functor.obj_ref.obj_ptr = (void *)f.get_pointer(); + functor.obj_ref.obj_ptr = (void *)(f.get_pointer()); functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value; functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value; return true; @@ -633,7 +633,7 @@ namespace boost { template<typename FunctionObj,typename Allocator> bool assign_to_a(const reference_wrapper<FunctionObj>& f, - function_buffer& functor, Allocator, function_obj_ref_tag) + function_buffer& functor, Allocator, function_obj_ref_tag) const { return assign_to(f,functor,function_obj_ref_tag()); } @@ -677,7 +677,7 @@ namespace boost { vtable_type* get_vtable() const { return reinterpret_cast<vtable_type*>( - reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01); + reinterpret_cast<std::size_t>(vtable) & ~static_cast<size_t>(0x01)); } struct clear_type {}; @@ -748,12 +748,16 @@ namespace boost { { this->assign_to_own(f); } - + +#ifndef BOOST_NO_RVALUE_REFERENCES + BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base() + { + this->move_assign(f); + } +#endif + ~BOOST_FUNCTION_FUNCTION() { clear(); } -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - // MSVC 6.0 and prior require all definitions to be inline, but - // these definitions can become very costly. result_type operator()(BOOST_FUNCTION_PARMS) const { if (this->empty()) @@ -762,9 +766,6 @@ namespace boost { return get_vtable()->invoker (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } -#else - result_type operator()(BOOST_FUNCTION_PARMS) const; -#endif // The distinction between when to use BOOST_FUNCTION_FUNCTION and // when to use self_type is obnoxious. MSVC cannot handle self_type as @@ -836,6 +837,26 @@ namespace boost { BOOST_CATCH_END return *this; } + +#ifndef BOOST_NO_RVALUE_REFERENCES + // Move assignment from another BOOST_FUNCTION_FUNCTION + BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f) + { + + if (&f == this) + return *this; + + this->clear(); + BOOST_TRY { + this->move_assign(f); + } BOOST_CATCH (...) { + vtable = 0; + BOOST_RETHROW; + } + BOOST_CATCH_END + return *this; + } +#endif void swap(BOOST_FUNCTION_FUNCTION& other) { @@ -864,7 +885,7 @@ namespace boost { #else private: struct dummy { - void nonnull() {}; + void nonnull() {} }; typedef void (dummy::*safe_bool)(); @@ -909,7 +930,7 @@ namespace boost { // static initialization. Otherwise, we will have a race // condition here in multi-threaded code. See // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. - static vtable_type stored_vtable = + static const vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; if (stored_vtable.assign_to(f, functor)) { @@ -917,7 +938,7 @@ namespace boost { if (boost::has_trivial_copy_constructor<Functor>::value && boost::has_trivial_destructor<Functor>::value && detail::function::function_allows_small_object_optimization<Functor>::value) - value |= (std::size_t)0x01; + value |= static_cast<size_t>(0x01); vtable = reinterpret_cast<detail::function::vtable_base *>(value); } else vtable = 0; @@ -943,7 +964,7 @@ namespace boost { // static initialization. Otherwise, we will have a race // condition here in multi-threaded code. See // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. - static vtable_type stored_vtable = + static const vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; if (stored_vtable.assign_to_a(f, functor, a)) { @@ -951,7 +972,7 @@ namespace boost { if (boost::has_trivial_copy_constructor<Functor>::value && boost::has_trivial_destructor<Functor>::value && detail::function::function_allows_small_object_optimization<Functor>::value) - value |= (std::size_t)0x01; + value |= static_cast<std::size_t>(0x01); vtable = reinterpret_cast<detail::function::vtable_base *>(value); } else vtable = 0; @@ -998,22 +1019,6 @@ namespace boost { f1.swap(f2); } -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS> - typename BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>::result_type - inline - BOOST_FUNCTION_FUNCTION<R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> - ::operator()(BOOST_FUNCTION_PARMS) const - { - if (this->empty()) - boost::throw_exception(bad_function_call()); - - return get_vtable()->invoker - (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); - } -#endif - // Poison comparisons between boost::function objects of the same type. template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS> void operator==(const BOOST_FUNCTION_FUNCTION< @@ -1085,12 +1090,26 @@ public: function(const base_type& f) : base_type(static_cast<const base_type&>(f)){} +#ifndef BOOST_NO_RVALUE_REFERENCES + // Move constructors + function(self_type&& f): base_type(static_cast<base_type&&>(f)){} + function(base_type&& f): base_type(static_cast<base_type&&>(f)){} +#endif + self_type& operator=(const self_type& f) { self_type(f).swap(*this); return *this; } +#ifndef BOOST_NO_RVALUE_REFERENCES + self_type& operator=(self_type&& f) + { + self_type(static_cast<self_type&&>(f)).swap(*this); + return *this; + } +#endif + template<typename Functor> #ifndef BOOST_NO_SFINAE typename enable_if_c< @@ -1119,6 +1138,14 @@ public: self_type(f).swap(*this); return *this; } + +#ifndef BOOST_NO_RVALUE_REFERENCES + self_type& operator=(base_type&& f) + { + self_type(static_cast<base_type&&>(f)).swap(*this); + return *this; + } +#endif }; #undef BOOST_FUNCTION_PARTIAL_SPEC diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp new file mode 100644 index 0000000..bed7730 --- /dev/null +++ b/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp @@ -0,0 +1,29 @@ + +// Copyright 2012 Daniel James. +// 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) + +#if !defined(BOOST_DETAIL_CONTAINER_FWD_0X_HPP) +#define BOOST_DETAIL_CONTAINER_FWD_0X_HPP + +#include <boost/detail/container_fwd.hpp> + +// std::array + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) +# include <array> +#endif + +// std::tuple + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +# include <tuple> +#endif + +// std::shared_ptr/std::unique_ptr + +#if !defined(BOOST_NO_CXX11_HDR_MEMORY) +# include <memory> +#endif + +#endif diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp index ea1bc25..3edc6ab 100644 --- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp +++ b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp @@ -1,5 +1,5 @@ -// Copyright 2005-2009 Daniel James. +// Copyright 2005-2012 Daniel James. // 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) @@ -13,21 +13,19 @@ #include <boost/config.hpp> #include <boost/functional/hash/detail/float_functions.hpp> #include <boost/functional/hash/detail/limits.hpp> +#include <boost/utility/enable_if.hpp> #include <boost/integer/static_log2.hpp> #include <boost/cstdint.hpp> #include <boost/assert.hpp> +#include <boost/limits.hpp> +#include <cstring> -// Include hash implementation for the current platform. - -// Cygwn -#if defined(__CYGWIN__) -# if defined(__i386__) || defined(_M_IX86) -# include <boost/functional/hash/detail/hash_float_x86.hpp> -# else -# include <boost/functional/hash/detail/hash_float_generic.hpp> -# endif -#else -# include <boost/functional/hash/detail/hash_float_generic.hpp> +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC >= 1400 +#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does + // not satisfy test. Loop body not executed +#endif #endif // Can we use fpclassify? @@ -50,6 +48,157 @@ # define BOOST_HASH_USE_FPCLASSIFY 0 #endif +namespace boost +{ + namespace hash_detail + { + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + + //////////////////////////////////////////////////////////////////////// + // Binary hash function + // + // Only used for floats with known iec559 floats, and certain values in + // numeric_limits + + inline std::size_t hash_binary(char* ptr, std::size_t length) + { + std::size_t seed = 0; + + if (length >= sizeof(std::size_t)) { + seed = *(std::size_t*) ptr; + length -= sizeof(std::size_t); + ptr += sizeof(std::size_t); + + while(length >= sizeof(std::size_t)) { + hash_float_combine(seed, *(std::size_t*) ptr); + length -= sizeof(std::size_t); + ptr += sizeof(std::size_t); + } + } + + if (length > 0) { + std::size_t buffer = 0; + std::memcpy(&buffer, ptr, length); + hash_float_combine(seed, buffer); + } + + return seed; + } + + template <typename Float> + inline std::size_t float_hash_impl(Float v, + BOOST_DEDUCED_TYPENAME boost::enable_if_c< + std::numeric_limits<Float>::is_iec559 && + std::numeric_limits<Float>::digits == 24 && + std::numeric_limits<Float>::radix == 2 && + std::numeric_limits<Float>::max_exponent == 128, + int>::type + ) + { + return hash_binary((char*) &v, 4); + } + + + template <typename Float> + inline std::size_t float_hash_impl(Float v, + BOOST_DEDUCED_TYPENAME boost::enable_if_c< + std::numeric_limits<Float>::is_iec559 && + std::numeric_limits<Float>::digits == 53 && + std::numeric_limits<Float>::radix == 2 && + std::numeric_limits<Float>::max_exponent == 1024, + int>::type + ) + { + return hash_binary((char*) &v, 8); + } + + template <typename Float> + inline std::size_t float_hash_impl(Float v, + BOOST_DEDUCED_TYPENAME boost::enable_if_c< + std::numeric_limits<Float>::is_iec559 && + std::numeric_limits<Float>::digits == 64 && + std::numeric_limits<Float>::radix == 2 && + std::numeric_limits<Float>::max_exponent == 16384, + int>::type + ) + { + return hash_binary((char*) &v, 10); + } + + template <typename Float> + inline std::size_t float_hash_impl(Float v, + BOOST_DEDUCED_TYPENAME boost::enable_if_c< + std::numeric_limits<Float>::is_iec559 && + std::numeric_limits<Float>::digits == 113 && + std::numeric_limits<Float>::radix == 2 && + std::numeric_limits<Float>::max_exponent == 16384, + int>::type + ) + { + return hash_binary((char*) &v, 16); + } + + //////////////////////////////////////////////////////////////////////// + // Portable hash function + // + // Used as a fallback when the binary hash function isn't supported. + + template <class T> + inline std::size_t float_hash_impl2(T v) + { + boost::hash_detail::call_frexp<T> frexp; + boost::hash_detail::call_ldexp<T> ldexp; + + int exp = 0; + + v = frexp(v, &exp); + + // A postive value is easier to hash, so combine the + // sign with the exponent and use the absolute value. + if(v < 0) { + v = -v; + exp += limits<T>::max_exponent - + limits<T>::min_exponent; + } + + v = ldexp(v, limits<std::size_t>::digits); + std::size_t seed = static_cast<std::size_t>(v); + v -= static_cast<T>(seed); + + // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; + std::size_t const length + = (limits<T>::digits * + boost::static_log2<limits<T>::radix>::value + + limits<std::size_t>::digits - 1) + / limits<std::size_t>::digits; + + for(std::size_t i = 0; i != length; ++i) + { + v = ldexp(v, limits<std::size_t>::digits); + std::size_t part = static_cast<std::size_t>(v); + v -= static_cast<T>(part); + hash_float_combine(seed, part); + } + + hash_float_combine(seed, exp); + + return seed; + } + +#if !defined(BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC) + template <class T> + inline std::size_t float_hash_impl(T v, ...) + { + typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type; + return float_hash_impl2(static_cast<type>(v)); + } +#endif + } +} + #if BOOST_HASH_USE_FPCLASSIFY #include <boost/config/no_tr1/cmath.hpp> @@ -71,7 +220,7 @@ namespace boost return (std::size_t)(-3); case FP_NORMAL: case FP_SUBNORMAL: - return float_hash_impl(v); + return float_hash_impl(v, 0); default: BOOST_ASSERT(0); return 0; @@ -87,9 +236,23 @@ namespace boost namespace hash_detail { template <class T> + inline bool is_zero(T v) + { +#if !defined(__GNUC__) + return v == 0; +#else + // GCC's '-Wfloat-equal' will complain about comparing + // v to 0, but because it disables warnings for system + // headers it won't complain if you use std::equal_to to + // compare with 0. Resulting in this silliness: + return std::equal_to<T>()(v, 0); +#endif + } + + template <class T> inline std::size_t float_hash_value(T v) { - return v == 0 ? 0 : float_hash_impl(v); + return boost::hash_detail::is_zero(v) ? 0 : float_hash_impl(v, 0); } } } @@ -98,4 +261,8 @@ namespace boost #undef BOOST_HASH_USE_FPCLASSIFY +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #endif diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp deleted file mode 100644 index 1278c2f..0000000 --- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp +++ /dev/null @@ -1,91 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// 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) - -// A general purpose hash function for non-zero floating point values. - -#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER) -#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER - -#include <boost/functional/hash/detail/float_functions.hpp> -#include <boost/integer/static_log2.hpp> -#include <boost/functional/hash/detail/limits.hpp> - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#if defined(BOOST_MSVC) -#pragma warning(push) -#if BOOST_MSVC >= 1400 -#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does - // not satisfy test. Loop body not executed -#endif -#endif - -namespace boost -{ - namespace hash_detail - { - inline void hash_float_combine(std::size_t& seed, std::size_t value) - { - seed ^= value + (seed<<6) + (seed>>2); - } - - template <class T> - inline std::size_t float_hash_impl2(T v) - { - boost::hash_detail::call_frexp<T> frexp; - boost::hash_detail::call_ldexp<T> ldexp; - - int exp = 0; - - v = frexp(v, &exp); - - // A postive value is easier to hash, so combine the - // sign with the exponent and use the absolute value. - if(v < 0) { - v = -v; - exp += limits<T>::max_exponent - - limits<T>::min_exponent; - } - - v = ldexp(v, limits<std::size_t>::digits); - std::size_t seed = static_cast<std::size_t>(v); - v -= static_cast<T>(seed); - - // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; - std::size_t const length - = (limits<T>::digits * - boost::static_log2<limits<T>::radix>::value - + limits<std::size_t>::digits - 1) - / limits<std::size_t>::digits; - - for(std::size_t i = 0; i != length; ++i) - { - v = ldexp(v, limits<std::size_t>::digits); - std::size_t part = static_cast<std::size_t>(v); - v -= static_cast<T>(part); - hash_float_combine(seed, part); - } - - hash_float_combine(seed, exp); - - return seed; - } - - template <class T> - inline std::size_t float_hash_impl(T v) - { - typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type; - return float_hash_impl2(static_cast<type>(v)); - } - } -} - -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif - -#endif diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp deleted file mode 100644 index b39bb0d..0000000 --- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp +++ /dev/null @@ -1,56 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// 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) - -// A non-portable hash function form non-zero floats on x86. -// -// Even if you're on an x86 platform, this might not work if their floating -// point isn't set up as this expects. So this should only be used if it's -// absolutely certain that it will work. - -#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER) -#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER - -#include <boost/cstdint.hpp> - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -namespace boost -{ - namespace hash_detail - { - inline void hash_float_combine(std::size_t& seed, std::size_t value) - { - seed ^= value + (seed<<6) + (seed>>2); - } - - inline std::size_t float_hash_impl(float v) - { - boost::uint32_t* ptr = (boost::uint32_t*)&v; - std::size_t seed = *ptr; - return seed; - } - - inline std::size_t float_hash_impl(double v) - { - boost::uint32_t* ptr = (boost::uint32_t*)&v; - std::size_t seed = *ptr++; - hash_float_combine(seed, *ptr); - return seed; - } - - inline std::size_t float_hash_impl(long double v) - { - boost::uint32_t* ptr = (boost::uint32_t*)&v; - std::size_t seed = *ptr++; - hash_float_combine(seed, *ptr++); - hash_float_combine(seed, *(boost::uint16_t*)ptr); - return seed; - } - } -} - -#endif diff --git a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp index 3c587a3..4358736 100644 --- a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp +++ b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp @@ -14,7 +14,11 @@ #define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP #include <boost/functional/hash/hash.hpp> -#include <boost/detail/container_fwd.hpp> +#include <boost/functional/hash/detail/container_fwd_0x.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/static_assert.hpp> +#include <boost/preprocessor/repetition/repeat_from_to.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once @@ -54,51 +58,51 @@ namespace boost std::size_t hash_value(std::pair<A, B> const& v) { std::size_t seed = 0; - hash_combine(seed, v.first); - hash_combine(seed, v.second); + boost::hash_combine(seed, v.first); + boost::hash_combine(seed, v.second); return seed; } template <class T, class A> std::size_t hash_value(std::vector<T, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class T, class A> std::size_t hash_value(std::list<T, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class T, class A> std::size_t hash_value(std::deque<T, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class K, class C, class A> std::size_t hash_value(std::set<K, C, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class K, class C, class A> std::size_t hash_value(std::multiset<K, C, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class K, class T, class C, class A> std::size_t hash_value(std::map<K, T, C, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class K, class T, class C, class A> std::size_t hash_value(std::multimap<K, T, C, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class T> @@ -110,6 +114,83 @@ namespace boost return seed; } +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) + template <class T, std::size_t N> + std::size_t hash_value(std::array<T, N> const& v) + { + return boost::hash_range(v.begin(), v.end()); + } +#endif + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) + namespace hash_detail { + template <std::size_t I, typename T> + inline typename boost::enable_if_c<(I == std::tuple_size<T>::value), + void>::type + hash_combine_tuple(std::size_t&, T const&) + { + } + + template <std::size_t I, typename T> + inline typename boost::enable_if_c<(I < std::tuple_size<T>::value), + void>::type + hash_combine_tuple(std::size_t& seed, T const& v) + { + boost::hash_combine(seed, std::get<I>(v)); + boost::hash_detail::hash_combine_tuple<I + 1>(seed, v); + } + + template <typename T> + inline std::size_t hash_tuple(T const& v) + { + std::size_t seed = 0; + boost::hash_detail::hash_combine_tuple<0>(seed, v); + return seed; + } + } + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + template <typename... T> + inline std::size_t hash_value(std::tuple<T...> const& v) + { + return boost::hash_detail::hash_tuple(v); + } +#else + + inline std::size_t hash_value(std::tuple<> const& v) + { + return boost::hash_detail::hash_tuple(v); + } + +# define BOOST_HASH_TUPLE_F(z, n, _) \ + template< \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \ + > \ + inline std::size_t hash_value(std::tuple< \ + BOOST_PP_ENUM_PARAMS_Z(z, n, A) \ + > const& v) \ + { \ + return boost::hash_detail::hash_tuple(v); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, 11, BOOST_HASH_TUPLE_F, _) +# undef BOOST_HASH_TUPLE_F +#endif + +#endif + +#if !defined(BOOST_NO_CXX11_SMART_PTR) + template <typename T> + inline std::size_t hash_value(std::shared_ptr<T> const& x) { + return boost::hash_value(x.get()); + } + + template <typename T, typename Deleter> + inline std::size_t hash_value(std::unique_ptr<T, Deleter> const& x) { + return boost::hash_value(x.get()); + } +#endif + // // call_hash_impl // diff --git a/3rdParty/Boost/src/boost/functional/hash/hash.hpp b/3rdParty/Boost/src/boost/functional/hash/hash.hpp index 51ec860..647fd68 100644 --- a/3rdParty/Boost/src/boost/functional/hash/hash.hpp +++ b/3rdParty/Boost/src/boost/functional/hash/hash.hpp @@ -15,16 +15,14 @@ #include <boost/functional/hash/detail/hash_float.hpp> #include <string> #include <boost/limits.hpp> - -#if defined(BOOST_HASH_NO_IMPLICIT_CASTS) -#include <boost/static_assert.hpp> -#endif +#include <boost/type_traits/is_enum.hpp> +#include <boost/utility/enable_if.hpp> #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) #include <boost/type_traits/is_pointer.hpp> #endif -#if !defined(BOOST_NO_0X_HDR_TYPEINDEX) +#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) #include <typeindex> #endif @@ -37,38 +35,67 @@ namespace boost { -#if defined(BOOST_HASH_NO_IMPLICIT_CASTS) - - // If you get a static assertion here, it's because hash_value - // isn't declared for your type. - template <typename T> - std::size_t hash_value(T const&) { - BOOST_STATIC_ASSERT((T*) 0 && false); - return 0; - } - -#endif - - std::size_t hash_value(bool); - std::size_t hash_value(char); - std::size_t hash_value(unsigned char); - std::size_t hash_value(signed char); - std::size_t hash_value(short); - std::size_t hash_value(unsigned short); - std::size_t hash_value(int); - std::size_t hash_value(unsigned int); - std::size_t hash_value(long); - std::size_t hash_value(unsigned long); + namespace hash_detail + { + struct enable_hash_value { typedef std::size_t type; }; + + template <typename T> struct basic_numbers {}; + template <typename T> struct long_numbers {}; + template <typename T> struct ulong_numbers {}; + template <typename T> struct float_numbers {}; + + template <> struct basic_numbers<bool> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<char> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<unsigned char> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<signed char> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<short> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<unsigned short> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<int> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<unsigned int> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<long> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<unsigned long> : + boost::hash_detail::enable_hash_value {}; #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - std::size_t hash_value(wchar_t); + template <> struct basic_numbers<wchar_t> : + boost::hash_detail::enable_hash_value {}; #endif - + #if !defined(BOOST_NO_LONG_LONG) - std::size_t hash_value(boost::long_long_type); - std::size_t hash_value(boost::ulong_long_type); + template <> struct long_numbers<boost::long_long_type> : + boost::hash_detail::enable_hash_value {}; + template <> struct ulong_numbers<boost::ulong_long_type> : + boost::hash_detail::enable_hash_value {}; #endif + template <> struct float_numbers<float> : + boost::hash_detail::enable_hash_value {}; + template <> struct float_numbers<double> : + boost::hash_detail::enable_hash_value {}; + template <> struct float_numbers<long double> : + boost::hash_detail::enable_hash_value {}; + } + + template <typename T> + typename boost::hash_detail::basic_numbers<T>::type hash_value(T); + template <typename T> + typename boost::hash_detail::long_numbers<T>::type hash_value(T); + template <typename T> + typename boost::hash_detail::ulong_numbers<T>::type hash_value(T); + + template <typename T> + typename boost::enable_if<boost::is_enum<T>, std::size_t>::type + hash_value(T); + #if !BOOST_WORKAROUND(__DMC__, <= 0x848) template <class T> std::size_t hash_value(T* const&); #else @@ -83,15 +110,14 @@ namespace boost std::size_t hash_value(T (&x)[N]); #endif - std::size_t hash_value(float v); - std::size_t hash_value(double v); - std::size_t hash_value(long double v); - template <class Ch, class A> std::size_t hash_value( std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&); -#if !defined(BOOST_NO_0X_HDR_TYPEINDEX) + template <typename T> + typename boost::hash_detail::float_numbers<T>::type hash_value(T); + +#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) std::size_t hash_value(std::type_index); #endif @@ -141,74 +167,30 @@ namespace boost } } - inline std::size_t hash_value(bool v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(char v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned char v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(signed char v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(short v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned short v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(int v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned int v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(long v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned long v) + template <typename T> + typename boost::hash_detail::basic_numbers<T>::type hash_value(T v) { return static_cast<std::size_t>(v); } -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - inline std::size_t hash_value(wchar_t v) + template <typename T> + typename boost::hash_detail::long_numbers<T>::type hash_value(T v) { - return static_cast<std::size_t>(v); + return hash_detail::hash_value_signed(v); } -#endif -#if !defined(BOOST_NO_LONG_LONG) - inline std::size_t hash_value(boost::long_long_type v) + template <typename T> + typename boost::hash_detail::ulong_numbers<T>::type hash_value(T v) { - return hash_detail::hash_value_signed(v); + return hash_detail::hash_value_unsigned(v); } - inline std::size_t hash_value(boost::ulong_long_type v) + template <typename T> + typename boost::enable_if<boost::is_enum<T>, std::size_t>::type + hash_value(T v) { - return hash_detail::hash_value_unsigned(v); + return static_cast<std::size_t>(v); } -#endif // Implementation by Alberto Barbati and Dave Harris. #if !BOOST_WORKAROUND(__DMC__, <= 0x848) @@ -324,22 +306,13 @@ namespace boost return hash_range(v.begin(), v.end()); } - inline std::size_t hash_value(float v) - { - return boost::hash_detail::float_hash_value(v); - } - - inline std::size_t hash_value(double v) - { - return boost::hash_detail::float_hash_value(v); - } - - inline std::size_t hash_value(long double v) + template <typename T> + typename boost::hash_detail::float_numbers<T>::type hash_value(T v) { return boost::hash_detail::float_hash_value(v); } -#if !defined(BOOST_NO_0X_HDR_TYPEINDEX) +#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) inline std::size_t hash_value(std::type_index v) { return v.hash_code(); @@ -450,7 +423,7 @@ namespace boost BOOST_HASH_SPECIALIZE(boost::ulong_long_type) #endif -#if !defined(BOOST_NO_0X_HDR_TYPEINDEX) +#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) BOOST_HASH_SPECIALIZE(std::type_index) #endif diff --git a/3rdParty/Boost/src/boost/implicit_cast.hpp b/3rdParty/Boost/src/boost/implicit_cast.hpp deleted file mode 100644 index 5b1cd92..0000000 --- a/3rdParty/Boost/src/boost/implicit_cast.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright David Abrahams 2003. -// 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 IMPLICIT_CAST_DWA200356_HPP -# define IMPLICIT_CAST_DWA200356_HPP - -# include <boost/mpl/identity.hpp> - -namespace boost { - -// implementation originally suggested by C. Green in -// http://lists.boost.org/MailArchives/boost/msg00886.php - -// The use of identity creates a non-deduced form, so that the -// explicit template argument must be supplied -template <typename T> -inline T implicit_cast (typename mpl::identity<T>::type x) { - return x; -} - -// incomplete return type now is here -//template <typename T> -//void implicit_cast (...); - -} // namespace boost - - -#endif // IMPLICIT_CAST_DWA200356_HPP diff --git a/3rdParty/Boost/src/boost/indirect_reference.hpp b/3rdParty/Boost/src/boost/indirect_reference.hpp new file mode 100644 index 0000000..5fbb342 --- /dev/null +++ b/3rdParty/Boost/src/boost/indirect_reference.hpp @@ -0,0 +1,43 @@ +#ifndef INDIRECT_REFERENCE_DWA200415_HPP +# define INDIRECT_REFERENCE_DWA200415_HPP + +// +// Copyright David Abrahams 2004. Use, modification and distribution is +// subject to 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) +// +// typename indirect_reference<P>::type provides the type of *p. +// +// http://www.boost.org/libs/iterator/doc/pointee.html +// + +# include <boost/detail/is_incrementable.hpp> +# include <boost/iterator/iterator_traits.hpp> +# include <boost/type_traits/remove_cv.hpp> +# include <boost/mpl/eval_if.hpp> +# include <boost/pointee.hpp> + +namespace boost { + +namespace detail +{ + template <class P> + struct smart_ptr_reference + { + typedef typename boost::pointee<P>::type& type; + }; +} + +template <class P> +struct indirect_reference + : mpl::eval_if< + detail::is_incrementable<P> + , iterator_reference<P> + , detail::smart_ptr_reference<P> + > +{ +}; + +} // namespace boost + +#endif // INDIRECT_REFERENCE_DWA200415_HPP diff --git a/3rdParty/Boost/src/boost/integer.hpp b/3rdParty/Boost/src/boost/integer.hpp index fc0b398..35a1e10 100644 --- a/3rdParty/Boost/src/boost/integer.hpp +++ b/3rdParty/Boost/src/boost/integer.hpp @@ -20,6 +20,7 @@ #include <boost/integer_traits.hpp> // for boost::::boost::integer_traits #include <boost/limits.hpp> // for ::std::numeric_limits #include <boost/cstdint.hpp> // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T +#include <boost/static_assert.hpp> // // We simply cannot include this header on gcc without getting copious warnings of the kind: @@ -51,6 +52,7 @@ namespace boost // convert category to type template< int Category > struct int_least_helper {}; // default is empty + template< int Category > struct uint_least_helper {}; // default is empty // specializatons: 1=long, 2=int, 3=short, 4=signed char, // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char @@ -65,14 +67,14 @@ namespace boost template<> struct int_least_helper<4> { typedef short least; }; template<> struct int_least_helper<5> { typedef signed char least; }; #ifdef BOOST_HAS_LONG_LONG - template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; }; + template<> struct uint_least_helper<1> { typedef boost::ulong_long_type least; }; #elif defined(BOOST_HAS_MS_INT64) - template<> struct int_least_helper<6> { typedef unsigned __int64 least; }; + template<> struct uint_least_helper<1> { typedef unsigned __int64 least; }; #endif - template<> struct int_least_helper<7> { typedef unsigned long least; }; - template<> struct int_least_helper<8> { typedef unsigned int least; }; - template<> struct int_least_helper<9> { typedef unsigned short least; }; - template<> struct int_least_helper<10> { typedef unsigned char least; }; + template<> struct uint_least_helper<2> { typedef unsigned long least; }; + template<> struct uint_least_helper<3> { typedef unsigned int least; }; + template<> struct uint_least_helper<4> { typedef unsigned short least; }; + template<> struct uint_least_helper<5> { typedef unsigned char least; }; template <int Bits> struct exact_signed_base_helper{}; @@ -111,10 +113,12 @@ namespace boost template< int Bits > // bits (including sign) required struct int_t : public detail::exact_signed_base_helper<Bits> { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT), + "No suitable signed integer type with the requested number of bits is available."); typedef typename detail::int_least_helper < #ifdef BOOST_HAS_LONG_LONG - (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif @@ -130,6 +134,8 @@ namespace boost template< int Bits > // bits required struct uint_t : public detail::exact_unsigned_base_helper<Bits> { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), + "No suitable unsigned integer type with the requested number of bits is available."); #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) // It's really not clear why this workaround should be needed... shrug I guess! JM BOOST_STATIC_CONSTANT(int, s = @@ -140,11 +146,10 @@ namespace boost (Bits <= ::std::numeric_limits<unsigned char>::digits)); typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least; #else - typedef typename detail::int_least_helper + typedef typename detail::uint_least_helper < - 5 + #ifdef BOOST_HAS_LONG_LONG - (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif @@ -217,7 +222,7 @@ namespace boost // It's really not clear why this workaround should be needed... shrug I guess! JM #if defined(BOOST_NO_INTEGRAL_INT64_T) BOOST_STATIC_CONSTANT(unsigned, which = - 6 + + 1 + (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) + @@ -225,18 +230,17 @@ namespace boost typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; #else // BOOST_NO_INTEGRAL_INT64_T BOOST_STATIC_CONSTANT(unsigned, which = - 5 + + 1 + (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)); - typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; + typedef typename detail::uint_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; #endif // BOOST_NO_INTEGRAL_INT64_T #else - typedef typename detail::int_least_helper + typedef typename detail::uint_least_helper < - 5 + #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) + #else diff --git a/3rdParty/Boost/src/boost/integer/integer_mask.hpp b/3rdParty/Boost/src/boost/integer/integer_mask.hpp new file mode 100644 index 0000000..2acf7f7 --- /dev/null +++ b/3rdParty/Boost/src/boost/integer/integer_mask.hpp @@ -0,0 +1,126 @@ +// Boost integer/integer_mask.hpp header file ------------------------------// + +// (C) Copyright Daryle Walker 2001. +// 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) + +// See http://www.boost.org for updates, documentation, and revision history. + +#ifndef BOOST_INTEGER_INTEGER_MASK_HPP +#define BOOST_INTEGER_INTEGER_MASK_HPP + +#include <boost/integer_fwd.hpp> // self include + +#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT +#include <boost/integer.hpp> // for boost::uint_t + +#include <climits> // for UCHAR_MAX, etc. +#include <cstddef> // for std::size_t + +#include <boost/limits.hpp> // for std::numeric_limits + +// +// We simply cannot include this header on gcc without getting copious warnings of the kind: +// +// boost/integer/integer_mask.hpp:93:35: warning: use of C99 long long integer constant +// +// And yet there is no other reasonable implementation, so we declare this a system header +// to suppress these warnings. +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif + +namespace boost +{ + + +// Specified single-bit mask class declaration -----------------------------// +// (Lowest bit starts counting at 0.) + +template < std::size_t Bit > +struct high_bit_mask_t +{ + typedef typename uint_t<(Bit + 1)>::least least; + typedef typename uint_t<(Bit + 1)>::fast fast; + + BOOST_STATIC_CONSTANT( least, high_bit = (least( 1u ) << Bit) ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = (fast( 1u ) << Bit) ); + + BOOST_STATIC_CONSTANT( std::size_t, bit_position = Bit ); + +}; // boost::high_bit_mask_t + + +// Specified bit-block mask class declaration ------------------------------// +// Makes masks for the lowest N bits +// (Specializations are needed when N fills up a type.) + +template < std::size_t Bits > +struct low_bits_mask_t +{ + typedef typename uint_t<Bits>::least least; + typedef typename uint_t<Bits>::fast fast; + + BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) ); + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); + + BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); + +}; // boost::low_bits_mask_t + + +#define BOOST_LOW_BITS_MASK_SPECIALIZE( Type ) \ + template < > struct low_bits_mask_t< std::numeric_limits<Type>::digits > { \ + typedef std::numeric_limits<Type> limits_type; \ + typedef uint_t<limits_type::digits>::least least; \ + typedef uint_t<limits_type::digits>::fast fast; \ + BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); \ + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); \ + BOOST_STATIC_CONSTANT( std::size_t, bit_count = limits_type::digits ); \ + } + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4245) // 'initializing' : conversion from 'int' to 'const boost::low_bits_mask_t<8>::least', signed/unsigned mismatch +#endif + +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned char ); + +#if USHRT_MAX > UCHAR_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned short ); +#endif + +#if UINT_MAX > USHRT_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned int ); +#endif + +#if ULONG_MAX > UINT_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long ); +#endif + +#if defined(BOOST_HAS_LONG_LONG) + #if ((defined(ULLONG_MAX) && (ULLONG_MAX > ULONG_MAX)) ||\ + (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX > ULONG_MAX)) ||\ + (defined(ULONGLONG_MAX) && (ULONGLONG_MAX > ULONG_MAX)) ||\ + (defined(_ULLONG_MAX) && (_ULLONG_MAX > ULONG_MAX))) + BOOST_LOW_BITS_MASK_SPECIALIZE( boost::ulong_long_type ); + #endif +#elif defined(BOOST_HAS_MS_INT64) + #if 18446744073709551615ui64 > ULONG_MAX + BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned __int64 ); + #endif +#endif + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#undef BOOST_LOW_BITS_MASK_SPECIALIZE + + +} // namespace boost + + +#endif // BOOST_INTEGER_INTEGER_MASK_HPP diff --git a/3rdParty/Boost/src/boost/integer_traits.hpp b/3rdParty/Boost/src/boost/integer_traits.hpp index 129ce82..98fdd93 100644 --- a/3rdParty/Boost/src/boost/integer_traits.hpp +++ b/3rdParty/Boost/src/boost/integer_traits.hpp @@ -5,7 +5,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * $Id: integer_traits.hpp 58381 2009-12-14 18:14:48Z johnmaddock $ + * $Id: integer_traits.hpp 80740 2012-09-28 18:34:12Z jewillco $ * * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers */ @@ -227,7 +227,7 @@ class integer_traits< ::boost::ulong_long_type> template<> class integer_traits< ::boost::long_long_type> : public std::numeric_limits< ::boost::long_long_type>, - public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) - 1)), ~(1LL << (sizeof(::boost::long_long_type) - 1))> + public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1)), ~(1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1))> { }; template<> diff --git a/3rdParty/Boost/src/boost/intrusive/detail/config_begin.hpp b/3rdParty/Boost/src/boost/intrusive/detail/config_begin.hpp new file mode 100644 index 0000000..7d15336 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/config_begin.hpp @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2012 +// +// 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_CONFIG_INCLUDED +#define BOOST_INTRUSIVE_CONFIG_INCLUDED +#include <boost/config.hpp> +#endif + +#ifdef BOOST_MSVC + + #pragma warning (push) + // + //'function' : resolved overload was found by argument-dependent lookup + //A function found by argument-dependent lookup (Koenig lookup) was eventually + //chosen by overload resolution. + // + //In Visual C++ .NET and earlier compilers, a different function would have + //been called. To pick the original function, use an explicitly qualified name. + // + + //warning C4275: non dll-interface class 'x' used as base for + //dll-interface class 'Y' + #pragma warning (disable : 4275) + //warning C4251: 'x' : class 'y' needs to have dll-interface to + //be used by clients of class 'z' + #pragma warning (disable : 4251) + #pragma warning (disable : 4675) + #pragma warning (disable : 4996) + #pragma warning (disable : 4503) + #pragma warning (disable : 4284) // odd return type for operator-> + #pragma warning (disable : 4244) // possible loss of data + #pragma warning (disable : 4521) ////Disable "multiple copy constructors specified" + #pragma warning (disable : 4522) + #pragma warning (disable : 4146) + #pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data + #pragma warning (disable : 4127) //conditional expression is constant + #pragma warning (disable : 4706) //assignment within conditional expression + #pragma warning (disable : 4541) //'typeid' used on polymorphic type 'boost::exception' with /GR- + #pragma warning (disable : 4512) //'typeid' used on polymorphic type 'boost::exception' with /GR- +#endif + +//#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE +//#define BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE diff --git a/3rdParty/Boost/src/boost/intrusive/detail/config_end.hpp b/3rdParty/Boost/src/boost/intrusive/detail/config_end.hpp new file mode 100644 index 0000000..d653030 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/config_end.hpp @@ -0,0 +1,15 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2012 +// +// 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#if defined BOOST_MSVC + #pragma warning (pop) +#endif diff --git a/3rdParty/Boost/src/boost/intrusive/detail/has_member_function_callable_with.hpp b/3rdParty/Boost/src/boost/intrusive/detail/has_member_function_callable_with.hpp new file mode 100644 index 0000000..6516e28 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/has_member_function_callable_with.hpp @@ -0,0 +1,356 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +// sample.h + +#if !defined(BOOST_PP_IS_ITERATING) + + #ifndef BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + + #include <boost/intrusive/detail/config_begin.hpp> + #include <boost/intrusive/detail/workaround.hpp> + #include <boost/intrusive/detail/preprocessor.hpp> + #include <boost/static_assert.hpp> + #include <boost/move/move.hpp> + + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //wrong SFINAE for GCC 4.2/4.3 + #if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430) + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED + #elif defined(BOOST_INTEL) && (BOOST_INTEL < 1200 ) + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED + #endif + + namespace boost_intrusive_has_member_function_callable_with { + + struct dont_care + { + dont_care(...); + }; + + struct private_type + { + static private_type p; + private_type const &operator,(int) const; + }; + + typedef char yes_type; // sizeof(yes_type) == 1 + struct no_type{ char dummy[2]; }; // sizeof(no_type) == 2 + + template<typename T> + no_type is_private_type(T const &); + yes_type is_private_type(private_type const &); + + } //boost_intrusive_has_member_function_callable_with + + #include <boost/intrusive/detail/config_end.hpp> + + #endif //BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + +#else //!BOOST_PP_IS_ITERATING + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME not defined!" + #endif + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN not defined!" + #endif + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END not defined!" + #endif + + #if BOOST_PP_ITERATION_START() != 0 + #error "BOOST_PP_ITERATION_START() must be zero (0)" + #endif + + #if BOOST_PP_ITERATION() == 0 + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template <typename Type> + class BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + struct BaseMixin + { + void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); + }; + + struct Base : public Type, public BaseMixin { Base(); }; + template <typename T, T t> class Helper{}; + + template <typename U> + static boost_intrusive_has_member_function_callable_with::no_type deduce + (U*, Helper<void (BaseMixin::*)(), &U::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME>* = 0); + static boost_intrusive_has_member_function_callable_with::yes_type deduce(...); + + public: + static const bool value = + sizeof(boost_intrusive_has_member_function_callable_with::yes_type) == sizeof(deduce((Base*)(0))); + }; + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + template<typename Fun, bool HasFunc + BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION_FINISH(), BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl); + //! + + template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), class P)> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + <Fun, false BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), P)> + { + static const bool value = false; + }; + //! + + #if !defined(_MSC_VER) || (_MSC_VER < 1600) + + #if defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + template<typename Fun> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)> + { + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //wrong SFINAE for GCC 4.2/4.3 + static const bool value = true; + }; + + #else //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + //Special case for 0 args + template< class F + , std::size_t N = + sizeof((boost::move_detail::declval<F>(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + boost_intrusive_has_member_function_callable_with::yes_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not + //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0. + template<class F> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0> + { + boost_intrusive_has_member_function_callable_with::no_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + template<typename Fun> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)> + { + template<class U> + static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U> + Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*); + + template <class U> + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test< Fun >(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + #endif //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + #else //#if !defined(_MSC_VER) || (_MSC_VER < 1600) + template<typename Fun> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)> + { + template<class U> + static decltype( boost::move_detail::declval<Fun>().BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME() + , boost_intrusive_has_member_function_callable_with::yes_type()) + Test(Fun*); + + template<class U> + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test<Fun>(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + #endif //#if !defined(_MSC_VER) || (_MSC_VER < 1600) + + #else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + template<typename Fun, bool HasFunc, class ...Args> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl); + + template<typename Fun, class ...Args> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, false, Args...> + { + static const bool value = false; + }; + + //Special case for 0 args + template< class F + , std::size_t N = + sizeof((boost::move_detail::declval<F>(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + boost_intrusive_has_member_function_callable_with::yes_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not + //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0. + template<class F> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0> + { + boost_intrusive_has_member_function_callable_with::no_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + template<typename Fun> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true> + { + template<class U> + static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + <U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*); + + template <class U> + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test< Fun >(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + + template<typename Fun, class ...DontCares> + struct BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME ) + : Fun + { + BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )(); + using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME; + + boost_intrusive_has_member_function_callable_with::private_type + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( DontCares...) const; + }; + + template<typename Fun, class ...Args> + struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + <Fun, true , Args...> + { + template<class T> + struct make_dontcare + { + typedef boost_intrusive_has_member_function_callable_with::dont_care type; + }; + + typedef BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME ) + <Fun, typename make_dontcare<Args>::type...> FunWrap; + + static bool const value = (sizeof(boost_intrusive_has_member_function_callable_with::no_type) == + sizeof(boost_intrusive_has_member_function_callable_with::is_private_type + ( (::boost::move_detail::declval< FunWrap >(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( ::boost::move_detail::declval<Args>()... ), 0) ) + ) + ); + }; + + template<typename Fun, class ...Args> + struct BOOST_PP_CAT( has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + : public BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + < Fun + , BOOST_PP_CAT( has_member_function_named_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )<Fun>::value + , Args... > + {}; + + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #else //BOOST_PP_ITERATION() == 0 + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template<typename Fun> + struct BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)) + : Fun + { + BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))(); + + using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME; + boost_intrusive_has_member_function_callable_with::private_type + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( BOOST_PP_ENUM(BOOST_PP_ITERATION() + , BOOST_INTRUSIVE_PP_IDENTITY + , boost_intrusive_has_member_function_callable_with::dont_care)) const; + }; + + template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), class P)> + struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), P) + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()) + , BOOST_INTRUSIVE_PP_IDENTITY + , void)> + { + typedef BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))<Fun> + FunWrap; + static bool const value = + (sizeof(boost_intrusive_has_member_function_callable_with::no_type) == + sizeof(boost_intrusive_has_member_function_callable_with::is_private_type + ( (boost::move_detail::declval<FunWrap>(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( BOOST_PP_ENUM( BOOST_PP_ITERATION(), BOOST_INTRUSIVE_PP_DECLVAL, _) ), 0 + ) + ) + ) + ); + }; + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + #endif //BOOST_PP_ITERATION() == 0 + + #if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH() + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template<typename Fun + BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION_FINISH(), BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)> + struct BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + : public BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + <Fun, BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<Fun>::value + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), P) > + {}; + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #endif //#if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH() + +#endif //!BOOST_PP_IS_ITERATING diff --git a/3rdParty/Boost/src/boost/intrusive/detail/memory_util.hpp b/3rdParty/Boost/src/boost/intrusive/detail/memory_util.hpp new file mode 100644 index 0000000..1a6431b --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/memory_util.hpp @@ -0,0 +1,288 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP +#define BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> +#include <boost/intrusive/detail/mpl.hpp> +#include <boost/intrusive/detail/preprocessor.hpp> + +namespace boost { +namespace intrusive { +namespace detail { + +template <typename T> +inline T* addressof(T& obj) +{ + return static_cast<T*> + (static_cast<void*> + (const_cast<char*> + (&reinterpret_cast<const char&>(obj)) + ) + ); +} + +template <typename T> struct unvoid { typedef T type; }; +template <> struct unvoid<void> { struct type { }; }; +template <> struct unvoid<const void> { struct type { }; }; + +template <typename T> +struct LowPriorityConversion +{ + // Convertible from T with user-defined-conversion rank. + LowPriorityConversion(const T&) { } +}; + +// Infrastructure for providing a default type for T::TNAME if absent. +#define BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(TNAME) \ + template <typename T, typename DefaultType> \ + struct boost_intrusive_default_type_ ## TNAME \ + { \ + template <typename X> \ + static char test(int, typename X::TNAME*); \ + \ + template <typename X> \ + static int test(boost::intrusive::detail:: \ + LowPriorityConversion<int>, void*); \ + \ + struct DefaultWrap { typedef DefaultType TNAME; }; \ + \ + static const bool value = (1 == sizeof(test<T>(0, 0))); \ + \ + typedef typename \ + ::boost::intrusive::detail::if_c \ + <value, T, DefaultWrap>::type::TNAME type; \ + }; \ + \ + template <typename T, typename DefaultType> \ + struct boost_intrusive_eval_default_type_ ## TNAME \ + { \ + template <typename X> \ + static char test(int, typename X::TNAME*); \ + \ + template <typename X> \ + static int test(boost::intrusive::detail:: \ + LowPriorityConversion<int>, void*); \ + \ + struct DefaultWrap \ + { typedef typename DefaultType::type TNAME; }; \ + \ + static const bool value = (1 == sizeof(test<T>(0, 0))); \ + \ + typedef typename \ + ::boost::intrusive::detail::eval_if_c \ + < value \ + , ::boost::intrusive::detail::identity<T> \ + , ::boost::intrusive::detail::identity<DefaultWrap> \ + >::type::TNAME type; \ + }; \ +// + +#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \ + typename INSTANTIATION_NS_PREFIX \ + boost_intrusive_default_type_ ## TNAME< T, TIMPL >::type \ +// + +#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \ + typename INSTANTIATION_NS_PREFIX \ + boost_intrusive_eval_default_type_ ## TNAME< T, TIMPL >::type \ +// + +}}} //namespace boost::intrusive::detail + +#include <boost/intrusive/detail/has_member_function_callable_with.hpp> + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME pointer_to +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME static_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME const_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME dynamic_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +namespace boost { +namespace intrusive { +namespace detail { + +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(element_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) + +////////////////////// +//struct first_param +////////////////////// + +template <typename T> struct first_param +{ typedef void type; }; + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template <template <typename, typename...> class TemplateClass, typename T, typename... Args> + struct first_param< TemplateClass<T, Args...> > + { + typedef T type; + }; + +#else //C++03 compilers + + #define BOOST_PP_LOCAL_MACRO(n) \ + template < template <typename \ + BOOST_PP_ENUM_TRAILING(n, BOOST_INTRUSIVE_PP_IDENTITY, typename) > \ + class TemplateClass \ + , typename T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)> \ + struct first_param \ + < TemplateClass<T BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> > \ + { \ + typedef T type; \ + }; \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + +#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES) + +/////////////////////////// +//struct type_rebind_mode +/////////////////////////// +template <typename Ptr, typename T> +struct type_has_rebind +{ + template <typename X> + #if !defined (__SUNPRO_CC) + static char test(int, typename X::template rebind<T>*); + #else + static char test(int, typename X::rebind<T>*); + #endif + + template <typename X> + static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*); + + static const bool value = (1 == sizeof(test<Ptr>(0, 0))); +}; + +template <typename Ptr, typename T> +struct type_has_rebind_other +{ + template <typename X> + #if !defined (__SUNPRO_CC) + static char test(int, typename X::template rebind<T>::other*); + #else + static char test(int, typename X::rebind<T>::other*); + #endif + + template <typename X> + static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*); + + static const bool value = (1 == sizeof(test<Ptr>(0, 0))); +}; + +template <typename Ptr, typename T> +struct type_rebind_mode +{ + static const unsigned int rebind = (unsigned int)type_has_rebind<Ptr, T>::value; + static const unsigned int rebind_other = (unsigned int)type_has_rebind_other<Ptr, T>::value; + static const unsigned int mode = rebind + rebind*rebind_other; +}; + +//////////////////////// +//struct type_rebinder +//////////////////////// +template <typename Ptr, typename U, unsigned int RebindMode = type_rebind_mode<Ptr, U>::mode> +struct type_rebinder; + +// Implementation of pointer_traits<Ptr>::rebind if Ptr has +// its own rebind::other type (C++03) +template <typename Ptr, typename U> +struct type_rebinder< Ptr, U, 2u > +{ + typedef typename Ptr::template rebind<U>::other type; +}; + +// Implementation of pointer_traits<Ptr>::rebind if Ptr has +// its own rebind template. +template <typename Ptr, typename U> +struct type_rebinder< Ptr, U, 1u > +{ + typedef typename Ptr::template rebind<U> type; +}; + +// Specialization of pointer_traits<Ptr>::rebind if Ptr does not +// have its own rebind template but has a the form Ptr<class T, +// OtherArgs>, where OtherArgs comprises zero or more type parameters. +// Many pointers fit this form, hence many pointers will get a +// reasonable default for rebind. +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template <template <class, class...> class Ptr, typename T, class... Tn, class U> +struct type_rebinder<Ptr<T, Tn...>, U, 0u > +{ + typedef Ptr<U, Tn...> type; +}; + +//Needed for non-conforming compilers like GCC 4.3 +template <template <class> class Ptr, typename T, class U> +struct type_rebinder<Ptr<T>, U, 0u > +{ + typedef Ptr<U> type; +}; + +#else //C++03 compilers + +#define BOOST_PP_LOCAL_MACRO(n) \ +template < template <typename \ + BOOST_PP_ENUM_TRAILING(n, BOOST_INTRUSIVE_PP_IDENTITY, typename) > \ + class Ptr \ + , typename T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + , class U> \ +struct type_rebinder \ + < Ptr<T BOOST_PP_ENUM_TRAILING_PARAMS(n, P)>, U, 0u > \ +{ \ + typedef Ptr<U BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \ +}; \ +// +#define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS) +#include BOOST_PP_LOCAL_ITERATE() + +#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES) + +} //namespace detail { +} //namespace intrusive { +} //namespace boost { + +#include <boost/intrusive/detail/config_end.hpp> + +#endif // ! defined(BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP) diff --git a/3rdParty/Boost/src/boost/intrusive/detail/mpl.hpp b/3rdParty/Boost/src/boost/intrusive/detail/mpl.hpp new file mode 100644 index 0000000..02b1361 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/mpl.hpp @@ -0,0 +1,367 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2012 +// +// 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_MPL_HPP +#define BOOST_INTRUSIVE_DETAIL_MPL_HPP + +#include <boost/intrusive/detail/config_begin.hpp> +#include <cstddef> + +namespace boost { +namespace intrusive { +namespace detail { + +typedef char one; +struct two {one _[2];}; + +template< bool C_ > +struct bool_ +{ + static const bool value = C_; +}; + +typedef bool_<true> true_; +typedef bool_<false> false_; + +typedef true_ true_type; +typedef false_ false_type; + +typedef char yes_type; +struct no_type +{ + char padding[8]; +}; + +template <bool B, class T = void> +struct enable_if_c { + typedef T type; +}; + +template <class T> +struct enable_if_c<false, T> {}; + +template <class Cond, class T = void> +struct enable_if : public enable_if_c<Cond::value, T>{}; + +template<class F, class Param> +struct apply +{ + typedef typename F::template apply<Param>::type type; +}; + +template <class T, class U> +class is_convertible +{ + typedef char true_t; + class false_t { char dummy[2]; }; + static true_t dispatch(U); + static false_t dispatch(...); + static const T &trigger(); + public: + static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t); +}; + +template< + bool C + , typename T1 + , typename T2 + > +struct if_c +{ + typedef T1 type; +}; + +template< + typename T1 + , typename T2 + > +struct if_c<false,T1,T2> +{ + typedef T2 type; +}; + +template< + typename C + , typename T1 + , typename T2 + > +struct if_ +{ + typedef typename if_c<0 != C::value, T1, T2>::type type; +}; + +template< + bool C + , typename F1 + , typename F2 + > +struct eval_if_c + : if_c<C,F1,F2>::type +{}; + +template< + typename C + , typename T1 + , typename T2 + > +struct eval_if + : if_<C,T1,T2>::type +{}; + +// identity is an extension: it is not part of the standard. +template <class T> +struct identity +{ + typedef T type; +}; + +#if defined(BOOST_MSVC) || defined(__BORLANDC_) +#define BOOST_INTRUSIVE_TT_DECL __cdecl +#else +#define BOOST_INTRUSIVE_TT_DECL +#endif + +#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(UNDER_CE) +#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS +#endif + +template <typename T> +struct is_unary_or_binary_function_impl +{ static const bool value = false; }; + +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R> +struct is_unary_or_binary_function_impl<R (*)()> +{ static const bool value = true; }; + +template <typename R> +struct is_unary_or_binary_function_impl<R (*)(...)> +{ static const bool value = true; }; + +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R> +struct is_unary_or_binary_function_impl<R (__stdcall*)()> +{ static const bool value = true; }; + +#ifndef _MANAGED + +template <typename R> +struct is_unary_or_binary_function_impl<R (__fastcall*)()> +{ static const bool value = true; }; + +#endif + +template <typename R> +struct is_unary_or_binary_function_impl<R (__cdecl*)()> +{ static const bool value = true; }; + +template <typename R> +struct is_unary_or_binary_function_impl<R (__cdecl*)(...)> +{ static const bool value = true; }; + +#endif + +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (*)(T0)> +{ static const bool value = true; }; + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (*)(T0...)> +{ static const bool value = true; }; + +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)> +{ static const bool value = true; }; + +#ifndef _MANAGED + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)> +{ static const bool value = true; }; + +#endif + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)> +{ static const bool value = true; }; + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)> +{ static const bool value = true; }; + +#endif + +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (*)(T0, T1)> +{ static const bool value = true; }; + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (*)(T0, T1...)> +{ static const bool value = true; }; + +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)> +{ static const bool value = true; }; + +#ifndef _MANAGED + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1)> +{ static const bool value = true; }; + +#endif + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)> +{ static const bool value = true; }; + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)> +{ static const bool value = true; }; +#endif + +template <typename T> +struct is_unary_or_binary_function_impl<T&> +{ static const bool value = false; }; + +template<typename T> +struct is_unary_or_binary_function +{ static const bool value = is_unary_or_binary_function_impl<T>::value; }; + +//boost::alignment_of yields to 10K lines of preprocessed code, so we +//need an alternative +template <typename T> struct alignment_of; + +template <typename T> +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; + +template <unsigned A, unsigned S> +struct alignment_logic +{ + static const std::size_t value = A < S ? A : S; +}; + +template< typename T > +struct alignment_of +{ + static const std::size_t value = alignment_logic + < sizeof(alignment_of_hack<T>) - sizeof(T) + , sizeof(T) + >::value; +}; + +template <typename T, typename U> +struct is_same +{ + typedef char yes_type; + struct no_type + { + char padding[8]; + }; + + template <typename V> + static yes_type is_same_tester(V*, V*); + static no_type is_same_tester(...); + + static T *t; + static U *u; + + static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u)); +}; + +template<typename T> +struct add_const +{ typedef const T type; }; + +template<typename T> +struct remove_const +{ typedef T type; }; + +template<typename T> +struct remove_const<const T> +{ typedef T type; }; + +template<class T> +struct remove_reference +{ + typedef T type; +}; + +template<class T> +struct remove_reference<T&> +{ + typedef T type; +}; + +template<class Class> +class is_empty_class +{ + template <typename T> + struct empty_helper_t1 : public T + { + empty_helper_t1(); + int i[256]; + }; + + struct empty_helper_t2 + { int i[256]; }; + + public: + static const bool value = sizeof(empty_helper_t1<Class>) == sizeof(empty_helper_t2); +}; + +template<std::size_t S> +struct ls_zeros +{ + static const std::size_t value = (S & std::size_t(1)) ? 0 : (1 + ls_zeros<(S>>1u)>::value); +}; + +template<> +struct ls_zeros<0> +{ + static const std::size_t value = 0; +}; + +template<> +struct ls_zeros<1> +{ + static const std::size_t value = 0; +}; + +} //namespace detail +} //namespace intrusive +} //namespace boost + +#include <boost/intrusive/detail/config_end.hpp> + +#endif //BOOST_INTRUSIVE_DETAIL_MPL_HPP diff --git a/3rdParty/Boost/src/boost/intrusive/detail/preprocessor.hpp b/3rdParty/Boost/src/boost/intrusive/detail/preprocessor.hpp new file mode 100644 index 0000000..348b104 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/preprocessor.hpp @@ -0,0 +1,52 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2008-2012. 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP +#define BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> + +#include <boost/preprocessor/iteration/local.hpp> +#include <boost/preprocessor/punctuation/paren_if.hpp> +#include <boost/preprocessor/punctuation/comma_if.hpp> +#include <boost/preprocessor/control/expr_if.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing.hpp> +#include <boost/preprocessor/repetition/enum_shifted_params.hpp> +#include <boost/preprocessor/repetition/enum_shifted.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> +#include <boost/preprocessor/logical/not.hpp> +#include <boost/preprocessor/arithmetic/sub.hpp> +#include <boost/preprocessor/arithmetic/add.hpp> +#include <boost/preprocessor/iteration/iterate.hpp> + +#define BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS 10 + +#define BOOST_INTRUSIVE_PP_IDENTITY(z, n, data) data + +#define BOOST_INTRUSIVE_PP_DECLVAL(z, n, data) \ +boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \ +//! + +#define BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data) \ + BOOST_PP_CAT(class P, n) = void \ +//! + +#include <boost/intrusive/detail/config_end.hpp> + +#endif //#ifndef BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP diff --git a/3rdParty/Boost/src/boost/intrusive/detail/workaround.hpp b/3rdParty/Boost/src/boost/intrusive/detail/workaround.hpp new file mode 100644 index 0000000..87cab4b --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/workaround.hpp @@ -0,0 +1,22 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP +#define BOOST_INTRUSIVE_DETAIL_WRKRND_HPP + +#include <boost/intrusive/detail/config_begin.hpp> + +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) + #define BOOST_INTRUSIVE_PERFECT_FORWARDING +#endif + +#include <boost/intrusive/detail/config_end.hpp> + +#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP diff --git a/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp b/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp new file mode 100644 index 0000000..98ca6b9 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp @@ -0,0 +1,265 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_POINTER_TRAITS_HPP +#define BOOST_INTRUSIVE_POINTER_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> +#include <boost/intrusive/detail/memory_util.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <cstddef> + +namespace boost { +namespace intrusive { + +//! pointer_traits is the implementation of C++11 std::pointer_traits class with some +//! extensions like castings. +//! +//! pointer_traits supplies a uniform interface to certain attributes of pointer-like types. +template <typename Ptr> +struct pointer_traits +{ + #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED + //!The pointer type + //!queried by this pointer_traits instantiation + typedef Ptr pointer; + + //!Ptr::element_type if such a type exists; otherwise, T if Ptr is a class + //!template instantiation of the form SomePointer<T, Args>, where Args is zero or + //!more type arguments ; otherwise , the specialization is ill-formed. + typedef unspecified_type element_type; + + //!Ptr::difference_type if such a type exists; otherwise, + //!std::ptrdiff_t. + typedef unspecified_type difference_type; + + //!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is + //!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or + //!more type arguments ; otherwise, the instantiation of rebind is ill-formed. + //! + //!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre> + //!shall be used instead of rebind<U> to obtain a pointer to U. + template <class U> using rebind = unspecified; + + //!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is + //!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or + //!more type arguments ; otherwise, the instantiation of rebind is ill-formed. + //! + typedef element_type &reference; + #else + typedef Ptr pointer; + // + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT + ( boost::intrusive::detail::, Ptr, element_type + , boost::intrusive::detail::first_param<Ptr>) element_type; + // + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT + (boost::intrusive::detail::, Ptr, difference_type, std::ptrdiff_t) difference_type; + // + typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference; + // + template <class U> struct rebind_pointer + { + typedef typename boost::intrusive::detail::type_rebinder<Ptr, U>::type type; + }; + + #if !defined(BOOST_NO_TEMPLATE_ALIASES) + template <class U> using rebind = typename boost::intrusive::detail::type_rebinder<Ptr, U>::type; + #endif + #endif //#if !defined(BOOST_NO_TEMPLATE_ALIASES) + + //! <b>Remark</b>: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise, + //! it is element_type &. + //! + //! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::pointer_to(r). + //! Non-standard extension: If such function does not exist, returns pointer(addressof(r)); + static pointer pointer_to(reference r) + { + //Non-standard extension, it does not require Ptr::pointer_to. If not present + //tries to converts &r to pointer. + const bool value = boost::intrusive::detail:: + has_member_function_callable_with_pointer_to + <Ptr, typename boost::intrusive::detail::unvoid<element_type &>::type>::value; + ::boost::integral_constant<bool, value> flag; + return pointer_traits::priv_pointer_to(flag, r); + } + + //! <b>Remark</b>: Non-standard extension. + //! + //! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::static_cast_from(r). + //! If such function does not exist, returns pointer_to(static_cast<element_type&>(*uptr)) + template<class UPtr> + static pointer static_cast_from(const UPtr &uptr) + { + const bool value = boost::intrusive::detail:: + has_member_function_callable_with_static_cast_from + <Ptr, const UPtr>::value; + ::boost::integral_constant<bool, value> flag; + return pointer_traits::priv_static_cast_from(flag, uptr); + } + + //! <b>Remark</b>: Non-standard extension. + //! + //! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::const_cast_from(r). + //! If such function does not exist, returns pointer_to(const_cast<element_type&>(*uptr)) + template<class UPtr> + static pointer const_cast_from(const UPtr &uptr) + { + const bool value = boost::intrusive::detail:: + has_member_function_callable_with_const_cast_from + <Ptr, const UPtr>::value; + ::boost::integral_constant<bool, value> flag; + return pointer_traits::priv_const_cast_from(flag, uptr); + } + + //! <b>Remark</b>: Non-standard extension. + //! + //! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::dynamic_cast_from(r). + //! If such function does not exist, returns pointer_to(*dynamic_cast<element_type*>(&*uptr)) + template<class UPtr> + static pointer dynamic_cast_from(const UPtr &uptr) + { + const bool value = boost::intrusive::detail:: + has_member_function_callable_with_dynamic_cast_from + <Ptr, const UPtr>::value; + ::boost::integral_constant<bool, value> flag; + return pointer_traits::priv_dynamic_cast_from(flag, uptr); + } + + ///@cond + private: + //priv_to_raw_pointer + template <class T> + static T* to_raw_pointer(T* p) + { return p; } + + template <class Pointer> + static typename pointer_traits<Pointer>::element_type* + to_raw_pointer(const Pointer &p) + { return pointer_traits::to_raw_pointer(p.operator->()); } + + //priv_pointer_to + static pointer priv_pointer_to(boost::true_type, typename boost::intrusive::detail::unvoid<element_type>::type& r) + { return Ptr::pointer_to(r); } + + static pointer priv_pointer_to(boost::false_type, typename boost::intrusive::detail::unvoid<element_type>::type& r) + { return pointer(boost::intrusive::detail::addressof(r)); } + + //priv_static_cast_from + template<class UPtr> + static pointer priv_static_cast_from(boost::true_type, const UPtr &uptr) + { return Ptr::static_cast_from(uptr); } + + template<class UPtr> + static pointer priv_static_cast_from(boost::false_type, const UPtr &uptr) + { return pointer_to(*static_cast<element_type*>(to_raw_pointer(uptr))); } + + //priv_const_cast_from + template<class UPtr> + static pointer priv_const_cast_from(boost::true_type, const UPtr &uptr) + { return Ptr::const_cast_from(uptr); } + + template<class UPtr> + static pointer priv_const_cast_from(boost::false_type, const UPtr &uptr) + { return pointer_to(const_cast<element_type&>(*uptr)); } + + //priv_dynamic_cast_from + template<class UPtr> + static pointer priv_dynamic_cast_from(boost::true_type, const UPtr &uptr) + { return Ptr::dynamic_cast_from(uptr); } + + template<class UPtr> + static pointer priv_dynamic_cast_from(boost::false_type, const UPtr &uptr) + { return pointer_to(*dynamic_cast<element_type*>(&*uptr)); } + ///@endcond +}; + +///@cond + +// Remove cv qualification from Ptr parameter to pointer_traits: +template <typename Ptr> +struct pointer_traits<const Ptr> : pointer_traits<Ptr> {}; +template <typename Ptr> +struct pointer_traits<volatile Ptr> : pointer_traits<Ptr> { }; +template <typename Ptr> +struct pointer_traits<const volatile Ptr> : pointer_traits<Ptr> { }; +// Remove reference from Ptr parameter to pointer_traits: +template <typename Ptr> +struct pointer_traits<Ptr&> : pointer_traits<Ptr> { }; + +///@endcond + +//! Specialization of pointer_traits for raw pointers +//! +template <typename T> +struct pointer_traits<T*> +{ + typedef T element_type; + typedef T* pointer; + typedef std::ptrdiff_t difference_type; + + #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED + typedef T & reference; + //!typedef for <pre>U *</pre> + //! + //!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre> + //!shall be used instead of rebind<U> to obtain a pointer to U. + template <class U> using rebind = U*; + #else + typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference; + #if !defined(BOOST_NO_TEMPLATE_ALIASES) + template <class U> using rebind = U*; + #endif + #endif + + template <class U> struct rebind_pointer + { typedef U* type; }; + + //! <b>Returns</b>: addressof(r) + //! + static pointer pointer_to(reference r) + { return boost::intrusive::detail::addressof(r); } + + //! <b>Returns</b>: static_cast<pointer>(uptr) + //! + template<class U> + static pointer static_cast_from(U *uptr) + { return static_cast<pointer>(uptr); } + + //! <b>Returns</b>: const_cast<pointer>(uptr) + //! + template<class U> + static pointer const_cast_from(U *uptr) + { return const_cast<pointer>(uptr); } + + //! <b>Returns</b>: dynamic_cast<pointer>(uptr) + //! + template<class U> + static pointer dynamic_cast_from(U *uptr) + { return dynamic_cast<pointer>(uptr); } +}; + +} //namespace container { +} //namespace boost { + +#include <boost/intrusive/detail/config_end.hpp> + +#endif // ! defined(BOOST_INTRUSIVE_POINTER_TRAITS_HPP) diff --git a/3rdParty/Boost/src/boost/iterator.hpp b/3rdParty/Boost/src/boost/iterator.hpp index a43cfe1..6adab0e 100644 --- a/3rdParty/Boost/src/boost/iterator.hpp +++ b/3rdParty/Boost/src/boost/iterator.hpp @@ -1,4 +1,4 @@ -// interator.hpp workarounds for non-conforming standard libraries ---------// +// iterator.hpp workarounds for non-conforming standard libraries ---------// // (C) Copyright Beman Dawes 2000. Distributed under the Boost // Software License, Version 1.0. (See accompanying file diff --git a/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp b/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp index 27b08ff..9f2fbb0 100644 --- a/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp +++ b/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp @@ -24,15 +24,9 @@ #ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY # include <boost/type_traits/remove_reference.hpp> - -# if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) -# include <boost/type_traits/add_reference.hpp> -# endif - -#else -# include <boost/type_traits/add_reference.hpp> #endif +#include <boost/type_traits/add_reference.hpp> #include <boost/iterator/detail/config_def.hpp> #include <boost/iterator/iterator_traits.hpp> diff --git a/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp b/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp index 5ee73b5..d84b402 100644 --- a/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp +++ b/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp @@ -14,8 +14,8 @@ #include <boost/iterator/detail/facade_iterator_category.hpp> #include <boost/iterator/detail/enable_if.hpp> -#include <boost/implicit_cast.hpp> #include <boost/static_assert.hpp> +#include <boost/utility/addressof.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/add_const.hpp> @@ -147,7 +147,7 @@ namespace boost // Returning a mutable reference allows nonsense like // (*r++).mutate(), but it imposes fewer assumptions about the - // behavior of the value_type. In particular, recall taht + // behavior of the value_type. In particular, recall that // (*r).mutate() is legal if operator* returns by value. value_type& operator*() const @@ -294,46 +294,43 @@ namespace boost // operator->() needs special support for input iterators to strictly meet the // standard's requirements. If *i is not a reference type, we must still - // produce a lvalue to which a pointer can be formed. We do that by - // returning an instantiation of this special proxy class template. - template <class T> - struct operator_arrow_proxy + // produce an lvalue to which a pointer can be formed. We do that by + // returning a proxy object containing an instance of the reference object. + template <class Reference, class Pointer> + struct operator_arrow_dispatch // proxy references { - operator_arrow_proxy(T const* px) : m_value(*px) {} - T* operator->() const { return &m_value; } - // This function is needed for MWCW and BCC, which won't call operator-> - // again automatically per 13.3.1.2 para 8 - operator T*() const { return &m_value; } - mutable T m_value; + struct proxy + { + explicit proxy(Reference const & x) : m_ref(x) {} + Reference* operator->() { return boost::addressof(m_ref); } + // This function is needed for MWCW and BCC, which won't call + // operator-> again automatically per 13.3.1.2 para 8 + operator Reference*() { return boost::addressof(m_ref); } + Reference m_ref; + }; + typedef proxy result_type; + static result_type apply(Reference const & x) + { + return result_type(x); + } }; - // A metafunction that gets the result type for operator->. Also - // has a static function make() which builds the result from a - // Reference - template <class ValueType, class Reference, class Pointer> - struct operator_arrow_result + template <class T, class Pointer> + struct operator_arrow_dispatch<T&, Pointer> // "real" references { - // CWPro8.3 won't accept "operator_arrow_result::type", and we - // need that type below, so metafunction forwarding would be a - // losing proposition here. - typedef typename mpl::if_< - is_reference<Reference> - , Pointer - , operator_arrow_proxy<ValueType> - >::type type; - - static type make(Reference x) + typedef Pointer result_type; + static result_type apply(T& x) { - return boost::implicit_cast<type>(&x); + return boost::addressof(x); } }; # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // Deal with ETI template<> - struct operator_arrow_result<int, int, int> + struct operator_arrow_dispatch<int, int> { - typedef int type; + typedef int result_type; }; # endif @@ -618,11 +615,10 @@ namespace boost Value, CategoryOrTraversal, Reference, Difference > associated_types; - typedef boost::detail::operator_arrow_result< - typename associated_types::value_type - , Reference + typedef boost::detail::operator_arrow_dispatch< + Reference , typename associated_types::pointer - > pointer_; + > operator_arrow_dispatch_; protected: // For use by derived classes @@ -634,7 +630,7 @@ namespace boost typedef Reference reference; typedef Difference difference_type; - typedef typename pointer_::type pointer; + typedef typename operator_arrow_dispatch_::result_type pointer; typedef typename associated_types::iterator_category iterator_category; @@ -645,7 +641,7 @@ namespace boost pointer operator->() const { - return pointer_::make(*this->derived()); + return operator_arrow_dispatch_::apply(*this->derived()); } typename boost::detail::operator_brackets_result<Derived,Value,reference>::type diff --git a/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp b/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp index 97b6b48..79cc7f2 100644 --- a/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp +++ b/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp @@ -7,8 +7,8 @@ #ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP #define BOOST_REVERSE_ITERATOR_23022003THW_HPP +#include <boost/next_prior.hpp> #include <boost/iterator.hpp> -#include <boost/utility.hpp> #include <boost/iterator/iterator_adaptor.hpp> namespace boost diff --git a/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp b/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp index c365fe0..b79a440 100644 --- a/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp +++ b/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp @@ -20,6 +20,8 @@ #include <boost/type_traits/is_reference.hpp> #include <boost/type_traits/remove_const.hpp> #include <boost/type_traits/remove_reference.hpp> +#include <boost/utility/result_of.hpp> + #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) # include <boost/type_traits/is_base_and_derived.hpp> @@ -35,33 +37,16 @@ namespace boost namespace detail { - - template <class UnaryFunc> - struct function_object_result - { - typedef typename UnaryFunc::result_type type; - }; - -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <class Return, class Argument> - struct function_object_result<Return(*)(Argument)> - { - typedef Return type; - }; -#endif - // Compute the iterator_adaptor instantiation to be used for transform_iterator template <class UnaryFunc, class Iterator, class Reference, class Value> struct transform_iterator_base { private: // By default, dereferencing the iterator yields the same as - // the function. Do we need to adjust the way - // function_object_result is computed for the standard - // proposal (e.g. using Doug's result_of)? + // the function. typedef typename ia_dflt_help< Reference - , function_object_result<UnaryFunc> + , result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)> >::type reference; // To get the default for Value: remove any reference on the @@ -113,7 +98,7 @@ namespace boost #endif } - template< + template < class OtherUnaryFunction , class OtherIterator , class OtherReference diff --git a/3rdParty/Boost/src/boost/lambda/bind.hpp b/3rdParty/Boost/src/boost/lambda/bind.hpp new file mode 100644 index 0000000..0371393 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/bind.hpp @@ -0,0 +1,19 @@ +// -- bind.hpp -- Boost Lambda Library -------------------------------------- + +// Copyright (C) 1999-2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// Gary Powell (gwpowell@hotmail.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) +// +// For more information, see http://www.boost.org + +#ifndef BOOST_LAMBDA_BIND_HPP +#define BOOST_LAMBDA_BIND_HPP + +#include "boost/lambda/core.hpp" + +#include "boost/lambda/detail/bind_functions.hpp" + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/core.hpp b/3rdParty/Boost/src/boost/lambda/core.hpp new file mode 100644 index 0000000..e42766f --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/core.hpp @@ -0,0 +1,79 @@ +// -- core.hpp -- Boost Lambda Library ------------------------------------- +// +// Copyright (C) 2000 Gary Powell (powellg@amazon.com) +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org +// +// Includes the core of LL, without any real features for client: +// +// tuples, lambda functors, return type deduction templates, +// argument substitution mechanism (select functions) +// +// Some functionality comes as well: +// Assignment and subscript operators, as well as function +// call operator for placeholder variables. +// ------------------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_CORE_HPP +#define BOOST_LAMBDA_CORE_HPP + +#include "boost/type_traits/transform_traits.hpp" +#include "boost/type_traits/cv_traits.hpp" + +#include "boost/tuple/tuple.hpp" + +// inject some of the tuple names into lambda +namespace boost { +namespace lambda { + +using ::boost::tuples::tuple; +using ::boost::tuples::null_type; + +} // lambda +} // boost + +#include "boost/lambda/detail/lambda_config.hpp" +#include "boost/lambda/detail/lambda_fwd.hpp" + +#include "boost/lambda/detail/arity_code.hpp" +#include "boost/lambda/detail/actions.hpp" + +#include "boost/lambda/detail/lambda_traits.hpp" + +#include "boost/lambda/detail/function_adaptors.hpp" +#include "boost/lambda/detail/return_type_traits.hpp" + +#include "boost/lambda/detail/select_functions.hpp" + +#include "boost/lambda/detail/lambda_functor_base.hpp" + +#include "boost/lambda/detail/lambda_functors.hpp" + +#include "boost/lambda/detail/ret.hpp" + +namespace boost { +namespace lambda { + +namespace { + + // These are constants types and need to be initialised + boost::lambda::placeholder1_type free1 = boost::lambda::placeholder1_type(); + boost::lambda::placeholder2_type free2 = boost::lambda::placeholder2_type(); + boost::lambda::placeholder3_type free3 = boost::lambda::placeholder3_type(); + + boost::lambda::placeholder1_type& _1 = free1; + boost::lambda::placeholder2_type& _2 = free2; + boost::lambda::placeholder3_type& _3 = free3; + // _1, _2, ... naming scheme by Peter Dimov +} // unnamed + +} // lambda +} // boost + + +#endif //BOOST_LAMBDA_CORE_HPP diff --git a/3rdParty/Boost/src/boost/lambda/detail/actions.hpp b/3rdParty/Boost/src/boost/lambda/detail/actions.hpp new file mode 100644 index 0000000..668799f --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/actions.hpp @@ -0,0 +1,174 @@ +// -- Boost Lambda Library - actions.hpp ---------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) + +// For more information, see www.boost.org + +// ---------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_ACTIONS_HPP +#define BOOST_LAMBDA_ACTIONS_HPP + +namespace boost { +namespace lambda { + + + +template<int Arity, class Act> class action; + +// these need to be defined here, since the corresponding lambda +// functions are members of lambda_functor classes + +class assignment_action {}; +class subscript_action {}; + +template <class Action> class other_action; + +// action for specifying the explicit return type +template <class RET> class explicit_return_type_action {}; + +// action for preventing the expansion of a lambda expression +struct protect_action {}; + + // must be defined here, comma is a special case +struct comma_action {}; + + + // actions, for which the existence of protect is checked in return type + // deduction. + +template <class Action> struct is_protectable { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// NOTE: comma action is protectable. Other protectable actions +// are listed in operator_actions.hpp + +template<> struct is_protectable<other_action<comma_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + + +namespace detail { + + // this type is used in return type deductions to signal that deduction + // did not find a result. It does not necessarily mean an error, it commonly + // means that something else should be tried. + class unspecified {}; +} + + // function action is a special case: bind functions can be called with + // the return type specialized explicitly e.g. bind<int>(foo); + // If this call syntax is used, the return type is stored in the latter + // argument of function_action template. Otherwise the argument gets the type + // 'unspecified'. + // This argument is only relevant in the return type deduction code +template <int I, class Result_type = detail::unspecified> +class function_action {}; + +template<class T> class function_action<1, T> { +public: + template<class RET, class A1> + static RET apply(A1& a1) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1); + } +}; + +template<class T> class function_action<2, T> { +public: + template<class RET, class A1, class A2> + static RET apply(A1& a1, A2& a2) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2); + } +}; + +template<class T> class function_action<3, T> { +public: + template<class RET, class A1, class A2, class A3> + static RET apply(A1& a1, A2& a2, A3& a3) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3); + } +}; + +template<class T> class function_action<4, T> { +public: + template<class RET, class A1, class A2, class A3, class A4> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4); + } +}; + +template<class T> class function_action<5, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5); + } +}; + +template<class T> class function_action<6, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6); + } +}; + +template<class T> class function_action<7, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6, a7); + } +}; + +template<class T> class function_action<8, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, + A8& a8) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + +template<class T> class function_action<9, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, + A8& a8, A9& a9) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +}; + +template<class T> class function_action<10, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9, class A10> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, + A8& a8, A9& a9, A10& a10) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +}; + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/arity_code.hpp b/3rdParty/Boost/src/boost/lambda/detail/arity_code.hpp new file mode 100644 index 0000000..bed34b9 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/arity_code.hpp @@ -0,0 +1,110 @@ +// -- Boost Lambda Library ------------------------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// -------------------------------------------------- + +#ifndef BOOST_LAMBDA_ARITY_CODE_HPP +#define BOOST_LAMBDA_ARITY_CODE_HPP + +#include "boost/type_traits/cv_traits.hpp" +#include "boost/type_traits/transform_traits.hpp" + +namespace boost { +namespace lambda { + +// These constants state, whether a lambda_functor instantiation results from +// an expression which contains no placeholders (NONE), +// only free1 placeholders (FIRST), +// free2 placeholders and maybe free1 placeholders (SECOND), +// free3 and maybe free1 and free2 placeholders (THIRD), +// freeE placeholders and maybe free1 and free2 (EXCEPTION). +// RETHROW means, that a rethrow expression is used somewhere in the lambda_functor. + +enum { NONE = 0x00, // Notice we are using bits as flags here. + FIRST = 0x01, + SECOND = 0x02, + THIRD = 0x04, + EXCEPTION = 0x08, + RETHROW = 0x10}; + + +template<class T> +struct get_tuple_arity; + +namespace detail { + +template <class T> struct get_arity_; + +} // end detail; + +template <class T> struct get_arity { + + BOOST_STATIC_CONSTANT(int, value = detail::get_arity_<typename boost::remove_cv<typename boost::remove_reference<T>::type>::type>::value); + +}; + +namespace detail { + +template<class T> +struct get_arity_ { + BOOST_STATIC_CONSTANT(int, value = 0); +}; + +template<class T> +struct get_arity_<lambda_functor<T> > { + BOOST_STATIC_CONSTANT(int, value = get_arity<T>::value); +}; + +template<class Action, class Args> +struct get_arity_<lambda_functor_base<Action, Args> > { + BOOST_STATIC_CONSTANT(int, value = get_tuple_arity<Args>::value); +}; + +template<int I> +struct get_arity_<placeholder<I> > { + BOOST_STATIC_CONSTANT(int, value = I); +}; + +} // detail + +template<class T> +struct get_tuple_arity { + BOOST_STATIC_CONSTANT(int, value = get_arity<typename T::head_type>::value | get_tuple_arity<typename T::tail_type>::value); +}; + + +template<> +struct get_tuple_arity<null_type> { + BOOST_STATIC_CONSTANT(int, value = 0); +}; + + + // Does T have placeholder<I> as it's subexpression? + +template<class T, int I> +struct has_placeholder { + BOOST_STATIC_CONSTANT(bool, value = (get_arity<T>::value & I) != 0); +}; + +template<int I, int J> +struct includes_placeholder { + BOOST_STATIC_CONSTANT(bool, value = (J & I) != 0); +}; + +template<int I, int J> +struct lacks_placeholder { + BOOST_STATIC_CONSTANT(bool, value = ((J & I) == 0)); +}; + + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/bind_functions.hpp b/3rdParty/Boost/src/boost/lambda/detail/bind_functions.hpp new file mode 100644 index 0000000..f85513c --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/bind_functions.hpp @@ -0,0 +1,1879 @@ +// -- bind_functions.hpp -- Boost Lambda Library +// +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see http://www.boost.org + +// ---------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_BIND_FUNCTIONS_HPP +#define BOOST_LAMBDA_BIND_FUNCTIONS_HPP + + +namespace boost { +namespace lambda { + +#ifdef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING + + // gcc 2.96 instantiates bind functions it does not even call. + // These instantiations lead to incorrect types in the return type, + // and a compilation error results. + // This tweaking is to prevent the formation of the erroneous type. +namespace detail { + +template<class T> struct constify_non_funcs { + typedef typename + detail::IF_type<boost::is_function<T>::value, + boost::add_reference<T>, + boost::add_const<T> + >::type type; +}; + +} +#endif +// 1-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<Result(&)()>::type + > +> + +bind(Result(& a1)()) { + return + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<Result(&)()>::type + > + ( typename detail::bind_tuple_mapper<Result(&)()>::type + (a1) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1> >, + typename detail::bind_tuple_mapper<const Arg1>::type + > +> + +bind(const Arg1& a1) { + return + lambda_functor_base< + action<1, function_action<1> >, + typename detail::bind_tuple_mapper<const Arg1>::type + > + ( typename detail::bind_tuple_mapper<const Arg1>::type + (a1) + ); +} + +template <class Result, class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<const Arg1>::type + > +> + +bind(const Arg1& a1) { + return + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<const Arg1>::type + > + ( typename detail::bind_tuple_mapper<const Arg1>::type + (a1) + ); +} + + + #else +template <class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + > +> + +bind(const Arg1& a1) { + return + lambda_functor_base< + action<1, function_action<1> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + (a1) + ); +} + +template <class Result, class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + > +> + +bind(const Arg1& a1) { + return + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + (a1) + ); +} + +template <class Result> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<Result(*)()>::type + > +> + +bind(Result(* const & a1)()) { + return + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<Result(*)()>::type + > + ( typename detail::bind_tuple_mapper<Result(*)()>::type + (a1) + ); +} + + +#endif + +// 2-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<Result(&)(Par1), const Arg2>::type + > +> + +bind(Result(&a1)(Par1), const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<Result(&)(Par1), const Arg2>::type + > + ( typename detail::bind_tuple_mapper<Result(&)(Par1), const Arg2>::type + (a1, a2) + ); +} +#endif + +#ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2> >, + typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + > +> + +bind(const Arg1& a1, const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2> >, + typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + > + ( typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + (a1, a2) + ); +} + +template <class Result, class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + > +> + +bind(const Arg1& a1, const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + > + ( typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + (a1, a2) + ); +} + + + #else +template <class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + (a1, a2) + ); +} + +template <class Result, class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + (a1, a2) + ); +} + +template <class Result, class Par1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<Result(*)(Par1), const Arg2>::type + > +> + +bind(Result(* const & a1)(Par1), const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<Result(*)(Par1), const Arg2>::type + > + ( typename detail::bind_tuple_mapper<Result(*)(Par1), const Arg2>::type + (a1, a2) + ); +} + + + #endif + +// 3-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2), const Arg2, const Arg3 + >::type + > +> + +bind(Result(&a1)(Par1, Par2), const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2), const Arg2, const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2), const Arg2, const Arg3 + >::type + (a1, a2, a3) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + (a1, a2, a3) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + (a1, a2, a3) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3 + >::type + (a1, a2, a3) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3 + >::type + (a1, a2, a3) + ); +} + +template <class Result, class Par1, class Par2, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2), const Arg2, const Arg3 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2), const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2), const Arg2, const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2), const Arg2, const Arg3 + >::type + (a1, a2, a3) + ); +} + + + #endif + +// 4-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Arg2, + class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3), const Arg2& a2, const Arg3& a3, + const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Arg2, + class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3), const Arg2& a2, + const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + + + #endif + +// 5-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Arg2, class Arg3, class Arg4, class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4), const Arg2& a2, const Arg3& a3, + const Arg4& a4, const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Arg2, class Arg3, class Arg4, class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + + + #endif + +// 6-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + + + #endif + +// 7-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5, const Arg6& a6, + const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5, Par6), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + + + #endif + +// 8-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Arg2, class Arg3, + class Arg4, class Arg5, class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5, const Arg6& a6, + const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Arg2, class Arg3, + class Arg4, class Arg5, class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + + + #endif + +// 9-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Par8, class Arg2, + class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, + class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, + const Arg9 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8, const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, const Arg9 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, const Arg9 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Par8, class Arg2, + class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, + class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, + const Arg9 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8, const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + + + #endif + +// 10-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Par8, class Par9, + class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, + class Arg7, class Arg8, class Arg9, class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8, const Arg9& a9, + const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8, class Arg9, class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9, const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, + class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9, const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8, class Arg9, class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, const Arg9, + const Arg10 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9, const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, + class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, const Arg9, + const Arg10 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9, const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Par8, class Par9, + class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, + class Arg7, class Arg8, class Arg9, class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, + Par9), const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8, const Arg9& a9, + const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + + + #endif + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/function_adaptors.hpp b/3rdParty/Boost/src/boost/lambda/detail/function_adaptors.hpp new file mode 100644 index 0000000..35db8b4 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/function_adaptors.hpp @@ -0,0 +1,789 @@ +// Boost Lambda Library - function_adaptors.hpp ---------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + + +#ifndef BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP +#define BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP + +#include "boost/mpl/has_xxx.hpp" +#include "boost/tuple/tuple.hpp" +#include "boost/type_traits/same_traits.hpp" +#include "boost/type_traits/remove_reference.hpp" +#include "boost/type_traits/remove_cv.hpp" +#include "boost/type_traits/add_const.hpp" +#include "boost/type_traits/add_volatile.hpp" +#include "boost/utility/result_of.hpp" + +namespace boost { +namespace lambda { + +namespace detail { + +BOOST_MPL_HAS_XXX_TEMPLATE_DEF(sig) + +template<class Tuple> +struct remove_references_from_elements { + typedef typename boost::tuples::cons< + typename boost::remove_reference<typename Tuple::head_type>::type, + typename remove_references_from_elements<typename Tuple::tail_type>::type + > type; +}; + +template<> +struct remove_references_from_elements<boost::tuples::null_type> { + typedef boost::tuples::null_type type; +}; + +} + +template <class Func> struct function_adaptor { + + typedef typename detail::remove_reference_and_cv<Func>::type plainF; + +#if !defined(BOOST_NO_RESULT_OF) + // Support functors that use the boost::result_of return type convention. + template<class Tuple, int Length, bool HasSig> + struct result_converter; + template<class Tuple, int Length> + struct result_converter<Tuple, Length, true> + : plainF::template sig< + typename detail::remove_references_from_elements<Tuple>::type + > + {}; + template<class Tuple> + struct result_converter<Tuple, 0, false> + : result_of<plainF()> + {}; + template<class Tuple> + struct result_converter<Tuple, 1, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 2, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 3, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 4, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 5, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 6, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type, + typename tuples::element<6, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 7, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type, + typename tuples::element<6, Tuple>::type, + typename tuples::element<7, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 8, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type, + typename tuples::element<6, Tuple>::type, + typename tuples::element<7, Tuple>::type, + typename tuples::element<8, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 9, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type, + typename tuples::element<6, Tuple>::type, + typename tuples::element<7, Tuple>::type, + typename tuples::element<8, Tuple>::type, + typename tuples::element<9, Tuple>::type) + > + {}; + + // we do not know the return type off-hand, we must ask it from Func + // To sig we pass a cons list, where the head is the function object type + // itself (potentially cv-qualified) + // and the tail contains the types of the actual arguments to be passed + // to the function object. The arguments can be cv qualified + // as well. + template <class Args> + struct sig + : result_converter< + Args + , tuples::length<typename Args::tail_type>::value + , detail::has_sig<plainF>::value + > + {}; +#else // BOOST_NO_RESULT_OF + + template <class Args> class sig { + typedef typename detail::remove_reference_and_cv<Func>::type plainF; + public: + typedef typename plainF::template sig< + typename detail::remove_references_from_elements<Args>::type + >::type type; + }; +#endif + + template<class RET, class A1> + static RET apply(A1& a1) { + return a1(); + } + template<class RET, class A1, class A2> + static RET apply(A1& a1, A2& a2) { + return a1(a2); + } + template<class RET, class A1, class A2, class A3> + static RET apply(A1& a1, A2& a2, A3& a3) { + return a1(a2, a3); + } + template<class RET, class A1, class A2, class A3, class A4> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) { + return a1(a2, a3, a4); + } + template<class RET, class A1, class A2, class A3, class A4, class A5> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return a1(a2, a3, a4, a5); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return a1(a2, a3, a4, a5, a6); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, + class A7> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, + A7& a7) { + return a1(a2, a3, a4, a5, a6, a7); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, + A7& a7, A8& a8) { + return a1(a2, a3, a4, a5, a6, a7, a8); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8, class A9> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, + A7& a7, A8& a8, A9& a9) { + return a1(a2, a3, a4, a5, a6, a7, a8, a9); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8, class A9, class A10> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, + A7& a7, A8& a8, A9& a9, A10& a10) { + return a1(a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +}; + +template <class Func> struct function_adaptor<const Func>; // error + +// -- function adaptors with data member access +template <class Object, class T> +struct function_adaptor<T Object::*> { + + // typedef detail::unspecified type; + + // T can have qualifiers and can be a reference type + // We get the return type by adding const, if the object through which + // the data member is accessed is const, and finally adding a reference + template<class Args> class sig { + typedef typename boost::tuples::element<1, Args>::type argument_type; + typedef typename boost::remove_reference< + argument_type + >::type unref_type; + + typedef typename detail::IF<boost::is_const<unref_type>::value, + typename boost::add_const<T>::type, + T + >::RET properly_consted_return_type; + + typedef typename detail::IF<boost::is_volatile<unref_type>::value, + typename boost::add_volatile<properly_consted_return_type>::type, + properly_consted_return_type + >::RET properly_cvd_return_type; + + + public: + typedef typename detail::IF<boost::is_reference<argument_type>::value, + typename boost::add_reference<properly_cvd_return_type>::type, + typename boost::remove_cv<T>::type + >::RET type; + }; + + template <class RET> + static RET apply( T Object::*data, Object& o) { + return o.*data; + } + template <class RET> + static RET apply( T Object::*data, const Object& o) { + return o.*data; + } + template <class RET> + static RET apply( T Object::*data, volatile Object& o) { + return o.*data; + } + template <class RET> + static RET apply( T Object::*data, const volatile Object& o) { + return o.*data; + } + template <class RET> + static RET apply( T Object::*data, Object* o) { + return o->*data; + } + template <class RET> + static RET apply( T Object::*data, const Object* o) { + return o->*data; + } + template <class RET> + static RET apply( T Object::*data, volatile Object* o) { + return o->*data; + } + template <class RET> + static RET apply( T Object::*data, const volatile Object* o) { + return o->*data; + } +}; + +// -- function adaptors with 1 argument apply + +template <class Result> +struct function_adaptor<Result (void)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET> + static Result apply(Result (*func)()) { + return func(); + } +}; + +template <class Result> +struct function_adaptor<Result (*)(void)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET> + static Result apply(Result (*func)()) { + return func(); + } +}; + + +// -- function adaptors with 2 argument apply +template <class Object, class Result> +struct function_adaptor<Result (Object::*)() const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET> + static Result apply( Result (Object::*func)() const, const Object* o) { + return (o->*func)(); + } + template <class RET> + static Result apply( Result (Object::*func)() const, const Object& o) { + return (o.*func)(); + } +}; + +template <class Object, class Result> +struct function_adaptor<Result (Object::*)()> { + + template<class T> struct sig { typedef Result type; }; + template <class RET> + static Result apply( Result (Object::*func)(), Object* o) { + return (o->*func)(); + } + template <class RET> + static Result apply( Result (Object::*func)(), Object& o) { + return (o.*func)(); + } +}; + +template <class Arg1, class Result> +struct function_adaptor<Result (Arg1)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1> + static Result apply(Result (*func)(Arg1), A1& a1) { + return func(a1); + } +}; + +template <class Arg1, class Result> +struct function_adaptor<Result (*)(Arg1)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1> + static Result apply(Result (*func)(Arg1), A1& a1) { + return func(a1); + } +}; + + +// -- function adaptors with 3 argument apply +template <class Object, class Arg1, class Result> +struct function_adaptor<Result (Object::*)(Arg1) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1> + static Result apply( Result (Object::*func)(Arg1) const, const Object* o, + A1& a1) { + return (o->*func)(a1); + } + template <class RET, class A1> + static Result apply( Result (Object::*func)(Arg1) const, const Object& o, + A1& a1) { + return (o.*func)(a1); + } +}; + +template <class Object, class Arg1, class Result> +struct function_adaptor<Result (Object::*)(Arg1)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1> + static Result apply( Result (Object::*func)(Arg1), Object* o, A1& a1) { + return (o->*func)(a1); + } + template <class RET, class A1> + static Result apply( Result (Object::*func)(Arg1), Object& o, A1& a1) { + return (o.*func)(a1); + } +}; + +template <class Arg1, class Arg2, class Result> +struct function_adaptor<Result (Arg1, Arg2)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2> + static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) { + return func(a1, a2); + } +}; + +template <class Arg1, class Arg2, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2> + static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) { + return func(a1, a2); + } +}; + + +// -- function adaptors with 4 argument apply +template <class Object, class Arg1, class Arg2, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2> + static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object* o, A1& a1, A2& a2) { + return (o->*func)(a1, a2); + } + template <class RET, class A1, class A2> + static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object& o, A1& a1, A2& a2) { + return (o.*func)(a1, a2); + } +}; + +template <class Object, class Arg1, class Arg2, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2> + static Result apply( Result (Object::*func)(Arg1, Arg2), Object* o, A1& a1, A2& a2) { + return (o->*func)(a1, a2); + } + template <class RET, class A1, class A2> + static Result apply( Result (Object::*func)(Arg1, Arg2), Object& o, A1& a1, A2& a2) { + return (o.*func)(a1, a2); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3> + static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) { + return func(a1, a2, a3); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3> + static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) { + return func(a1, a2, a3); + } +}; + + +// -- function adaptors with 5 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object* o, A1& a1, A2& a2, A3& a3) { + return (o->*func)(a1, a2, a3); + } + template <class RET, class A1, class A2, class A3> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object& o, A1& a1, A2& a2, A3& a3) { + return (o.*func)(a1, a2, a3); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object* o, A1& a1, A2& a2, A3& a3) { + return (o->*func)(a1, a2, a3); + } + template <class RET, class A1, class A2, class A3> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object& o, A1& a1, A2& a2, A3& a3) { + return (o.*func)(a1, a2, a3); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) { + return func(a1, a2, a3, a4); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) { + return func(a1, a2, a3, a4); + } +}; + + +// -- function adaptors with 6 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4) { + return (o->*func)(a1, a2, a3, a4); + } + template <class RET, class A1, class A2, class A3, class A4> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4) { + return (o.*func)(a1, a2, a3, a4); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object* o, A1& a1, A2& a2, A3& a3, A4& a4) { + return (o->*func)(a1, a2, a3, a4); + } + template <class RET, class A1, class A2, class A3, class A4> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object& o, A1& a1, A2& a2, A3& a3, A4& a4) { + return (o.*func)(a1, a2, a3, a4); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return func(a1, a2, a3, a4, a5); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return func(a1, a2, a3, a4, a5); + } +}; + + +// -- function adaptors with 7 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return (o->*func)(a1, a2, a3, a4, a5); + } + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return (o.*func)(a1, a2, a3, a4, a5); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return (o->*func)(a1, a2, a3, a4, a5); + } + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return (o.*func)(a1, a2, a3, a4, a5); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return func(a1, a2, a3, a4, a5, a6); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return func(a1, a2, a3, a4, a5, a6); + } +}; + + +// -- function adaptors with 8 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return (o->*func)(a1, a2, a3, a4, a5, a6); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return (o.*func)(a1, a2, a3, a4, a5, a6); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return (o->*func)(a1, a2, a3, a4, a5, a6); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return (o.*func)(a1, a2, a3, a4, a5, a6); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return func(a1, a2, a3, a4, a5, a6, a7); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return func(a1, a2, a3, a4, a5, a6, a7); + } +}; + + +// -- function adaptors with 9 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return (o->*func)(a1, a2, a3, a4, a5, a6, a7); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return (o.*func)(a1, a2, a3, a4, a5, a6, a7); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return (o->*func)(a1, a2, a3, a4, a5, a6, a7); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return (o.*func)(a1, a2, a3, a4, a5, a6, a7); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return func(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return func(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + + +// -- function adaptors with 10 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) { + return func(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) { + return func(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +}; + +} // namespace lambda +} // namespace boost + +#endif + + + + + + + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/is_instance_of.hpp b/3rdParty/Boost/src/boost/lambda/detail/is_instance_of.hpp new file mode 100644 index 0000000..1dfbd43 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/is_instance_of.hpp @@ -0,0 +1,104 @@ +// Boost Lambda Library - is_instance_of.hpp --------------------- + +// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// --------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_IS_INSTANCE_OF +#define BOOST_LAMBDA_IS_INSTANCE_OF + +#include "boost/config.hpp" // for BOOST_STATIC_CONSTANT +#include "boost/type_traits/conversion_traits.hpp" // for is_convertible +#include "boost/preprocessor/enum_shifted_params.hpp" +#include "boost/preprocessor/repeat_2nd.hpp" + +// is_instance_of -------------------------------- +// +// is_instance_of_n<A, B>::value is true, if type A is +// an instantiation of a template B, or A derives from an instantiation +// of template B +// +// n is the number of template arguments for B +// +// Example: +// is_instance_of_2<std::istream, basic_stream>::value == true + +// The original implementation was somewhat different, with different versions +// for different compilers. However, there was still a problem +// with gcc.3.0.2 and 3.0.3 compilers, which didn't think regard +// is_instance_of_N<...>::value was a constant. +// John Maddock suggested the way around this problem by building +// is_instance_of templates using boost::is_convertible. +// Now we only have one version of is_instance_of templates, which delagate +// all the nasty compiler tricks to is_convertible. + +#define BOOST_LAMBDA_CLASS(z, N,A) BOOST_PP_COMMA_IF(N) class +#define BOOST_LAMBDA_CLASS_ARG(z, N,A) BOOST_PP_COMMA_IF(N) class A##N +#define BOOST_LAMBDA_ARG(z, N,A) BOOST_PP_COMMA_IF(N) A##N + +#define BOOST_LAMBDA_CLASS_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS, NAME) + +#define BOOST_LAMBDA_CLASS_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS_ARG, NAME) + +#define BOOST_LAMBDA_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_ARG, NAME) + +namespace boost { +namespace lambda { + +#define BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE(INDEX) \ + \ +namespace detail { \ + \ +template <template<BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class F> \ +struct BOOST_PP_CAT(conversion_tester_,INDEX) { \ + template<BOOST_LAMBDA_CLASS_ARG_LIST(INDEX,A)> \ + BOOST_PP_CAT(conversion_tester_,INDEX) \ + (const F<BOOST_LAMBDA_ARG_LIST(INDEX,A)>&); \ +}; \ + \ +} /* end detail */ \ + \ +template <class From, template <BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class To> \ +struct BOOST_PP_CAT(is_instance_of_,INDEX) \ +{ \ + private: \ + typedef ::boost::is_convertible< \ + From, \ + BOOST_PP_CAT(detail::conversion_tester_,INDEX)<To> \ + > helper_type; \ + \ +public: \ + BOOST_STATIC_CONSTANT(bool, value = helper_type::value); \ +}; + + +#define BOOST_LAMBDA_HELPER(z, N, A) BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE( BOOST_PP_INC(N) ) + +// Generate the traits for 1-4 argument templates + +BOOST_PP_REPEAT_2ND(4,BOOST_LAMBDA_HELPER,FOO) + +#undef BOOST_LAMBDA_HELPER +#undef BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE +#undef BOOST_LAMBDA_CLASS +#undef BOOST_LAMBDA_ARG +#undef BOOST_LAMBDA_CLASS_ARG +#undef BOOST_LAMBDA_CLASS_LIST +#undef BOOST_LAMBDA_ARG_LIST +#undef BOOST_LAMBDA_CLASS_ARG_LIST + +} // lambda +} // boost + +#endif + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_config.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_config.hpp new file mode 100644 index 0000000..9fd1a7b --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_config.hpp @@ -0,0 +1,48 @@ +// Boost Lambda Library - lambda_config.hpp ------------------------------ + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// --------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_LAMBDA_CONFIG_HPP +#define BOOST_LAMBDA_LAMBDA_CONFIG_HPP + +// add to boost/config.hpp +// for now + + +# if defined __GNUC__ +# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# define BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +# endif +# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97) +# define BOOST_NO_TEMPLATED_STREAMS +# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +# endif +# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 95) +# define BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER +# endif +# endif // __GNUC__ + + +#if defined __KCC + +#define BOOST_NO_FDECL_TEMPLATES_AS_TEMPLATE_TEMPLATE_PARAMS + +#endif // __KCC + +#endif + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_functor_base.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_functor_base.hpp new file mode 100644 index 0000000..b084acd --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_functor_base.hpp @@ -0,0 +1,615 @@ +// Boost Lambda Library lambda_functor_base.hpp ----------------------------- +// +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// ------------------------------------------------------------ + +#ifndef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP +#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP + +#include "boost/type_traits/add_reference.hpp" +#include "boost/type_traits/add_const.hpp" +#include "boost/type_traits/remove_const.hpp" +#include "boost/lambda/detail/lambda_fwd.hpp" +#include "boost/lambda/detail/lambda_traits.hpp" + +namespace boost { +namespace lambda { + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + // for return type deductions we wrap bound argument to this class, + // which fulfils the base class contract for lambda_functors +template <class T> +class identity { + + T elem; +public: + + typedef T element_t; + + // take all parameters as const references. Note that non-const references + // stay as they are. + typedef typename boost::add_reference< + typename boost::add_const<T>::type + >::type par_t; + + explicit identity(par_t t) : elem(t) {} + + template <typename SigArgs> + struct sig { typedef typename boost::remove_const<element_t>::type type; }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; } +}; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + +template <class T> +inline lambda_functor<identity<T&> > var(T& t) { return identity<T&>(t); } + + // for lambda functors, var is an identity operator. It was forbidden + // at some point, but we might want to var something that can be a + // non-lambda functor or a lambda functor. +template <class T> +lambda_functor<T> var(const lambda_functor<T>& t) { return t; } + +template <class T> struct var_type { + typedef lambda_functor<identity<T&> > type; +}; + + +template <class T> +inline +lambda_functor<identity<typename bound_argument_conversion<const T>::type> > +constant(const T& t) { + return identity<typename bound_argument_conversion<const T>::type>(t); +} +template <class T> +lambda_functor<T> constant(const lambda_functor<T>& t) { return t; } + +template <class T> struct constant_type { + typedef + lambda_functor< + identity<typename bound_argument_conversion<const T>::type> + > type; +}; + + + +template <class T> +inline lambda_functor<identity<const T&> > constant_ref(const T& t) { + return identity<const T&>(t); +} +template <class T> +lambda_functor<T> constant_ref(const lambda_functor<T>& t) { return t; } + +template <class T> struct constant_ref_type { + typedef + lambda_functor<identity<const T&> > type; +}; + + + + // as_lambda_functor turns any types to lambda functors + // non-lambda_functors will be bound argument types +template <class T> +struct as_lambda_functor { + typedef typename + detail::remove_reference_and_cv<T>::type plain_T; + typedef typename + detail::IF<is_lambda_functor<plain_T>::value, + plain_T, + lambda_functor< + identity<typename bound_argument_conversion<T>::type> + > + >::RET type; +}; + +// turns arbitrary objects into lambda functors +template <class T> +inline +lambda_functor<identity<typename bound_argument_conversion<const T>::type> > +to_lambda_functor(const T& t) { + return identity<typename bound_argument_conversion<const T>::type>(t); +} + +template <class T> +inline lambda_functor<T> +to_lambda_functor(const lambda_functor<T>& t) { + return t; +} + +namespace detail { + + + +// In a call constify_rvals<T>::go(x) +// x should be of type T. If T is a non-reference type, do +// returns x as const reference. +// Otherwise the type doesn't change. +// The purpose of this class is to avoid +// 'cannot bind temporaries to non-const references' errors. +template <class T> struct constify_rvals { + template<class U> + static inline const U& go(const U& u) { return u; } +}; + +template <class T> struct constify_rvals<T&> { + template<class U> + static inline U& go(U& u) { return u; } +}; + + // check whether one of the elements of a tuple (cons list) is of type + // null_type. Needed, because the compiler goes ahead and instantiates + // sig template for nullary case even if the nullary operator() is not + // called +template <class T> struct is_null_type +{ BOOST_STATIC_CONSTANT(bool, value = false); }; + +template <> struct is_null_type<null_type> +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +template<class Tuple> struct has_null_type { + BOOST_STATIC_CONSTANT(bool, value = (is_null_type<typename Tuple::head_type>::value || has_null_type<typename Tuple::tail_type>::value)); +}; +template<> struct has_null_type<null_type> { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + + +// helpers ------------------- + + +template<class Args, class SigArgs> +class deduce_argument_types_ { + typedef typename as_lambda_functor<typename Args::head_type>::type lf_t; + typedef typename lf_t::inherited::template sig<SigArgs>::type el_t; +public: + typedef + boost::tuples::cons< + el_t, + typename deduce_argument_types_<typename Args::tail_type, SigArgs>::type + > type; +}; + +template<class SigArgs> +class deduce_argument_types_<null_type, SigArgs> { +public: + typedef null_type type; +}; + + +// // note that tuples cannot have plain function types as elements. +// // Hence, all other types will be non-const, except references to +// // functions. +// template <class T> struct remove_reference_except_from_functions { +// typedef typename boost::remove_reference<T>::type t; +// typedef typename detail::IF<boost::is_function<t>::value, T, t>::RET type; +// }; + +template<class Args, class SigArgs> +class deduce_non_ref_argument_types_ { + typedef typename as_lambda_functor<typename Args::head_type>::type lf_t; + typedef typename lf_t::inherited::template sig<SigArgs>::type el_t; +public: + typedef + boost::tuples::cons< + // typename detail::remove_reference_except_from_functions<el_t>::type, + typename boost::remove_reference<el_t>::type, + typename deduce_non_ref_argument_types_<typename Args::tail_type, SigArgs>::type + > type; +}; + +template<class SigArgs> +class deduce_non_ref_argument_types_<null_type, SigArgs> { +public: + typedef null_type type; +}; + + // ------------- + +// take stored Args and Open Args, and return a const list with +// deduced elements (real return types) +template<class Args, class SigArgs> +class deduce_argument_types { + typedef typename deduce_argument_types_<Args, SigArgs>::type t1; +public: + typedef typename detail::IF< + has_null_type<t1>::value, null_type, t1 + >::RET type; +}; + +// take stored Args and Open Args, and return a const list with +// deduced elements (references are stripped from the element types) + +template<class Args, class SigArgs> +class deduce_non_ref_argument_types { + typedef typename deduce_non_ref_argument_types_<Args, SigArgs>::type t1; +public: + typedef typename detail::IF< + has_null_type<t1>::value, null_type, t1 + >::RET type; +}; + +template <int N, class Args, class SigArgs> +struct nth_return_type_sig { + typedef typename + as_lambda_functor< + typename boost::tuples::element<N, Args>::type + // typename tuple_element_as_reference<N, Args>::type + >::type lf_type; + + typedef typename lf_type::inherited::template sig<SigArgs>::type type; +}; + +template<int N, class Tuple> struct element_or_null { + typedef typename boost::tuples::element<N, Tuple>::type type; +}; + +template<int N> struct element_or_null<N, null_type> { + typedef null_type type; +}; + + + + +} // end detail + + // -- lambda_functor base --------------------- + +// the explicit_return_type_action case ----------------------------------- +template<class RET, class Args> +class lambda_functor_base<explicit_return_type_action<RET>, Args> +{ +public: + Args args; + + typedef RET result_type; + + explicit lambda_functor_base(const Args& a) : args(a) {} + + template <class SigArgs> struct sig { typedef RET type; }; + + template<class RET_, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const + { + return detail::constify_rvals<RET>::go( + detail::r_select<RET>::go(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)); + } +}; + +// the protect_action case ----------------------------------- +template<class Args> +class lambda_functor_base<protect_action, Args> +{ +public: + Args args; +public: + + explicit lambda_functor_base(const Args& a) : args(a) {} + + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const + { + CALL_USE_ARGS; + return boost::tuples::get<0>(args); + } + + template<class SigArgs> struct sig { + // typedef typename detail::tuple_element_as_reference<0, SigArgs>::type type; + typedef typename boost::tuples::element<0, Args>::type type; + }; +}; + +// Do nothing -------------------------------------------------------- +class do_nothing_action {}; + +template<class Args> +class lambda_functor_base<do_nothing_action, Args> { + // Args args; +public: + // explicit lambda_functor_base(const Args& a) {} + lambda_functor_base() {} + + + template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const { + return CALL_USE_ARGS; + } + + template<class SigArgs> struct sig { typedef void type; }; +}; + + +// These specializations provide a shorter notation to define actions. +// These lambda_functor_base instances take care of the recursive evaluation +// of the arguments and pass the evaluated arguments to the apply function +// of an action class. To make action X work with these classes, one must +// instantiate the lambda_functor_base as: +// lambda_functor_base<action<ARITY, X>, Args> +// Where ARITY is the arity of the apply function in X + +// The return type is queried as: +// return_type_N<X, EvaluatedArgumentTypes>::type +// for which there must be a specialization. + +// Function actions, casts, throws,... all go via these classes. + + +template<class Act, class Args> +class lambda_functor_base<action<0, Act>, Args> +{ +public: +// Args args; not needed + explicit lambda_functor_base(const Args& /*a*/) {} + + template<class SigArgs> struct sig { + typedef typename return_type_N<Act, null_type>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + CALL_USE_ARGS; + return Act::template apply<RET>(); + } +}; + + +#if defined BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART +#error "Multiple defines of BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART" +#endif + + +#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(ARITY) \ +template<class Act, class Args> \ +class lambda_functor_base<action<ARITY, Act>, Args> \ +{ \ +public: \ + Args args; \ + \ + explicit lambda_functor_base(const Args& a) : args(a) {} \ + \ + template<class SigArgs> struct sig { \ + typedef typename \ + detail::deduce_argument_types<Args, SigArgs>::type rets_t; \ + public: \ + typedef typename \ + return_type_N_prot<Act, rets_t>::type type; \ + }; \ + \ + \ + template<class RET, CALL_TEMPLATE_ARGS> \ + RET call(CALL_FORMAL_ARGS) const { \ + using boost::tuples::get; \ + using detail::constify_rvals; \ + using detail::r_select; \ + using detail::element_or_null; \ + using detail::deduce_argument_types; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(1) + + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(2) + + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(3) + + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(4) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(5) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(6) + + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(7) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + typedef typename element_or_null<6, rets_t>::type rt6; + + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(8) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + typedef typename element_or_null<6, rets_t>::type rt6; + typedef typename element_or_null<7, rets_t>::type rt7; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(9) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + typedef typename element_or_null<6, rets_t>::type rt6; + typedef typename element_or_null<7, rets_t>::type rt7; + typedef typename element_or_null<8, rets_t>::type rt8; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(10) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + typedef typename element_or_null<6, rets_t>::type rt6; + typedef typename element_or_null<7, rets_t>::type rt7; + typedef typename element_or_null<8, rets_t>::type rt8; + typedef typename element_or_null<9, rets_t>::type rt9; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt9>::go(r_select<rt9>::go(get<9>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +#undef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART + + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_functors.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_functors.hpp new file mode 100644 index 0000000..9b1b082 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_functors.hpp @@ -0,0 +1,324 @@ +// Boost Lambda Library - lambda_functors.hpp ------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see http://www.boost.org + +// ------------------------------------------------ + +#ifndef BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP +#define BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + +#include <boost/mpl/or.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_array.hpp> + +#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1)\ + typename lazy_disable_if<is_array<A1>, typename R1 >::type +#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) \ + typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2> >, typename R1, R2 >::type +#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) \ + typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2>, is_array<A3> >, typename R1, R2, R3 >::type + +#else + +#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1) typename R1::type +#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) typename R1, R2::type +#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) typename R1, R2, R3::type + +#endif + +namespace boost { +namespace lambda { + +// -- lambda_functor -------------------------------------------- +// -------------------------------------------------------------- + +//inline const null_type const_null_type() { return null_type(); } + +namespace detail { +namespace { + + static const null_type constant_null_type = null_type(); + +} // unnamed +} // detail + +class unused {}; + +#define cnull_type() detail::constant_null_type + +// -- free variables types -------------------------------------------------- + + // helper to work around the case where the nullary return type deduction + // is always performed, even though the functor is not nullary +namespace detail { + template<int N, class Tuple> struct get_element_or_null_type { + typedef typename + detail::tuple_element_as_reference<N, Tuple>::type type; + }; + template<int N> struct get_element_or_null_type<N, null_type> { + typedef null_type type; + }; +} + +template <int I> struct placeholder; + +template<> struct placeholder<FIRST> { + + template<class SigArgs> struct sig { + typedef typename detail::get_element_or_null_type<0, SigArgs>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + BOOST_STATIC_ASSERT(boost::is_reference<RET>::value); + CALL_USE_ARGS; // does nothing, prevents warnings for unused args + return a; + } +}; + +template<> struct placeholder<SECOND> { + + template<class SigArgs> struct sig { + typedef typename detail::get_element_or_null_type<1, SigArgs>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return b; } +}; + +template<> struct placeholder<THIRD> { + + template<class SigArgs> struct sig { + typedef typename detail::get_element_or_null_type<2, SigArgs>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return c; } +}; + +template<> struct placeholder<EXCEPTION> { + + template<class SigArgs> struct sig { + typedef typename detail::get_element_or_null_type<3, SigArgs>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return env; } +}; + +typedef const lambda_functor<placeholder<FIRST> > placeholder1_type; +typedef const lambda_functor<placeholder<SECOND> > placeholder2_type; +typedef const lambda_functor<placeholder<THIRD> > placeholder3_type; + + +/////////////////////////////////////////////////////////////////////////////// + + +// free variables are lambda_functors. This is to allow uniform handling with +// other lambda_functors. +// ------------------------------------------------------------------- + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + +// -- lambda_functor NONE ------------------------------------------------ +template <class T> +class lambda_functor : public T +{ + +BOOST_STATIC_CONSTANT(int, arity_bits = get_arity<T>::value); + +public: + typedef T inherited; + + lambda_functor() {} + lambda_functor(const lambda_functor& l) : inherited(l) {} + + lambda_functor(const T& t) : inherited(t) {} + + template <class SigArgs> struct sig { + typedef typename inherited::template + sig<typename SigArgs::tail_type>::type type; + }; + + // Note that this return type deduction template is instantiated, even + // if the nullary + // operator() is not called at all. One must make sure that it does not fail. + typedef typename + inherited::template sig<null_type>::type + nullary_return_type; + + // Support for boost::result_of. + template <class Sig> struct result; + template <class F> + struct result<F()> { + typedef nullary_return_type type; + }; + template <class F, class A> + struct result<F(A)> { + typedef typename sig<tuple<F, A> >::type type; + }; + template <class F, class A, class B> + struct result<F(A, B)> { + typedef typename sig<tuple<F, A, B> >::type type; + }; + template <class F, class A, class B, class C> + struct result<F(A, B, C)> { + typedef typename sig<tuple<F, A, B, C> >::type type; + }; + + nullary_return_type operator()() const { + return inherited::template + call<nullary_return_type> + (cnull_type(), cnull_type(), cnull_type(), cnull_type()); + } + + template<class A> + typename inherited::template sig<tuple<A&> >::type + operator()(A& a) const { + return inherited::template call< + typename inherited::template sig<tuple<A&> >::type + >(a, cnull_type(), cnull_type(), cnull_type()); + } + + template<class A> + BOOST_LAMBDA_DISABLE_IF_ARRAY1(A, inherited::template sig<tuple<A const&> >) + operator()(A const& a) const { + return inherited::template call< + typename inherited::template sig<tuple<A const&> >::type + >(a, cnull_type(), cnull_type(), cnull_type()); + } + + template<class A, class B> + typename inherited::template sig<tuple<A&, B&> >::type + operator()(A& a, B& b) const { + return inherited::template call< + typename inherited::template sig<tuple<A&, B&> >::type + >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B> + BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B&> >) + operator()(A const& a, B& b) const { + return inherited::template call< + typename inherited::template sig<tuple<A const&, B&> >::type + >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B> + BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A&, B const&> >) + operator()(A& a, B const& b) const { + return inherited::template call< + typename inherited::template sig<tuple<A&, B const&> >::type + >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B> + BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B const&> >) + operator()(A const& a, B const& b) const { + return inherited::template call< + typename inherited::template sig<tuple<A const&, B const&> >::type + >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B, class C> + typename inherited::template sig<tuple<A&, B&, C&> >::type + operator()(A& a, B& b, C& c) const + { + return inherited::template call< + typename inherited::template sig<tuple<A&, B&, C&> >::type + >(a, b, c, cnull_type()); + } + + template<class A, class B, class C> + BOOST_LAMBDA_DISABLE_IF_ARRAY3(A, B, C, inherited::template sig<tuple<A const&, B const&, C const&> >) + operator()(A const& a, B const& b, C const& c) const + { + return inherited::template call< + typename inherited::template sig<tuple<A const&, B const&, C const&> >::type + >(a, b, c, cnull_type()); + } + + // for internal calls with env + template<CALL_TEMPLATE_ARGS> + typename inherited::template sig<tuple<CALL_REFERENCE_TYPES> >::type + internal_call(CALL_FORMAL_ARGS) const { + return inherited::template + call<typename inherited::template + sig<tuple<CALL_REFERENCE_TYPES> >::type>(CALL_ACTUAL_ARGS); + } + + template<class A> + const lambda_functor<lambda_functor_base< + other_action<assignment_action>, + boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type> > > + operator=(const A& a) const { + return lambda_functor_base< + other_action<assignment_action>, + boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type> > + ( boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type>(*this, a) ); + } + + template<class A> + const lambda_functor<lambda_functor_base< + other_action<subscript_action>, + boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type> > > + operator[](const A& a) const { + return lambda_functor_base< + other_action<subscript_action>, + boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type> > + ( boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type>(*this, a ) ); + } +}; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + +} // namespace lambda +} // namespace boost + +// is_placeholder + +#include <boost/is_placeholder.hpp> + +namespace boost +{ + +template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::FIRST> > > +{ + enum _vt { value = 1 }; +}; + +template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::SECOND> > > +{ + enum _vt { value = 2 }; +}; + +template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::THIRD> > > +{ + enum _vt { value = 3 }; +}; + +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_fwd.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_fwd.hpp new file mode 100644 index 0000000..a27bfad --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_fwd.hpp @@ -0,0 +1,74 @@ +// lambda_fwd.hpp - Boost Lambda Library ------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// ------------------------------------------------------- + +#ifndef BOOST_LAMBDA_FWD_HPP +#define BOOST_LAMBDA_FWD_HPP + +namespace boost { +namespace lambda { + +namespace detail { + +template<class T> struct generate_error; + +} +// -- placeholders -------------------------------------------- + +template <int I> struct placeholder; + +// function_adaptors +template <class Func> +struct function_adaptor; + +template <int I, class Act> class action; + +template <class Base> +class lambda_functor; + +template <class Act, class Args> +class lambda_functor_base; + +} // namespace lambda +} // namespace boost + + +// #define CALL_TEMPLATE_ARGS class A, class Env +// #define CALL_FORMAL_ARGS A& a, Env& env +// #define CALL_ACTUAL_ARGS a, env +// #define CALL_ACTUAL_ARGS_NO_ENV a +// #define CALL_REFERENCE_TYPES A&, Env& +// #define CALL_PLAIN_TYPES A, Env +#define CALL_TEMPLATE_ARGS class A, class B, class C, class Env +#define CALL_FORMAL_ARGS A& a, B& b, C& c, Env& env +#define CALL_ACTUAL_ARGS a, b, c, env +#define CALL_ACTUAL_ARGS_NO_ENV a, b, c +#define CALL_REFERENCE_TYPES A&, B&, C&, Env& +#define CALL_PLAIN_TYPES A, B, C, Env + +namespace boost { +namespace lambda { +namespace detail { + +template<class A1, class A2, class A3, class A4> +void do_nothing(A1&, A2&, A3&, A4&) {} + +} // detail +} // lambda +} // boost + +// prevent the warnings from unused arguments +#define CALL_USE_ARGS \ +::boost::lambda::detail::do_nothing(a, b, c, env) + + + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_traits.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_traits.hpp new file mode 100644 index 0000000..f35fa09 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_traits.hpp @@ -0,0 +1,578 @@ +// - lambda_traits.hpp --- Boost Lambda Library ---------------------------- +// +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org +// ------------------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_LAMBDA_TRAITS_HPP +#define BOOST_LAMBDA_LAMBDA_TRAITS_HPP + +#include "boost/type_traits/transform_traits.hpp" +#include "boost/type_traits/cv_traits.hpp" +#include "boost/type_traits/function_traits.hpp" +#include "boost/type_traits/object_traits.hpp" +#include "boost/tuple/tuple.hpp" + +namespace boost { +namespace lambda { + +// -- if construct ------------------------------------------------ +// Proposed by Krzysztof Czarnecki and Ulrich Eisenecker + +namespace detail { + +template <bool If, class Then, class Else> struct IF { typedef Then RET; }; + +template <class Then, class Else> struct IF<false, Then, Else> { + typedef Else RET; +}; + + +// An if construct that doesn't instantiate the non-matching template: + +// Called as: +// IF_type<condition, A, B>::type +// The matching template must define the typeded 'type' +// I.e. A::type if condition is true, B::type if condition is false +// Idea from Vesa Karvonen (from C&E as well I guess) +template<class T> +struct IF_type_ +{ + typedef typename T::type type; +}; + + +template<bool C, class T, class E> +struct IF_type +{ + typedef typename + IF_type_<typename IF<C, T, E>::RET >::type type; +}; + +// helper that can be used to give typedef T to some type +template <class T> struct identity_mapping { typedef T type; }; + +// An if construct for finding an integral constant 'value' +// Does not instantiate the non-matching branch +// Called as IF_value<condition, A, B>::value +// If condition is true A::value must be defined, otherwise B::value + +template<class T> +struct IF_value_ +{ + BOOST_STATIC_CONSTANT(int, value = T::value); +}; + + +template<bool C, class T, class E> +struct IF_value +{ + BOOST_STATIC_CONSTANT(int, value = (IF_value_<typename IF<C, T, E>::RET>::value)); +}; + + +// -------------------------------------------------------------- + +// removes reference from other than function types: +template<class T> class remove_reference_if_valid +{ + + typedef typename boost::remove_reference<T>::type plainT; +public: + typedef typename IF< + boost::is_function<plainT>::value, + T, + plainT + >::RET type; + +}; + + +template<class T> struct remove_reference_and_cv { + typedef typename boost::remove_cv< + typename boost::remove_reference<T>::type + >::type type; +}; + + + +// returns a reference to the element of tuple T +template<int N, class T> struct tuple_element_as_reference { + typedef typename + boost::tuples::access_traits< + typename boost::tuples::element<N, T>::type + >::non_const_type type; +}; + +// returns the cv and reverence stripped type of a tuple element +template<int N, class T> struct tuple_element_stripped { + typedef typename + remove_reference_and_cv< + typename boost::tuples::element<N, T>::type + >::type type; +}; + +// is_lambda_functor ------------------------------------------------- + +template <class T> struct is_lambda_functor_ { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template <class Arg> struct is_lambda_functor_<lambda_functor<Arg> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +} // end detail + + +template <class T> struct is_lambda_functor { + BOOST_STATIC_CONSTANT(bool, + value = + detail::is_lambda_functor_< + typename detail::remove_reference_and_cv<T>::type + >::value); +}; + + +namespace detail { + +// -- parameter_traits_ --------------------------------------------- + +// An internal parameter type traits class that respects +// the reference_wrapper class. + +// The conversions performed are: +// references -> compile_time_error +// T1 -> T2, +// reference_wrapper<T> -> T& +// const array -> ref to const array +// array -> ref to array +// function -> ref to function + +// ------------------------------------------------------------------------ + +template<class T1, class T2> +struct parameter_traits_ { + typedef T2 type; +}; + +// Do not instantiate with reference types +template<class T, class Any> struct parameter_traits_<T&, Any> { + typedef typename + generate_error<T&>:: + parameter_traits_class_instantiated_with_reference_type type; +}; + +// Arrays can't be stored as plain types; convert them to references +template<class T, int n, class Any> struct parameter_traits_<T[n], Any> { + typedef T (&type)[n]; +}; + +template<class T, int n, class Any> +struct parameter_traits_<const T[n], Any> { + typedef const T (&type)[n]; +}; + +template<class T, int n, class Any> +struct parameter_traits_<volatile T[n], Any> { + typedef volatile T (&type)[n]; +}; +template<class T, int n, class Any> +struct parameter_traits_<const volatile T[n], Any> { + typedef const volatile T (&type)[n]; +}; + + +template<class T, class Any> +struct parameter_traits_<boost::reference_wrapper<T>, Any >{ + typedef T& type; +}; + +template<class T, class Any> +struct parameter_traits_<const boost::reference_wrapper<T>, Any >{ + typedef T& type; +}; + +template<class T, class Any> +struct parameter_traits_<volatile boost::reference_wrapper<T>, Any >{ + typedef T& type; +}; + +template<class T, class Any> +struct parameter_traits_<const volatile boost::reference_wrapper<T>, Any >{ + typedef T& type; +}; + +template<class Any> +struct parameter_traits_<void, Any> { + typedef void type; +}; + +template<class Arg, class Any> +struct parameter_traits_<lambda_functor<Arg>, Any > { + typedef lambda_functor<Arg> type; +}; + +template<class Arg, class Any> +struct parameter_traits_<const lambda_functor<Arg>, Any > { + typedef lambda_functor<Arg> type; +}; + +// Are the volatile versions needed? +template<class Arg, class Any> +struct parameter_traits_<volatile lambda_functor<Arg>, Any > { + typedef lambda_functor<Arg> type; +}; + +template<class Arg, class Any> +struct parameter_traits_<const volatile lambda_functor<Arg>, Any > { + typedef lambda_functor<Arg> type; +}; + +} // end namespace detail + + +// ------------------------------------------------------------------------ +// traits classes for lambda expressions (bind functions, operators ...) + +// must be instantiated with non-reference types + +// The default is const plain type ------------------------- +// const T -> const T, +// T -> const T, +// references -> compile_time_error +// reference_wrapper<T> -> T& +// array -> const ref array +template<class T> +struct const_copy_argument { + typedef typename + detail::parameter_traits_< + T, + typename detail::IF<boost::is_function<T>::value, T&, const T>::RET + >::type type; +}; + +// T may be a function type. Without the IF test, const would be added +// to a function type, which is illegal. + +// all arrays are converted to const. +// This traits template is used for 'const T&' parameter passing +// and thus the knowledge of the potential +// non-constness of an actual argument is lost. +template<class T, int n> struct const_copy_argument <T[n]> { + typedef const T (&type)[n]; +}; +template<class T, int n> struct const_copy_argument <volatile T[n]> { + typedef const volatile T (&type)[n]; +}; + +template<class T> +struct const_copy_argument<T&> {}; +// do not instantiate with references + // typedef typename detail::generate_error<T&>::references_not_allowed type; + + +template<> +struct const_copy_argument<void> { + typedef void type; +}; + + +// Does the same as const_copy_argument, but passes references through as such +template<class T> +struct bound_argument_conversion { + typedef typename const_copy_argument<T>::type type; +}; + +template<class T> +struct bound_argument_conversion<T&> { + typedef T& type; +}; + +// The default is non-const reference ------------------------- +// const T -> const T&, +// T -> T&, +// references -> compile_time_error +// reference_wrapper<T> -> T& +template<class T> +struct reference_argument { + typedef typename detail::parameter_traits_<T, T&>::type type; +}; + +template<class T> +struct reference_argument<T&> { + typedef typename detail::generate_error<T&>::references_not_allowed type; +}; + +template<class Arg> +struct reference_argument<lambda_functor<Arg> > { + typedef lambda_functor<Arg> type; +}; + +template<class Arg> +struct reference_argument<const lambda_functor<Arg> > { + typedef lambda_functor<Arg> type; +}; + +// Are the volatile versions needed? +template<class Arg> +struct reference_argument<volatile lambda_functor<Arg> > { + typedef lambda_functor<Arg> type; +}; + +template<class Arg> +struct reference_argument<const volatile lambda_functor<Arg> > { + typedef lambda_functor<Arg> type; +}; + +template<> +struct reference_argument<void> { + typedef void type; +}; + +namespace detail { + +// Array to pointer conversion +template <class T> +struct array_to_pointer { + typedef T type; +}; + +template <class T, int N> +struct array_to_pointer <const T[N]> { + typedef const T* type; +}; +template <class T, int N> +struct array_to_pointer <T[N]> { + typedef T* type; +}; + +template <class T, int N> +struct array_to_pointer <const T (&) [N]> { + typedef const T* type; +}; +template <class T, int N> +struct array_to_pointer <T (&) [N]> { + typedef T* type; +}; + + +// --------------------------------------------------------------------------- +// The call_traits for bind +// Respects the reference_wrapper class. + +// These templates are used outside of bind functions as well. +// the bind_tuple_mapper provides a shorter notation for default +// bound argument storing semantics, if all arguments are treated +// uniformly. + +// from template<class T> foo(const T& t) : bind_traits<const T>::type +// from template<class T> foo(T& t) : bind_traits<T>::type + +// Conversions: +// T -> const T, +// cv T -> cv T, +// T& -> T& +// reference_wrapper<T> -> T& +// const reference_wrapper<T> -> T& +// array -> const ref array + +// make bound arguments const, this is a deliberate design choice, the +// purpose is to prevent side effects to bound arguments that are stored +// as copies +template<class T> +struct bind_traits { + typedef const T type; +}; + +template<class T> +struct bind_traits<T&> { + typedef T& type; +}; + +// null_types are an exception, we always want to store them as non const +// so that other templates can assume that null_type is always without const +template<> +struct bind_traits<null_type> { + typedef null_type type; +}; + +// the bind_tuple_mapper, bind_type_generators may +// introduce const to null_type +template<> +struct bind_traits<const null_type> { + typedef null_type type; +}; + +// Arrays can't be stored as plain types; convert them to references. +// All arrays are converted to const. This is because bind takes its +// parameters as const T& and thus the knowledge of the potential +// non-constness of actual argument is lost. +template<class T, int n> struct bind_traits <T[n]> { + typedef const T (&type)[n]; +}; + +template<class T, int n> +struct bind_traits<const T[n]> { + typedef const T (&type)[n]; +}; + +template<class T, int n> struct bind_traits<volatile T[n]> { + typedef const volatile T (&type)[n]; +}; + +template<class T, int n> +struct bind_traits<const volatile T[n]> { + typedef const volatile T (&type)[n]; +}; + +template<class R> +struct bind_traits<R()> { + typedef R(&type)(); +}; + +template<class R, class Arg1> +struct bind_traits<R(Arg1)> { + typedef R(&type)(Arg1); +}; + +template<class R, class Arg1, class Arg2> +struct bind_traits<R(Arg1, Arg2)> { + typedef R(&type)(Arg1, Arg2); +}; + +template<class R, class Arg1, class Arg2, class Arg3> +struct bind_traits<R(Arg1, Arg2, Arg3)> { + typedef R(&type)(Arg1, Arg2, Arg3); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9); +}; + +template<class T> +struct bind_traits<reference_wrapper<T> >{ + typedef T& type; +}; + +template<class T> +struct bind_traits<const reference_wrapper<T> >{ + typedef T& type; +}; + +template<> +struct bind_traits<void> { + typedef void type; +}; + + + +template < + class T0 = null_type, class T1 = null_type, class T2 = null_type, + class T3 = null_type, class T4 = null_type, class T5 = null_type, + class T6 = null_type, class T7 = null_type, class T8 = null_type, + class T9 = null_type +> +struct bind_tuple_mapper { + typedef + tuple<typename bind_traits<T0>::type, + typename bind_traits<T1>::type, + typename bind_traits<T2>::type, + typename bind_traits<T3>::type, + typename bind_traits<T4>::type, + typename bind_traits<T5>::type, + typename bind_traits<T6>::type, + typename bind_traits<T7>::type, + typename bind_traits<T8>::type, + typename bind_traits<T9>::type> type; +}; + +// bind_traits, except map const T& -> const T + // this is needed e.g. in currying. Const reference arguments can + // refer to temporaries, so it is not safe to store them as references. + template <class T> struct remove_const_reference { + typedef typename bind_traits<T>::type type; + }; + + template <class T> struct remove_const_reference<const T&> { + typedef const T type; + }; + + +// maps the bind argument types to the resulting lambda functor type +template < + class T0 = null_type, class T1 = null_type, class T2 = null_type, + class T3 = null_type, class T4 = null_type, class T5 = null_type, + class T6 = null_type, class T7 = null_type, class T8 = null_type, + class T9 = null_type +> +class bind_type_generator { + + typedef typename + detail::bind_tuple_mapper< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 + >::type args_t; + + BOOST_STATIC_CONSTANT(int, nof_elems = boost::tuples::length<args_t>::value); + + typedef + action< + nof_elems, + function_action<nof_elems> + > action_type; + +public: + typedef + lambda_functor< + lambda_functor_base< + action_type, + args_t + > + > type; + +}; + + + +} // detail + +template <class T> inline const T& make_const(const T& t) { return t; } + + +} // end of namespace lambda +} // end of namespace boost + + + +#endif // BOOST_LAMBDA_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/lambda/detail/member_ptr.hpp b/3rdParty/Boost/src/boost/lambda/detail/member_ptr.hpp new file mode 100644 index 0000000..288f70c --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/member_ptr.hpp @@ -0,0 +1,737 @@ +// Boost Lambda Library -- member_ptr.hpp --------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 2000 Gary Powell (gary.powell@sierra.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) +// +// For more information, see www.boost.org + +// -------------------------------------------------------------------------- + +#if !defined(BOOST_LAMBDA_MEMBER_PTR_HPP) +#define BOOST_LAMBDA_MEMBER_PTR_HPP + +namespace boost { +namespace lambda { + + +class member_pointer_action {}; + + +namespace detail { + +// the boost type_traits member_pointer traits are not enough, +// need to know more details. +template<class T> +struct member_pointer { + typedef typename boost::add_reference<T>::type type; + typedef detail::unspecified class_type; + typedef detail::unspecified qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +template<class T, class U> +struct member_pointer<T U::*> { + typedef typename boost::add_reference<T>::type type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = true); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +template<class T, class U> +struct member_pointer<const T U::*> { + typedef typename boost::add_reference<const T>::type type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = true); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +template<class T, class U> +struct member_pointer<volatile T U::*> { + typedef typename boost::add_reference<volatile T>::type type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = true); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +template<class T, class U> +struct member_pointer<const volatile T U::*> { + typedef typename boost::add_reference<const volatile T>::type type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = true); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +// -- nonconst member functions -- +template<class T, class U> +struct member_pointer<T (U::*)()> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1> +struct member_pointer<T (U::*)(A1)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2> +struct member_pointer<T (U::*)(A1, A2)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3> +struct member_pointer<T (U::*)(A1, A2, A3)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4> +struct member_pointer<T (U::*)(A1, A2, A3, A4)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +// -- const member functions -- +template<class T, class U> +struct member_pointer<T (U::*)() const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1> +struct member_pointer<T (U::*)(A1) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2> +struct member_pointer<T (U::*)(A1, A2) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3> +struct member_pointer<T (U::*)(A1, A2, A3) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4> +struct member_pointer<T (U::*)(A1, A2, A3, A4) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; + // -- volatile -- +template<class T, class U> +struct member_pointer<T (U::*)() volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1> +struct member_pointer<T (U::*)(A1) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2> +struct member_pointer<T (U::*)(A1, A2) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3> +struct member_pointer<T (U::*)(A1, A2, A3) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4> +struct member_pointer<T (U::*)(A1, A2, A3, A4) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; + // -- const volatile +template<class T, class U> +struct member_pointer<T (U::*)() const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1> +struct member_pointer<T (U::*)(A1) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2> +struct member_pointer<T (U::*)(A1, A2) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3> +struct member_pointer<T (U::*)(A1, A2, A3) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4> +struct member_pointer<T (U::*)(A1, A2, A3, A4) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; + +} // detail + +namespace detail { + + // this class holds a pointer to a member function and the object. + // when called, it just calls the member function with the parameters + // provided + + // It would have been possible to use existing lambda_functors to represent + // a bound member function like this, but to have a separate template is + // safer, since now this functor doesn't mix and match with lambda_functors + // only thing you can do with this is to call it + + // note that previously instantiated classes + // (other_action<member_pointer_action> and member_pointer_action_helper + // guarantee, that A and B are + // such types, that for objects a and b of corresponding types, a->*b leads + // to the builtin ->* to be called. So types that would end in a call to + // a user defined ->* do not create a member_pointer_caller object. + +template<class RET, class A, class B> +class member_pointer_caller { + A a; B b; + +public: + member_pointer_caller(const A& aa, const B& bb) : a(aa), b(bb) {} + + RET operator()() const { return (a->*b)(); } + + template<class A1> + RET operator()(const A1& a1) const { return (a->*b)(a1); } + + template<class A1, class A2> + RET operator()(const A1& a1, const A2& a2) const { return (a->*b)(a1, a2); } + + template<class A1, class A2, class A3> + RET operator()(const A1& a1, const A2& a2, const A3& a3) const { + return (a->*b)(a1, a2, a3); + } + + template<class A1, class A2, class A3, class A4> + RET operator()(const A1& a1, const A2& a2, const A3& a3, + const A4& a4) const { + return (a->*b)(a1, a2, a3, a4); + } + + template<class A1, class A2, class A3, class A4, class A5> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5) const { + return (a->*b)(a1, a2, a3, a4, a5); + } + + template<class A1, class A2, class A3, class A4, class A5, class A6> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6) const { + return (a->*b)(a1, a2, a3, a4, a5, a6); + } + + template<class A1, class A2, class A3, class A4, class A5, class A6, + class A7> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7) const { + return (a->*b)(a1, a2, a3, a4, a5, a6, a7); + } + + template<class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, + const A8& a8) const { + return (a->*b)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template<class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8, class A9> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, + const A8& a8, const A9& a9) const { + return (a->*b)(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + +}; + +// helper templates for return type deduction and action classes +// different cases for data member, function member, neither + +// true-true case +template <bool Is_data_member, bool Is_function_member> +struct member_pointer_action_helper; + // cannot be both, no body provided + + // data member case + // this means, that B is a data member and A is a pointer type, + // so either built-in ->* should be called, or there is an error +template <> +struct member_pointer_action_helper<true, false> { +public: + + template<class RET, class A, class B> + static RET apply(A& a, B& b) { + return a->*b; + } + + template<class A, class B> + struct return_type { + private: + typedef typename detail::remove_reference_and_cv<B>::type plainB; + + typedef typename detail::member_pointer<plainB>::type type0; + // we remove the reference now, as we may have to add cv:s + typedef typename boost::remove_reference<type0>::type type1; + + // A is a reference to pointer + // remove the top level cv qualifiers and reference + typedef typename + detail::remove_reference_and_cv<A>::type non_ref_A; + + // A is a pointer type, so take the type pointed to + typedef typename ::boost::remove_pointer<non_ref_A>::type non_pointer_A; + + public: + // For non-reference types, we must add const and/or volatile if + // the pointer type has these qualifiers + // If the member is a reference, these do not have any effect + // (cv T == T if T is a reference type) + typedef typename detail::IF< + ::boost::is_const<non_pointer_A>::value, + typename ::boost::add_const<type1>::type, + type1 + >::RET type2; + typedef typename detail::IF< + ::boost::is_volatile<non_pointer_A>::value, + typename ::boost::add_volatile<type2>::type, + type2 + >::RET type3; + // add reference back + typedef typename ::boost::add_reference<type3>::type type; + }; +}; + + // neither case +template <> +struct member_pointer_action_helper<false, false> { +public: + template<class RET, class A, class B> + static RET apply(A& a, B& b) { +// not a built in member pointer operator, just call ->* + return a->*b; + } + // an overloaded member pointer operators, user should have specified + // the return type + // At this point we know that there is no matching specialization for + // return_type_2, so try return_type_2_plain + template<class A, class B> + struct return_type { + + typedef typename plain_return_type_2< + other_action<member_pointer_action>, A, B + >::type type; + }; + +}; + + +// member pointer function case +// This is a built in ->* call for a member function, +// the only thing that you can do with that, is to give it some arguments +// note, it is guaranteed that A is a pointer type, and thus it cannot +// be a call to overloaded ->* +template <> +struct member_pointer_action_helper<false, true> { + public: + + template<class RET, class A, class B> + static RET apply(A& a, B& b) { + typedef typename ::boost::remove_cv<B>::type plainB; + typedef typename detail::member_pointer<plainB>::type ret_t; + typedef typename ::boost::remove_cv<A>::type plainA; + + // we always strip cv:s to + // make the two routes (calling and type deduction) + // to give the same results (and the const does not make any functional + // difference) + return detail::member_pointer_caller<ret_t, plainA, plainB>(a, b); + } + + template<class A, class B> + struct return_type { + typedef typename detail::remove_reference_and_cv<B>::type plainB; + typedef typename detail::member_pointer<plainB>::type ret_t; + typedef typename detail::remove_reference_and_cv<A>::type plainA; + + typedef detail::member_pointer_caller<ret_t, plainA, plainB> type; + }; +}; + +} // detail + +template<> class other_action<member_pointer_action> { +public: + template<class RET, class A, class B> + static RET apply(A& a, B& b) { + typedef typename + ::boost::remove_cv<B>::type plainB; + + return detail::member_pointer_action_helper< + boost::is_pointer<A>::value && + detail::member_pointer<plainB>::is_data_member, + boost::is_pointer<A>::value && + detail::member_pointer<plainB>::is_function_member + >::template apply<RET>(a, b); + } +}; + + // return type deduction -- + + // If the right argument is a pointer to data member, + // and the left argument is of compatible pointer to class type + // return type is a reference to the data member type + + // if right argument is a pointer to a member function, and the left + // argument is of a compatible type, the return type is a + // member_pointer_caller (see above) + + // Otherwise, return type deduction fails. There is either an error, + // or the user is trying to call an overloaded ->* + // In such a case either ret<> must be used, or a return_type_2 user + // defined specialization must be provided + + +template<class A, class B> +struct return_type_2<other_action<member_pointer_action>, A, B> { +private: + typedef typename + detail::remove_reference_and_cv<B>::type plainB; +public: + typedef typename + detail::member_pointer_action_helper< + detail::member_pointer<plainB>::is_data_member, + detail::member_pointer<plainB>::is_function_member + >::template return_type<A, B>::type type; +}; + + // this is the way the generic lambda_functor_base functions instantiate + // return type deduction. We turn it into return_type_2, so that the + // user can provide specializations on that level. +template<class Args> +struct return_type_N<other_action<member_pointer_action>, Args> { + typedef typename boost::tuples::element<0, Args>::type A; + typedef typename boost::tuples::element<1, Args>::type B; + typedef typename + return_type_2<other_action<member_pointer_action>, + typename boost::remove_reference<A>::type, + typename boost::remove_reference<B>::type + >::type type; +}; + + +template<class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<lambda_functor<Arg1>, typename const_copy_argument<Arg2>::type> + > +> +operator->*(const lambda_functor<Arg1>& a1, const Arg2& a2) +{ + return + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<lambda_functor<Arg1>, typename const_copy_argument<Arg2>::type> + > + (tuple<lambda_functor<Arg1>, + typename const_copy_argument<Arg2>::type>(a1, a2)); +} + +template<class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<lambda_functor<Arg1>, lambda_functor<Arg2> > + > +> +operator->*(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) +{ + return + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<lambda_functor<Arg1>, lambda_functor<Arg2> > + > + (tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2)); +} + +template<class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<typename const_copy_argument<Arg1>::type, lambda_functor<Arg2> > + > +> +operator->*(const Arg1& a1, const lambda_functor<Arg2>& a2) +{ + return + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<typename const_copy_argument<Arg1>::type, lambda_functor<Arg2> > + > + (tuple<typename const_copy_argument<Arg1>::type, + lambda_functor<Arg2> >(a1, a2)); +} + + +} // namespace lambda +} // namespace boost + + +#endif + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/operator_actions.hpp b/3rdParty/Boost/src/boost/lambda/detail/operator_actions.hpp new file mode 100644 index 0000000..949b40f --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/operator_actions.hpp @@ -0,0 +1,139 @@ +// -- operator_actions.hpp - Boost Lambda Library ---------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) + +// For more information, see http://lambda.cs.utu.fi + +#ifndef BOOST_LAMBDA_OPERATOR_ACTIONS_HPP +#define BOOST_LAMBDA_OPERATOR_ACTIONS_HPP + +namespace boost { +namespace lambda { + + +// -- artihmetic ---------------------- + +class plus_action {}; +class minus_action {}; +class multiply_action {}; +class divide_action {}; +class remainder_action {}; + +// -- bitwise ------------------- + +class leftshift_action {}; +class rightshift_action {}; +class xor_action {}; + + +// -- bitwise/logical ------------------- + +class and_action {}; +class or_action {}; +class not_action {}; + +// -- relational ------------------------- + +class less_action {}; +class greater_action {}; +class lessorequal_action {}; +class greaterorequal_action {}; +class equal_action {}; +class notequal_action {}; + +// -- increment/decrement ------------------------------ + +class increment_action {}; +class decrement_action {}; + +// -- void return ------------------------------ + +// -- other ------------------------------ + +class addressof_action {}; + // class comma_action {}; // defined in actions.hpp +class contentsof_action {}; +// class member_pointer_action {}; (defined in member_ptr.hpp) + + +// -- actioun group templates -------------------- + +template <class Action> class arithmetic_action; +template <class Action> class bitwise_action; +template <class Action> class logical_action; +template <class Action> class relational_action; +template <class Action> class arithmetic_assignment_action; +template <class Action> class bitwise_assignment_action; +template <class Action> class unary_arithmetic_action; +template <class Action> class pre_increment_decrement_action; +template <class Action> class post_increment_decrement_action; + +// --------------------------------------------------------- + + // actions, for which the existence of protect is checked in return type + // deduction. + +template <class Act> struct is_protectable<arithmetic_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<bitwise_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<logical_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<relational_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> +struct is_protectable<arithmetic_assignment_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<bitwise_assignment_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<unary_arithmetic_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> +struct is_protectable<pre_increment_decrement_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct +is_protectable<post_increment_decrement_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template <> struct is_protectable<other_action<addressof_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> struct is_protectable<other_action<contentsof_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template<> struct is_protectable<other_action<subscript_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template<> struct is_protectable<other_action<assignment_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +// NOTE: comma action is also protectable, but the specialization is + // in actions.hpp + + +} // namespace lambda +} // namespace boost + +#endif + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/operator_lambda_func_base.hpp b/3rdParty/Boost/src/boost/lambda/detail/operator_lambda_func_base.hpp new file mode 100644 index 0000000..12a6d93 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/operator_lambda_func_base.hpp @@ -0,0 +1,271 @@ +// Boost Lambda Library - operator_lambda_func_base.hpp ----------------- +// +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// ------------------------------------------------------------ + +#ifndef BOOST_LAMBDA_OPERATOR_LAMBDA_FUNC_BASE_HPP +#define BOOST_LAMBDA_OPERATOR_LAMBDA_FUNC_BASE_HPP + +namespace boost { +namespace lambda { + + +// These operators cannot be implemented as apply functions of action +// templates + + +// Specialization for comma. +template<class Args> +class lambda_functor_base<other_action<comma_action>, Args> { +public: + Args args; +public: + explicit lambda_functor_base(const Args& a) : args(a) {} + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS), + detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); + } + + + template<class SigArgs> struct sig { + private: + typedef typename + detail::deduce_argument_types<Args, SigArgs>::type rets_t; + public: + typedef typename return_type_2_comma< // comma needs special handling + typename detail::element_or_null<0, rets_t>::type, + typename detail::element_or_null<1, rets_t>::type + >::type type; + }; + +}; + +namespace detail { + +// helper traits to make the expression shorter, takes binary action +// bound argument tuple, open argument tuple and gives the return type + +template<class Action, class Bound, class Open> class binary_rt { + private: + typedef typename + detail::deduce_argument_types<Bound, Open>::type rets_t; + public: + typedef typename return_type_2_prot< + Action, + typename detail::element_or_null<0, rets_t>::type, + typename detail::element_or_null<1, rets_t>::type + >::type type; +}; + + + // same for unary actions +template<class Action, class Bound, class Open> class unary_rt { + private: + typedef typename + detail::deduce_argument_types<Bound, Open>::type rets_t; + public: + typedef typename return_type_1_prot< + Action, + typename detail::element_or_null<0, rets_t>::type + >::type type; +}; + + +} // end detail + +// Specialization for logical and (to preserve shortcircuiting) +// this could be done with a macro as the others, code used to be different +template<class Args> +class lambda_functor_base<logical_action<and_action>, Args> { +public: + Args args; +public: + explicit lambda_functor_base(const Args& a) : args(a) {} + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) && + detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); + } + template<class SigArgs> struct sig { + typedef typename + detail::binary_rt<logical_action<and_action>, Args, SigArgs>::type type; + }; +}; + +// Specialization for logical or (to preserve shortcircuiting) +// this could be done with a macro as the others, code used to be different +template<class Args> +class lambda_functor_base<logical_action< or_action>, Args> { +public: + Args args; +public: + explicit lambda_functor_base(const Args& a) : args(a) {} + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) || + detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); + } + + template<class SigArgs> struct sig { + typedef typename + detail::binary_rt<logical_action<or_action>, Args, SigArgs>::type type; + }; +}; + +// Specialization for subscript +template<class Args> +class lambda_functor_base<other_action<subscript_action>, Args> { +public: + Args args; +public: + explicit lambda_functor_base(const Args& a) : args(a) {} + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) + [detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS)]; + } + + template<class SigArgs> struct sig { + typedef typename + detail::binary_rt<other_action<subscript_action>, Args, SigArgs>::type + type; + }; +}; + + +#define BOOST_LAMBDA_BINARY_ACTION(SYMBOL, ACTION_CLASS) \ +template<class Args> \ +class lambda_functor_base<ACTION_CLASS, Args> { \ +public: \ + Args args; \ +public: \ + explicit lambda_functor_base(const Args& a) : args(a) {} \ + \ + template<class RET, CALL_TEMPLATE_ARGS> \ + RET call(CALL_FORMAL_ARGS) const { \ + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) \ + SYMBOL \ + detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); \ + } \ + template<class SigArgs> struct sig { \ + typedef typename \ + detail::binary_rt<ACTION_CLASS, Args, SigArgs>::type type; \ + }; \ +}; + +#define BOOST_LAMBDA_PREFIX_UNARY_ACTION(SYMBOL, ACTION_CLASS) \ +template<class Args> \ +class lambda_functor_base<ACTION_CLASS, Args> { \ +public: \ + Args args; \ +public: \ + explicit lambda_functor_base(const Args& a) : args(a) {} \ + \ + template<class RET, CALL_TEMPLATE_ARGS> \ + RET call(CALL_FORMAL_ARGS) const { \ + return SYMBOL \ + detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS); \ + } \ + template<class SigArgs> struct sig { \ + typedef typename \ + detail::unary_rt<ACTION_CLASS, Args, SigArgs>::type type; \ + }; \ +}; + +#define BOOST_LAMBDA_POSTFIX_UNARY_ACTION(SYMBOL, ACTION_CLASS) \ +template<class Args> \ +class lambda_functor_base<ACTION_CLASS, Args> { \ +public: \ + Args args; \ +public: \ + explicit lambda_functor_base(const Args& a) : args(a) {} \ + \ + template<class RET, CALL_TEMPLATE_ARGS> \ + RET call(CALL_FORMAL_ARGS) const { \ + return \ + detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) SYMBOL; \ + } \ + template<class SigArgs> struct sig { \ + typedef typename \ + detail::unary_rt<ACTION_CLASS, Args, SigArgs>::type type; \ + }; \ +}; + +BOOST_LAMBDA_BINARY_ACTION(+,arithmetic_action<plus_action>) +BOOST_LAMBDA_BINARY_ACTION(-,arithmetic_action<minus_action>) +BOOST_LAMBDA_BINARY_ACTION(*,arithmetic_action<multiply_action>) +BOOST_LAMBDA_BINARY_ACTION(/,arithmetic_action<divide_action>) +BOOST_LAMBDA_BINARY_ACTION(%,arithmetic_action<remainder_action>) + +BOOST_LAMBDA_BINARY_ACTION(<<,bitwise_action<leftshift_action>) +BOOST_LAMBDA_BINARY_ACTION(>>,bitwise_action<rightshift_action>) +BOOST_LAMBDA_BINARY_ACTION(&,bitwise_action<and_action>) +BOOST_LAMBDA_BINARY_ACTION(|,bitwise_action<or_action>) +BOOST_LAMBDA_BINARY_ACTION(^,bitwise_action<xor_action>) + +BOOST_LAMBDA_BINARY_ACTION(<,relational_action<less_action>) +BOOST_LAMBDA_BINARY_ACTION(>,relational_action<greater_action>) +BOOST_LAMBDA_BINARY_ACTION(<=,relational_action<lessorequal_action>) +BOOST_LAMBDA_BINARY_ACTION(>=,relational_action<greaterorequal_action>) +BOOST_LAMBDA_BINARY_ACTION(==,relational_action<equal_action>) +BOOST_LAMBDA_BINARY_ACTION(!=,relational_action<notequal_action>) + +BOOST_LAMBDA_BINARY_ACTION(+=,arithmetic_assignment_action<plus_action>) +BOOST_LAMBDA_BINARY_ACTION(-=,arithmetic_assignment_action<minus_action>) +BOOST_LAMBDA_BINARY_ACTION(*=,arithmetic_assignment_action<multiply_action>) +BOOST_LAMBDA_BINARY_ACTION(/=,arithmetic_assignment_action<divide_action>) +BOOST_LAMBDA_BINARY_ACTION(%=,arithmetic_assignment_action<remainder_action>) + +BOOST_LAMBDA_BINARY_ACTION(<<=,bitwise_assignment_action<leftshift_action>) +BOOST_LAMBDA_BINARY_ACTION(>>=,bitwise_assignment_action<rightshift_action>) +BOOST_LAMBDA_BINARY_ACTION(&=,bitwise_assignment_action<and_action>) +BOOST_LAMBDA_BINARY_ACTION(|=,bitwise_assignment_action<or_action>) +BOOST_LAMBDA_BINARY_ACTION(^=,bitwise_assignment_action<xor_action>) + +BOOST_LAMBDA_BINARY_ACTION(=,other_action< assignment_action>) + + +BOOST_LAMBDA_PREFIX_UNARY_ACTION(+, unary_arithmetic_action<plus_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(-, unary_arithmetic_action<minus_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(~, bitwise_action<not_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(!, logical_action<not_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(++, pre_increment_decrement_action<increment_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(--, pre_increment_decrement_action<decrement_action>) + +BOOST_LAMBDA_PREFIX_UNARY_ACTION(&,other_action<addressof_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(*,other_action<contentsof_action>) + +BOOST_LAMBDA_POSTFIX_UNARY_ACTION(++, post_increment_decrement_action<increment_action>) +BOOST_LAMBDA_POSTFIX_UNARY_ACTION(--, post_increment_decrement_action<decrement_action>) + + +#undef BOOST_LAMBDA_POSTFIX_UNARY_ACTION +#undef BOOST_LAMBDA_PREFIX_UNARY_ACTION +#undef BOOST_LAMBDA_BINARY_ACTION + +} // namespace lambda +} // namespace boost + +#endif + + + + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/operator_return_type_traits.hpp b/3rdParty/Boost/src/boost/lambda/detail/operator_return_type_traits.hpp new file mode 100644 index 0000000..b2d3d3a --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/operator_return_type_traits.hpp @@ -0,0 +1,917 @@ +// operator_return_type_traits.hpp -- Boost Lambda Library ------------------ + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +#ifndef BOOST_LAMBDA_OPERATOR_RETURN_TYPE_TRAITS_HPP +#define BOOST_LAMBDA_OPERATOR_RETURN_TYPE_TRAITS_HPP + +#include "boost/lambda/detail/is_instance_of.hpp" +#include "boost/type_traits/same_traits.hpp" + +#include "boost/indirect_reference.hpp" +#include "boost/detail/container_fwd.hpp" + +#include <cstddef> // needed for the ptrdiff_t +#include <iosfwd> // for istream and ostream + +#include <iterator> // needed for operator& + +namespace boost { +namespace lambda { +namespace detail { + +// -- general helper templates for type deduction ------------------ + +// Much of the type deduction code for standard arithmetic types from Gary Powell + +template <class A> struct promote_code { static const int value = -1; }; +// this means that a code is not defined for A + +// -- the next 5 types are needed in if_then_else_return +// the promotion order is not important, but they must have distinct values. +template <> struct promote_code<bool> { static const int value = 10; }; +template <> struct promote_code<char> { static const int value = 20; }; +template <> struct promote_code<unsigned char> { static const int value = 30; }; +template <> struct promote_code<signed char> { static const int value = 40; }; +template <> struct promote_code<short int> { static const int value = 50; }; +// ---------- + +template <> struct promote_code<int> { static const int value = 100; }; +template <> struct promote_code<unsigned int> { static const int value = 200; }; +template <> struct promote_code<long> { static const int value = 300; }; +template <> struct promote_code<unsigned long> { static const int value = 400; }; + +template <> struct promote_code<float> { static const int value = 500; }; +template <> struct promote_code<double> { static const int value = 600; }; +template <> struct promote_code<long double> { static const int value = 700; }; + +// TODO: wchar_t + +// forward delcaration of complex. + +} // namespace detail +} // namespace lambda +} // namespace boost + +namespace boost { +namespace lambda { +namespace detail { + +template <> struct promote_code< std::complex<float> > { static const int value = 800; }; +template <> struct promote_code< std::complex<double> > { static const int value = 900; }; +template <> struct promote_code< std::complex<long double> > { static const int value = 1000; }; + +// -- int promotion ------------------------------------------- +template <class T> struct promote_to_int { typedef T type; }; + +template <> struct promote_to_int<bool> { typedef int type; }; +template <> struct promote_to_int<char> { typedef int type; }; +template <> struct promote_to_int<unsigned char> { typedef int type; }; +template <> struct promote_to_int<signed char> { typedef int type; }; +template <> struct promote_to_int<short int> { typedef int type; }; + +// The unsigned short int promotion rule is this: +// unsigned short int to signed int if a signed int can hold all values +// of unsigned short int, otherwise go to unsigned int. +template <> struct promote_to_int<unsigned short int> +{ + typedef + detail::IF<sizeof(int) <= sizeof(unsigned short int), +// I had the logic reversed but ">" messes up the parsing. + unsigned int, + int>::RET type; +}; + + +// TODO: think, should there be default behaviour for non-standard types? + +} // namespace detail + +// ------------------------------------------ +// Unary actions ---------------------------- +// ------------------------------------------ + +template<class Act, class A> +struct plain_return_type_1 { + typedef detail::unspecified type; +}; + + + +template<class Act, class A> +struct plain_return_type_1<unary_arithmetic_action<Act>, A> { + typedef A type; +}; + +template<class Act, class A> +struct return_type_1<unary_arithmetic_action<Act>, A> { + typedef + typename plain_return_type_1< + unary_arithmetic_action<Act>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + + +template<class A> +struct plain_return_type_1<bitwise_action<not_action>, A> { + typedef A type; +}; + +// bitwise not, operator~() +template<class A> struct return_type_1<bitwise_action<not_action>, A> { + typedef + typename plain_return_type_1< + bitwise_action<not_action>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + + +// prefix increment and decrement operators return +// their argument by default as a non-const reference +template<class Act, class A> +struct plain_return_type_1<pre_increment_decrement_action<Act>, A> { + typedef A& type; +}; + +template<class Act, class A> +struct return_type_1<pre_increment_decrement_action<Act>, A> { + typedef + typename plain_return_type_1< + pre_increment_decrement_action<Act>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + +// post decrement just returns the same plain type. +template<class Act, class A> +struct plain_return_type_1<post_increment_decrement_action<Act>, A> { + typedef A type; +}; + +template<class Act, class A> +struct return_type_1<post_increment_decrement_action<Act>, A> +{ + typedef + typename plain_return_type_1< + post_increment_decrement_action<Act>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + +// logical not, operator!() +template<class A> +struct plain_return_type_1<logical_action<not_action>, A> { + typedef bool type; +}; + +template<class A> +struct return_type_1<logical_action<not_action>, A> { + typedef + typename plain_return_type_1< + logical_action<not_action>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + +// address of action --------------------------------------- + + +template<class A> +struct return_type_1<other_action<addressof_action>, A> { + typedef + typename plain_return_type_1< + other_action<addressof_action>, + typename detail::remove_reference_and_cv<A>::type + >::type type1; + + // If no user defined specialization for A, then return the + // cv qualified pointer to A + typedef typename detail::IF< + boost::is_same<type1, detail::unspecified>::value, + typename boost::remove_reference<A>::type*, + type1 + >::RET type; +}; + +// contentsof action ------------------------------------ + +// TODO: this deduction may lead to fail directly, +// (if A has no specialization for iterator_traits and has no +// typedef A::reference. +// There is no easy way around this, cause there doesn't seem to be a way +// to test whether a class is an iterator or not. + +// The default works with std::iterators. + +namespace detail { + + // A is a nonreference type +template <class A> struct contentsof_type { + typedef typename boost::indirect_reference<A>::type type; +}; + + // this is since the nullary () in lambda_functor is always instantiated +template <> struct contentsof_type<null_type> { + typedef detail::unspecified type; +}; + + +template <class A> struct contentsof_type<const A> { + typedef typename contentsof_type<A>::type type; +}; + +template <class A> struct contentsof_type<volatile A> { + typedef typename contentsof_type<A>::type type; +}; + +template <class A> struct contentsof_type<const volatile A> { + typedef typename contentsof_type<A>::type type; +}; + + // standard iterator traits should take care of the pointer types + // but just to be on the safe side, we have the specializations here: + // these work even if A is cv-qualified. +template <class A> struct contentsof_type<A*> { + typedef A& type; +}; +template <class A> struct contentsof_type<A* const> { + typedef A& type; +}; +template <class A> struct contentsof_type<A* volatile> { + typedef A& type; +}; +template <class A> struct contentsof_type<A* const volatile> { + typedef A& type; +}; + +template<class A, int N> struct contentsof_type<A[N]> { + typedef A& type; +}; +template<class A, int N> struct contentsof_type<const A[N]> { + typedef const A& type; +}; +template<class A, int N> struct contentsof_type<volatile A[N]> { + typedef volatile A& type; +}; +template<class A, int N> struct contentsof_type<const volatile A[N]> { + typedef const volatile A& type; +}; + + + + + +} // end detail + +template<class A> +struct return_type_1<other_action<contentsof_action>, A> { + + typedef + typename plain_return_type_1< + other_action<contentsof_action>, + typename detail::remove_reference_and_cv<A>::type + >::type type1; + + // If no user defined specialization for A, then return the + // cv qualified pointer to A + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::contentsof_type< + typename boost::remove_reference<A>::type + >, + detail::identity_mapping<type1> + >::type type; +}; + + +// ------------------------------------------------------------------ +// binary actions --------------------------------------------------- +// ------------------------------------------------------------------ + +// here the default case is: no user defined versions: +template <class Act, class A, class B> +struct plain_return_type_2 { + typedef detail::unspecified type; +}; + +namespace detail { + +// error classes +class illegal_pointer_arithmetic{}; + +// pointer arithmetic type deductions ---------------------- +// value = false means that this is not a pointer arithmetic case +// value = true means, that this can be a pointer arithmetic case, but not necessarily is +// This means, that for user defined operators for pointer types, say for some operator+(X, *Y), +// the deductions must be coded at an earliel level (return_type_2). + +template<class Act, class A, class B> +struct pointer_arithmetic_traits { static const bool value = false; }; + +template<class A, class B> +struct pointer_arithmetic_traits<plus_action, A, B> { + + typedef typename + array_to_pointer<typename boost::remove_reference<A>::type>::type AP; + typedef typename + array_to_pointer<typename boost::remove_reference<B>::type>::type BP; + + static const bool is_pointer_A = boost::is_pointer<AP>::value; + static const bool is_pointer_B = boost::is_pointer<BP>::value; + + static const bool value = is_pointer_A || is_pointer_B; + + // can't add two pointers. + // note, that we do not check wether the other type is valid for + // addition with a pointer. + // the compiler will catch it in the apply function + + typedef typename + detail::IF< + is_pointer_A && is_pointer_B, + detail::return_type_deduction_failure< + detail::illegal_pointer_arithmetic + >, + typename detail::IF<is_pointer_A, AP, BP>::RET + >::RET type; + +}; + +template<class A, class B> +struct pointer_arithmetic_traits<minus_action, A, B> { + typedef typename + array_to_pointer<typename boost::remove_reference<A>::type>::type AP; + typedef typename + array_to_pointer<typename boost::remove_reference<B>::type>::type BP; + + static const bool is_pointer_A = boost::is_pointer<AP>::value; + static const bool is_pointer_B = boost::is_pointer<BP>::value; + + static const bool value = is_pointer_A || is_pointer_B; + + static const bool same_pointer_type = + is_pointer_A && is_pointer_B && + boost::is_same< + typename boost::remove_const< + typename boost::remove_pointer< + typename boost::remove_const<AP>::type + >::type + >::type, + typename boost::remove_const< + typename boost::remove_pointer< + typename boost::remove_const<BP>::type + >::type + >::type + >::value; + + // ptr - ptr has type ptrdiff_t + // note, that we do not check if, in ptr - B, B is + // valid for subtraction with a pointer. + // the compiler will catch it in the apply function + + typedef typename + detail::IF< + same_pointer_type, const std::ptrdiff_t, + typename detail::IF< + is_pointer_A, + AP, + detail::return_type_deduction_failure<detail::illegal_pointer_arithmetic> + >::RET + >::RET type; +}; + +} // namespace detail + +// -- arithmetic actions --------------------------------------------- + +namespace detail { + +template<bool is_pointer_arithmetic, class Act, class A, class B> +struct return_type_2_arithmetic_phase_1; + +template<class A, class B> struct return_type_2_arithmetic_phase_2; +template<class A, class B> struct return_type_2_arithmetic_phase_3; + +} // namespace detail + + +// drop any qualifiers from the argument types within arithmetic_action +template<class A, class B, class Act> +struct return_type_2<arithmetic_action<Act>, A, B> +{ + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<arithmetic_action<Act>, plain_A, plain_B>::type type1; + + // if user defined return type, do not enter the whole arithmetic deductions + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::return_type_2_arithmetic_phase_1< + detail::pointer_arithmetic_traits<Act, A, B>::value, Act, A, B + >, + plain_return_type_2<arithmetic_action<Act>, plain_A, plain_B> + >::type type; +}; + +namespace detail { + +// perform integral promotion, no pointer arithmetic +template<bool is_pointer_arithmetic, class Act, class A, class B> +struct return_type_2_arithmetic_phase_1 +{ + typedef typename + return_type_2_arithmetic_phase_2< + typename remove_reference_and_cv<A>::type, + typename remove_reference_and_cv<B>::type + >::type type; +}; + +// pointer_arithmetic +template<class Act, class A, class B> +struct return_type_2_arithmetic_phase_1<true, Act, A, B> +{ + typedef typename + pointer_arithmetic_traits<Act, A, B>::type type; +}; + +template<class A, class B> +struct return_type_2_arithmetic_phase_2 { + typedef typename + return_type_2_arithmetic_phase_3< + typename promote_to_int<A>::type, + typename promote_to_int<B>::type + >::type type; +}; + +// specialization for unsigned int. +// We only have to do these two specialization because the value promotion will +// take care of the other cases. +// The unsigned int promotion rule is this: +// unsigned int to long if a long can hold all values of unsigned int, +// otherwise go to unsigned long. + +// struct so I don't have to type this twice. +struct promotion_of_unsigned_int +{ + typedef + detail::IF<sizeof(long) <= sizeof(unsigned int), + unsigned long, + long>::RET type; +}; + +template<> +struct return_type_2_arithmetic_phase_2<unsigned int, long> +{ + typedef promotion_of_unsigned_int::type type; +}; +template<> +struct return_type_2_arithmetic_phase_2<long, unsigned int> +{ + typedef promotion_of_unsigned_int::type type; +}; + + +template<class A, class B> struct return_type_2_arithmetic_phase_3 { + enum { promote_code_A_value = promote_code<A>::value, + promote_code_B_value = promote_code<B>::value }; // enums for KCC + typedef typename + detail::IF< + promote_code_A_value == -1 || promote_code_B_value == -1, + detail::return_type_deduction_failure<return_type_2_arithmetic_phase_3>, + typename detail::IF< + ((int)promote_code_A_value > (int)promote_code_B_value), + A, + B + >::RET + >::RET type; +}; + +} // namespace detail + +// -- bitwise actions ------------------------------------------- +// note: for integral types deuduction is similar to arithmetic actions. + +// drop any qualifiers from the argument types within arithmetic action +template<class A, class B, class Act> +struct return_type_2<bitwise_action<Act>, A, B> +{ + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<bitwise_action<Act>, plain_A, plain_B>::type type1; + + // if user defined return type, do not enter type deductions + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + return_type_2<arithmetic_action<plus_action>, A, B>, + plain_return_type_2<bitwise_action<Act>, plain_A, plain_B> + >::type type; + + // plus_action is just a random pick, has to be a concrete instance + + // TODO: This check is only valid for built-in types, overloaded types might + // accept floating point operators + + // bitwise operators not defined for floating point types + // these test are not strictly needed here, since the error will be caught in + // the apply function + BOOST_STATIC_ASSERT(!(boost::is_float<plain_A>::value && boost::is_float<plain_B>::value)); + +}; + +namespace detail { + +#ifdef BOOST_NO_TEMPLATED_STREAMS + +template<class A, class B> +struct leftshift_type { + + typedef typename detail::IF< + boost::is_convertible< + typename boost::remove_reference<A>::type*, + std::ostream* + >::value, + std::ostream&, + typename detail::remove_reference_and_cv<A>::type + >::RET type; +}; + +template<class A, class B> +struct rightshift_type { + + typedef typename detail::IF< + + boost::is_convertible< + typename boost::remove_reference<A>::type*, + std::istream* + >::value, + std::istream&, + typename detail::remove_reference_and_cv<A>::type + >::RET type; +}; + +#else + +template <class T> struct get_ostream_type { + typedef std::basic_ostream<typename T::char_type, + typename T::traits_type>& type; +}; + +template <class T> struct get_istream_type { + typedef std::basic_istream<typename T::char_type, + typename T::traits_type>& type; +}; + +template<class A, class B> +struct leftshift_type { +private: + typedef typename boost::remove_reference<A>::type plainA; +public: + typedef typename detail::IF_type< + is_instance_of_2<plainA, std::basic_ostream>::value, + get_ostream_type<plainA>, //reference to the stream + detail::remove_reference_and_cv<A> + >::type type; +}; + +template<class A, class B> +struct rightshift_type { +private: + typedef typename boost::remove_reference<A>::type plainA; +public: + typedef typename detail::IF_type< + is_instance_of_2<plainA, std::basic_istream>::value, + get_istream_type<plainA>, //reference to the stream + detail::remove_reference_and_cv<A> + >::type type; +}; + + +#endif + +} // end detail + +// ostream +template<class A, class B> +struct return_type_2<bitwise_action<leftshift_action>, A, B> +{ + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<bitwise_action<leftshift_action>, plain_A, plain_B>::type type1; + + // if user defined return type, do not enter type deductions + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::leftshift_type<A, B>, + plain_return_type_2<bitwise_action<leftshift_action>, plain_A, plain_B> + >::type type; +}; + +// istream +template<class A, class B> +struct return_type_2<bitwise_action<rightshift_action>, A, B> +{ + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<bitwise_action<rightshift_action>, plain_A, plain_B>::type type1; + + // if user defined return type, do not enter type deductions + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::rightshift_type<A, B>, + plain_return_type_2<bitwise_action<rightshift_action>, plain_A, plain_B> + >::type type; +}; + +// -- logical actions ---------------------------------------- +// always bool +// NOTE: this may not be true for some weird user-defined types, +template<class A, class B, class Act> +struct plain_return_type_2<logical_action<Act>, A, B> { + typedef bool type; +}; + +template<class A, class B, class Act> +struct return_type_2<logical_action<Act>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<logical_action<Act>, plain_A, plain_B>::type type; + +}; + + +// -- relational actions ---------------------------------------- +// always bool +// NOTE: this may not be true for some weird user-defined types, +template<class A, class B, class Act> +struct plain_return_type_2<relational_action<Act>, A, B> { + typedef bool type; +}; + +template<class A, class B, class Act> +struct return_type_2<relational_action<Act>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<relational_action<Act>, plain_A, plain_B>::type type; +}; + +// Assingment actions ----------------------------------------------- +// return type is the type of the first argument as reference + +// note that cv-qualifiers are preserved. +// Yes, assignment operator can be const! + +// NOTE: this may not be true for some weird user-defined types, + +template<class A, class B, class Act> +struct return_type_2<arithmetic_assignment_action<Act>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2< + arithmetic_assignment_action<Act>, plain_A, plain_B + >::type type1; + + typedef typename + detail::IF< + boost::is_same<type1, detail::unspecified>::value, + typename boost::add_reference<A>::type, + type1 + >::RET type; +}; + +template<class A, class B, class Act> +struct return_type_2<bitwise_assignment_action<Act>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2< + bitwise_assignment_action<Act>, plain_A, plain_B + >::type type1; + + typedef typename + detail::IF< + boost::is_same<type1, detail::unspecified>::value, + typename boost::add_reference<A>::type, + type1 + >::RET type; +}; + +template<class A, class B> +struct return_type_2<other_action<assignment_action>, A, B> { + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2< + other_action<assignment_action>, plain_A, plain_B + >::type type1; + + typedef typename + detail::IF< + boost::is_same<type1, detail::unspecified>::value, + typename boost::add_reference<A>::type, + type1 + >::RET type; +}; + +// -- other actions ---------------------------------------- + +// comma action ---------------------------------- +// Note: this may not be true for some weird user-defined types, + +// NOTE! This only tries the plain_return_type_2 layer and gives +// detail::unspecified as default. If no such specialization is found, the +// type rule in the spcecialization of the return_type_2_prot is used +// to give the type of the right argument (which can be a reference too) +// (The built in operator, can return a l- or rvalue). +template<class A, class B> +struct return_type_2<other_action<comma_action>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2< + other_action<comma_action>, plain_A, plain_B + >::type type; + }; + +// subscript action ----------------------------------------------- + + +namespace detail { + // A and B are nonreference types +template <class A, class B> struct subscript_type { + typedef detail::unspecified type; +}; + +template <class A, class B> struct subscript_type<A*, B> { + typedef A& type; +}; +template <class A, class B> struct subscript_type<A* const, B> { + typedef A& type; +}; +template <class A, class B> struct subscript_type<A* volatile, B> { + typedef A& type; +}; +template <class A, class B> struct subscript_type<A* const volatile, B> { + typedef A& type; +}; + + +template<class A, class B, int N> struct subscript_type<A[N], B> { + typedef A& type; +}; + + // these 3 specializations are needed to make gcc <3 happy +template<class A, class B, int N> struct subscript_type<const A[N], B> { + typedef const A& type; +}; +template<class A, class B, int N> struct subscript_type<volatile A[N], B> { + typedef volatile A& type; +}; +template<class A, class B, int N> struct subscript_type<const volatile A[N], B> { + typedef const volatile A& type; +}; + +} // end detail + +template<class A, class B> +struct return_type_2<other_action<subscript_action>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename boost::remove_reference<A>::type nonref_A; + typedef typename boost::remove_reference<B>::type nonref_B; + + typedef typename + plain_return_type_2< + other_action<subscript_action>, plain_A, plain_B + >::type type1; + + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::subscript_type<nonref_A, nonref_B>, + plain_return_type_2<other_action<subscript_action>, plain_A, plain_B> + >::type type; + +}; + +template<class Key, class T, class Cmp, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::map<Key, T, Cmp, Allocator>, B> { + typedef T& type; + // T == std::map<Key, T, Cmp, Allocator>::mapped_type; +}; + +template<class Key, class T, class Cmp, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::multimap<Key, T, Cmp, Allocator>, B> { + typedef T& type; + // T == std::map<Key, T, Cmp, Allocator>::mapped_type; +}; + + // deque +template<class T, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::deque<T, Allocator>, B> { + typedef typename std::deque<T, Allocator>::reference type; +}; +template<class T, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, const std::deque<T, Allocator>, B> { + typedef typename std::deque<T, Allocator>::const_reference type; +}; + + // vector +template<class T, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::vector<T, Allocator>, B> { + typedef typename std::vector<T, Allocator>::reference type; +}; +template<class T, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, const std::vector<T, Allocator>, B> { + typedef typename std::vector<T, Allocator>::const_reference type; +}; + + // basic_string +template<class Char, class Traits, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::basic_string<Char, Traits, Allocator>, B> { + typedef typename std::basic_string<Char, Traits, Allocator>::reference type; +}; +template<class Char, class Traits, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, const std::basic_string<Char, Traits, Allocator>, B> { + typedef typename std::basic_string<Char, Traits, Allocator>::const_reference type; +}; + +template<class Char, class Traits, class Allocator> +struct plain_return_type_2<arithmetic_action<plus_action>, + std::basic_string<Char, Traits, Allocator>, + std::basic_string<Char, Traits, Allocator> > { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + +template<class Char, class Traits, class Allocator> +struct plain_return_type_2<arithmetic_action<plus_action>, + const Char*, + std::basic_string<Char, Traits, Allocator> > { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + +template<class Char, class Traits, class Allocator> +struct plain_return_type_2<arithmetic_action<plus_action>, + std::basic_string<Char, Traits, Allocator>, + const Char*> { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + +template<class Char, class Traits, class Allocator, std::size_t N> +struct plain_return_type_2<arithmetic_action<plus_action>, + Char[N], + std::basic_string<Char, Traits, Allocator> > { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + +template<class Char, class Traits, class Allocator, std::size_t N> +struct plain_return_type_2<arithmetic_action<plus_action>, + std::basic_string<Char, Traits, Allocator>, + Char[N]> { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + + +} // namespace lambda +} // namespace boost + +#endif + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/operators.hpp b/3rdParty/Boost/src/boost/lambda/detail/operators.hpp new file mode 100644 index 0000000..149e1ee --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/operators.hpp @@ -0,0 +1,370 @@ +// Boost Lambda Library - operators.hpp -------------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// --------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_OPERATORS_HPP +#define BOOST_LAMBDA_OPERATORS_HPP + +#include "boost/lambda/detail/is_instance_of.hpp" + +namespace boost { +namespace lambda { + +#if defined BOOST_LAMBDA_BE1 +#error "Multiple defines of BOOST_LAMBDA_BE1" +#endif + + // For all BOOSTA_LAMBDA_BE* macros: + + // CONSTA must be either 'A' or 'const A' + // CONSTB must be either 'B' or 'const B' + + // It is stupid to have the names A and B as macro arguments, but it avoids + // the need to pass in emtpy macro arguments, which gives warnings on some + // compilers + +#define BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \ +template<class Arg, class B> \ +inline const \ +lambda_functor< \ + lambda_functor_base< \ + ACTION, \ + tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type> \ + > \ +> \ +OPER_NAME (const lambda_functor<Arg>& a, CONSTB& b) { \ + return \ + lambda_functor_base< \ + ACTION, \ + tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>\ + > \ + (tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>(a, b)); \ +} + + +#if defined BOOST_LAMBDA_BE2 +#error "Multiple defines of BOOST_LAMBDA_BE2" +#endif + +#define BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \ +template<class A, class Arg> \ +inline const \ +lambda_functor< \ + lambda_functor_base< \ + ACTION, \ + tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> > \ + > \ +> \ +OPER_NAME (CONSTA& a, const lambda_functor<Arg>& b) { \ + return \ + lambda_functor_base< \ + ACTION, \ + tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> > \ + > \ + (tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> >(a, b)); \ +} + + +#if defined BOOST_LAMBDA_BE3 +#error "Multiple defines of BOOST_LAMBDA_BE3" +#endif + +#define BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \ +template<class ArgA, class ArgB> \ +inline const \ +lambda_functor< \ + lambda_functor_base< \ + ACTION, \ + tuple<lambda_functor<ArgA>, lambda_functor<ArgB> > \ + > \ +> \ +OPER_NAME (const lambda_functor<ArgA>& a, const lambda_functor<ArgB>& b) { \ + return \ + lambda_functor_base< \ + ACTION, \ + tuple<lambda_functor<ArgA>, lambda_functor<ArgB> > \ + > \ + (tuple<lambda_functor<ArgA>, lambda_functor<ArgB> >(a, b)); \ +} + +#if defined BOOST_LAMBDA_BE +#error "Multiple defines of BOOST_LAMBDA_BE" +#endif + +#define BOOST_LAMBDA_BE(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \ +BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \ +BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \ +BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) + +#define BOOST_LAMBDA_EMPTY() + +BOOST_LAMBDA_BE(operator+, arithmetic_action<plus_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator-, arithmetic_action<minus_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator*, arithmetic_action<multiply_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator/, arithmetic_action<divide_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator%, arithmetic_action<remainder_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator<<, bitwise_action<leftshift_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator>>, bitwise_action<rightshift_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator&, bitwise_action<and_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator|, bitwise_action<or_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator^, bitwise_action<xor_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator&&, logical_action<and_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator||, logical_action<or_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator<, relational_action<less_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator>, relational_action<greater_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator<=, relational_action<lessorequal_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator>=, relational_action<greaterorequal_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator==, relational_action<equal_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator!=, relational_action<notequal_action>, const A, const B, const_copy_argument) + +BOOST_LAMBDA_BE(operator+=, arithmetic_assignment_action<plus_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator-=, arithmetic_assignment_action<minus_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator*=, arithmetic_assignment_action<multiply_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator/=, arithmetic_assignment_action<divide_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator%=, arithmetic_assignment_action<remainder_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator<<=, bitwise_assignment_action<leftshift_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator>>=, bitwise_assignment_action<rightshift_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator&=, bitwise_assignment_action<and_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator|=, bitwise_assignment_action<or_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator^=, bitwise_assignment_action<xor_action>, A, const B, reference_argument) + + +// A special trick for comma operator for correct preprocessing +#if defined BOOST_LAMBDA_COMMA_OPERATOR_NAME +#error "Multiple defines of BOOST_LAMBDA_COMMA_OPERATOR_NAME" +#endif + +#define BOOST_LAMBDA_COMMA_OPERATOR_NAME operator, + +BOOST_LAMBDA_BE1(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE2(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE3(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument) + + + +namespace detail { + +// special cases for ostream& << Any and istream& >> Any --------------- +// the actual stream classes may vary and thus a specialisation for, +// say ostream& does not match (the general case above is chosen). +// Therefore we specialise for non-const reference: +// if the left argument is a stream, we store the stream as reference +// if it is something else, we store a const plain by default + +// Note that the overloading is const vs. non-const first argument + +#ifdef BOOST_NO_TEMPLATED_STREAMS +template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default { + typedef typename detail::IF< + boost::is_convertible<T*, std::ostream*>::value, + T&, + typename const_copy_argument <T>::type + >::RET type; +}; + +template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default { + typedef typename detail::IF< + boost::is_convertible<T*, std::istream*>::value, + T&, + typename const_copy_argument <T>::type + >::RET type; +}; +#else + +template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default { + typedef typename detail::IF< + is_instance_of_2< + T, std::basic_ostream + >::value, + T&, + typename const_copy_argument <T>::type + >::RET type; +}; + +template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default { + typedef typename detail::IF< + is_instance_of_2< + T, std::basic_istream + >::value, + T&, + typename const_copy_argument <T>::type + >::RET type; +}; +#endif + +} // detail + +BOOST_LAMBDA_BE2(operator<<, bitwise_action< leftshift_action>, A, const B, detail::convert_ostream_to_ref_others_to_c_plain_by_default) +BOOST_LAMBDA_BE2(operator>>, bitwise_action< rightshift_action>, A, const B, detail::convert_istream_to_ref_others_to_c_plain_by_default) + + +// special case for io_manipulators. +// function references cannot be given as arguments to lambda operator +// expressions in general. With << and >> the use of manipulators is +// so common, that specializations are provided to make them work. + +template<class Arg, class Ret, class ManipArg> +inline const +lambda_functor< + lambda_functor_base< + bitwise_action<leftshift_action>, + tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> + > +> +operator<<(const lambda_functor<Arg>& a, Ret(&b)(ManipArg)) +{ + return + lambda_functor_base< + bitwise_action<leftshift_action>, + tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> + > + ( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) ); +} + +template<class Arg, class Ret, class ManipArg> +inline const +lambda_functor< + lambda_functor_base< + bitwise_action<rightshift_action>, + tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> + > +> +operator>>(const lambda_functor<Arg>& a, Ret(&b)(ManipArg)) +{ + return + lambda_functor_base< + bitwise_action<rightshift_action>, + tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> + > + ( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) ); +} + + +// (+ and -) take their arguments as const references. +// This has consquences with pointer artihmetic +// E.g int a[]; ... *a = 1 works but not *(a+1) = 1. +// the result of a+1 would be const +// To make the latter work too, +// non-const arrays are taken as non-const and stored as non-const as well. +#if defined BOOST_LAMBDA_PTR_ARITHMETIC_E1 +#error "Multiple defines of BOOST_LAMBDA_PTR_ARITHMETIC_E1" +#endif + +#define BOOST_LAMBDA_PTR_ARITHMETIC_E1(OPER_NAME, ACTION, CONSTB) \ +template<class Arg, int N, class B> \ +inline const \ +lambda_functor< \ + lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \ +> \ +OPER_NAME (const lambda_functor<Arg>& a, CONSTB(&b)[N]) \ +{ \ + return \ + lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \ + (tuple<lambda_functor<Arg>, CONSTB(&)[N]>(a, b)); \ +} + + +#if defined BOOST_LAMBDA_PTR_ARITHMETIC_E2 +#error "Multiple defines of BOOST_LAMBDA_PTR_ARITHMETIC_E2" +#endif + +#define BOOST_LAMBDA_PTR_ARITHMETIC_E2(OPER_NAME, ACTION, CONSTA) \ +template<int N, class A, class Arg> \ +inline const \ +lambda_functor< \ + lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \ +> \ +OPER_NAME (CONSTA(&a)[N], const lambda_functor<Arg>& b) \ +{ \ + return \ + lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \ + (tuple<CONSTA(&)[N], lambda_functor<Arg> >(a, b)); \ +} + + +BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>, B) +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>, A) +BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>,const B) +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>,const A) + + +//BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator-, arithmetic_action<minus_action>) +// This is not needed, since the result of ptr-ptr is an rvalue anyway + +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, A) +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, const A) + + +#undef BOOST_LAMBDA_BE1 +#undef BOOST_LAMBDA_BE2 +#undef BOOST_LAMBDA_BE3 +#undef BOOST_LAMBDA_BE +#undef BOOST_LAMBDA_COMMA_OPERATOR_NAME + +#undef BOOST_LAMBDA_PTR_ARITHMETIC_E1 +#undef BOOST_LAMBDA_PTR_ARITHMETIC_E2 + + +// --------------------------------------------------------------------- +// unary operators ----------------------------------------------------- +// --------------------------------------------------------------------- + +#if defined BOOST_LAMBDA_UE +#error "Multiple defines of BOOST_LAMBDA_UE" +#endif + +#define BOOST_LAMBDA_UE(OPER_NAME, ACTION) \ +template<class Arg> \ +inline const \ +lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \ +OPER_NAME (const lambda_functor<Arg>& a) \ +{ \ + return \ + lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > \ + ( tuple<lambda_functor<Arg> >(a) ); \ +} + + +BOOST_LAMBDA_UE(operator+, unary_arithmetic_action<plus_action>) +BOOST_LAMBDA_UE(operator-, unary_arithmetic_action<minus_action>) +BOOST_LAMBDA_UE(operator~, bitwise_action<not_action>) +BOOST_LAMBDA_UE(operator!, logical_action<not_action>) +BOOST_LAMBDA_UE(operator++, pre_increment_decrement_action<increment_action>) +BOOST_LAMBDA_UE(operator--, pre_increment_decrement_action<decrement_action>) +BOOST_LAMBDA_UE(operator*, other_action<contentsof_action>) +BOOST_LAMBDA_UE(operator&, other_action<addressof_action>) + +#if defined BOOST_LAMBDA_POSTFIX_UE +#error "Multiple defines of BOOST_LAMBDA_POSTFIX_UE" +#endif + +#define BOOST_LAMBDA_POSTFIX_UE(OPER_NAME, ACTION) \ +template<class Arg> \ +inline const \ +lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \ +OPER_NAME (const lambda_functor<Arg>& a, int) \ +{ \ + return \ + lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > \ + ( tuple<lambda_functor<Arg> >(a) ); \ +} + + +BOOST_LAMBDA_POSTFIX_UE(operator++, post_increment_decrement_action<increment_action>) +BOOST_LAMBDA_POSTFIX_UE(operator--, post_increment_decrement_action<decrement_action>) + +#undef BOOST_LAMBDA_UE +#undef BOOST_LAMBDA_POSTFIX_UE + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/ret.hpp b/3rdParty/Boost/src/boost/lambda/detail/ret.hpp new file mode 100644 index 0000000..fbd8b3a --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/ret.hpp @@ -0,0 +1,325 @@ +// Boost Lambda Library ret.hpp ----------------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + + +#ifndef BOOST_LAMBDA_RET_HPP +#define BOOST_LAMBDA_RET_HPP + +namespace boost { +namespace lambda { + + // TODO: + +// Add specializations for function references for ret, protect and unlambda +// e.g void foo(); unlambda(foo); fails, as it would add a const qualifier + // for a function type. + // on the other hand unlambda(*foo) does work + + +// -- ret ------------------------- +// the explicit return type template + + // TODO: It'd be nice to make ret a nop for other than lambda functors + // but causes an ambiguiyty with gcc (not with KCC), check what is the + // right interpretation. + + // // ret for others than lambda functors has no effect + // template <class U, class T> + // inline const T& ret(const T& t) { return t; } + + +template<class RET, class Arg> +inline const +lambda_functor< + lambda_functor_base< + explicit_return_type_action<RET>, + tuple<lambda_functor<Arg> > + > +> +ret(const lambda_functor<Arg>& a1) +{ + return + lambda_functor_base< + explicit_return_type_action<RET>, + tuple<lambda_functor<Arg> > + > + (tuple<lambda_functor<Arg> >(a1)); +} + +// protect ------------------ + + // protecting others than lambda functors has no effect +template <class T> +inline const T& protect(const T& t) { return t; } + +template<class Arg> +inline const +lambda_functor< + lambda_functor_base< + protect_action, + tuple<lambda_functor<Arg> > + > +> +protect(const lambda_functor<Arg>& a1) +{ + return + lambda_functor_base< + protect_action, + tuple<lambda_functor<Arg> > + > + (tuple<lambda_functor<Arg> >(a1)); +} + +// ------------------------------------------------------------------- + +// Hides the lambda functorness of a lambda functor. +// After this, the functor is immune to argument substitution, etc. +// This can be used, e.g. to make it safe to pass lambda functors as +// arguments to functions, which might use them as target functions + +// note, unlambda and protect are different things. Protect hides the lambda +// functor for one application, unlambda for good. + +template <class LambdaFunctor> +class non_lambda_functor +{ + LambdaFunctor lf; +public: + + // This functor defines the result_type typedef. + // The result type must be deducible without knowing the arguments + + template <class SigArgs> struct sig { + typedef typename + LambdaFunctor::inherited:: + template sig<typename SigArgs::tail_type>::type type; + }; + + explicit non_lambda_functor(const LambdaFunctor& a) : lf(a) {} + + typename LambdaFunctor::nullary_return_type + operator()() const { + return lf.template + call<typename LambdaFunctor::nullary_return_type> + (cnull_type(), cnull_type(), cnull_type(), cnull_type()); + } + + template<class A> + typename sig<tuple<const non_lambda_functor, A&> >::type + operator()(A& a) const { + return lf.template call<typename sig<tuple<const non_lambda_functor, A&> >::type >(a, cnull_type(), cnull_type(), cnull_type()); + } + + template<class A, class B> + typename sig<tuple<const non_lambda_functor, A&, B&> >::type + operator()(A& a, B& b) const { + return lf.template call<typename sig<tuple<const non_lambda_functor, A&, B&> >::type >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B, class C> + typename sig<tuple<const non_lambda_functor, A&, B&, C&> >::type + operator()(A& a, B& b, C& c) const { + return lf.template call<typename sig<tuple<const non_lambda_functor, A&, B&, C&> >::type>(a, b, c, cnull_type()); + } +}; + +template <class Arg> +inline const Arg& unlambda(const Arg& a) { return a; } + +template <class Arg> +inline const non_lambda_functor<lambda_functor<Arg> > +unlambda(const lambda_functor<Arg>& a) +{ + return non_lambda_functor<lambda_functor<Arg> >(a); +} + + // Due to a language restriction, lambda functors cannot be made to + // accept non-const rvalue arguments. Usually iterators do not return + // temporaries, but sometimes they do. That's why a workaround is provided. + // Note, that this potentially breaks const correctness, so be careful! + +// any lambda functor can be turned into a const_incorrect_lambda_functor +// The operator() takes arguments as consts and then casts constness +// away. So this breaks const correctness!!! but is a necessary workaround +// in some cases due to language limitations. +// Note, that this is not a lambda_functor anymore, so it can not be used +// as a sub lambda expression. + +template <class LambdaFunctor> +struct const_incorrect_lambda_functor { + LambdaFunctor lf; +public: + + explicit const_incorrect_lambda_functor(const LambdaFunctor& a) : lf(a) {} + + template <class SigArgs> struct sig { + typedef typename + LambdaFunctor::inherited::template + sig<typename SigArgs::tail_type>::type type; + }; + + // The nullary case is not needed (no arguments, no parameter type problems) + + template<class A> + typename sig<tuple<const const_incorrect_lambda_functor, A&> >::type + operator()(const A& a) const { + return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&> >::type >(const_cast<A&>(a), cnull_type(), cnull_type(), cnull_type()); + } + + template<class A, class B> + typename sig<tuple<const const_incorrect_lambda_functor, A&, B&> >::type + operator()(const A& a, const B& b) const { + return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&, B&> >::type >(const_cast<A&>(a), const_cast<B&>(b), cnull_type(), cnull_type()); + } + + template<class A, class B, class C> + typename sig<tuple<const const_incorrect_lambda_functor, A&, B&, C&> >::type + operator()(const A& a, const B& b, const C& c) const { + return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&, B&, C&> >::type>(const_cast<A&>(a), const_cast<B&>(b), const_cast<C&>(c), cnull_type()); + } +}; + +// ------------------------------------------------------------------------ +// any lambda functor can be turned into a const_parameter_lambda_functor +// The operator() takes arguments as const. +// This is useful if lambda functors are called with non-const rvalues. +// Note, that this is not a lambda_functor anymore, so it can not be used +// as a sub lambda expression. + +template <class LambdaFunctor> +struct const_parameter_lambda_functor { + LambdaFunctor lf; +public: + + explicit const_parameter_lambda_functor(const LambdaFunctor& a) : lf(a) {} + + template <class SigArgs> struct sig { + typedef typename + LambdaFunctor::inherited::template + sig<typename SigArgs::tail_type>::type type; + }; + + // The nullary case is not needed: no arguments, no constness problems. + + template<class A> + typename sig<tuple<const const_parameter_lambda_functor, const A&> >::type + operator()(const A& a) const { + return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&> >::type >(a, cnull_type(), cnull_type(), cnull_type()); + } + + template<class A, class B> + typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&> >::type + operator()(const A& a, const B& b) const { + return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&> >::type >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B, class C> + typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&, const C&> +>::type + operator()(const A& a, const B& b, const C& c) const { + return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&, const C&> >::type>(a, b, c, cnull_type()); + } +}; + +template <class Arg> +inline const const_incorrect_lambda_functor<lambda_functor<Arg> > +break_const(const lambda_functor<Arg>& lf) +{ + return const_incorrect_lambda_functor<lambda_functor<Arg> >(lf); +} + + +template <class Arg> +inline const const_parameter_lambda_functor<lambda_functor<Arg> > +const_parameters(const lambda_functor<Arg>& lf) +{ + return const_parameter_lambda_functor<lambda_functor<Arg> >(lf); +} + +// make void ------------------------------------------------ +// make_void( x ) turns a lambda functor x with some return type y into +// another lambda functor, which has a void return type +// when called, the original return type is discarded + +// we use this action. The action class will be called, which means that +// the wrapped lambda functor is evaluated, but we just don't do anything +// with the result. +struct voidifier_action { + template<class Ret, class A> static void apply(A&) {} +}; + +template<class Args> struct return_type_N<voidifier_action, Args> { + typedef void type; +}; + +template<class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, voidifier_action>, + tuple<lambda_functor<Arg1> > + > +> +make_void(const lambda_functor<Arg1>& a1) { +return + lambda_functor_base< + action<1, voidifier_action>, + tuple<lambda_functor<Arg1> > + > + (tuple<lambda_functor<Arg1> > (a1)); +} + +// for non-lambda functors, make_void does nothing +// (the argument gets evaluated immediately) + +template<class Arg1> +inline const +lambda_functor< + lambda_functor_base<do_nothing_action, null_type> +> +make_void(const Arg1& a1) { +return + lambda_functor_base<do_nothing_action, null_type>(); +} + +// std_functor ----------------------------------------------------- + +// The STL uses the result_type typedef as the convention to let binders know +// the return type of a function object. +// LL uses the sig template. +// To let LL know that the function object has the result_type typedef +// defined, it can be wrapped with the std_functor function. + + +// Just inherit form the template parameter (the standard functor), +// and provide a sig template. So we have a class which is still the +// same functor + the sig template. + +template<class T> +struct result_type_to_sig : public T { + template<class Args> struct sig { typedef typename T::result_type type; }; + result_type_to_sig(const T& t) : T(t) {} +}; + +template<class F> +inline result_type_to_sig<F> std_functor(const F& f) { return f; } + + +} // namespace lambda +} // namespace boost + +#endif + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/return_type_traits.hpp b/3rdParty/Boost/src/boost/lambda/detail/return_type_traits.hpp new file mode 100644 index 0000000..bf2394e --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/return_type_traits.hpp @@ -0,0 +1,282 @@ +// return_type_traits.hpp -- Boost Lambda Library --------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + + +#ifndef BOOST_LAMBDA_RETURN_TYPE_TRAITS_HPP +#define BOOST_LAMBDA_RETURN_TYPE_TRAITS_HPP + +#include "boost/mpl/has_xxx.hpp" + +#include <cstddef> // needed for the ptrdiff_t + +namespace boost { +namespace lambda { + +using ::boost::type_traits::ice_and; +using ::boost::type_traits::ice_or; +using ::boost::type_traits::ice_not; + +// Much of the type deduction code for standard arithmetic types +// from Gary Powell + + // different arities: +template <class Act, class A1> struct return_type_1; // 1-ary actions +template <class Act, class A1, class A2> struct return_type_2; // 2-ary +template <class Act, class Args> struct return_type_N; // >3- ary + +template <class Act, class A1> struct return_type_1_prot; +template <class Act, class A1, class A2> struct return_type_2_prot; // 2-ary +template <class Act, class A1> struct return_type_N_prot; // >3-ary + + +namespace detail { + +template<class> class return_type_deduction_failure {}; + + // In some cases return type deduction should fail (an invalid lambda + // expression). Sometimes the lambda expression can be ok, the return type + // just is not deducible (user defined operators). Then return type deduction + // should never be entered at all, and the use of ret<> does this. + // However, for nullary lambda functors, return type deduction is always + // entered, and there seems to be no way around this. + + // (the return type is part of the prototype of the non-template + // operator()(). The prototype is instantiated, even though the body + // is not.) + + // So, in the case the return type deduction should fail, it should not + // fail directly, but rather result in a valid but wrong return type, + // causing a compile time error only if the function is really called. + + + +} // end detail + + + +// return_type_X_prot classes -------------------------------------------- +// These classes are the first layer that gets instantiated from the +// lambda_functor_base sig templates. It will check whether +// the action is protectable and one of arguments is "protected" or its +// evaluation will otherwise result in another lambda functor. +// If this is a case, the result type will be another lambda functor. + +// The arguments are always non-reference types, except for comma action +// where the right argument can be a reference too. This is because it +// matters (in the builtin case) whether the argument is an lvalue or +// rvalue: int i; i, 1 -> rvalue; 1, i -> lvalue + +template <class Act, class A> struct return_type_1_prot { +public: + typedef typename + detail::IF< + // is_protectable<Act>::value && is_lambda_functor<A>::value, + ice_and<is_protectable<Act>::value, is_lambda_functor<A>::value>::value, + lambda_functor< + lambda_functor_base< + Act, + tuple<typename detail::remove_reference_and_cv<A>::type> + > + >, + typename return_type_1<Act, A>::type + >::RET type; +}; + + // take care of the unavoidable instantiation for nullary case +template<class Act> struct return_type_1_prot<Act, null_type> { + typedef null_type type; +}; + +// Unary actions (result from unary operators) +// do not have a default return type. +template<class Act, class A> struct return_type_1 { + typedef typename + detail::return_type_deduction_failure<return_type_1> type; +}; + + +namespace detail { + + template <class T> + class protect_conversion { + typedef typename boost::remove_reference<T>::type non_ref_T; + public: + + // add const to rvalues, so that all rvalues are stored as const in + // the args tuple + typedef typename detail::IF_type< +// boost::is_reference<T>::value && !boost::is_const<non_ref_T>::value, + ice_and<boost::is_reference<T>::value, + ice_not<boost::is_const<non_ref_T>::value>::value>::value, + detail::identity_mapping<T>, + const_copy_argument<non_ref_T> // handles funtion and array + >::type type; // types correctly + }; + +} // end detail + +template <class Act, class A, class B> struct return_type_2_prot { + +// experimental feature + // We may have a lambda functor as a result type of a subexpression + // (if protect) has been used. + // Thus, if one of the parameter types is a lambda functor, the result + // is a lambda functor as well. + // We need to make a conservative choise here. + // The resulting lambda functor stores all const reference arguments as + // const copies. References to non-const are stored as such. + // So if the source of the argument is a const open argument, a bound + // argument stored as a const reference, or a function returning a + // const reference, that information is lost. There is no way of + // telling apart 'real const references' from just 'LL internal + // const references' (or it would be really hard) + + // The return type is a subclass of lambda_functor, which has a converting + // copy constructor. It can copy any lambda functor, that has the same + // action type and code, and a copy compatible argument tuple. + + + typedef typename boost::remove_reference<A>::type non_ref_A; + typedef typename boost::remove_reference<B>::type non_ref_B; + +typedef typename + detail::IF< +// is_protectable<Act>::value && +// (is_lambda_functor<A>::value || is_lambda_functor<B>::value), + ice_and<is_protectable<Act>::value, + ice_or<is_lambda_functor<A>::value, + is_lambda_functor<B>::value>::value>::value, + lambda_functor< + lambda_functor_base< + Act, + tuple<typename detail::protect_conversion<A>::type, + typename detail::protect_conversion<B>::type> + > + >, + typename return_type_2<Act, non_ref_A, non_ref_B>::type + >::RET type; +}; + + // take care of the unavoidable instantiation for nullary case +template<class Act> struct return_type_2_prot<Act, null_type, null_type> { + typedef null_type type; +}; + // take care of the unavoidable instantiation for nullary case +template<class Act, class Other> struct return_type_2_prot<Act, Other, null_type> { + typedef null_type type; +}; + // take care of the unavoidable instantiation for nullary case +template<class Act, class Other> struct return_type_2_prot<Act, null_type, Other> { + typedef null_type type; +}; + + // comma is a special case, as the user defined operator can return + // an lvalue (reference) too, hence it must be handled at this level. +template<class A, class B> +struct return_type_2_comma +{ + typedef typename boost::remove_reference<A>::type non_ref_A; + typedef typename boost::remove_reference<B>::type non_ref_B; + +typedef typename + detail::IF< +// is_protectable<other_action<comma_action> >::value && // it is protectable +// (is_lambda_functor<A>::value || is_lambda_functor<B>::value), + ice_and<is_protectable<other_action<comma_action> >::value, // it is protectable + ice_or<is_lambda_functor<A>::value, + is_lambda_functor<B>::value>::value>::value, + lambda_functor< + lambda_functor_base< + other_action<comma_action>, + tuple<typename detail::protect_conversion<A>::type, + typename detail::protect_conversion<B>::type> + > + >, + typename + return_type_2<other_action<comma_action>, non_ref_A, non_ref_B>::type + >::RET type1; + + // if no user defined return_type_2 (or plain_return_type_2) specialization + // matches, then return the righthand argument + typedef typename + detail::IF< + boost::is_same<type1, detail::unspecified>::value, + B, + type1 + >::RET type; + +}; + + + // currently there are no protectable actions with > 2 args + +template<class Act, class Args> struct return_type_N_prot { + typedef typename return_type_N<Act, Args>::type type; +}; + + // take care of the unavoidable instantiation for nullary case +template<class Act> struct return_type_N_prot<Act, null_type> { + typedef null_type type; +}; + +// handle different kind of actions ------------------------ + + // use the return type given in the bind invocation as bind<Ret>(...) +template<int I, class Args, class Ret> +struct return_type_N<function_action<I, Ret>, Args> { + typedef Ret type; +}; + +// ::result_type support + +namespace detail +{ + +BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) + +template<class F> struct get_result_type +{ + typedef typename F::result_type type; +}; + +template<class F, class A> struct get_sig +{ + typedef typename function_adaptor<F>::template sig<A>::type type; +}; + +} // namespace detail + + // Ret is detail::unspecified, so try to deduce return type +template<int I, class Args> +struct return_type_N<function_action<I, detail::unspecified>, Args > { + + // in the case of function action, the first element in Args is + // some type of function + typedef typename Args::head_type Func; + typedef typename detail::remove_reference_and_cv<Func>::type plain_Func; + +public: + // pass the function to function_adaptor, and get the return type from + // that + typedef typename detail::IF< + detail::has_result_type<plain_Func>::value, + detail::get_result_type<plain_Func>, + detail::get_sig<plain_Func, Args> + >::RET::type type; +}; + + +} // namespace lambda +} // namespace boost + +#endif + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/select_functions.hpp b/3rdParty/Boost/src/boost/lambda/detail/select_functions.hpp new file mode 100644 index 0000000..956045c --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/select_functions.hpp @@ -0,0 +1,74 @@ +// -- select_functions.hpp -- Boost Lambda Library -------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see http://www.boost.org + + +#ifndef BOOST_LAMBDA_SELECT_FUNCTIONS_HPP +#define BOOST_LAMBDA_SELECT_FUNCTIONS_HPP + +namespace boost { +namespace lambda { +namespace detail { + + +// select functions ------------------------------- +template<class Any, CALL_TEMPLATE_ARGS> +inline Any& select(Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; } + + +template<class Arg, CALL_TEMPLATE_ARGS> +inline typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type +select ( const lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) { + return op.template call< + typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type + >(CALL_ACTUAL_ARGS); +} +template<class Arg, CALL_TEMPLATE_ARGS> +inline typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type +select ( lambda_functor<Arg>& op, CALL_FORMAL_ARGS) { + return op.template call< + typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type + >(CALL_ACTUAL_ARGS); +} + +// ------------------------------------------------------------------------ +// select functions where the return type is explicitly given +// Note: on many functions, this return type is just discarded. +// The select functions are inside a class template, and the return type +// is a class template argument. +// The first implementation used function templates with an explicitly +// specified template parameter. +// However, this resulted in ambiguous calls (at least with gcc 2.95.2 +// and edg 2.44). Not sure whether the compilers were right or wrong. + +template<class RET> struct r_select { + +// Any == RET + template<class Any, CALL_TEMPLATE_ARGS> + static + inline RET go (Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; } + + + template<class Arg, CALL_TEMPLATE_ARGS> + static + inline RET go (const lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) { + return op.template call<RET>(CALL_ACTUAL_ARGS); + } + template<class Arg, CALL_TEMPLATE_ARGS> + static + inline RET go (lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) { + return op.template call<RET>(CALL_ACTUAL_ARGS); + } +}; + +} // namespace detail +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/lambda.hpp b/3rdParty/Boost/src/boost/lambda/lambda.hpp new file mode 100644 index 0000000..75b06c7 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/lambda.hpp @@ -0,0 +1,34 @@ +// -- lambda.hpp -- Boost Lambda Library ----------------------------------- +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see http://lambda.cs.utu.fi + +#ifndef BOOST_LAMBDA_LAMBDA_HPP +#define BOOST_LAMBDA_LAMBDA_HPP + + +#include "boost/lambda/core.hpp" + +#ifdef BOOST_NO_FDECL_TEMPLATES_AS_TEMPLATE_TEMPLATE_PARAMS +#include <istream> +#include <ostream> +#endif + +#include "boost/lambda/detail/operator_actions.hpp" +#include "boost/lambda/detail/operator_lambda_func_base.hpp" +#include "boost/lambda/detail/operator_return_type_traits.hpp" + + +#include "boost/lambda/detail/operators.hpp" + +#ifndef BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER +// sorry, member ptr does not work with gcc2.95 +#include "boost/lambda/detail/member_ptr.hpp" +#endif + + +#endif diff --git a/3rdParty/Boost/src/boost/lexical_cast.hpp b/3rdParty/Boost/src/boost/lexical_cast.hpp index d7d9052..c475982 100644 --- a/3rdParty/Boost/src/boost/lexical_cast.hpp +++ b/3rdParty/Boost/src/boost/lexical_cast.hpp @@ -1,6 +1,12 @@ #ifndef BOOST_LEXICAL_CAST_INCLUDED #define BOOST_LEXICAL_CAST_INCLUDED +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + // Boost lexical_cast.hpp header -------------------------------------------// // // See http://www.boost.org/libs/conversion for documentation. @@ -11,28 +17,43 @@ // enhanced with contributions from Terje Slettebo, // with additional fixes and suggestions from Gennaro Prota, // Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov, -// Alexander Nasonov and other Boosters -// when: November 2000, March 2003, June 2005, June 2006 +// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann, +// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters +// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2012 + +#include <boost/config.hpp> +#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) +#define BOOST_LCAST_NO_WCHAR_T +#endif #include <climits> #include <cstddef> -#include <istream> #include <string> +#include <cstring> +#include <cstdio> #include <typeinfo> #include <exception> -#include <boost/config.hpp> #include <boost/limits.hpp> #include <boost/mpl/if.hpp> #include <boost/throw_exception.hpp> +#include <boost/type_traits/ice.hpp> #include <boost/type_traits/is_pointer.hpp> -#include <boost/type_traits/make_unsigned.hpp> -#include <boost/call_traits.hpp> #include <boost/static_assert.hpp> #include <boost/detail/lcast_precision.hpp> #include <boost/detail/workaround.hpp> + #ifndef BOOST_NO_STD_LOCALE -#include <locale> +# include <locale> +#else +# ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + // Getting error at this point means, that your STL library is old/lame/misconfigured. + // If nothing can be done with STL library, define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE, + // but beware: lexical_cast will understand only 'C' locale delimeters and thousands + // separators. +# error "Unable to use <locale> header. Define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE to force " +# error "boost::lexical_cast to use only 'C' locale during conversions." +# endif #endif #ifdef BOOST_NO_STRINGSTREAM @@ -41,10 +62,6 @@ #include <sstream> #endif -#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) -#define BOOST_LCAST_NO_WCHAR_T -#endif - #ifdef BOOST_NO_TYPEID #define BOOST_LCAST_THROW_BAD_CAST(S, T) throw_exception(bad_lexical_cast()) #else @@ -55,7 +72,13 @@ namespace boost { // exception used to indicate runtime lexical_cast failure - class bad_lexical_cast : public std::bad_cast + class BOOST_SYMBOL_VISIBLE bad_lexical_cast : + // workaround MSVC bug with std::bad_cast when _HAS_EXCEPTIONS == 0 +#if defined(BOOST_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS + public std::exception +#else + public std::bad_cast +#endif #if defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x560 ) // under bcc32 5.5.1 bad_cast doesn't derive from exception @@ -64,7 +87,7 @@ namespace boost { public: - bad_lexical_cast() : + bad_lexical_cast() BOOST_NOEXCEPT : #ifndef BOOST_NO_TYPEID source(&typeid(void)), target(&typeid(void)) #else @@ -75,7 +98,7 @@ namespace boost bad_lexical_cast( const std::type_info &source_type_arg, - const std::type_info &target_type_arg) : + const std::type_info &target_type_arg) BOOST_NOEXCEPT : source(&source_type_arg), target(&target_type_arg) { } @@ -89,81 +112,222 @@ namespace boost return *target; } +#ifndef BOOST_NO_NOEXCEPT + virtual const char *what() const noexcept +#else virtual const char *what() const throw() +#endif { return "bad lexical cast: " "source type value could not be interpreted as target"; } + +#ifndef BOOST_NO_NOEXCEPT + virtual ~bad_lexical_cast() BOOST_NOEXCEPT +#else virtual ~bad_lexical_cast() throw() - { - } +#endif + {} private: const std::type_info *source; const std::type_info *target; }; - namespace detail // selectors for choosing stream character type + namespace detail // widest_char { - template<typename Type> + template <typename TargetChar, typename SourceChar> + struct widest_char + { + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + (sizeof(TargetChar) > sizeof(SourceChar)) + , TargetChar + , SourceChar >::type type; + }; + } +} // namespace boost + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__SUNPRO_CC) && !defined(__PGIC__) + +#include <cmath> +#include <istream> + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) +#include <array> +#endif + +#include <boost/array.hpp> +#include <boost/numeric/conversion/cast.hpp> +#include <boost/type_traits/make_unsigned.hpp> +#include <boost/type_traits/is_signed.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/math/special_functions/sign.hpp> +#include <boost/math/special_functions/fpclassify.hpp> +#include <boost/range/iterator_range_core.hpp> +#include <boost/container/container_fwd.hpp> +#ifndef BOOST_NO_CWCHAR +# include <cwchar> +#endif + +namespace boost { + namespace detail // widest_char<...> (continuation) + { + struct not_a_character_type{}; + + template <typename CharT> + struct widest_char<not_a_character_type, CharT > + { + typedef CharT type; + }; + + template <typename CharT> + struct widest_char< CharT, not_a_character_type > + { + typedef CharT type; + }; + + template <> + struct widest_char< not_a_character_type, not_a_character_type > + { + typedef char type; + }; + } + + namespace detail // is_char_or_wchar<...> and stream_char<...> templates + { + // returns true, if T is one of the character types + template <typename T> + struct is_char_or_wchar + { + typedef ::boost::type_traits::ice_or< + ::boost::is_same< T, char >::value, + #ifndef BOOST_LCAST_NO_WCHAR_T + ::boost::is_same< T, wchar_t >::value, + #endif + #ifndef BOOST_NO_CHAR16_T + ::boost::is_same< T, char16_t >::value, + #endif + #ifndef BOOST_NO_CHAR32_T + ::boost::is_same< T, char32_t >::value, + #endif + ::boost::is_same< T, unsigned char >::value, + ::boost::is_same< T, signed char >::value + > result_type; + + BOOST_STATIC_CONSTANT(bool, value = (result_type::value) ); + }; + + // selectors for choosing stream character type + // returns one of char, wchar_t, char16_t, char32_t or not_a_character_type types + template <typename Type> struct stream_char { + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + is_char_or_wchar<Type >::value, + Type, + boost::detail::not_a_character_type + >::type type; + }; + + template <> + struct stream_char<unsigned char> + { typedef char type; }; -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template<class CharT, class Traits, class Alloc> - struct stream_char< std::basic_string<CharT,Traits,Alloc> > + template <> + struct stream_char<signed char> + { + typedef char type; + }; + + template <typename CharT> + struct stream_char<CharT*> + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; + }; + + template <typename CharT> + struct stream_char<const CharT*> + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; + }; + + template <typename CharT> + struct stream_char<iterator_range<CharT*> > + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT*>::type type; + }; + + template <typename CharT> + struct stream_char<iterator_range<const CharT*> > + { + typedef BOOST_DEDUCED_TYPENAME stream_char<const CharT*>::type type; + }; + + template <class CharT, class Traits, class Alloc> + struct stream_char< std::basic_string<CharT, Traits, Alloc> > { typedef CharT type; }; -#endif -#ifndef BOOST_LCAST_NO_WCHAR_T -#ifndef BOOST_NO_INTRINSIC_WCHAR_T - template<> - struct stream_char<wchar_t> + template <class CharT, class Traits, class Alloc> + struct stream_char< ::boost::container::basic_string<CharT, Traits, Alloc> > { - typedef wchar_t type; + typedef CharT type; }; -#endif - template<> - struct stream_char<wchar_t *> + template<typename CharT, std::size_t N> + struct stream_char<boost::array<CharT, N> > { - typedef wchar_t type; + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; }; - template<> - struct stream_char<const wchar_t *> + template<typename CharT, std::size_t N> + struct stream_char<boost::array<const CharT, N> > { - typedef wchar_t type; + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; }; -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + template <typename CharT, std::size_t N> + struct stream_char<std::array<CharT, N> > + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; + }; + + template <typename CharT, std::size_t N> + struct stream_char<std::array<const CharT, N> > + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; + }; +#endif // !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + +#if !defined(BOOST_LCAST_NO_WCHAR_T) && defined(BOOST_NO_INTRINSIC_WCHAR_T) template<> - struct stream_char<std::wstring> + struct stream_char<wchar_t> { - typedef wchar_t type; + typedef boost::detail::not_a_character_type type; }; -#endif -#endif - template<typename TargetChar, typename SourceChar> - struct widest_char + template<> + struct stream_char<wchar_t*> { - typedef TargetChar type; + typedef wchar_t type; }; template<> - struct widest_char<char, wchar_t> + struct stream_char<const wchar_t*> { typedef wchar_t type; }; +#endif } namespace detail // deduce_char_traits template { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template<class CharT, class Target, class Source> struct deduce_char_traits { @@ -188,140 +352,73 @@ namespace boost typedef Traits type; }; - template<class CharT, class Traits, class Alloc1, class Alloc2> + template<class CharT, class Traits, class Alloc, class Source> struct deduce_char_traits< CharT - , std::basic_string<CharT,Traits,Alloc1> - , std::basic_string<CharT,Traits,Alloc2> + , ::boost::container::basic_string<CharT,Traits,Alloc> + , Source > { typedef Traits type; }; -#endif - } - namespace detail // lcast_src_length - { - // Return max. length of string representation of Source; - // 0 if unlimited (with exceptions for some types, see below). - // Values with limited string representation are placed to - // the buffer locally defined in lexical_cast function. - // 1 is returned for few types such as CharT const* or - // std::basic_string<CharT> that already have an internal - // buffer ready to be reused by lexical_stream_limited_src. - // Each specialization should have a correspondent operator<< - // defined in lexical_stream_limited_src. - template< class CharT // A result of widest_char transformation. - , class Source // Source type of lexical_cast. - > - struct lcast_src_length - { - BOOST_STATIC_CONSTANT(std::size_t, value = 0); - // To check coverage, build the test with - // bjam --v2 profile optimization=off - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<char, bool> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<char, char> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; - - // No specializations for: - // lcast_src_length<char, signed char> - // lcast_src_length<char, unsigned char> - // lcast_src_length<char, signed char*> - // lcast_src_length<char, unsigned char*> - // lcast_src_length<char, signed char const*> - // lcast_src_length<char, unsigned char const*> - -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_src_length<wchar_t, bool> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<wchar_t, char> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; - -#ifndef BOOST_NO_INTRINSIC_WCHAR_T - template<> - struct lcast_src_length<wchar_t, wchar_t> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; -#endif -#endif - - template<> - struct lcast_src_length<char, char const*> + template<class CharT, class Target, class Traits, class Alloc> + struct deduce_char_traits< CharT + , Target + , ::boost::container::basic_string<CharT,Traits,Alloc> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; - template<> - struct lcast_src_length<char, char*> + template<class CharT, class Traits, class Alloc1, class Alloc2> + struct deduce_char_traits< CharT + , std::basic_string<CharT,Traits,Alloc1> + , std::basic_string<CharT,Traits,Alloc2> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_src_length<wchar_t, wchar_t const*> + template<class CharT, class Traits, class Alloc1, class Alloc2> + struct deduce_char_traits< CharT + , ::boost::container::basic_string<CharT,Traits,Alloc1> + , ::boost::container::basic_string<CharT,Traits,Alloc2> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; - template<> - struct lcast_src_length<wchar_t, wchar_t*> + template<class CharT, class Traits, class Alloc1, class Alloc2> + struct deduce_char_traits< CharT + , ::boost::container::basic_string<CharT,Traits,Alloc1> + , ::std::basic_string<CharT,Traits,Alloc2> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; -#endif -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template<class CharT, class Traits, class Alloc> - struct lcast_src_length< CharT, std::basic_string<CharT,Traits,Alloc> > - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; -#else - template<> - struct lcast_src_length< char, std::basic_string<char> > + template<class CharT, class Traits, class Alloc1, class Alloc2> + struct deduce_char_traits< CharT + , ::std::basic_string<CharT,Traits,Alloc1> + , ::boost::container::basic_string<CharT,Traits,Alloc2> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; + } -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_src_length< wchar_t, std::basic_string<wchar_t> > + namespace detail // lcast_src_length + { + // Return max. length of string representation of Source; + template< class Source // Source type of lexical_cast. + > + struct lcast_src_length { BOOST_STATIC_CONSTANT(std::size_t, value = 1); + // To check coverage, build the test with + // bjam --v2 profile optimization=off static void check_coverage() {} }; -#endif -#endif // Helper for integral types. // Notes on length calculation: @@ -342,7 +439,7 @@ namespace boost #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_CONSTANT(std::size_t, value = std::numeric_limits<Source>::is_signed + - std::numeric_limits<Source>::is_specialized + // == 1 + std::numeric_limits<Source>::is_specialized + /* == 1 */ std::numeric_limits<Source>::digits10 * 2 ); #else @@ -351,19 +448,11 @@ namespace boost #endif }; -#define BOOST_LCAST_DEF1(CharT, T) \ - template<> struct lcast_src_length<CharT, T> \ +#define BOOST_LCAST_DEF(T) \ + template<> struct lcast_src_length<T> \ : lcast_src_length_integral<T> \ { static void check_coverage() {} }; -#ifdef BOOST_LCAST_NO_WCHAR_T -#define BOOST_LCAST_DEF(T) BOOST_LCAST_DEF1(char, T) -#else -#define BOOST_LCAST_DEF(T) \ - BOOST_LCAST_DEF1(char, T) \ - BOOST_LCAST_DEF1(wchar_t, T) -#endif - BOOST_LCAST_DEF(short) BOOST_LCAST_DEF(unsigned short) BOOST_LCAST_DEF(int) @@ -379,7 +468,6 @@ namespace boost #endif #undef BOOST_LCAST_DEF -#undef BOOST_LCAST_DEF1 #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION // Helper for floating point types. @@ -405,53 +493,30 @@ namespace boost }; template<> - struct lcast_src_length<char,float> + struct lcast_src_length<float> : lcast_src_length_floating<float> { static void check_coverage() {} }; template<> - struct lcast_src_length<char,double> + struct lcast_src_length<double> : lcast_src_length_floating<double> { static void check_coverage() {} }; template<> - struct lcast_src_length<char,long double> + struct lcast_src_length<long double> : lcast_src_length_floating<long double> { static void check_coverage() {} }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_src_length<wchar_t,float> - : lcast_src_length_floating<float> - { - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<wchar_t,double> - : lcast_src_length_floating<double> - { - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<wchar_t,long double> - : lcast_src_length_floating<long double> - { - static void check_coverage() {} - }; - -#endif // #ifndef BOOST_LCAST_NO_WCHAR_T #endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION } - namespace detail // '0' and '-' constants + namespace detail // '0', '+' and '-' constants { template<typename CharT> struct lcast_char_constants; @@ -460,6 +525,10 @@ namespace boost { BOOST_STATIC_CONSTANT(char, zero = '0'); BOOST_STATIC_CONSTANT(char, minus = '-'); + BOOST_STATIC_CONSTANT(char, plus = '+'); + BOOST_STATIC_CONSTANT(char, lowercase_e = 'e'); + BOOST_STATIC_CONSTANT(char, capital_e = 'E'); + BOOST_STATIC_CONSTANT(char, c_decimal_separator = '.'); }; #ifndef BOOST_LCAST_NO_WCHAR_T @@ -468,15 +537,38 @@ namespace boost { BOOST_STATIC_CONSTANT(wchar_t, zero = L'0'); BOOST_STATIC_CONSTANT(wchar_t, minus = L'-'); + BOOST_STATIC_CONSTANT(wchar_t, plus = L'+'); + BOOST_STATIC_CONSTANT(wchar_t, lowercase_e = L'e'); + BOOST_STATIC_CONSTANT(wchar_t, capital_e = L'E'); + BOOST_STATIC_CONSTANT(wchar_t, c_decimal_separator = L'.'); }; #endif - } - namespace detail // lexical_streambuf_fake - { - struct lexical_streambuf_fake - { +#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS) + template<> + struct lcast_char_constants<char16_t> + { + BOOST_STATIC_CONSTANT(char16_t, zero = u'0'); + BOOST_STATIC_CONSTANT(char16_t, minus = u'-'); + BOOST_STATIC_CONSTANT(char16_t, plus = u'+'); + BOOST_STATIC_CONSTANT(char16_t, lowercase_e = u'e'); + BOOST_STATIC_CONSTANT(char16_t, capital_e = u'E'); + BOOST_STATIC_CONSTANT(char16_t, c_decimal_separator = u'.'); }; +#endif + +#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS) + template<> + struct lcast_char_constants<char32_t> + { + BOOST_STATIC_CONSTANT(char32_t, zero = U'0'); + BOOST_STATIC_CONSTANT(char32_t, minus = U'-'); + BOOST_STATIC_CONSTANT(char32_t, plus = U'+'); + BOOST_STATIC_CONSTANT(char32_t, lowercase_e = U'e'); + BOOST_STATIC_CONSTANT(char32_t, capital_e = U'E'); + BOOST_STATIC_CONSTANT(char32_t, c_decimal_separator = U'.'); + }; +#endif } namespace detail // lcast_to_unsigned @@ -490,10 +582,10 @@ namespace boost #endif template<class T> inline - BOOST_DEDUCED_TYPENAME make_unsigned<T>::type lcast_to_unsigned(T value) + BOOST_DEDUCED_TYPENAME make_unsigned<T>::type lcast_to_unsigned(T value) BOOST_NOEXCEPT { typedef BOOST_DEDUCED_TYPENAME make_unsigned<T>::type result_type; - result_type uvalue = static_cast<result_type>(value); + const result_type uvalue = static_cast<result_type>(value); return value < 0 ? -uvalue : uvalue; } #if (defined _MSC_VER) @@ -506,257 +598,1096 @@ namespace boost namespace detail // lcast_put_unsigned { template<class Traits, class T, class CharT> - CharT* lcast_put_unsigned(T n, CharT* finish) + CharT* lcast_put_unsigned(const T n_param, CharT* finish) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed); #endif + typedef typename Traits::int_type int_type; + CharT const czero = lcast_char_constants<CharT>::zero; + int_type const zero = Traits::to_int_type(czero); + BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + (sizeof(int_type) > sizeof(T)) + , int_type + , T + >::type n = n_param; + #ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE - // TODO: use BOOST_NO_STD_LOCALE std::locale loc; - typedef std::numpunct<CharT> numpunct; - numpunct const& np = BOOST_USE_FACET(numpunct, loc); - std::string const& grouping = np.grouping(); - std::string::size_type const grouping_size = grouping.size(); - CharT thousands_sep = grouping_size ? np.thousands_sep() : 0; - std::string::size_type group = 0; // current group number - char last_grp_size = grouping[0] <= 0 ? CHAR_MAX : grouping[0]; - // a) Since grouping is const, grouping[grouping.size()] returns 0. - // b) It's safe to assume here and below that CHAR_MAX - // is equivalent to unlimited grouping: + if (loc != std::locale::classic()) { + typedef std::numpunct<CharT> numpunct; + numpunct const& np = BOOST_USE_FACET(numpunct, loc); + std::string const grouping = np.grouping(); + std::string::size_type const grouping_size = grouping.size(); + + if ( grouping_size && grouping[0] > 0 ) + { + #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX); + // Check that ulimited group is unreachable: + BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX); #endif + CharT thousands_sep = np.thousands_sep(); + std::string::size_type group = 0; // current group number + char last_grp_size = grouping[0]; + char left = last_grp_size; - char left = last_grp_size; + do + { + if(left == 0) + { + ++group; + if(group < grouping_size) + { + char const grp_size = grouping[group]; + last_grp_size = grp_size <= 0 ? CHAR_MAX : grp_size; + } + + left = last_grp_size; + --finish; + Traits::assign(*finish, thousands_sep); + } + + --left; + + --finish; + int_type const digit = static_cast<int_type>(n % 10U); + Traits::assign(*finish, Traits::to_char_type(zero + digit)); + n /= 10; + } while(n); + return finish; + } + } #endif + { + do + { + --finish; + int_type const digit = static_cast<int_type>(n % 10U); + Traits::assign(*finish, Traits::to_char_type(zero + digit)); + n /= 10; + } while(n); + } + return finish; + } + } + + namespace detail // lcast_ret_unsigned + { + template<class Traits, class T, class CharT> + inline bool lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end) + { +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed); +#endif typedef typename Traits::int_type int_type; CharT const czero = lcast_char_constants<CharT>::zero; - int_type const zero = Traits::to_int_type(czero); + --end; + value = 0; + + if (begin > end || *end < czero || *end >= czero + 10) + return false; + value = *end - czero; + --end; + T multiplier = 1; + bool multiplier_overflowed = false; - do - { #ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE - if(left == 0) + std::locale loc; + if (loc != std::locale::classic()) { + typedef std::numpunct<CharT> numpunct; + numpunct const& np = BOOST_USE_FACET(numpunct, loc); + std::string const& grouping = np.grouping(); + std::string::size_type const grouping_size = grouping.size(); + + /* According to Programming languages - C++ + * we MUST check for correct grouping + */ + if (grouping_size && grouping[0] > 0) { - ++group; - if(group < grouping_size) + unsigned char current_grouping = 0; + CharT const thousands_sep = np.thousands_sep(); + char remained = grouping[current_grouping] - 1; + bool shall_we_return = true; + + for(;end>=begin; --end) { - char const grp_size = grouping[group]; - last_grp_size = grp_size <= 0 ? CHAR_MAX : grp_size; + if (remained) { + T const multiplier_10 = multiplier * 10; + if (multiplier_10 / 10 != multiplier) multiplier_overflowed = true; + + T const dig_value = *end - czero; + T const new_sub_value = multiplier_10 * dig_value; + + if (*end < czero || *end >= czero + 10 + /* detecting overflow */ + || (dig_value && new_sub_value / dig_value != multiplier_10) + || static_cast<T>((std::numeric_limits<T>::max)()-new_sub_value) < value + || (multiplier_overflowed && dig_value) + ) + return false; + + value += new_sub_value; + multiplier *= 10; + --remained; + } else { + if ( !Traits::eq(*end, thousands_sep) ) //|| begin == end ) return false; + { + /* + * According to Programming languages - C++ + * Digit grouping is checked. That is, the positions of discarded + * separators is examined for consistency with + * use_facet<numpunct<charT> >(loc ).grouping() + * + * BUT what if there is no separators at all and grouping() + * is not empty? Well, we have no extraced separators, so we + * won`t check them for consistency. This will allow us to + * work with "C" locale from other locales + */ + shall_we_return = false; + break; + } else { + if ( begin == end ) return false; + if (current_grouping < grouping_size-1 ) ++current_grouping; + remained = grouping[current_grouping]; + } + } } - left = last_grp_size; - --finish; - Traits::assign(*finish, thousands_sep); + if (shall_we_return) return true; } - - --left; + } #endif - - --finish; - int_type const digit = static_cast<int_type>(n % 10U); - Traits::assign(*finish, Traits::to_char_type(zero + digit)); - n /= 10; - } while(n); - - return finish; + { + while ( begin <= end ) + { + T const multiplier_10 = multiplier * 10; + if (multiplier_10 / 10 != multiplier) multiplier_overflowed = true; + + T const dig_value = *end - czero; + T const new_sub_value = multiplier_10 * dig_value; + + if (*end < czero || *end >= czero + 10 + /* detecting overflow */ + || (dig_value && new_sub_value / dig_value != multiplier_10) + || static_cast<T>((std::numeric_limits<T>::max)()-new_sub_value) < value + || (multiplier_overflowed && dig_value) + ) + return false; + + value += new_sub_value; + multiplier *= 10; + --end; + } + } + return true; } } - namespace detail // stream wrapper for handling lexical conversions + namespace detail { - template<typename Target, typename Source, typename Traits> - class lexical_stream - { - private: - typedef typename widest_char< - typename stream_char<Target>::type, - typename stream_char<Source>::type>::type char_type; + template <class CharT> + bool lc_iequal(const CharT* val, const CharT* lcase, const CharT* ucase, unsigned int len) BOOST_NOEXCEPT { + for( unsigned int i=0; i < len; ++i ) { + if ( val[i] != lcase[i] && val[i] != ucase[i] ) return false; + } - typedef Traits traits_type; + return true; + } - public: - lexical_stream(char_type* = 0, char_type* = 0) + /* Returns true and sets the correct value if found NaN or Inf. */ + template <class CharT, class T> + inline bool parse_inf_nan_impl(const CharT* begin, const CharT* end, T& value + , const CharT* lc_NAN, const CharT* lc_nan + , const CharT* lc_INFINITY, const CharT* lc_infinity + , const CharT opening_brace, const CharT closing_brace) BOOST_NOEXCEPT + { + using namespace std; + if (begin == end) return false; + const CharT minus = lcast_char_constants<CharT>::minus; + const CharT plus = lcast_char_constants<CharT>::plus; + const int inifinity_size = 8; + + bool has_minus = false; + /* Parsing +/- */ + if( *begin == minus) { - stream.unsetf(std::ios::skipws); - lcast_set_precision(stream, static_cast<Source*>(0), static_cast<Target*>(0) ); + ++ begin; + has_minus = true; } - ~lexical_stream() - { - #if defined(BOOST_NO_STRINGSTREAM) - stream.freeze(false); - #endif - } - bool operator<<(const Source &input) + else if( *begin == plus ) ++begin; + + if( end-begin < 3 ) return false; + if( lc_iequal(begin, lc_nan, lc_NAN, 3) ) { - return !(stream << input).fail(); - } - template<typename InputStreamable> - bool operator>>(InputStreamable &output) + begin += 3; + if (end != begin) /* It is 'nan(...)' or some bad input*/ + { + if(end-begin<2) return false; // bad input + -- end; + if( *begin != opening_brace || *end != closing_brace) return false; // bad input + } + + if( !has_minus ) value = std::numeric_limits<T>::quiet_NaN(); + else value = (boost::math::changesign) (std::numeric_limits<T>::quiet_NaN()); + return true; + } else + if (( /* 'INF' or 'inf' */ + end-begin==3 + && + lc_iequal(begin, lc_infinity, lc_INFINITY, 3) + ) + || + ( /* 'INFINITY' or 'infinity' */ + end-begin==inifinity_size + && + lc_iequal(begin, lc_infinity, lc_INFINITY, inifinity_size) + ) + ) { - return !is_pointer<InputStreamable>::value && - stream >> output && - stream.get() == -#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING) -// GCC 2.9x lacks std::char_traits<>::eof(). -// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3 -// configurations, which do provide std::char_traits<>::eof(). - - EOF; -#else - traits_type::eof(); -#endif + if( !has_minus ) value = std::numeric_limits<T>::infinity(); + else value = (boost::math::changesign) (std::numeric_limits<T>::infinity()); + return true; } -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + return false; + } - bool operator>>(std::string &output) + template <class CharT, class T> + bool put_inf_nan_impl(CharT* begin, CharT*& end, const T& value + , const CharT* lc_nan + , const CharT* lc_infinity) BOOST_NOEXCEPT + { + using namespace std; + const CharT minus = lcast_char_constants<CharT>::minus; + if ( (boost::math::isnan)(value) ) { - #if defined(BOOST_NO_STRINGSTREAM) - stream << '\0'; - #endif - stream.str().swap(output); + if ( (boost::math::signbit)(value) ) + { + *begin = minus; + ++ begin; + } + + memcpy(begin, lc_nan, 3 * sizeof(CharT)); + end = begin + 3; return true; - } - #ifndef BOOST_LCAST_NO_WCHAR_T - bool operator>>(std::wstring &output) + } else if ( (boost::math::isinf)(value) ) { - stream.str().swap(output); + if ( (boost::math::signbit)(value) ) + { + *begin = minus; + ++ begin; + } + + memcpy(begin, lc_infinity, 3 * sizeof(CharT)); + end = begin + 3; return true; } - #endif + return false; + } + + +#ifndef BOOST_LCAST_NO_WCHAR_T + template <class T> + bool parse_inf_nan(const wchar_t* begin, const wchar_t* end, T& value) BOOST_NOEXCEPT + { + return parse_inf_nan_impl(begin, end, value + , L"NAN", L"nan" + , L"INFINITY", L"infinity" + , L'(', L')'); + } + + template <class T> + bool put_inf_nan(wchar_t* begin, wchar_t*& end, const T& value) BOOST_NOEXCEPT + { + return put_inf_nan_impl(begin, end, value, L"nan", L"infinity"); + } + +#endif +#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS) + template <class T> + bool parse_inf_nan(const char16_t* begin, const char16_t* end, T& value) BOOST_NOEXCEPT + { + return parse_inf_nan_impl(begin, end, value + , u"NAN", u"nan" + , u"INFINITY", u"infinity" + , u'(', u')'); + } + + template <class T> + bool put_inf_nan(char16_t* begin, char16_t*& end, const T& value) BOOST_NOEXCEPT + { + return put_inf_nan_impl(begin, end, value, u"nan", u"infinity"); + } +#endif +#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS) + template <class T> + bool parse_inf_nan(const char32_t* begin, const char32_t* end, T& value) BOOST_NOEXCEPT + { + return parse_inf_nan_impl(begin, end, value + , U"NAN", U"nan" + , U"INFINITY", U"infinity" + , U'(', U')'); + } + + template <class T> + bool put_inf_nan(char32_t* begin, char32_t*& end, const T& value) BOOST_NOEXCEPT + { + return put_inf_nan_impl(begin, end, value, U"nan", U"infinity"); + } +#endif + + template <class CharT, class T> + bool parse_inf_nan(const CharT* begin, const CharT* end, T& value) BOOST_NOEXCEPT + { + return parse_inf_nan_impl(begin, end, value + , "NAN", "nan" + , "INFINITY", "infinity" + , '(', ')'); + } + + template <class CharT, class T> + bool put_inf_nan(CharT* begin, CharT*& end, const T& value) BOOST_NOEXCEPT + { + return put_inf_nan_impl(begin, end, value, "nan", "infinity"); + } + } + + + namespace detail // lcast_ret_float + { + template <class T> + struct mantissa_holder_type + { + /* Can not be used with this type */ + }; + + template <> + struct mantissa_holder_type<float> + { + typedef unsigned int type; + }; + + template <> + struct mantissa_holder_type<double> + { +#if defined(BOOST_HAS_LONG_LONG) + typedef boost::ulong_long_type type; +#elif defined(BOOST_HAS_MS_INT64) + typedef unsigned __int64 type; +#endif + }; + + template<class Traits, class T, class CharT> + inline bool lcast_ret_float(T& value, const CharT* begin, const CharT* end) + { + +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + std::locale loc; + typedef std::numpunct<CharT> numpunct; + numpunct const& np = BOOST_USE_FACET(numpunct, loc); + std::string const grouping( + (loc == std::locale::classic()) + ? std::string() + : np.grouping() + ); + std::string::size_type const grouping_size = grouping.size(); + CharT const thousands_sep = grouping_size ? np.thousands_sep() : 0; + CharT const decimal_point = np.decimal_point(); + bool found_grouping = false; + std::string::size_type last_grouping_pos = grouping_size - 1; #else - bool operator>>(std::basic_string<char_type,traits_type>& output) - { - stream.str().swap(output); - return true; + CharT const decimal_point = lcast_char_constants<CharT>::c_decimal_separator; +#endif + + CharT const czero = lcast_char_constants<CharT>::zero; + CharT const minus = lcast_char_constants<CharT>::minus; + CharT const plus = lcast_char_constants<CharT>::plus; + CharT const capital_e = lcast_char_constants<CharT>::capital_e; + CharT const lowercase_e = lcast_char_constants<CharT>::lowercase_e; + + value = static_cast<T>(0); + + if (parse_inf_nan(begin, end, value)) return true; + + typedef typename Traits::int_type int_type; + typedef BOOST_DEDUCED_TYPENAME mantissa_holder_type<T>::type mantissa_type; + int_type const zero = Traits::to_int_type(czero); + if (begin == end) return false; + + /* Getting the plus/minus sign */ + bool has_minus = false; + if (Traits::eq(*begin, minus) ) { + ++ begin; + has_minus = true; + if (begin == end) return false; + } else if (Traits::eq(*begin, plus) ) { + ++begin; + if (begin == end) return false; } - template<class Alloc> - bool operator>>(std::basic_string<char_type,traits_type,Alloc>& out) + bool found_decimal = false; + bool found_number_before_exp = false; + int pow_of_10 = 0; + mantissa_type mantissa=0; + bool is_mantissa_full = false; + + char length_since_last_delim = 0; + + while ( begin != end ) { - std::basic_string<char_type,traits_type> str(stream.str()); - out.assign(str.begin(), str.end()); - return true; + if (found_decimal) { + /* We allow no thousand_separators after decimal point */ + + mantissa_type tmp_mantissa = mantissa * 10u; + if (Traits::eq(*begin, lowercase_e) || Traits::eq(*begin, capital_e)) break; + if ( *begin < czero || *begin >= czero + 10 ) return false; + if ( is_mantissa_full + || tmp_mantissa / 10u != mantissa + || (std::numeric_limits<mantissa_type>::max)()-(*begin - zero) < tmp_mantissa + ) { + is_mantissa_full = true; + ++ begin; + continue; + } + + -- pow_of_10; + mantissa = tmp_mantissa; + mantissa += *begin - zero; + + found_number_before_exp = true; + } else { + + if (*begin >= czero && *begin < czero + 10) { + + /* Checking for mantissa overflow. If overflow will + * occur, them we only increase multiplyer + */ + mantissa_type tmp_mantissa = mantissa * 10u; + if( !is_mantissa_full + && tmp_mantissa / 10u == mantissa + && (std::numeric_limits<mantissa_type>::max)()-(*begin - zero) >= tmp_mantissa + ) + { + mantissa = tmp_mantissa; + mantissa += *begin - zero; + } else + { + is_mantissa_full = true; + ++ pow_of_10; + } + + found_number_before_exp = true; + ++ length_since_last_delim; + } else if (Traits::eq(*begin, decimal_point) || Traits::eq(*begin, lowercase_e) || Traits::eq(*begin, capital_e)) { +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + /* If ( we need to check grouping + * and ( grouping missmatches + * or grouping position is incorrect + * or we are using the grouping position 0 twice + * ) + * ) then return error + */ + if( grouping_size && found_grouping + && ( + length_since_last_delim != grouping[0] + || last_grouping_pos>1 + || (last_grouping_pos==0 && grouping_size>1) + ) + ) return false; +#endif + + if(Traits::eq(*begin, decimal_point)) { + ++ begin; + found_decimal = true; + if (!found_number_before_exp && begin==end) return false; + continue; + }else { + if (!found_number_before_exp) return false; + break; + } + } +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + else if (grouping_size && Traits::eq(*begin, thousands_sep)){ + if(found_grouping) + { + /* It is not he first time, when we find thousands separator, + * so we need to chek, is the distance between two groupings + * equal to grouping[last_grouping_pos] */ + + if (length_since_last_delim != grouping[last_grouping_pos] ) + { + if (!last_grouping_pos) return false; + else + { + -- last_grouping_pos; + if (length_since_last_delim != grouping[last_grouping_pos]) return false; + } + } else + /* We are calling the grouping[0] twice, when grouping size is more than 1 */ + if (grouping_size>1u && last_grouping_pos+1<grouping_size) return false; + + } else { + /* Delimiter at the begining ',000' */ + if (!length_since_last_delim) return false; + + found_grouping = true; + if (length_since_last_delim > grouping[last_grouping_pos] ) return false; + } + + length_since_last_delim = 0; + ++ begin; + + /* Delimiter at the end '100,' */ + if (begin == end) return false; + continue; + } +#endif + else return false; + } + + ++begin; } + + // Exponent found + if ( begin != end && (Traits::eq(*begin, lowercase_e) || Traits::eq(*begin, capital_e)) ) { + ++ begin; + if ( begin == end ) return false; + + bool exp_has_minus = false; + if(Traits::eq(*begin, minus)) { + exp_has_minus = true; + ++ begin; + if ( begin == end ) return false; + } else if (Traits::eq(*begin, plus)) { + ++ begin; + if ( begin == end ) return false; + } + + int exp_pow_of_10 = 0; + while ( begin != end ) + { + if ( *begin < czero + || *begin >= czero + 10 + || exp_pow_of_10 * 10 < exp_pow_of_10) /* Overflows are checked lower more precisely*/ + return false; + + exp_pow_of_10 *= 10; + exp_pow_of_10 += *begin - zero; + ++ begin; + }; + + if ( exp_pow_of_10 ) { + /* Overflows are checked lower */ + if ( exp_has_minus ) { + pow_of_10 -= exp_pow_of_10; + } else { + pow_of_10 += exp_pow_of_10; + } + } + } + + /* We need a more accurate algorithm... We can not use current algorithm + * with long doubles (and with doubles if sizeof(double)==sizeof(long double)). + */ + long double result = std::pow(10.0L, pow_of_10) * mantissa; + value = static_cast<T>( has_minus ? (boost::math::changesign)(result) : result); + + if ( (boost::math::isinf)(value) || (boost::math::isnan)(value) ) return false; + + return true; + } + } + + namespace detail // stl_buf_unlocker + { + template< class BufferType, class CharT > + class stl_buf_unlocker: public BufferType{ + public: + typedef BufferType base_class; +#ifndef BOOST_NO_USING_TEMPLATE + using base_class::pptr; + using base_class::pbase; + using base_class::setg; + using base_class::setp; +#else + CharT* pptr() const { return base_class::pptr(); } + CharT* pbase() const { return base_class::pbase(); } + void setg(CharT* gbeg, CharT* gnext, CharT* gend){ return base_class::setg(gbeg, gnext, gend); } + void setp(CharT* pbeg, CharT* pend) { return setp(pbeg, pend); } #endif - private: - #if defined(BOOST_NO_STRINGSTREAM) - std::strstream stream; - #elif defined(BOOST_NO_STD_LOCALE) - std::stringstream stream; - #else - std::basic_stringstream<char_type,traits_type> stream; - #endif }; } + namespace detail + { + struct do_not_construct_out_stream_t{}; + } + namespace detail // optimized stream wrapper { // String representation of Source has an upper limit. template< class CharT // a result of widest_char transformation - , class Base // lexical_streambuf_fake or basic_streambuf<CharT> , class Traits // usually char_traits<CharT> + , bool RequiresStringbuffer > - class lexical_stream_limited_src : public Base + class lexical_stream_limited_src { + +#if defined(BOOST_NO_STRINGSTREAM) + typedef std::ostrstream out_stream_t; + typedef stl_buf_unlocker<std::strstreambuf, char> unlocked_but_t; +#elif defined(BOOST_NO_STD_LOCALE) + typedef std::ostringstream out_stream_t; + typedef stl_buf_unlocker<std::stringbuf, char> unlocked_but_t; +#else + typedef std::basic_ostringstream<CharT, Traits> out_stream_t; + typedef stl_buf_unlocker<std::basic_stringbuf<CharT, Traits>, CharT> unlocked_but_t; +#endif + typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< + RequiresStringbuffer, + out_stream_t, + do_not_construct_out_stream_t + >::type deduced_out_stream_t; + // A string representation of Source is written to [start, finish). - // Currently, it is assumed that [start, finish) is big enough - // to hold a string representation of any Source value. CharT* start; CharT* finish; + deduced_out_stream_t out_stream; + + public: + lexical_stream_limited_src(CharT* sta, CharT* fin) + : start(sta) + , finish(fin) + {} private: + // Undefined: + lexical_stream_limited_src(lexical_stream_limited_src const&); + void operator=(lexical_stream_limited_src const&); - static void widen_and_assign(char*p, char ch) +/************************************ HELPER FUNCTIONS FOR OPERATORS << ( ... ) ********************************/ + bool shl_char(CharT ch) BOOST_NOEXCEPT { - Traits::assign(*p, ch); + Traits::assign(*start, ch); + finish = start + 1; + return true; } #ifndef BOOST_LCAST_NO_WCHAR_T - static void widen_and_assign(wchar_t* p, char ch) + template <class T> + bool shl_char(T ch) { - // TODO: use BOOST_NO_STD_LOCALE + BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)) , + "boost::lexical_cast does not support narrowing of char types." + "Use boost::locale instead" ); +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE std::locale loc; - wchar_t w = BOOST_USE_FACET(std::ctype<wchar_t>, loc).widen(ch); - Traits::assign(*p, w); + CharT const w = BOOST_USE_FACET(std::ctype<CharT>, loc).widen(ch); +#else + CharT const w = ch; +#endif + Traits::assign(*start, w); + finish = start + 1; + return true; + } +#endif + + bool shl_char_array(CharT const* str) BOOST_NOEXCEPT + { + start = const_cast<CharT*>(str); + finish = start + Traits::length(str); + return true; } - static void widen_and_assign(wchar_t* p, wchar_t ch) + template <class T> + bool shl_char_array(T const* str) { - Traits::assign(*p, ch); + BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)), + "boost::lexical_cast does not support narrowing of char types." + "Use boost::locale instead" ); + return shl_input_streamable(str); + } + + bool shl_char_array_limited(CharT const* str, std::size_t max_size) BOOST_NOEXCEPT + { + start = const_cast<CharT*>(str); + finish = std::find(start, start + max_size, Traits::to_char_type(0)); + return true; } - static void widen_and_assign(char*, wchar_t ch); // undefined + template<typename InputStreamable> + bool shl_input_streamable(InputStreamable& input) + { +#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) + // If you have compilation error at this point, than your STL library + // does not support such conversions. Try updating it. + BOOST_STATIC_ASSERT((boost::is_same<char, CharT>::value)); #endif + bool const result = !(out_stream << input).fail(); + const unlocked_but_t* const p + = static_cast<unlocked_but_t*>(out_stream.rdbuf()) ; + start = p->pbase(); + finish = p->pptr(); + return result; + } - template<class OutputStreamable> - bool lcast_put(const OutputStreamable& input) + template <class T> + inline bool shl_signed(T n) { - this->setp(start, finish); - std::basic_ostream<CharT> stream(static_cast<Base*>(this)); - lcast_set_precision(stream, static_cast<OutputStreamable*>(0)); - bool const result = !(stream << input).fail(); - finish = this->pptr(); - return result; + start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); + if(n < 0) + { + --start; + CharT const minus = lcast_char_constants<CharT>::minus; + Traits::assign(*start, minus); + } + return true; } - // Undefined: - lexical_stream_limited_src(lexical_stream_limited_src const&); - void operator=(lexical_stream_limited_src const&); + template <class T, class SomeCharT> + bool shl_real_type(const T& val, SomeCharT* begin, SomeCharT*& end) + { + if (put_inf_nan(begin, end, val)) return true; + lcast_set_precision(out_stream, &val); + return shl_input_streamable(val); + } - public: + static bool shl_real_type(float val, char* begin, char*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + const double val_as_double = val; + end = begin + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + sprintf_s(begin, end-begin, +#else + sprintf(begin, +#endif + "%.*g", static_cast<int>(boost::detail::lcast_get_precision<float>()), val_as_double); + return end > begin; + } - lexical_stream_limited_src(CharT* sta, CharT* fin) - : start(sta) - , finish(fin) - {} + static bool shl_real_type(double val, char* begin, char*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + end = begin + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + sprintf_s(begin, end-begin, +#else + sprintf(begin, +#endif + "%.*g", static_cast<int>(boost::detail::lcast_get_precision<double>()), val); + return end > begin; + } + +#ifndef __MINGW32__ + static bool shl_real_type(long double val, char* begin, char*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + end = begin + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + sprintf_s(begin, end-begin, +#else + sprintf(begin, +#endif + "%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double>()), val ); + return end > begin; + } +#endif - public: // output +#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_SWPRINTF) && !defined(__MINGW32__) + static bool shl_real_type(float val, wchar_t* begin, wchar_t*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + const double val_as_double = val; + end = begin + swprintf(begin, end-begin, + L"%.*g", + static_cast<int>(boost::detail::lcast_get_precision<float >()), + val_as_double ); + return end > begin; + } + + static bool shl_real_type(double val, wchar_t* begin, wchar_t*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + end = begin + swprintf(begin, end-begin, + L"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double >()), val ); + return end > begin; + } + + static bool shl_real_type(long double val, wchar_t* begin, wchar_t*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + end = begin + swprintf(begin, end-begin, + L"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double >()), val ); + return end > begin; + } +#endif + +/************************************ OPERATORS << ( ... ) ********************************/ + public: template<class Alloc> - bool operator<<(std::basic_string<CharT,Traits,Alloc> const& str) + bool operator<<(std::basic_string<CharT,Traits,Alloc> const& str) BOOST_NOEXCEPT { start = const_cast<CharT*>(str.data()); finish = start + str.length(); return true; } - bool operator<<(bool); - bool operator<<(char); -#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - bool operator<<(wchar_t); -#endif - bool operator<<(CharT const*); - bool operator<<(short); - bool operator<<(int); - bool operator<<(long); - bool operator<<(unsigned short); - bool operator<<(unsigned int); - bool operator<<(unsigned long); + template<class Alloc> + bool operator<<(::boost::container::basic_string<CharT,Traits,Alloc> const& str) BOOST_NOEXCEPT + { + start = const_cast<CharT*>(str.data()); + finish = start + str.length(); + return true; + } + + bool operator<<(bool value) BOOST_NOEXCEPT + { + CharT const czero = lcast_char_constants<CharT>::zero; + Traits::assign(*start, Traits::to_char_type(czero + value)); + finish = start + 1; + return true; + } + + bool operator<<(const iterator_range<CharT*>& rng) BOOST_NOEXCEPT + { + start = rng.begin(); + finish = rng.end(); + return true; + } + + bool operator<<(const iterator_range<const CharT*>& rng) BOOST_NOEXCEPT + { + start = const_cast<CharT*>(rng.begin()); + finish = const_cast<CharT*>(rng.end()); + return true; + } + + bool operator<<(const iterator_range<const signed char*>& rng) BOOST_NOEXCEPT + { + return (*this) << iterator_range<char*>( + const_cast<char*>(reinterpret_cast<const char*>(rng.begin())), + const_cast<char*>(reinterpret_cast<const char*>(rng.end())) + ); + } + + bool operator<<(const iterator_range<const unsigned char*>& rng) BOOST_NOEXCEPT + { + return (*this) << iterator_range<char*>( + const_cast<char*>(reinterpret_cast<const char*>(rng.begin())), + const_cast<char*>(reinterpret_cast<const char*>(rng.end())) + ); + } + + bool operator<<(const iterator_range<signed char*>& rng) BOOST_NOEXCEPT + { + return (*this) << iterator_range<char*>( + reinterpret_cast<char*>(rng.begin()), + reinterpret_cast<char*>(rng.end()) + ); + } + + bool operator<<(const iterator_range<unsigned char*>& rng) BOOST_NOEXCEPT + { + return (*this) << iterator_range<char*>( + reinterpret_cast<char*>(rng.begin()), + reinterpret_cast<char*>(rng.end()) + ); + } + + bool operator<<(char ch) { return shl_char(ch); } + bool operator<<(unsigned char ch) { return ((*this) << static_cast<char>(ch)); } + bool operator<<(signed char ch) { return ((*this) << static_cast<char>(ch)); } +#if !defined(BOOST_LCAST_NO_WCHAR_T) + bool operator<<(wchar_t const* str) { return shl_char_array(str); } + bool operator<<(wchar_t * str) { return shl_char_array(str); } +#ifndef BOOST_NO_INTRINSIC_WCHAR_T + bool operator<<(wchar_t ch) { return shl_char(ch); } +#endif +#endif +#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS) + bool operator<<(char16_t ch) { return shl_char(ch); } + bool operator<<(char16_t * str) { return shl_char_array(str); } + bool operator<<(char16_t const * str) { return shl_char_array(str); } +#endif +#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS) + bool operator<<(char32_t ch) { return shl_char(ch); } + bool operator<<(char32_t * str) { return shl_char_array(str); } + bool operator<<(char32_t const * str) { return shl_char_array(str); } +#endif + bool operator<<(unsigned char const* ch) { return ((*this) << reinterpret_cast<char const*>(ch)); } + bool operator<<(unsigned char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); } + bool operator<<(signed char const* ch) { return ((*this) << reinterpret_cast<char const*>(ch)); } + bool operator<<(signed char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); } + bool operator<<(char const* str) { return shl_char_array(str); } + bool operator<<(char* str) { return shl_char_array(str); } + bool operator<<(short n) { return shl_signed(n); } + bool operator<<(int n) { return shl_signed(n); } + bool operator<<(long n) { return shl_signed(n); } + bool operator<<(unsigned short n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + bool operator<<(unsigned int n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + bool operator<<(unsigned long n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + #if defined(BOOST_HAS_LONG_LONG) - bool operator<<(boost::ulong_long_type); - bool operator<<(boost::long_long_type ); + bool operator<<(boost::ulong_long_type n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + bool operator<<(boost::long_long_type n) { return shl_signed(n); } #elif defined(BOOST_HAS_MS_INT64) - bool operator<<(unsigned __int64); - bool operator<<( __int64); + bool operator<<(unsigned __int64 n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + bool operator<<( __int64 n) { return shl_signed(n); } +#endif + bool operator<<(float val) { return shl_real_type(val, start, finish); } + bool operator<<(double val) { return shl_real_type(val, start, finish); } + bool operator<<(long double val) { +#ifndef __MINGW32__ + return shl_real_type(val, start, finish); +#else + return shl_real_type(static_cast<double>(val), start, finish); #endif - // These three operators use ostream and streambuf. - // lcast_streambuf_for_source<T>::value is true. - bool operator<<(float); - bool operator<<(double); - bool operator<<(long double); + } + + template <std::size_t N> + bool operator<<(boost::array<CharT, N> const& input) BOOST_NOEXCEPT + { return shl_char_array_limited(input.begin(), N); } + + template <std::size_t N> + bool operator<<(boost::array<unsigned char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(boost::array<signed char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(boost::array<const CharT, N> const& input) BOOST_NOEXCEPT + { return shl_char_array_limited(input.begin(), N); } + + template <std::size_t N> + bool operator<<(boost::array<const unsigned char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(boost::array<const signed char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + template <std::size_t N> + bool operator<<(std::array<CharT, N> const& input) BOOST_NOEXCEPT + { return shl_char_array_limited(input.begin(), N); } + + template <std::size_t N> + bool operator<<(std::array<unsigned char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(std::array<signed char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(std::array<const CharT, N> const& input) BOOST_NOEXCEPT + { return shl_char_array_limited(input.begin(), N); } + + template <std::size_t N> + bool operator<<(std::array<const unsigned char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(std::array<const signed char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } +#endif // !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + + template <class InStreamable> + bool operator<<(const InStreamable& input) { return shl_input_streamable(input); } + +/************************************ HELPER FUNCTIONS FOR OPERATORS >> ( ... ) ********************************/ + private: - public: // input + template <typename Type> + bool shr_unsigned(Type& output) + { + if (start == finish) return false; + CharT const minus = lcast_char_constants<CharT>::minus; + CharT const plus = lcast_char_constants<CharT>::plus; + bool has_minus = false; + + /* We won`t use `start' any more, so no need in decrementing it after */ + if ( Traits::eq(minus,*start) ) + { + ++start; + has_minus = true; + } else if ( Traits::eq( plus, *start ) ) + { + ++start; + } + + bool const succeed = lcast_ret_unsigned<Traits>(output, start, finish); +#if (defined _MSC_VER) +# pragma warning( push ) +// C4146: unary minus operator applied to unsigned type, result still unsigned +# pragma warning( disable : 4146 ) +#elif defined( __BORLANDC__ ) +# pragma option push -w-8041 +#endif + if (has_minus) output = static_cast<Type>(-output); +#if (defined _MSC_VER) +# pragma warning( pop ) +#elif defined( __BORLANDC__ ) +# pragma option pop +#endif + return succeed; + } + + template <typename Type> + bool shr_signed(Type& output) + { + if (start == finish) return false; + CharT const minus = lcast_char_constants<CharT>::minus; + CharT const plus = lcast_char_constants<CharT>::plus; + typedef BOOST_DEDUCED_TYPENAME make_unsigned<Type>::type utype; + utype out_tmp =0; + bool has_minus = false; + + /* We won`t use `start' any more, so no need in decrementing it after */ + if ( Traits::eq(minus,*start) ) + { + ++start; + has_minus = true; + } else if ( Traits::eq(plus, *start) ) + { + ++start; + } + + bool succeed = lcast_ret_unsigned<Traits>(out_tmp, start, finish); + if (has_minus) { +#if (defined _MSC_VER) +# pragma warning( push ) +// C4146: unary minus operator applied to unsigned type, result still unsigned +# pragma warning( disable : 4146 ) +#elif defined( __BORLANDC__ ) +# pragma option push -w-8041 +#endif + utype const comp_val = static_cast<utype>(-(std::numeric_limits<Type>::min)()); + succeed = succeed && out_tmp<=comp_val; + output = -out_tmp; +#if (defined _MSC_VER) +# pragma warning( pop ) +#elif defined( __BORLANDC__ ) +# pragma option pop +#endif + } else { + utype const comp_val = static_cast<utype>((std::numeric_limits<Type>::max)()); + succeed = succeed && out_tmp<=comp_val; + output = out_tmp; + } + return succeed; + } - // Generic istream-based algorithm. - // lcast_streambuf_for_target<InputStreamable>::value is true. template<typename InputStreamable> - bool operator>>(InputStreamable& output) + bool shr_using_base_class(InputStreamable& output) { #if (defined _MSC_VER) # pragma warning( push ) @@ -766,8 +1697,22 @@ namespace boost if(is_pointer<InputStreamable>::value) return false; - this->setg(start, start, finish); - std::basic_istream<CharT> stream(static_cast<Base*>(this)); +#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) + // If you have compilation error at this point, than your STL library + // unsupports such conversions. Try updating it. + BOOST_STATIC_ASSERT((boost::is_same<char, CharT>::value)); +#endif + +#if defined(BOOST_NO_STRINGSTREAM) + std::istrstream stream(start, finish - start); +#elif defined(BOOST_NO_STD_LOCALE) + std::istringstream stream; +#else + std::basic_istringstream<CharT, Traits> stream; +#endif + static_cast<unlocked_but_t*>(stream.rdbuf()) + ->setg(start, start, finish); + stream.unsetf(std::ios::skipws); lcast_set_precision(stream, static_cast<InputStreamable*>(0)); #if (defined _MSC_VER) @@ -786,395 +1731,741 @@ namespace boost #endif } - bool operator>>(CharT&); - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -// This #if is in sync with lcast_streambuf_for_target - - bool operator>>(std::string&); + template<class T> + inline bool shr_xchar(T& output) + { + BOOST_STATIC_ASSERT_MSG(( sizeof(CharT) == sizeof(T) ), + "boost::lexical_cast does not support narrowing of character types." + "Use boost::locale instead" ); + bool const ok = (finish - start == 1); + if (ok) { + CharT out; + Traits::assign(out, *start); + output = static_cast<T>(out); + } + return ok; + } -#ifndef BOOST_LCAST_NO_WCHAR_T - bool operator>>(std::wstring&); +/************************************ OPERATORS >> ( ... ) ********************************/ + public: + bool operator>>(unsigned short& output) { return shr_unsigned(output); } + bool operator>>(unsigned int& output) { return shr_unsigned(output); } + bool operator>>(unsigned long int& output) { return shr_unsigned(output); } + bool operator>>(short& output) { return shr_signed(output); } + bool operator>>(int& output) { return shr_signed(output); } + bool operator>>(long int& output) { return shr_signed(output); } +#if defined(BOOST_HAS_LONG_LONG) + bool operator>>(boost::ulong_long_type& output) { return shr_unsigned(output); } + bool operator>>(boost::long_long_type& output) { return shr_signed(output); } +#elif defined(BOOST_HAS_MS_INT64) + bool operator>>(unsigned __int64& output) { return shr_unsigned(output); } + bool operator>>(__int64& output) { return shr_signed(output); } +#endif + bool operator>>(char& output) { return shr_xchar(output); } + bool operator>>(unsigned char& output) { return shr_xchar(output); } + bool operator>>(signed char& output) { return shr_xchar(output); } +#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) + bool operator>>(wchar_t& output) { return shr_xchar(output); } +#endif +#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS) + bool operator>>(char16_t& output) { return shr_xchar(output); } #endif +#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS) + bool operator>>(char32_t& output) { return shr_xchar(output); } +#endif + template<class Alloc> + bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) { str.assign(start, finish); return true; } -#else template<class Alloc> - bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) + bool operator>>(::boost::container::basic_string<CharT,Traits,Alloc>& str) { str.assign(start, finish); return true; } + + + private: + template <std::size_t N, class ArrayT> + bool shr_std_array(ArrayT& output) BOOST_NOEXCEPT { - str.assign(start, finish); + using namespace std; + const std::size_t size = finish - start; + if (size > N - 1) { // `-1` because we need to store \0 at the end + return false; + } + + memcpy(output.begin(), start, size * sizeof(CharT)); + *(output.begin() + size) = Traits::to_char_type(0); return true; } -#endif - }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - bool value) - { - typedef typename Traits::int_type int_type; - CharT const czero = lcast_char_constants<CharT>::zero; - int_type const zero = Traits::to_int_type(czero); - Traits::assign(*start, Traits::to_char_type(zero + value)); - finish = start + 1; - return true; - } + public: - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - char ch) - { - widen_and_assign(start, ch); - finish = start + 1; - return true; - } + template <std::size_t N> + bool operator>>(boost::array<CharT, N>& output) BOOST_NOEXCEPT + { + return shr_std_array<N>(output); + } -#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - wchar_t ch) - { - widen_and_assign(start, ch); - finish = start + 1; - return true; - } -#endif + template <std::size_t N> + bool operator>>(boost::array<unsigned char, N>& output) + { + return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output)); + } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - short n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) - { - --start; - CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + template <std::size_t N> + bool operator>>(boost::array<signed char, N>& output) + { + return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output)); + } + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + template <std::size_t N> + bool operator>>(std::array<CharT, N>& output) BOOST_NOEXCEPT + { + return shr_std_array<N>(output); } - return true; - } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - int n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) - { - --start; - CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + template <std::size_t N> + bool operator>>(std::array<unsigned char, N>& output) + { + return ((*this) >> reinterpret_cast<std::array<char, N>& >(output)); } - return true; - } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - long n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) - { - --start; - CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + template <std::size_t N> + bool operator>>(std::array<signed char, N>& in) + { + return ((*this) >> reinterpret_cast<std::array<char, N>& >(output)); } - return true; - } +#endif // !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) -#if defined(BOOST_HAS_LONG_LONG) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - boost::long_long_type n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) + + /* + * case "-0" || "0" || "+0" : output = false; return true; + * case "1" || "+1": output = true; return true; + * default: return false; + */ + bool operator>>(bool& output) BOOST_NOEXCEPT { - --start; + CharT const zero = lcast_char_constants<CharT>::zero; + CharT const plus = lcast_char_constants<CharT>::plus; CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + + switch(finish-start) + { + case 1: + output = Traits::eq(start[0], zero+1); + return output || Traits::eq(start[0], zero ); + case 2: + if ( Traits::eq( plus, *start) ) + { + ++start; + output = Traits::eq(start[0], zero +1); + return output || Traits::eq(start[0], zero ); + } else + { + output = false; + return Traits::eq( minus, *start) + && Traits::eq( zero, start[1]); + } + default: + output = false; // Suppress warning about uninitalized variable + return false; + } } - return true; - } -#elif defined(BOOST_HAS_MS_INT64) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - __int64 n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) - { - --start; + + bool operator>>(float& output) { return lcast_ret_float<Traits>(output,start,finish); } + + private: + // Not optimised converter + template <class T> + bool float_types_converter_internal(T& output, int /*tag*/) { + if (parse_inf_nan(start, finish, output)) return true; + bool return_value = shr_using_base_class(output); + + /* Some compilers and libraries successfully + * parse 'inf', 'INFINITY', '1.0E', '1.0E-'... + * We are trying to provide a unified behaviour, + * so we just forbid such conversions (as some + * of the most popular compilers/libraries do) + * */ CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + CharT const plus = lcast_char_constants<CharT>::plus; + CharT const capital_e = lcast_char_constants<CharT>::capital_e; + CharT const lowercase_e = lcast_char_constants<CharT>::lowercase_e; + if ( return_value && + ( + Traits::eq(*(finish-1), lowercase_e) // 1.0e + || Traits::eq(*(finish-1), capital_e) // 1.0E + || Traits::eq(*(finish-1), minus) // 1.0e- or 1.0E- + || Traits::eq(*(finish-1), plus) // 1.0e+ or 1.0E+ + ) + ) return false; + + return return_value; } - return true; - } + + // Optimised converter + bool float_types_converter_internal(double& output,char /*tag*/) { + return lcast_ret_float<Traits>(output,start,finish); + } + public: + + bool operator>>(double& output) + { + /* + * Some compilers implement long double as double. In that case these types have + * same size, same precision, same max and min values... And it means, + * that current implementation of lcast_ret_float cannot be used for type + * double, because it will give a big precision loss. + * */ + boost::mpl::if_c< +#if defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64) + ::boost::type_traits::ice_eq< sizeof(double), sizeof(long double) >::value, +#else + 0 #endif + int, + char + >::type tag = 0; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - unsigned short n) - { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } + return float_types_converter_internal(output, tag); + } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - unsigned int n) - { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } + bool operator>>(long double& output) + { + int tag = 0; + return float_types_converter_internal(output, tag); + } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - unsigned long n) - { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } + // Generic istream-based algorithm. + // lcast_streambuf_for_target<InputStreamable>::value is true. + template<typename InputStreamable> + bool operator>>(InputStreamable& output) { return shr_using_base_class(output); } + }; + } -#if defined(BOOST_HAS_LONG_LONG) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - boost::ulong_long_type n) - { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } -#elif defined(BOOST_HAS_MS_INT64) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - unsigned __int64 n) + namespace detail + { + template<class T> + struct array_to_pointer_decay { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } -#endif + typedef T type; + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - float val) + template<class T, std::size_t N> + struct array_to_pointer_decay<T[N]> { - return this->lcast_put(val); - } + typedef const T * type; + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - double val) + template<typename T> + struct is_stdstring { - return this->lcast_put(val); - } + BOOST_STATIC_CONSTANT(bool, value = false ); + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - long double val) + template<typename CharT, typename Traits, typename Alloc> + struct is_stdstring< std::basic_string<CharT, Traits, Alloc> > { - return this->lcast_put(val); - } + BOOST_STATIC_CONSTANT(bool, value = true ); + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - CharT const* str) + template<typename CharT, typename Traits, typename Alloc> + struct is_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc> > { - start = const_cast<CharT*>(str); - finish = start + Traits::length(str); - return true; - } + BOOST_STATIC_CONSTANT(bool, value = true ); + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>( - CharT& output) - { - bool const ok = (finish - start == 1); - if(ok) - Traits::assign(output, *start); - return ok; - } + template<typename Target, typename Source> + struct is_arithmetic_and_not_xchars + { + BOOST_STATIC_CONSTANT(bool, value = + ( + ::boost::type_traits::ice_and< + ::boost::is_arithmetic<Source>::value, + ::boost::is_arithmetic<Target>::value, + ::boost::type_traits::ice_not< + detail::is_char_or_wchar<Target>::value + >::value, + ::boost::type_traits::ice_not< + detail::is_char_or_wchar<Source>::value + >::value + >::value + ) + ); + }; -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>( - std::string& str) - { - str.assign(start, finish); - return true; - } + /* + * is_xchar_to_xchar<Target, Source>::value is true, when + * Target and Souce are the same char types, or when + * Target and Souce are char types of the same size. + */ + template<typename Target, typename Source> + struct is_xchar_to_xchar + { + BOOST_STATIC_CONSTANT(bool, value = + ( + ::boost::type_traits::ice_or< + ::boost::type_traits::ice_and< + is_same<Source,Target>::value, + is_char_or_wchar<Target>::value + >::value, + ::boost::type_traits::ice_and< + ::boost::type_traits::ice_eq< sizeof(char),sizeof(Target)>::value, + ::boost::type_traits::ice_eq< sizeof(char),sizeof(Source)>::value, + is_char_or_wchar<Target>::value, + is_char_or_wchar<Source>::value + >::value + >::value + ) + ); + }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>( - std::wstring& str) + + // this metafunction evaluates to true, if we have optimized comnversion + // from Float type to Char array. + // Must be in sync with lexical_stream_limited_src<Char, ...>::shl_real_type(...) + template <typename Float, typename Char> + struct is_this_float_conversion_optimized { - str.assign(start, finish); - return true; - } -#endif + typedef ::boost::type_traits::ice_and< + ::boost::is_float<Float>::value, +#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_SWPRINTF) && !defined(__MINGW32__) + ::boost::type_traits::ice_or< + ::boost::type_traits::ice_eq<sizeof(Char), sizeof(char) >::value, + ::boost::is_same<Char, wchar_t>::value + >::value +#else + ::boost::type_traits::ice_eq<sizeof(Char), sizeof(char) >::value #endif - } + > result_type; - namespace detail // lcast_streambuf_for_source - { - // Returns true if optimized stream wrapper needs ostream for writing. - template<class Source> - struct lcast_streambuf_for_source - { - BOOST_STATIC_CONSTANT(bool, value = false); + BOOST_STATIC_CONSTANT(bool, value = (result_type::value) ); }; - template<> - struct lcast_streambuf_for_source<float> + template<typename Target, typename Source> + struct is_char_array_to_stdstring { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = false ); }; - - template<> - struct lcast_streambuf_for_source<double> + + template<typename CharT, typename Traits, typename Alloc> + struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, CharT* > { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true ); }; - - template<> - struct lcast_streambuf_for_source<long double> + + template<typename CharT, typename Traits, typename Alloc> + struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, const CharT* > { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true ); }; - } - namespace detail // lcast_streambuf_for_target - { - // Returns true if optimized stream wrapper needs istream for reading. - template<class Target> - struct lcast_streambuf_for_target + template<typename CharT, typename Traits, typename Alloc> + struct is_char_array_to_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc>, CharT* > { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true ); }; - template<> - struct lcast_streambuf_for_target<char> + template<typename CharT, typename Traits, typename Alloc> + struct is_char_array_to_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc>, const CharT* > { - BOOST_STATIC_CONSTANT(bool, value = false); + BOOST_STATIC_CONSTANT(bool, value = true ); }; -#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - template<> - struct lcast_streambuf_for_target<wchar_t> +#if (defined _MSC_VER) +# pragma warning( push ) +# pragma warning( disable : 4701 ) // possible use of ... before initialization +# pragma warning( disable : 4702 ) // unreachable code +# pragma warning( disable : 4267 ) // conversion from 'size_t' to 'unsigned int' +#endif + template<typename Target, typename Source> + struct lexical_cast_do_cast { - BOOST_STATIC_CONSTANT(bool, value = false); + static inline Target lexical_cast_impl(const Source& arg) + { + typedef BOOST_DEDUCED_TYPENAME detail::array_to_pointer_decay<Source>::type src; + typedef BOOST_DEDUCED_TYPENAME ::boost::remove_cv<src>::type no_cv_src; + typedef BOOST_DEDUCED_TYPENAME detail::stream_char<Target>::type target_char_t; + typedef BOOST_DEDUCED_TYPENAME detail::stream_char<no_cv_src>::type src_char_type; + typedef BOOST_DEDUCED_TYPENAME detail::widest_char< + target_char_t, src_char_type + >::type char_type; + +#if !defined(BOOST_NO_CHAR16_T) && defined(BOOST_NO_UNICODE_LITERALS) + BOOST_STATIC_ASSERT_MSG(( !::boost::is_same<char16_t, src_char_type>::value + && !::boost::is_same<char16_t, target_char_t>::value), + "Your compiler does not have full support for char16_t" ); +#endif +#if !defined(BOOST_NO_CHAR32_T) && defined(BOOST_NO_UNICODE_LITERALS) + BOOST_STATIC_ASSERT_MSG(( !::boost::is_same<char32_t, src_char_type>::value + && !::boost::is_same<char32_t, target_char_t>::value), + "Your compiler does not have full support for char32_t" ); +#endif + + typedef BOOST_DEDUCED_TYPENAME ::boost::detail::deduce_char_traits< + char_type, Target, no_cv_src + >::type traits; + + typedef ::boost::type_traits::ice_and< + ::boost::detail::is_char_or_wchar<src_char_type>::value, // source is lexical type + ::boost::detail::is_char_or_wchar<target_char_t>::value, // target is a lexical type + ::boost::is_same<char, src_char_type>::value, // source is not a wide character based type + ::boost::type_traits::ice_ne<sizeof(char), sizeof(target_char_t) >::value // target type is based on wide character + > is_string_widening_required_t; + + typedef ::boost::type_traits::ice_or< + ::boost::is_integral<no_cv_src>::value, + ::boost::detail::is_this_float_conversion_optimized<no_cv_src, char_type >::value, + ::boost::detail::is_char_or_wchar<src_char_type >::value + > is_source_input_optimized_t; + + // Target type must be default constructible + Target result; + + // If we have an optimized conversion for + // Source, we do not need to construct stringbuf. + const bool requires_stringbuf = ::boost::type_traits::ice_or< + is_string_widening_required_t::value, + ::boost::type_traits::ice_not< is_source_input_optimized_t::value >::value + >::value; + + typedef detail::lexical_stream_limited_src<char_type, traits, requires_stringbuf > interpreter_type; + + typedef detail::lcast_src_length<no_cv_src> lcast_src_length; + std::size_t const src_len = lcast_src_length::value; + char_type buf[src_len + 1]; + lcast_src_length::check_coverage(); + + interpreter_type interpreter(buf, buf + src_len); + + // Disabling ADL, by directly specifying operators. + if(!(interpreter.operator <<(arg) && interpreter.operator >>(result))) + BOOST_LCAST_THROW_BAD_CAST(Source, Target); + + return result; + } }; +#if (defined _MSC_VER) +# pragma warning( pop ) #endif -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template<class Traits, class Alloc> - struct lcast_streambuf_for_target< - std::basic_string<char,Traits,Alloc> > + template <typename Source> + struct lexical_cast_copy { - BOOST_STATIC_CONSTANT(bool, value = false); + static inline const Source& lexical_cast_impl(const Source &arg) BOOST_NOEXCEPT + { + return arg; + } }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<class Traits, class Alloc> - struct lcast_streambuf_for_target< - std::basic_string<wchar_t,Traits,Alloc> > + template <class Source, class Target > + struct detect_precision_loss { - BOOST_STATIC_CONSTANT(bool, value = false); - }; -#endif -#else - template<> - struct lcast_streambuf_for_target<std::string> + typedef boost::numeric::Trunc<Source> Rounder; + typedef Source source_type ; + + typedef BOOST_DEDUCED_TYPENAME mpl::if_< + ::boost::is_arithmetic<Source>, Source, Source const& + >::type argument_type ; + + static source_type nearbyint ( argument_type s ) + { + const source_type orig_div_round = s / Rounder::nearbyint(s); + const source_type eps = std::numeric_limits<source_type>::epsilon(); + + if ((orig_div_round > 1 ? orig_div_round - 1 : 1 - orig_div_round) > eps) + BOOST_LCAST_THROW_BAD_CAST(Source, Target); + + return s ; + } + + typedef typename Rounder::round_style round_style; + } ; + + template <class Source, class Target > + struct nothrow_overflow_handler + { + void operator() ( boost::numeric::range_check_result r ) + { + if (r != boost::numeric::cInRange) + BOOST_LCAST_THROW_BAD_CAST(Source, Target); + } + } ; + + template <typename Target, typename Source> + struct lexical_cast_dynamic_num_not_ignoring_minus { - BOOST_STATIC_CONSTANT(bool, value = false); + static inline Target lexical_cast_impl(const Source &arg) + { + return boost::numeric::converter< + Target, + Source, + boost::numeric::conversion_traits<Target,Source>, + nothrow_overflow_handler<Source, Target>, + detect_precision_loss<Source, Target> + >::convert(arg); + } }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_streambuf_for_target<std::wstring> + template <typename Target, typename Source> + struct lexical_cast_dynamic_num_ignoring_minus { - BOOST_STATIC_CONSTANT(bool, value = false); + static inline Target lexical_cast_impl(const Source &arg) + { + typedef boost::numeric::converter< + Target, + Source, + boost::numeric::conversion_traits<Target,Source>, + nothrow_overflow_handler<Source, Target>, + detect_precision_loss<Source, Target> + > converter_t; + + return ( + arg < 0 ? -converter_t::convert(-arg) : converter_t::convert(arg) + ); + } }; + + /* + * lexical_cast_dynamic_num follows the rules: + * 1) If Source can be converted to Target without precision loss and + * without overflows, then assign Source to Target and return + * + * 2) If Source is less than 0 and Target is an unsigned integer, + * then negate Source, check the requirements of rule 1) and if + * successful, assign static_casted Source to Target and return + * + * 3) Otherwise throw a bad_lexical_cast exception + * + * + * Rule 2) required because boost::lexical_cast has the behavior of + * stringstream, which uses the rules of scanf for conversions. And + * in the C99 standard for unsigned input value minus sign is + * optional, so if a negative number is read, no errors will arise + * and the result will be the two's complement. + */ + template <typename Target, typename Source> + struct lexical_cast_dynamic_num + { + static inline Target lexical_cast_impl(const Source &arg) + { + typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< + ::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::is_signed<Source>::value, + ::boost::is_float<Source>::value + >::value, + ::boost::type_traits::ice_not< + ::boost::is_same<Source, bool>::value + >::value, + ::boost::type_traits::ice_not< + ::boost::is_same<Target, bool>::value + >::value, + ::boost::is_unsigned<Target>::value + >::value, + lexical_cast_dynamic_num_ignoring_minus<Target, Source>, + lexical_cast_dynamic_num_not_ignoring_minus<Target, Source> + >::type caster_type; + + return caster_type::lexical_cast_impl(arg); + } + }; + } + + template <typename Target, typename Source> + inline Target lexical_cast(const Source &arg) + { + typedef BOOST_DEDUCED_TYPENAME ::boost::detail::array_to_pointer_decay<Source>::type src; + + typedef BOOST_DEDUCED_TYPENAME ::boost::type_traits::ice_or< + ::boost::detail::is_xchar_to_xchar<Target, src >::value, + ::boost::detail::is_char_array_to_stdstring<Target, src >::value, + ::boost::type_traits::ice_and< + ::boost::is_same<Target, src >::value, + ::boost::detail::is_stdstring<Target >::value + >::value + > shall_we_copy_t; + + typedef BOOST_DEDUCED_TYPENAME + ::boost::detail::is_arithmetic_and_not_xchars<Target, src > shall_we_copy_with_dynamic_check_t; + + typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< + shall_we_copy_t::value, + ::boost::detail::lexical_cast_copy<src >, + BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< + shall_we_copy_with_dynamic_check_t::value, + ::boost::detail::lexical_cast_dynamic_num<Target, src >, + ::boost::detail::lexical_cast_do_cast<Target, src > + >::type + >::type caster_type; + + return caster_type::lexical_cast_impl(arg); + } + + template <typename Target> + inline Target lexical_cast(const char* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const char*>(chars, chars + count) + ); + } + + + template <typename Target> + inline Target lexical_cast(const unsigned char* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const unsigned char*>(chars, chars + count) + ); + } + + template <typename Target> + inline Target lexical_cast(const signed char* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const signed char*>(chars, chars + count) + ); + } + +#ifndef BOOST_LCAST_NO_WCHAR_T + template <typename Target> + inline Target lexical_cast(const wchar_t* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const wchar_t*>(chars, chars + count) + ); + } #endif +#ifndef BOOST_NO_CHAR16_T + template <typename Target> + inline Target lexical_cast(const char16_t* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const char16_t*>(chars, chars + count) + ); + } #endif +#ifndef BOOST_NO_CHAR32_T + template <typename Target> + inline Target lexical_cast(const char32_t* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const char32_t*>(chars, chars + count) + ); } +#endif - #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +} // namespace boost - // call-by-const reference version +#else // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace boost { namespace detail { - template<class T> - struct array_to_pointer_decay + + // selectors for choosing stream character type + template<typename Type> + struct stream_char { - typedef T type; + typedef char type; }; - template<class T, std::size_t N> - struct array_to_pointer_decay<T[N]> +#ifndef BOOST_LCAST_NO_WCHAR_T +#ifndef BOOST_NO_INTRINSIC_WCHAR_T + template<> + struct stream_char<wchar_t> { - typedef const T * type; + typedef wchar_t type; }; +#endif -#if (defined _MSC_VER) -# pragma warning( push ) -# pragma warning( disable : 4701 ) // possible use of ... before initialization -# pragma warning( disable : 4702 ) // unreachable code + template<> + struct stream_char<wchar_t *> + { + typedef wchar_t type; + }; + + template<> + struct stream_char<const wchar_t *> + { + typedef wchar_t type; + }; + + template<> + struct stream_char<std::wstring> + { + typedef wchar_t type; + }; #endif - template< typename Target - , typename Source - , bool Unlimited // string representation of Source is unlimited - , typename CharT - > - Target lexical_cast( - BOOST_DEDUCED_TYPENAME boost::call_traits<Source>::param_type arg, - CharT* buf, std::size_t src_len) + // stream wrapper for handling lexical conversions + template<typename Target, typename Source, typename Traits> + class lexical_stream { - typedef BOOST_DEDUCED_TYPENAME - deduce_char_traits<CharT,Target,Source>::type traits; + private: + typedef typename widest_char< + typename stream_char<Target>::type, + typename stream_char<Source>::type>::type char_type; - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< - lcast_streambuf_for_target<Target>::value || - lcast_streambuf_for_source<Source>::value - , std::basic_streambuf<CharT> - , lexical_streambuf_fake - >::type base; + typedef Traits traits_type; - BOOST_DEDUCED_TYPENAME boost::mpl::if_c< - Unlimited - , detail::lexical_stream<Target,Source,traits> - , detail::lexical_stream_limited_src<CharT,base,traits> - >::type interpreter(buf, buf + src_len); + public: + lexical_stream(char_type* = 0, char_type* = 0) + { + stream.unsetf(std::ios::skipws); + lcast_set_precision(stream, static_cast<Source*>(0), static_cast<Target*>(0) ); + } + ~lexical_stream() + { + #if defined(BOOST_NO_STRINGSTREAM) + stream.freeze(false); + #endif + } + bool operator<<(const Source &input) + { + return !(stream << input).fail(); + } + template<typename InputStreamable> + bool operator>>(InputStreamable &output) + { + return !is_pointer<InputStreamable>::value && + stream >> output && + stream.get() == +#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING) +// GCC 2.9x lacks std::char_traits<>::eof(). +// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3 +// configurations, which do provide std::char_traits<>::eof(). - Target result; - if(!(interpreter << arg && interpreter >> result)) - BOOST_LCAST_THROW_BAD_CAST(Source, Target); - return result; - } -#if (defined _MSC_VER) -# pragma warning( pop ) + EOF; +#else + traits_type::eof(); #endif - } + } - template<typename Target, typename Source> - inline Target lexical_cast(const Source &arg) - { - typedef typename detail::array_to_pointer_decay<Source>::type src; - - typedef typename detail::widest_char< - typename detail::stream_char<Target>::type - , typename detail::stream_char<src>::type - >::type char_type; - - typedef detail::lcast_src_length<char_type, src> lcast_src_length; - std::size_t const src_len = lcast_src_length::value; - char_type buf[src_len + 1]; - lcast_src_length::check_coverage(); - return detail::lexical_cast<Target, src, !src_len>(arg, buf, src_len); - } + bool operator>>(std::string &output) + { + #if defined(BOOST_NO_STRINGSTREAM) + stream << '\0'; + #endif + stream.str().swap(output); + return true; + } + #ifndef BOOST_LCAST_NO_WCHAR_T + bool operator>>(std::wstring &output) + { + stream.str().swap(output); + return true; + } + #endif - #else + private: + #if defined(BOOST_NO_STRINGSTREAM) + std::strstream stream; + #elif defined(BOOST_NO_STD_LOCALE) + std::stringstream stream; + #else + std::basic_stringstream<char_type,traits_type> stream; + #endif + }; + } // call-by-value fallback version (deprecated) @@ -1191,23 +2482,24 @@ namespace boost Target result; if(!(interpreter << arg && interpreter >> result)) -#ifndef BOOST_NO_TYPEID - throw_exception(bad_lexical_cast(typeid(Source), typeid(Target))); -#else - throw_exception(bad_lexical_cast()); -#endif + BOOST_LCAST_THROW_BAD_CAST(Source, Target); return result; } - #endif -} +} // namespace boost + +#endif // Copyright Kevlin Henney, 2000-2005. -// Copyright Alexander Nasonov, 2006-2007. +// Copyright Alexander Nasonov, 2006-2010. +// Copyright Antony Polukhin, 2011-2012. // // 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) +#undef BOOST_LCAST_THROW_BAD_CAST #undef BOOST_LCAST_NO_WCHAR_T -#endif + +#endif // BOOST_LEXICAL_CAST_INCLUDED + diff --git a/3rdParty/Boost/src/boost/logic/tribool.hpp b/3rdParty/Boost/src/boost/logic/tribool.hpp index 229feb4..90cba3e 100644 --- a/3rdParty/Boost/src/boost/logic/tribool.hpp +++ b/3rdParty/Boost/src/boost/logic/tribool.hpp @@ -93,7 +93,7 @@ public: * * \throws nothrow */ - tribool(bool value) : value(value? true_value : false_value) {} + tribool(bool initial_value) : value(initial_value? true_value : false_value) {} /** * Construct a new 3-state boolean value with an indeterminate value. @@ -452,7 +452,7 @@ namespace boost { #define BOOST_TRIBOOL_THIRD_STATE(Name) \ inline bool \ Name(boost::logic::tribool x, \ - boost::logic::detail::indeterminate_t dummy = \ + boost::logic::detail::indeterminate_t = \ boost::logic::detail::indeterminate_t()) \ { return x.value == boost::logic::tribool::indeterminate_value; } diff --git a/3rdParty/Boost/src/boost/make_shared.hpp b/3rdParty/Boost/src/boost/make_shared.hpp new file mode 100644 index 0000000..c04938f --- /dev/null +++ b/3rdParty/Boost/src/boost/make_shared.hpp @@ -0,0 +1,17 @@ +#ifndef BOOST_MAKE_SHARED_HPP_INCLUDED +#define BOOST_MAKE_SHARED_HPP_INCLUDED + +// make_shared.hpp +// +// Copyright (c) 2007, 2008 Peter Dimov +// +// 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 +// +// See http://www.boost.org/libs/smart_ptr/make_shared.html +// for documentation. + +#include <boost/smart_ptr/make_shared.hpp> + +#endif // #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/math/common_factor_ct.hpp b/3rdParty/Boost/src/boost/math/common_factor_ct.hpp new file mode 100644 index 0000000..848c925 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/common_factor_ct.hpp @@ -0,0 +1,180 @@ +// Boost common_factor_ct.hpp header file ----------------------------------// + +// (C) Copyright Daryle Walker and Stephen Cleary 2001-2002. +// 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) + +// See http://www.boost.org for updates, documentation, and revision history. + +#ifndef BOOST_MATH_COMMON_FACTOR_CT_HPP +#define BOOST_MATH_COMMON_FACTOR_CT_HPP + +#include <boost/math_fwd.hpp> // self include +#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT, etc. +#include <boost/mpl/integral_c.hpp> + +namespace boost +{ +namespace math +{ + +// Implementation details --------------------------------------------------// + +namespace detail +{ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // Build GCD with Euclid's recursive algorithm + template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_gcd_helper_t + { + private: + BOOST_STATIC_CONSTANT( static_gcd_type, new_value1 = Value2 ); + BOOST_STATIC_CONSTANT( static_gcd_type, new_value2 = Value1 % Value2 ); + + #ifndef __BORLANDC__ + #define BOOST_DETAIL_GCD_HELPER_VAL(Value) static_cast<static_gcd_type>(Value) + #else + typedef static_gcd_helper_t self_type; + #define BOOST_DETAIL_GCD_HELPER_VAL(Value) (self_type:: Value ) + #endif + + typedef static_gcd_helper_t< BOOST_DETAIL_GCD_HELPER_VAL(new_value1), + BOOST_DETAIL_GCD_HELPER_VAL(new_value2) > next_step_type; + + #undef BOOST_DETAIL_GCD_HELPER_VAL + + public: + BOOST_STATIC_CONSTANT( static_gcd_type, value = next_step_type::value ); + }; + + // Non-recursive case + template < static_gcd_type Value1 > + struct static_gcd_helper_t< Value1, 0UL > + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 ); + }; +#else + // Use inner class template workaround from Peter Dimov + template < static_gcd_type Value1 > + struct static_gcd_helper2_t + { + template < static_gcd_type Value2 > + struct helper + { + BOOST_STATIC_CONSTANT( static_gcd_type, value + = static_gcd_helper2_t<Value2>::BOOST_NESTED_TEMPLATE + helper<Value1 % Value2>::value ); + }; + + template < > + struct helper< 0UL > + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 ); + }; + }; + + // Special case + template < > + struct static_gcd_helper2_t< 0UL > + { + template < static_gcd_type Value2 > + struct helper + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value2 ); + }; + }; + + // Build the GCD from the above template(s) + template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_gcd_helper_t + { + BOOST_STATIC_CONSTANT( static_gcd_type, value + = static_gcd_helper2_t<Value1>::BOOST_NESTED_TEMPLATE + helper<Value2>::value ); + }; +#endif + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // Build the LCM from the GCD + template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_lcm_helper_t + { + typedef static_gcd_helper_t<Value1, Value2> gcd_type; + + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 / gcd_type::value + * Value2 ); + }; + + // Special case for zero-GCD values + template < > + struct static_lcm_helper_t< 0UL, 0UL > + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); + }; +#else + // Adapt GCD's inner class template workaround for LCM + template < static_gcd_type Value1 > + struct static_lcm_helper2_t + { + template < static_gcd_type Value2 > + struct helper + { + typedef static_gcd_helper_t<Value1, Value2> gcd_type; + + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 + / gcd_type::value * Value2 ); + }; + + template < > + struct helper< 0UL > + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); + }; + }; + + // Special case + template < > + struct static_lcm_helper2_t< 0UL > + { + template < static_gcd_type Value2 > + struct helper + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); + }; + }; + + // Build the LCM from the above template(s) + template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_lcm_helper_t + { + BOOST_STATIC_CONSTANT( static_gcd_type, value + = static_lcm_helper2_t<Value1>::BOOST_NESTED_TEMPLATE + helper<Value2>::value ); + }; +#endif + +} // namespace detail + + +// Compile-time greatest common divisor evaluator class declaration --------// + +template < static_gcd_type Value1, static_gcd_type Value2 > +struct static_gcd : public mpl::integral_c<static_gcd_type, (detail::static_gcd_helper_t<Value1, Value2>::value) > +{ +}; // boost::math::static_gcd + + +// Compile-time least common multiple evaluator class declaration ----------// + +template < static_gcd_type Value1, static_gcd_type Value2 > +struct static_lcm : public mpl::integral_c<static_gcd_type, (detail::static_lcm_helper_t<Value1, Value2>::value) > +{ +}; // boost::math::static_lcm + + +} // namespace math +} // namespace boost + + +#endif // BOOST_MATH_COMMON_FACTOR_CT_HPP diff --git a/3rdParty/Boost/src/boost/math/common_factor_rt.hpp b/3rdParty/Boost/src/boost/math/common_factor_rt.hpp new file mode 100644 index 0000000..4582a96 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/common_factor_rt.hpp @@ -0,0 +1,530 @@ +// Boost common_factor_rt.hpp header file ----------------------------------// + +// (C) Copyright Daryle Walker and Paul Moore 2001-2002. Permission to copy, +// use, modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided "as is" +// without express or implied warranty, and with no claim as to its suitability +// for any purpose. + +// boostinspect:nolicense (don't complain about the lack of a Boost license) +// (Paul Moore hasn't been in contact for years, so there's no way to change the +// license.) + +// See http://www.boost.org for updates, documentation, and revision history. + +#ifndef BOOST_MATH_COMMON_FACTOR_RT_HPP +#define BOOST_MATH_COMMON_FACTOR_RT_HPP + +#include <boost/math_fwd.hpp> // self include + +#include <boost/config.hpp> // for BOOST_NESTED_TEMPLATE, etc. +#include <boost/limits.hpp> // for std::numeric_limits +#include <climits> // for CHAR_MIN +#include <boost/detail/workaround.hpp> + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127 4244) // Conditional expression is constant +#endif + +namespace boost +{ +namespace math +{ + + +// Forward declarations for function templates -----------------------------// + +template < typename IntegerType > + IntegerType gcd( IntegerType const &a, IntegerType const &b ); + +template < typename IntegerType > + IntegerType lcm( IntegerType const &a, IntegerType const &b ); + + +// Greatest common divisor evaluator class declaration ---------------------// + +template < typename IntegerType > +class gcd_evaluator +{ +public: + // Types + typedef IntegerType result_type, first_argument_type, second_argument_type; + + // Function object interface + result_type operator ()( first_argument_type const &a, + second_argument_type const &b ) const; + +}; // boost::math::gcd_evaluator + + +// Least common multiple evaluator class declaration -----------------------// + +template < typename IntegerType > +class lcm_evaluator +{ +public: + // Types + typedef IntegerType result_type, first_argument_type, second_argument_type; + + // Function object interface + result_type operator ()( first_argument_type const &a, + second_argument_type const &b ) const; + +}; // boost::math::lcm_evaluator + + +// Implementation details --------------------------------------------------// + +namespace detail +{ + // Greatest common divisor for rings (including unsigned integers) + template < typename RingType > + RingType + gcd_euclidean + ( + RingType a, + RingType b + ) + { + // Avoid repeated construction + #ifndef __BORLANDC__ + RingType const zero = static_cast<RingType>( 0 ); + #else + RingType zero = static_cast<RingType>( 0 ); + #endif + + // Reduce by GCD-remainder property [GCD(a,b) == GCD(b,a MOD b)] + while ( true ) + { + if ( a == zero ) + return b; + b %= a; + + if ( b == zero ) + return a; + a %= b; + } + } + + // Greatest common divisor for (signed) integers + template < typename IntegerType > + inline + IntegerType + gcd_integer + ( + IntegerType const & a, + IntegerType const & b + ) + { + // Avoid repeated construction + IntegerType const zero = static_cast<IntegerType>( 0 ); + IntegerType const result = gcd_euclidean( a, b ); + + return ( result < zero ) ? static_cast<IntegerType>(-result) : result; + } + + // Greatest common divisor for unsigned binary integers + template < typename BuiltInUnsigned > + BuiltInUnsigned + gcd_binary + ( + BuiltInUnsigned u, + BuiltInUnsigned v + ) + { + if ( u && v ) + { + // Shift out common factors of 2 + unsigned shifts = 0; + + while ( !(u & 1u) && !(v & 1u) ) + { + ++shifts; + u >>= 1; + v >>= 1; + } + + // Start with the still-even one, if any + BuiltInUnsigned r[] = { u, v }; + unsigned which = static_cast<bool>( u & 1u ); + + // Whittle down the values via their differences + do + { +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) + while ( !(r[ which ] & 1u) ) + { + r[ which ] = (r[which] >> 1); + } +#else + // Remove factors of two from the even one + while ( !(r[ which ] & 1u) ) + { + r[ which ] >>= 1; + } +#endif + + // Replace the larger of the two with their difference + if ( r[!which] > r[which] ) + { + which ^= 1u; + } + + r[ which ] -= r[ !which ]; + } + while ( r[which] ); + + // Shift-in the common factor of 2 to the residues' GCD + return r[ !which ] << shifts; + } + else + { + // At least one input is zero, return the other + // (adding since zero is the additive identity) + // or zero if both are zero. + return u + v; + } + } + + // Least common multiple for rings (including unsigned integers) + template < typename RingType > + inline + RingType + lcm_euclidean + ( + RingType const & a, + RingType const & b + ) + { + RingType const zero = static_cast<RingType>( 0 ); + RingType const temp = gcd_euclidean( a, b ); + + return ( temp != zero ) ? ( a / temp * b ) : zero; + } + + // Least common multiple for (signed) integers + template < typename IntegerType > + inline + IntegerType + lcm_integer + ( + IntegerType const & a, + IntegerType const & b + ) + { + // Avoid repeated construction + IntegerType const zero = static_cast<IntegerType>( 0 ); + IntegerType const result = lcm_euclidean( a, b ); + + return ( result < zero ) ? static_cast<IntegerType>(-result) : result; + } + + // Function objects to find the best way of computing GCD or LCM +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template < typename T, bool IsSpecialized, bool IsSigned > + struct gcd_optimal_evaluator_helper_t + { + T operator ()( T const &a, T const &b ) + { + return gcd_euclidean( a, b ); + } + }; + + template < typename T > + struct gcd_optimal_evaluator_helper_t< T, true, true > + { + T operator ()( T const &a, T const &b ) + { + return gcd_integer( a, b ); + } + }; +#else + template < bool IsSpecialized, bool IsSigned > + struct gcd_optimal_evaluator_helper2_t + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return gcd_euclidean( a, b ); + } + }; + }; + + template < > + struct gcd_optimal_evaluator_helper2_t< true, true > + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return gcd_integer( a, b ); + } + }; + }; + + template < typename T, bool IsSpecialized, bool IsSigned > + struct gcd_optimal_evaluator_helper_t + : gcd_optimal_evaluator_helper2_t<IsSpecialized, IsSigned> + ::BOOST_NESTED_TEMPLATE helper<T> + { + }; +#endif + + template < typename T > + struct gcd_optimal_evaluator + { + T operator ()( T const &a, T const &b ) + { + typedef ::std::numeric_limits<T> limits_type; + + typedef gcd_optimal_evaluator_helper_t<T, + limits_type::is_specialized, limits_type::is_signed> helper_type; + + helper_type solver; + + return solver( a, b ); + } + }; +#else // BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + template < typename T > + struct gcd_optimal_evaluator + { + T operator ()( T const &a, T const &b ) + { + return gcd_integer( a, b ); + } + }; +#endif + + // Specialize for the built-in integers +#define BOOST_PRIVATE_GCD_UF( Ut ) \ + template < > struct gcd_optimal_evaluator<Ut> \ + { Ut operator ()( Ut a, Ut b ) const { return gcd_binary( a, b ); } } + + BOOST_PRIVATE_GCD_UF( unsigned char ); + BOOST_PRIVATE_GCD_UF( unsigned short ); + BOOST_PRIVATE_GCD_UF( unsigned ); + BOOST_PRIVATE_GCD_UF( unsigned long ); + +#ifdef BOOST_HAS_LONG_LONG + BOOST_PRIVATE_GCD_UF( boost::ulong_long_type ); +#elif defined(BOOST_HAS_MS_INT64) + BOOST_PRIVATE_GCD_UF( unsigned __int64 ); +#endif + +#if CHAR_MIN == 0 + BOOST_PRIVATE_GCD_UF( char ); // char is unsigned +#endif + +#undef BOOST_PRIVATE_GCD_UF + +#define BOOST_PRIVATE_GCD_SF( St, Ut ) \ + template < > struct gcd_optimal_evaluator<St> \ + { St operator ()( St a, St b ) const { Ut const a_abs = \ + static_cast<Ut>( a < 0 ? -a : +a ), b_abs = static_cast<Ut>( \ + b < 0 ? -b : +b ); return static_cast<St>( \ + gcd_optimal_evaluator<Ut>()(a_abs, b_abs) ); } } + + BOOST_PRIVATE_GCD_SF( signed char, unsigned char ); + BOOST_PRIVATE_GCD_SF( short, unsigned short ); + BOOST_PRIVATE_GCD_SF( int, unsigned ); + BOOST_PRIVATE_GCD_SF( long, unsigned long ); + +#if CHAR_MIN < 0 + BOOST_PRIVATE_GCD_SF( char, unsigned char ); // char is signed +#endif + +#ifdef BOOST_HAS_LONG_LONG + BOOST_PRIVATE_GCD_SF( boost::long_long_type, boost::ulong_long_type ); +#elif defined(BOOST_HAS_MS_INT64) + BOOST_PRIVATE_GCD_SF( __int64, unsigned __int64 ); +#endif + +#undef BOOST_PRIVATE_GCD_SF + +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template < typename T, bool IsSpecialized, bool IsSigned > + struct lcm_optimal_evaluator_helper_t + { + T operator ()( T const &a, T const &b ) + { + return lcm_euclidean( a, b ); + } + }; + + template < typename T > + struct lcm_optimal_evaluator_helper_t< T, true, true > + { + T operator ()( T const &a, T const &b ) + { + return lcm_integer( a, b ); + } + }; +#else + template < bool IsSpecialized, bool IsSigned > + struct lcm_optimal_evaluator_helper2_t + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return lcm_euclidean( a, b ); + } + }; + }; + + template < > + struct lcm_optimal_evaluator_helper2_t< true, true > + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return lcm_integer( a, b ); + } + }; + }; + + template < typename T, bool IsSpecialized, bool IsSigned > + struct lcm_optimal_evaluator_helper_t + : lcm_optimal_evaluator_helper2_t<IsSpecialized, IsSigned> + ::BOOST_NESTED_TEMPLATE helper<T> + { + }; +#endif + + template < typename T > + struct lcm_optimal_evaluator + { + T operator ()( T const &a, T const &b ) + { + typedef ::std::numeric_limits<T> limits_type; + + typedef lcm_optimal_evaluator_helper_t<T, + limits_type::is_specialized, limits_type::is_signed> helper_type; + + helper_type solver; + + return solver( a, b ); + } + }; +#else // BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + template < typename T > + struct lcm_optimal_evaluator + { + T operator ()( T const &a, T const &b ) + { + return lcm_integer( a, b ); + } + }; +#endif + + // Functions to find the GCD or LCM in the best way + template < typename T > + inline + T + gcd_optimal + ( + T const & a, + T const & b + ) + { + gcd_optimal_evaluator<T> solver; + + return solver( a, b ); + } + + template < typename T > + inline + T + lcm_optimal + ( + T const & a, + T const & b + ) + { + lcm_optimal_evaluator<T> solver; + + return solver( a, b ); + } + +} // namespace detail + + +// Greatest common divisor evaluator member function definition ------------// + +template < typename IntegerType > +inline +typename gcd_evaluator<IntegerType>::result_type +gcd_evaluator<IntegerType>::operator () +( + first_argument_type const & a, + second_argument_type const & b +) const +{ + return detail::gcd_optimal( a, b ); +} + + +// Least common multiple evaluator member function definition --------------// + +template < typename IntegerType > +inline +typename lcm_evaluator<IntegerType>::result_type +lcm_evaluator<IntegerType>::operator () +( + first_argument_type const & a, + second_argument_type const & b +) const +{ + return detail::lcm_optimal( a, b ); +} + + +// Greatest common divisor and least common multiple function definitions --// + +template < typename IntegerType > +inline +IntegerType +gcd +( + IntegerType const & a, + IntegerType const & b +) +{ + gcd_evaluator<IntegerType> solver; + + return solver( a, b ); +} + +template < typename IntegerType > +inline +IntegerType +lcm +( + IntegerType const & a, + IntegerType const & b +) +{ + lcm_evaluator<IntegerType> solver; + + return solver( a, b ); +} + + +} // namespace math +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_MATH_COMMON_FACTOR_RT_HPP diff --git a/3rdParty/Boost/src/boost/math/policies/policy.hpp b/3rdParty/Boost/src/boost/math/policies/policy.hpp new file mode 100644 index 0000000..01fe3d0 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/policies/policy.hpp @@ -0,0 +1,982 @@ +// Copyright John Maddock 2007. +// Use, modification and distribution are subject to 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 BOOST_MATH_POLICY_HPP +#define BOOST_MATH_POLICY_HPP + +#include <boost/mpl/list.hpp> +#include <boost/mpl/contains.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/find_if.hpp> +#include <boost/mpl/remove_if.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/mpl/push_back.hpp> +#include <boost/mpl/at.hpp> +#include <boost/mpl/size.hpp> +#include <boost/mpl/comparison.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/static_assert.hpp> +#include <boost/assert.hpp> +#include <boost/math/tools/config.hpp> +#include <limits> +// Sadly we do need the .h versions of these to be sure of getting +// FLT_MANT_DIG etc. +#include <limits.h> +#include <stdlib.h> +#include <stddef.h> +#include <math.h> + +namespace boost{ namespace math{ + +namespace tools{ + +template <class T> +int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)); +template <class T> +T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)); + +} + +namespace policies{ + +// +// Define macros for our default policies, if they're not defined already: +// +#ifndef BOOST_MATH_DOMAIN_ERROR_POLICY +#define BOOST_MATH_DOMAIN_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_POLE_ERROR_POLICY +#define BOOST_MATH_POLE_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_OVERFLOW_ERROR_POLICY +#define BOOST_MATH_OVERFLOW_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_EVALUATION_ERROR_POLICY +#define BOOST_MATH_EVALUATION_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_ROUNDING_ERROR_POLICY +#define BOOST_MATH_ROUNDING_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_UNDERFLOW_ERROR_POLICY +#define BOOST_MATH_UNDERFLOW_ERROR_POLICY ignore_error +#endif +#ifndef BOOST_MATH_DENORM_ERROR_POLICY +#define BOOST_MATH_DENORM_ERROR_POLICY ignore_error +#endif +#ifndef BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY +#define BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY ignore_error +#endif +#ifndef BOOST_MATH_DIGITS10_POLICY +#define BOOST_MATH_DIGITS10_POLICY 0 +#endif +#ifndef BOOST_MATH_PROMOTE_FLOAT_POLICY +#define BOOST_MATH_PROMOTE_FLOAT_POLICY true +#endif +#ifndef BOOST_MATH_PROMOTE_DOUBLE_POLICY +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false +#else +#define BOOST_MATH_PROMOTE_DOUBLE_POLICY true +#endif +#endif +#ifndef BOOST_MATH_DISCRETE_QUANTILE_POLICY +#define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_outwards +#endif +#ifndef BOOST_MATH_ASSERT_UNDEFINED_POLICY +#define BOOST_MATH_ASSERT_UNDEFINED_POLICY true +#endif +#ifndef BOOST_MATH_MAX_SERIES_ITERATION_POLICY +#define BOOST_MATH_MAX_SERIES_ITERATION_POLICY 1000000 +#endif +#ifndef BOOST_MATH_MAX_ROOT_ITERATION_POLICY +#define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 200 +#endif + +#if !defined(__BORLANDC__) \ + && !(defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) +#define BOOST_MATH_META_INT(type, name, Default)\ + template <type N = Default> struct name : public boost::mpl::int_<N>{};\ + namespace detail{\ + template <type N>\ + char test_is_valid_arg(const name<N>*);\ + char test_is_default_arg(const name<Default>*);\ + template <class T> struct is_##name##_imp\ + {\ + template <type N> static char test(const name<N>*);\ + static double test(...);\ + BOOST_STATIC_CONSTANT(bool, value = sizeof(test(static_cast<T*>(0))) == 1);\ + };\ + }\ + template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>{}; + +#define BOOST_MATH_META_BOOL(name, Default)\ + template <bool N = Default> struct name : public boost::mpl::bool_<N>{};\ + namespace detail{\ + template <bool N>\ + char test_is_valid_arg(const name<N>*);\ + char test_is_default_arg(const name<Default>*);\ + template <class T> struct is_##name##_imp\ + {\ + template <bool N> static char test(const name<N>*);\ + static double test(...);\ + BOOST_STATIC_CONSTANT(bool, value = sizeof(test(static_cast<T*>(0))) == 1);\ + };\ + }\ + template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>{}; +#else +#define BOOST_MATH_META_INT(Type, name, Default)\ + template <Type N = Default> struct name : public boost::mpl::int_<N>{};\ + namespace detail{\ + template <Type N>\ + char test_is_valid_arg(const name<N>*);\ + char test_is_default_arg(const name<Default>*);\ + template <class T> struct is_##name##_tester\ + {\ + template <Type N> static char test(const name<N>&);\ + static double test(...);\ + };\ + template <class T> struct is_##name##_imp\ + {\ + static T inst;\ + BOOST_STATIC_CONSTANT(bool, value = sizeof( ::boost::math::policies::detail::is_##name##_tester<T>::test(inst)) == 1);\ + };\ + }\ + template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>\ + {\ + template <class U> struct apply{ typedef is_##name<U> type; };\ + }; + +#define BOOST_MATH_META_BOOL(name, Default)\ + template <bool N = Default> struct name : public boost::mpl::bool_<N>{};\ + namespace detail{\ + template <bool N>\ + char test_is_valid_arg(const name<N>*);\ + char test_is_default_arg(const name<Default>*);\ + template <class T> struct is_##name##_tester\ + {\ + template <bool N> static char test(const name<N>&);\ + static double test(...);\ + };\ + template <class T> struct is_##name##_imp\ + {\ + static T inst;\ + BOOST_STATIC_CONSTANT(bool, value = sizeof( ::boost::math::policies::detail::is_##name##_tester<T>::test(inst)) == 1);\ + };\ + }\ + template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>\ + {\ + template <class U> struct apply{ typedef is_##name<U> type; };\ + }; +#endif +// +// Begin by defining policy types for error handling: +// +enum error_policy_type +{ + throw_on_error = 0, + errno_on_error = 1, + ignore_error = 2, + user_error = 3 +}; + +BOOST_MATH_META_INT(error_policy_type, domain_error, BOOST_MATH_DOMAIN_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, pole_error, BOOST_MATH_POLE_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, overflow_error, BOOST_MATH_OVERFLOW_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, underflow_error, BOOST_MATH_UNDERFLOW_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, denorm_error, BOOST_MATH_DENORM_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, evaluation_error, BOOST_MATH_EVALUATION_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, rounding_error, BOOST_MATH_ROUNDING_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, indeterminate_result_error, BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY) + +// +// Policy types for internal promotion: +// +BOOST_MATH_META_BOOL(promote_float, BOOST_MATH_PROMOTE_FLOAT_POLICY) +BOOST_MATH_META_BOOL(promote_double, BOOST_MATH_PROMOTE_DOUBLE_POLICY) +BOOST_MATH_META_BOOL(assert_undefined, BOOST_MATH_ASSERT_UNDEFINED_POLICY) +// +// Policy types for discrete quantiles: +// +enum discrete_quantile_policy_type +{ + real, + integer_round_outwards, + integer_round_inwards, + integer_round_down, + integer_round_up, + integer_round_nearest +}; + +BOOST_MATH_META_INT(discrete_quantile_policy_type, discrete_quantile, BOOST_MATH_DISCRETE_QUANTILE_POLICY) +// +// Precision: +// +BOOST_MATH_META_INT(int, digits10, BOOST_MATH_DIGITS10_POLICY) +BOOST_MATH_META_INT(int, digits2, 0) +// +// Iterations: +// +BOOST_MATH_META_INT(unsigned long, max_series_iterations, BOOST_MATH_MAX_SERIES_ITERATION_POLICY) +BOOST_MATH_META_INT(unsigned long, max_root_iterations, BOOST_MATH_MAX_ROOT_ITERATION_POLICY) +// +// Define the names for each possible policy: +// +#define BOOST_MATH_PARAMETER(name)\ + BOOST_PARAMETER_TEMPLATE_KEYWORD(name##_name)\ + BOOST_PARAMETER_NAME(name##_name) + +struct default_policy{}; + +namespace detail{ +// +// Trait to work out bits precision from digits10 and digits2: +// +template <class Digits10, class Digits2> +struct precision +{ + // + // Now work out the precision: + // + typedef typename mpl::if_c< + (Digits10::value == 0), + digits2<0>, + digits2<((Digits10::value + 1) * 1000L) / 301L> + >::type digits2_type; +public: +#ifdef __BORLANDC__ + typedef typename mpl::if_c< + (Digits2::value > ::boost::math::policies::detail::precision<Digits10,Digits2>::digits2_type::value), + Digits2, digits2_type>::type type; +#else + typedef typename mpl::if_c< + (Digits2::value > digits2_type::value), + Digits2, digits2_type>::type type; +#endif +}; + +template <class A, class B, bool b> +struct select_result +{ + typedef A type; +}; +template <class A, class B> +struct select_result<A, B, false> +{ + typedef typename mpl::deref<B>::type type; +}; + +template <class Seq, class Pred, class DefaultType> +struct find_arg +{ +private: + typedef typename mpl::find_if<Seq, Pred>::type iter; + typedef typename mpl::end<Seq>::type end_type; +public: + typedef typename select_result< + DefaultType, iter, + ::boost::is_same<iter, end_type>::value>::type type; +}; + +double test_is_valid_arg(...); +double test_is_default_arg(...); +char test_is_valid_arg(const default_policy*); +char test_is_default_arg(const default_policy*); + +template <class T> +struct is_valid_policy_imp +{ + BOOST_STATIC_CONSTANT(bool, value = sizeof(::boost::math::policies::detail::test_is_valid_arg(static_cast<T*>(0))) == 1); +}; + +template <class T> +struct is_default_policy_imp +{ + BOOST_STATIC_CONSTANT(bool, value = sizeof(::boost::math::policies::detail::test_is_default_arg(static_cast<T*>(0))) == 1); +}; + +template <class T> struct is_valid_policy +: public mpl::bool_< + ::boost::math::policies::detail::is_valid_policy_imp<T>::value> +{}; + +template <class T> struct is_default_policy +: public mpl::bool_< + ::boost::math::policies::detail::is_default_policy_imp<T>::value> +{ + template <class U> + struct apply + { + typedef is_default_policy<U> type; + }; +}; + +template <class Seq, class T, int N> +struct append_N +{ + typedef typename mpl::push_back<Seq, T>::type new_seq; + typedef typename append_N<new_seq, T, N-1>::type type; +}; + +template <class Seq, class T> +struct append_N<Seq, T, 0> +{ + typedef Seq type; +}; + +// +// Traits class to work out what template parameters our default +// policy<> class will have when modified for forwarding: +// +template <bool f, bool d> +struct default_args +{ + typedef promote_float<false> arg1; + typedef promote_double<false> arg2; +}; + +template <> +struct default_args<false, false> +{ + typedef default_policy arg1; + typedef default_policy arg2; +}; + +template <> +struct default_args<true, false> +{ + typedef promote_float<false> arg1; + typedef default_policy arg2; +}; + +template <> +struct default_args<false, true> +{ + typedef promote_double<false> arg1; + typedef default_policy arg2; +}; + +typedef default_args<BOOST_MATH_PROMOTE_FLOAT_POLICY, BOOST_MATH_PROMOTE_DOUBLE_POLICY>::arg1 forwarding_arg1; +typedef default_args<BOOST_MATH_PROMOTE_FLOAT_POLICY, BOOST_MATH_PROMOTE_DOUBLE_POLICY>::arg2 forwarding_arg2; + +} // detail +// +// Now define the policy type with enough arguments to handle all +// the policies: +// +template <class A1 = default_policy, + class A2 = default_policy, + class A3 = default_policy, + class A4 = default_policy, + class A5 = default_policy, + class A6 = default_policy, + class A7 = default_policy, + class A8 = default_policy, + class A9 = default_policy, + class A10 = default_policy, + class A11 = default_policy, + class A12 = default_policy, + class A13 = default_policy> +struct policy +{ +private: + // + // Validate all our arguments: + // + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A1>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A2>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A3>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A4>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A5>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A6>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A7>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A8>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A9>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A10>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A11>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A12>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A13>::value); + // + // Typelist of the arguments: + // + typedef mpl::list<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13> arg_list; + +public: + typedef typename detail::find_arg<arg_list, is_domain_error<mpl::_1>, domain_error<> >::type domain_error_type; + typedef typename detail::find_arg<arg_list, is_pole_error<mpl::_1>, pole_error<> >::type pole_error_type; + typedef typename detail::find_arg<arg_list, is_overflow_error<mpl::_1>, overflow_error<> >::type overflow_error_type; + typedef typename detail::find_arg<arg_list, is_underflow_error<mpl::_1>, underflow_error<> >::type underflow_error_type; + typedef typename detail::find_arg<arg_list, is_denorm_error<mpl::_1>, denorm_error<> >::type denorm_error_type; + typedef typename detail::find_arg<arg_list, is_evaluation_error<mpl::_1>, evaluation_error<> >::type evaluation_error_type; + typedef typename detail::find_arg<arg_list, is_rounding_error<mpl::_1>, rounding_error<> >::type rounding_error_type; + typedef typename detail::find_arg<arg_list, is_indeterminate_result_error<mpl::_1>, indeterminate_result_error<> >::type indeterminate_result_error_type; +private: + // + // Now work out the precision: + // + typedef typename detail::find_arg<arg_list, is_digits10<mpl::_1>, digits10<> >::type digits10_type; + typedef typename detail::find_arg<arg_list, is_digits2<mpl::_1>, digits2<> >::type bits_precision_type; +public: + typedef typename detail::precision<digits10_type, bits_precision_type>::type precision_type; + // + // Internal promotion: + // + typedef typename detail::find_arg<arg_list, is_promote_float<mpl::_1>, promote_float<> >::type promote_float_type; + typedef typename detail::find_arg<arg_list, is_promote_double<mpl::_1>, promote_double<> >::type promote_double_type; + // + // Discrete quantiles: + // + typedef typename detail::find_arg<arg_list, is_discrete_quantile<mpl::_1>, discrete_quantile<> >::type discrete_quantile_type; + // + // Mathematically undefined properties: + // + typedef typename detail::find_arg<arg_list, is_assert_undefined<mpl::_1>, assert_undefined<> >::type assert_undefined_type; + // + // Max iterations: + // + typedef typename detail::find_arg<arg_list, is_max_series_iterations<mpl::_1>, max_series_iterations<> >::type max_series_iterations_type; + typedef typename detail::find_arg<arg_list, is_max_root_iterations<mpl::_1>, max_root_iterations<> >::type max_root_iterations_type; +}; +// +// These full specializations are defined to reduce the amount of +// template instantiations that have to take place when using the default +// policies, they have quite a large impact on compile times: +// +template <> +struct policy<default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy> +{ +public: + typedef domain_error<> domain_error_type; + typedef pole_error<> pole_error_type; + typedef overflow_error<> overflow_error_type; + typedef underflow_error<> underflow_error_type; + typedef denorm_error<> denorm_error_type; + typedef evaluation_error<> evaluation_error_type; + typedef rounding_error<> rounding_error_type; + typedef indeterminate_result_error<> indeterminate_result_error_type; +#if BOOST_MATH_DIGITS10_POLICY == 0 + typedef digits2<> precision_type; +#else + typedef detail::precision<digits10<>, digits2<> >::type precision_type; +#endif + typedef promote_float<> promote_float_type; + typedef promote_double<> promote_double_type; + typedef discrete_quantile<> discrete_quantile_type; + typedef assert_undefined<> assert_undefined_type; + typedef max_series_iterations<> max_series_iterations_type; + typedef max_root_iterations<> max_root_iterations_type; +}; + +template <> +struct policy<detail::forwarding_arg1, detail::forwarding_arg2, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy> +{ +public: + typedef domain_error<> domain_error_type; + typedef pole_error<> pole_error_type; + typedef overflow_error<> overflow_error_type; + typedef underflow_error<> underflow_error_type; + typedef denorm_error<> denorm_error_type; + typedef evaluation_error<> evaluation_error_type; + typedef rounding_error<> rounding_error_type; + typedef indeterminate_result_error<> indeterminate_result_error_type; +#if BOOST_MATH_DIGITS10_POLICY == 0 + typedef digits2<> precision_type; +#else + typedef detail::precision<digits10<>, digits2<> >::type precision_type; +#endif + typedef promote_float<false> promote_float_type; + typedef promote_double<false> promote_double_type; + typedef discrete_quantile<> discrete_quantile_type; + typedef assert_undefined<> assert_undefined_type; + typedef max_series_iterations<> max_series_iterations_type; + typedef max_root_iterations<> max_root_iterations_type; +}; + +template <class Policy, + class A1 = default_policy, + class A2 = default_policy, + class A3 = default_policy, + class A4 = default_policy, + class A5 = default_policy, + class A6 = default_policy, + class A7 = default_policy, + class A8 = default_policy, + class A9 = default_policy, + class A10 = default_policy, + class A11 = default_policy, + class A12 = default_policy, + class A13 = default_policy> +struct normalise +{ +private: + typedef mpl::list<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13> arg_list; + typedef typename detail::find_arg<arg_list, is_domain_error<mpl::_1>, typename Policy::domain_error_type >::type domain_error_type; + typedef typename detail::find_arg<arg_list, is_pole_error<mpl::_1>, typename Policy::pole_error_type >::type pole_error_type; + typedef typename detail::find_arg<arg_list, is_overflow_error<mpl::_1>, typename Policy::overflow_error_type >::type overflow_error_type; + typedef typename detail::find_arg<arg_list, is_underflow_error<mpl::_1>, typename Policy::underflow_error_type >::type underflow_error_type; + typedef typename detail::find_arg<arg_list, is_denorm_error<mpl::_1>, typename Policy::denorm_error_type >::type denorm_error_type; + typedef typename detail::find_arg<arg_list, is_evaluation_error<mpl::_1>, typename Policy::evaluation_error_type >::type evaluation_error_type; + typedef typename detail::find_arg<arg_list, is_rounding_error<mpl::_1>, typename Policy::rounding_error_type >::type rounding_error_type; + typedef typename detail::find_arg<arg_list, is_indeterminate_result_error<mpl::_1>, typename Policy::indeterminate_result_error_type >::type indeterminate_result_error_type; + // + // Now work out the precision: + // + typedef typename detail::find_arg<arg_list, is_digits10<mpl::_1>, digits10<> >::type digits10_type; + typedef typename detail::find_arg<arg_list, is_digits2<mpl::_1>, typename Policy::precision_type >::type bits_precision_type; + typedef typename detail::precision<digits10_type, bits_precision_type>::type precision_type; + // + // Internal promotion: + // + typedef typename detail::find_arg<arg_list, is_promote_float<mpl::_1>, typename Policy::promote_float_type >::type promote_float_type; + typedef typename detail::find_arg<arg_list, is_promote_double<mpl::_1>, typename Policy::promote_double_type >::type promote_double_type; + // + // Discrete quantiles: + // + typedef typename detail::find_arg<arg_list, is_discrete_quantile<mpl::_1>, typename Policy::discrete_quantile_type >::type discrete_quantile_type; + // + // Mathematically undefined properties: + // + typedef typename detail::find_arg<arg_list, is_assert_undefined<mpl::_1>, typename Policy::assert_undefined_type >::type assert_undefined_type; + // + // Max iterations: + // + typedef typename detail::find_arg<arg_list, is_max_series_iterations<mpl::_1>, typename Policy::max_series_iterations_type>::type max_series_iterations_type; + typedef typename detail::find_arg<arg_list, is_max_root_iterations<mpl::_1>, typename Policy::max_root_iterations_type>::type max_root_iterations_type; + // + // Define a typelist of the policies: + // + typedef mpl::vector< + domain_error_type, + pole_error_type, + overflow_error_type, + underflow_error_type, + denorm_error_type, + evaluation_error_type, + rounding_error_type, + indeterminate_result_error_type, + precision_type, + promote_float_type, + promote_double_type, + discrete_quantile_type, + assert_undefined_type, + max_series_iterations_type, + max_root_iterations_type> result_list; + // + // Remove all the policies that are the same as the default: + // + typedef typename mpl::remove_if<result_list, detail::is_default_policy<mpl::_> >::type reduced_list; + // + // Pad out the list with defaults: + // + typedef typename detail::append_N<reduced_list, default_policy, (14 - ::boost::mpl::size<reduced_list>::value)>::type result_type; +public: + typedef policy< + typename mpl::at<result_type, mpl::int_<0> >::type, + typename mpl::at<result_type, mpl::int_<1> >::type, + typename mpl::at<result_type, mpl::int_<2> >::type, + typename mpl::at<result_type, mpl::int_<3> >::type, + typename mpl::at<result_type, mpl::int_<4> >::type, + typename mpl::at<result_type, mpl::int_<5> >::type, + typename mpl::at<result_type, mpl::int_<6> >::type, + typename mpl::at<result_type, mpl::int_<7> >::type, + typename mpl::at<result_type, mpl::int_<8> >::type, + typename mpl::at<result_type, mpl::int_<9> >::type, + typename mpl::at<result_type, mpl::int_<10> >::type, + typename mpl::at<result_type, mpl::int_<11> >::type, + typename mpl::at<result_type, mpl::int_<12> >::type > type; +}; +// +// Full specialisation to speed up compilation of the common case: +// +template <> +struct normalise<policy<>, + promote_float<false>, + promote_double<false>, + discrete_quantile<>, + assert_undefined<>, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy> +{ + typedef policy<detail::forwarding_arg1, detail::forwarding_arg2> type; +}; + +template <> +struct normalise<policy<detail::forwarding_arg1, detail::forwarding_arg2>, + promote_float<false>, + promote_double<false>, + discrete_quantile<>, + assert_undefined<>, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy> +{ + typedef policy<detail::forwarding_arg1, detail::forwarding_arg2> type; +}; + +inline policy<> make_policy() +{ return policy<>(); } + +template <class A1> +inline typename normalise<policy<>, A1>::type make_policy(const A1&) +{ + typedef typename normalise<policy<>, A1>::type result_type; + return result_type(); +} + +template <class A1, class A2> +inline typename normalise<policy<>, A1, A2>::type make_policy(const A1&, const A2&) +{ + typedef typename normalise<policy<>, A1, A2>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3> +inline typename normalise<policy<>, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) +{ + typedef typename normalise<policy<>, A1, A2, A3>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4> +inline typename normalise<policy<>, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5> +inline typename normalise<policy<>, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10, class A11> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type result_type; + return result_type(); +} + +// +// Traits class to handle internal promotion: +// +template <class Real, class Policy> +struct evaluation +{ + typedef Real type; +}; + +template <class Policy> +struct evaluation<float, Policy> +{ + typedef typename mpl::if_<typename Policy::promote_float_type, double, float>::type type; +}; + +template <class Policy> +struct evaluation<double, Policy> +{ + typedef typename mpl::if_<typename Policy::promote_double_type, long double, double>::type type; +}; + +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + +template <class Real> +struct basic_digits : public mpl::int_<0>{ }; +template <> +struct basic_digits<float> : public mpl::int_<FLT_MANT_DIG>{ }; +template <> +struct basic_digits<double> : public mpl::int_<DBL_MANT_DIG>{ }; +template <> +struct basic_digits<long double> : public mpl::int_<LDBL_MANT_DIG>{ }; + +template <class Real, class Policy> +struct precision +{ + BOOST_STATIC_ASSERT( ::std::numeric_limits<Real>::radix == 2); + typedef typename Policy::precision_type precision_type; + typedef basic_digits<Real> digits_t; + typedef typename mpl::if_< + mpl::equal_to<digits_t, mpl::int_<0> >, + // Possibly unknown precision: + precision_type, + typename mpl::if_< + mpl::or_<mpl::less_equal<digits_t, precision_type>, mpl::less_equal<precision_type, mpl::int_<0> > >, + // Default case, full precision for RealType: + digits2< ::std::numeric_limits<Real>::digits>, + // User customised precision: + precision_type + >::type + >::type type; +}; + +template <class Policy> +struct precision<float, Policy> +{ + typedef digits2<FLT_MANT_DIG> type; +}; +template <class Policy> +struct precision<double, Policy> +{ + typedef digits2<DBL_MANT_DIG> type; +}; +template <class Policy> +struct precision<long double, Policy> +{ + typedef digits2<LDBL_MANT_DIG> type; +}; + +#else + +template <class Real, class Policy> +struct precision +{ + BOOST_STATIC_ASSERT((::std::numeric_limits<Real>::radix == 2) || ((::std::numeric_limits<Real>::is_specialized == 0) || (::std::numeric_limits<Real>::digits == 0))); +#ifndef __BORLANDC__ + typedef typename Policy::precision_type precision_type; + typedef typename mpl::if_c< + ((::std::numeric_limits<Real>::is_specialized == 0) || (::std::numeric_limits<Real>::digits == 0)), + // Possibly unknown precision: + precision_type, + typename mpl::if_c< + ((::std::numeric_limits<Real>::digits <= precision_type::value) + || (Policy::precision_type::value <= 0)), + // Default case, full precision for RealType: + digits2< ::std::numeric_limits<Real>::digits>, + // User customised precision: + precision_type + >::type + >::type type; +#else + typedef typename Policy::precision_type precision_type; + typedef mpl::int_< ::std::numeric_limits<Real>::digits> digits_t; + typedef mpl::bool_< ::std::numeric_limits<Real>::is_specialized> spec_t; + typedef typename mpl::if_< + mpl::or_<mpl::equal_to<spec_t, mpl::false_>, mpl::equal_to<digits_t, mpl::int_<0> > >, + // Possibly unknown precision: + precision_type, + typename mpl::if_< + mpl::or_<mpl::less_equal<digits_t, precision_type>, mpl::less_equal<precision_type, mpl::int_<0> > >, + // Default case, full precision for RealType: + digits2< ::std::numeric_limits<Real>::digits>, + // User customised precision: + precision_type + >::type + >::type type; +#endif +}; + +#endif + +namespace detail{ + +template <class T, class Policy> +inline int digits_imp(mpl::true_ const&) +{ +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized); +#else + BOOST_ASSERT(::std::numeric_limits<T>::is_specialized); +#endif + typedef typename boost::math::policies::precision<T, Policy>::type p_t; + return p_t::value; +} + +template <class T, class Policy> +inline int digits_imp(mpl::false_ const&) +{ + return tools::digits<T>(); +} + +} // namespace detail + +template <class T, class Policy> +inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) +{ + typedef mpl::bool_< std::numeric_limits<T>::is_specialized > tag_type; + return detail::digits_imp<T, Policy>(tag_type()); +} + +template <class Policy> +inline unsigned long get_max_series_iterations() +{ + typedef typename Policy::max_series_iterations_type iter_type; + return iter_type::value; +} + +template <class Policy> +inline unsigned long get_max_root_iterations() +{ + typedef typename Policy::max_root_iterations_type iter_type; + return iter_type::value; +} + +namespace detail{ + +template <class T, class Digits, class Small, class Default> +struct series_factor_calc +{ + static T get() + { + return ldexp(T(1.0), 1 - Digits::value); + } +}; + +template <class T, class Digits> +struct series_factor_calc<T, Digits, mpl::true_, mpl::true_> +{ + static T get() + { + return boost::math::tools::epsilon<T>(); + } +}; +template <class T, class Digits> +struct series_factor_calc<T, Digits, mpl::true_, mpl::false_> +{ + static T get() + { + static const boost::uintmax_t v = static_cast<boost::uintmax_t>(1u) << (Digits::value - 1); + return 1 / static_cast<T>(v); + } +}; +template <class T, class Digits> +struct series_factor_calc<T, Digits, mpl::false_, mpl::true_> +{ + static T get() + { + return boost::math::tools::epsilon<T>(); + } +}; + +template <class T, class Policy> +inline T get_epsilon_imp(mpl::true_ const&) +{ +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized); + BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::radix == 2); +#else + BOOST_ASSERT(::std::numeric_limits<T>::is_specialized); + BOOST_ASSERT(::std::numeric_limits<T>::radix == 2); +#endif + typedef typename boost::math::policies::precision<T, Policy>::type p_t; + typedef mpl::bool_<p_t::value <= std::numeric_limits<boost::uintmax_t>::digits> is_small_int; + typedef mpl::bool_<p_t::value >= std::numeric_limits<T>::digits> is_default_value; + return series_factor_calc<T, p_t, is_small_int, is_default_value>::get(); +} + +template <class T, class Policy> +inline T get_epsilon_imp(mpl::false_ const&) +{ + return tools::epsilon<T>(); +} + +} // namespace detail + +template <class T, class Policy> +inline T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) +{ + typedef mpl::bool_< (std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2)) > tag_type; + return detail::get_epsilon_imp<T, Policy>(tag_type()); +} + +namespace detail{ + +template <class A1, + class A2, + class A3, + class A4, + class A5, + class A6, + class A7, + class A8, + class A9, + class A10, + class A11> +char test_is_policy(const policy<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11>*); +double test_is_policy(...); + +template <class P> +struct is_policy_imp +{ + BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::math::policies::detail::test_is_policy(static_cast<P*>(0))) == 1)); +}; + +} + +template <class P> +struct is_policy : public mpl::bool_< ::boost::math::policies::detail::is_policy_imp<P>::value> {}; + +// +// Helper traits class for distribution error handling: +// +template <class Policy> +struct constructor_error_check +{ + typedef typename Policy::domain_error_type domain_error_type; + typedef typename mpl::if_c< + (domain_error_type::value == throw_on_error) || (domain_error_type::value == user_error), + mpl::true_, + mpl::false_>::type type; +}; + +template <class Policy> +struct method_error_check +{ + typedef typename Policy::domain_error_type domain_error_type; + typedef typename mpl::if_c< + (domain_error_type::value == throw_on_error) && (domain_error_type::value != user_error), + mpl::false_, + mpl::true_>::type type; +}; + +}}} // namespaces + +#endif // BOOST_MATH_POLICY_HPP + + + diff --git a/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp b/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp new file mode 100644 index 0000000..50c034d --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp @@ -0,0 +1,570 @@ +// fp_traits.hpp + +#ifndef BOOST_MATH_FP_TRAITS_HPP +#define BOOST_MATH_FP_TRAITS_HPP + +// Copyright (c) 2006 Johan Rade + +// 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) + +/* +To support old compilers, care has been taken to avoid partial template +specialization and meta function forwarding. +With these techniques, the code could be simplified. +*/ + +#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT +// The VAX floating point formats are used (for float and double) +# define BOOST_FPCLASSIFY_VAX_FORMAT +#endif + +#include <cstring> + +#include <boost/assert.hpp> +#include <boost/cstdint.hpp> +#include <boost/detail/endian.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/is_floating_point.hpp> + +#ifdef BOOST_NO_STDC_NAMESPACE + namespace std{ using ::memcpy; } +#endif + +#ifndef FP_NORMAL + +#define FP_ZERO 0 +#define FP_NORMAL 1 +#define FP_INFINITE 2 +#define FP_NAN 3 +#define FP_SUBNORMAL 4 + +#else + +#define BOOST_HAS_FPCLASSIFY + +#ifndef fpclassify +# if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) \ + && defined(_GLIBCXX_USE_C99_MATH) \ + && !(defined(_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) \ + && (_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC != 0)) +# ifdef _STLP_VENDOR_CSTD +# if _STLPORT_VERSION >= 0x520 +# define BOOST_FPCLASSIFY_PREFIX ::__std_alias:: +# else +# define BOOST_FPCLASSIFY_PREFIX ::_STLP_VENDOR_CSTD:: +# endif +# else +# define BOOST_FPCLASSIFY_PREFIX ::std:: +# endif +# else +# undef BOOST_HAS_FPCLASSIFY +# define BOOST_FPCLASSIFY_PREFIX +# endif +#elif (defined(__HP_aCC) && !defined(__hppa)) +// aCC 6 appears to do "#define fpclassify fpclassify" which messes us up a bit! +# define BOOST_FPCLASSIFY_PREFIX :: +#else +# define BOOST_FPCLASSIFY_PREFIX +#endif + +#ifdef __MINGW32__ +# undef BOOST_HAS_FPCLASSIFY +#endif + +#endif + + +//------------------------------------------------------------------------------ + +namespace boost { +namespace math { +namespace detail { + +//------------------------------------------------------------------------------ + +/* +The following classes are used to tag the different methods that are used +for floating point classification +*/ + +struct native_tag {}; +template <bool has_limits> +struct generic_tag {}; +struct ieee_tag {}; +struct ieee_copy_all_bits_tag : public ieee_tag {}; +struct ieee_copy_leading_bits_tag : public ieee_tag {}; + +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +// +// These helper functions are used only when numeric_limits<> +// members are not compile time constants: +// +inline bool is_generic_tag_false(const generic_tag<false>*) +{ + return true; +} +inline bool is_generic_tag_false(const void*) +{ + return false; +} +#endif + +//------------------------------------------------------------------------------ + +/* +Most processors support three different floating point precisions: +single precision (32 bits), double precision (64 bits) +and extended double precision (80 - 128 bits, depending on the processor) + +Note that the C++ type long double can be implemented +both as double precision and extended double precision. +*/ + +struct unknown_precision{}; +struct single_precision {}; +struct double_precision {}; +struct extended_double_precision {}; + +// native_tag version -------------------------------------------------------------- + +template<class T> struct fp_traits_native +{ + typedef native_tag method; +}; + +// generic_tag version ------------------------------------------------------------- + +template<class T, class U> struct fp_traits_non_native +{ +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + typedef generic_tag<std::numeric_limits<T>::is_specialized> method; +#else + typedef generic_tag<false> method; +#endif +}; + +// ieee_tag versions --------------------------------------------------------------- + +/* +These specializations of fp_traits_non_native contain information needed +to "parse" the binary representation of a floating point number. + +Typedef members: + + bits -- the target type when copying the leading bytes of a floating + point number. It is a typedef for uint32_t or uint64_t. + + method -- tells us whether all bytes are copied or not. + It is a typedef for ieee_copy_all_bits_tag or ieee_copy_leading_bits_tag. + +Static data members: + + sign, exponent, flag, significand -- bit masks that give the meaning of the + bits in the leading bytes. + +Static function members: + + get_bits(), set_bits() -- provide access to the leading bytes. + +*/ + +// ieee_tag version, float (32 bits) ----------------------------------------------- + +#ifndef BOOST_FPCLASSIFY_VAX_FORMAT + +template<> struct fp_traits_non_native<float, single_precision> +{ + typedef ieee_copy_all_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7f800000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x007fffff); + + typedef uint32_t bits; + static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); } + static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); } +}; + +// ieee_tag version, double (64 bits) ---------------------------------------------- + +#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) \ + || defined(__BORLANDC__) || defined(__CODEGEAR__) + +template<> struct fp_traits_non_native<double, double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 4); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +//.............................................................................. + +#else + +template<> struct fp_traits_non_native<double, double_precision> +{ + typedef ieee_copy_all_bits_tag method; + + static const uint64_t sign = ((uint64_t)0x80000000u) << 32; + static const uint64_t exponent = ((uint64_t)0x7ff00000) << 32; + static const uint64_t flag = 0; + static const uint64_t significand + = (((uint64_t)0x000fffff) << 32) + ((uint64_t)0xffffffffu); + + typedef uint64_t bits; + static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); } + static void set_bits(double& x, uint64_t a) { std::memcpy(&x, &a, 8); } +}; + +#endif + +#endif // #ifndef BOOST_FPCLASSIFY_VAX_FORMAT + +// long double (64 bits) ------------------------------------------------------- + +#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ + || defined(__BORLANDC__) || defined(__CODEGEAR__) + +template<> struct fp_traits_non_native<long double, double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 4); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +//.............................................................................. + +#else + +template<> struct fp_traits_non_native<long double, double_precision> +{ + typedef ieee_copy_all_bits_tag method; + + static const uint64_t sign = (uint64_t)0x80000000u << 32; + static const uint64_t exponent = (uint64_t)0x7ff00000 << 32; + static const uint64_t flag = 0; + static const uint64_t significand + = ((uint64_t)0x000fffff << 32) + (uint64_t)0xffffffffu; + + typedef uint64_t bits; + static void get_bits(long double x, uint64_t& a) { std::memcpy(&a, &x, 8); } + static void set_bits(long double& x, uint64_t a) { std::memcpy(&x, &a, 8); } +}; + +#endif + + +// long double (>64 bits), x86 and x64 ----------------------------------------- + +#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \ + || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) \ + || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) + +// Intel extended double precision format (80 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x00007fff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + 6, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + 6, &a, 4); + } +}; + + +// long double (>64 bits), Itanium --------------------------------------------- + +#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) + +// The floating point format is unknown at compile time +// No template specialization is provided. +// The generic_tag definition is used. + +// The Itanium supports both +// the Intel extended double precision format (80 bits) and +// the IEEE extended double precision format with 15 exponent bits (128 bits). + + +// long double (>64 bits), PowerPC --------------------------------------------- + +#elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) \ + || defined(__ppc) || defined(__ppc__) || defined(__PPC__) + +// PowerPC extended double precision format (128 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 12); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + + +// long double (>64 bits), Motorola 68K ---------------------------------------- + +#elif defined(__m68k) || defined(__m68k__) \ + || defined(__mc68000) || defined(__mc68000__) \ + +// Motorola extended double precision format (96 bits) + +// It is the same format as the Intel extended double precision format, +// except that 1) it is big-endian, 2) the 3rd and 4th byte are padding, and +// 3) the flag bit is not set for infinity + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x00007fff); + + // copy 1st, 2nd, 5th and 6th byte. 3rd and 4th byte are padding. + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, &x, 2); + std::memcpy(reinterpret_cast<unsigned char*>(&a) + 2, + reinterpret_cast<const unsigned char*>(&x) + 4, 2); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(&x, &a, 2); + std::memcpy(reinterpret_cast<unsigned char*>(&x) + 4, + reinterpret_cast<const unsigned char*>(&a) + 2, 2); + } +}; + + +// long double (>64 bits), All other processors -------------------------------- + +#else + +// IEEE extended double precision format with 15 exponent bits (128 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x0000ffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 12); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +#endif + +//------------------------------------------------------------------------------ + +// size_to_precision is a type switch for converting a C++ floating point type +// to the corresponding precision type. + +template<int n, bool fp> struct size_to_precision +{ + typedef unknown_precision type; +}; + +template<> struct size_to_precision<4, true> +{ + typedef single_precision type; +}; + +template<> struct size_to_precision<8, true> +{ + typedef double_precision type; +}; + +template<> struct size_to_precision<10, true> +{ + typedef extended_double_precision type; +}; + +template<> struct size_to_precision<12, true> +{ + typedef extended_double_precision type; +}; + +template<> struct size_to_precision<16, true> +{ + typedef extended_double_precision type; +}; + +//------------------------------------------------------------------------------ +// +// Figure out whether to use native classification functions based on +// whether T is a built in floating point type or not: +// +template <class T> +struct select_native +{ + typedef BOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T), ::boost::is_floating_point<T>::value>::type precision; + typedef fp_traits_non_native<T, precision> type; +}; +template<> +struct select_native<float> +{ + typedef fp_traits_native<float> type; +}; +template<> +struct select_native<double> +{ + typedef fp_traits_native<double> type; +}; +template<> +struct select_native<long double> +{ + typedef fp_traits_native<long double> type; +}; + +//------------------------------------------------------------------------------ + +// fp_traits is a type switch that selects the right fp_traits_non_native + +#if (defined(BOOST_MATH_USE_C99) && !(defined(__GNUC__) && (__GNUC__ < 4))) \ + && !defined(__hpux) \ + && !defined(__DECCXX)\ + && !defined(__osf__) \ + && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\ + && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) +# define BOOST_MATH_USE_STD_FPCLASSIFY +#endif + +template<class T> struct fp_traits +{ + typedef BOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T), ::boost::is_floating_point<T>::value>::type precision; +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) + typedef typename select_native<T>::type type; +#else + typedef fp_traits_non_native<T, precision> type; +#endif + typedef fp_traits_non_native<T, precision> sign_change_type; +}; + +//------------------------------------------------------------------------------ + +} // namespace detail +} // namespace math +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp b/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp new file mode 100644 index 0000000..952259a --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp @@ -0,0 +1,80 @@ +// Copyright John Maddock 2008. + +// Use, modification and distribution are subject to 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 BOOST_MATH_SPECIAL_ROUND_FWD_HPP +#define BOOST_MATH_SPECIAL_ROUND_FWD_HPP + +#include <boost/config.hpp> + +#ifdef _MSC_VER +#pragma once +#endif + +namespace boost +{ + namespace math + { + + template <class T, class Policy> + T trunc(const T& v, const Policy& pol); + template <class T> + T trunc(const T& v); + template <class T, class Policy> + int itrunc(const T& v, const Policy& pol); + template <class T> + int itrunc(const T& v); + template <class T, class Policy> + long ltrunc(const T& v, const Policy& pol); + template <class T> + long ltrunc(const T& v); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + boost::long_long_type lltrunc(const T& v, const Policy& pol); + template <class T> + boost::long_long_type lltrunc(const T& v); +#endif + template <class T, class Policy> + T round(const T& v, const Policy& pol); + template <class T> + T round(const T& v); + template <class T, class Policy> + int iround(const T& v, const Policy& pol); + template <class T> + int iround(const T& v); + template <class T, class Policy> + long lround(const T& v, const Policy& pol); + template <class T> + long lround(const T& v); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + boost::long_long_type llround(const T& v, const Policy& pol); + template <class T> + boost::long_long_type llround(const T& v); +#endif + template <class T, class Policy> + T modf(const T& v, T* ipart, const Policy& pol); + template <class T> + T modf(const T& v, T* ipart); + template <class T, class Policy> + T modf(const T& v, int* ipart, const Policy& pol); + template <class T> + T modf(const T& v, int* ipart); + template <class T, class Policy> + T modf(const T& v, long* ipart, const Policy& pol); + template <class T> + T modf(const T& v, long* ipart); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + T modf(const T& v, boost::long_long_type* ipart, const Policy& pol); + template <class T> + T modf(const T& v, boost::long_long_type* ipart); +#endif + + } +} +#endif // BOOST_MATH_SPECIAL_ROUND_FWD_HPP + diff --git a/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp new file mode 100644 index 0000000..6f92d18 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp @@ -0,0 +1,537 @@ +// Copyright John Maddock 2005-2008. +// Copyright (c) 2006-2008 Johan Rade +// Use, modification and distribution are subject to 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 BOOST_MATH_FPCLASSIFY_HPP +#define BOOST_MATH_FPCLASSIFY_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <math.h> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/limits.hpp> +#include <boost/math/tools/real_cast.hpp> +#include <boost/type_traits/is_floating_point.hpp> +#include <boost/math/special_functions/math_fwd.hpp> +#include <boost/math/special_functions/detail/fp_traits.hpp> +/*! + \file fpclassify.hpp + \brief Classify floating-point value as normal, subnormal, zero, infinite, or NaN. + \version 1.0 + \author John Maddock + */ + +/* + +1. If the platform is C99 compliant, then the native floating point +classification functions are used. However, note that we must only +define the functions which call std::fpclassify etc if that function +really does exist: otherwise a compiler may reject the code even though +the template is never instantiated. + +2. If the platform is not C99 compliant, and the binary format for +a floating point type (float, double or long double) can be determined +at compile time, then the following algorithm is used: + + If all exponent bits, the flag bit (if there is one), + and all significand bits are 0, then the number is zero. + + If all exponent bits and the flag bit (if there is one) are 0, + and at least one significand bit is 1, then the number is subnormal. + + If all exponent bits are 1 and all significand bits are 0, + then the number is infinity. + + If all exponent bits are 1 and at least one significand bit is 1, + then the number is a not-a-number. + + Otherwise the number is normal. + + This algorithm works for the IEEE 754 representation, + and also for several non IEEE 754 formats. + + Most formats have the structure + sign bit + exponent bits + significand bits. + + A few have the structure + sign bit + exponent bits + flag bit + significand bits. + The flag bit is 0 for zero and subnormal numbers, + and 1 for normal numbers and NaN. + It is 0 (Motorola 68K) or 1 (Intel) for infinity. + + To get the bits, the four or eight most significant bytes are copied + into an uint32_t or uint64_t and bit masks are applied. + This covers all the exponent bits and the flag bit (if there is one), + but not always all the significand bits. + Some of the functions below have two implementations, + depending on whether all the significand bits are copied or not. + +3. If the platform is not C99 compliant, and the binary format for +a floating point type (float, double or long double) can not be determined +at compile time, then comparison with std::numeric_limits values +is used. + +*/ + +#if defined(_MSC_VER) || defined(__BORLANDC__) +#include <float.h> +#endif + +#ifdef BOOST_NO_STDC_NAMESPACE + namespace std{ using ::abs; using ::fabs; } +#endif + +namespace boost{ + +// +// This must not be located in any namespace under boost::math +// otherwise we can get into an infinite loop if isnan is +// a #define for "isnan" ! +// +namespace math_detail{ + +template <class T> +inline bool is_nan_helper(T t, const boost::true_type&) +{ +#ifdef isnan + return isnan(t); +#elif defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) || !defined(BOOST_HAS_FPCLASSIFY) + return false; +#else // BOOST_HAS_FPCLASSIFY + return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == (int)FP_NAN); +#endif +} + +template <class T> +inline bool is_nan_helper(T, const boost::false_type&) +{ + return false; +} + +} + +namespace math{ + +namespace detail{ + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const native_tag&) +{ + return (std::fpclassify)(t); +} +#endif + +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<true>&) +{ + BOOST_MATH_INSTRUMENT_VARIABLE(t); + + // whenever possible check for Nan's first: +#if defined(BOOST_HAS_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) + if(::boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>())) + return FP_NAN; +#elif defined(isnan) + if(boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>())) + return FP_NAN; +#elif defined(_MSC_VER) || defined(__BORLANDC__) + if(::_isnan(boost::math::tools::real_cast<double>(t))) + return FP_NAN; +#endif + // std::fabs broken on a few systems especially for long long!!!! + T at = (t < T(0)) ? -t : t; + + // Use a process of exclusion to figure out + // what kind of type we have, this relies on + // IEEE conforming reals that will treat + // Nan's as unordered. Some compilers + // don't do this once optimisations are + // turned on, hence the check for nan's above. + if(at <= (std::numeric_limits<T>::max)()) + { + if(at >= (std::numeric_limits<T>::min)()) + return FP_NORMAL; + return (at != 0) ? FP_SUBNORMAL : FP_ZERO; + } + else if(at > (std::numeric_limits<T>::max)()) + return FP_INFINITE; + return FP_NAN; +} + +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<false>&) +{ +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return fpclassify_imp(t, generic_tag<true>()); +#endif + // + // An unknown type with no numeric_limits support, + // so what are we supposed to do we do here? + // + BOOST_MATH_INSTRUMENT_VARIABLE(t); + + return t == 0 ? FP_ZERO : FP_NORMAL; +} + +template<class T> +int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_all_bits_tag) +{ + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_MATH_INSTRUMENT_VARIABLE(x); + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + BOOST_MATH_INSTRUMENT_VARIABLE(a); + a &= traits::exponent | traits::flag | traits::significand; + BOOST_MATH_INSTRUMENT_VARIABLE((traits::exponent | traits::flag | traits::significand)); + BOOST_MATH_INSTRUMENT_VARIABLE(a); + + if(a <= traits::significand) { + if(a == 0) + return FP_ZERO; + else + return FP_SUBNORMAL; + } + + if(a < traits::exponent) return FP_NORMAL; + + a &= traits::significand; + if(a == 0) return FP_INFINITE; + + return FP_NAN; +} + +template<class T> +int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag) +{ + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_MATH_INSTRUMENT_VARIABLE(x); + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::flag | traits::significand; + + if(a <= traits::significand) { + if(x == 0) + return FP_ZERO; + else + return FP_SUBNORMAL; + } + + if(a < traits::exponent) return FP_NORMAL; + + a &= traits::significand; + traits::set_bits(x,a); + if(x == 0) return FP_INFINITE; + + return FP_NAN; +} + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline int fpclassify_imp<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::fpclassify_imp(t, generic_tag<true>()); +} +#endif + +} // namespace detail + +template <class T> +inline int fpclassify BOOST_NO_MACRO_EXPAND(T t) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename tools::promote_args<T>::type value_type; +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0))) + return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>()); + return detail::fpclassify_imp(static_cast<value_type>(t), method()); +#else + return detail::fpclassify_imp(static_cast<value_type>(t), method()); +#endif +} + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isfinite_impl(T x, native_tag const&) + { + return (std::isfinite)(x); + } +#endif + + template<class T> + inline bool isfinite_impl(T x, generic_tag<true> const&) + { + return x >= -(std::numeric_limits<T>::max)() + && x <= (std::numeric_limits<T>::max)(); + } + + template<class T> + inline bool isfinite_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isfinite_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression. + return true; + } + + template<class T> + inline bool isfinite_impl(T x, ieee_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits; + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent; + return a != traits::exponent; + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isfinite_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isfinite_impl(t, generic_tag<true>()); +} +#endif + +} + +template<class T> +inline bool (isfinite)(T x) +{ //!< \brief return true if floating-point type t is finite. + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isfinite_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isnormal_impl(T x, native_tag const&) + { + return (std::isnormal)(x); + } +#endif + + template<class T> + inline bool isnormal_impl(T x, generic_tag<true> const&) + { + if(x < 0) x = -x; + return x >= (std::numeric_limits<T>::min)() + && x <= (std::numeric_limits<T>::max)(); + } + + template<class T> + inline bool isnormal_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isnormal_impl(x, generic_tag<true>()); +#endif + return !(x == 0); + } + + template<class T> + inline bool isnormal_impl(T x, ieee_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits; + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::flag; + return (a != 0) && (a < traits::exponent); + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isnormal_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isnormal_impl(t, generic_tag<true>()); +} +#endif + +} + +template<class T> +inline bool (isnormal)(T x) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isnormal_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isinf_impl(T x, native_tag const&) + { + return (std::isinf)(x); + } +#endif + + template<class T> + inline bool isinf_impl(T x, generic_tag<true> const&) + { + (void)x; // in case the compiler thinks that x is unused because std::numeric_limits<T>::has_infinity is false + return std::numeric_limits<T>::has_infinity + && ( x == std::numeric_limits<T>::infinity() + || x == -std::numeric_limits<T>::infinity()); + } + + template<class T> + inline bool isinf_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isinf_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression. + return false; + } + + template<class T> + inline bool isinf_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + return a == traits::exponent; + } + + template<class T> + inline bool isinf_impl(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + if(a != traits::exponent) + return false; + + traits::set_bits(x,0); + return x == 0; + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isinf_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isinf_impl(t, generic_tag<true>()); +} +#endif + +} // namespace detail + +template<class T> +inline bool (isinf)(T x) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isinf_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isnan_impl(T x, native_tag const&) + { + return (std::isnan)(x); + } +#endif + + template<class T> + inline bool isnan_impl(T x, generic_tag<true> const&) + { + return std::numeric_limits<T>::has_infinity + ? !(x <= std::numeric_limits<T>::infinity()) + : x != x; + } + + template<class T> + inline bool isnan_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isnan_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression + return false; + } + + template<class T> + inline bool isnan_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + return a > traits::exponent; + } + + template<class T> + inline bool isnan_impl(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + + a &= traits::exponent | traits::significand; + if(a < traits::exponent) + return false; + + a &= traits::significand; + traits::set_bits(x,a); + return x != 0; + } + +} // namespace detail + +template<class T> bool (isnan)(T x) +{ //!< \brief return true if floating-point type t is NaN (Not A Number). + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + return detail::isnan_impl(x, method()); +} + +#ifdef isnan +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +#endif + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_FPCLASSIFY_HPP + diff --git a/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp b/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp new file mode 100644 index 0000000..6669e3f --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp @@ -0,0 +1,1296 @@ +// math_fwd.hpp + +// TODO revise completely for new distribution classes. + +// Copyright Paul A. Bristow 2006. +// Copyright John Maddock 2006. + +// Use, modification and distribution are subject to 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) + +// Omnibus list of forward declarations of math special functions. + +// IT = Integer type. +// RT = Real type (built-in floating-point types, float, double, long double) & User Defined Types +// AT = Integer or Real type + +#ifndef BOOST_MATH_SPECIAL_MATH_FWD_HPP +#define BOOST_MATH_SPECIAL_MATH_FWD_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <boost/math/special_functions/detail/round_fwd.hpp> +#include <boost/math/tools/promotion.hpp> // for argument promotion. +#include <boost/math/policies/policy.hpp> +#include <boost/mpl/comparison.hpp> +#include <boost/config/no_tr1/complex.hpp> + +#define BOOST_NO_MACRO_EXPAND /**/ + +namespace boost +{ + namespace math + { // Math functions (in roughly alphabetic order). + + // Beta functions. + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type + beta(RT1 a, RT2 b); // Beta function (2 arguments). + + template <class RT1, class RT2, class A> + typename tools::promote_args<RT1, RT2, A>::type + beta(RT1 a, RT2 b, A x); // Beta function (3 arguments). + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + beta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Beta function (3 arguments). + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + betac(RT1 a, RT2 b, RT3 x); + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + betac(RT1 a, RT2 b, RT3 x, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta(RT1 a, RT2 b, RT3 x); // Incomplete beta function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac(RT1 a, RT2 b, RT3 x); // Incomplete beta complement function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta complement function. + + template <class T1, class T2, class T3, class T4> + typename tools::promote_args<T1, T2, T3, T4>::type + ibeta_inv(T1 a, T2 b, T3 p, T4* py); + + template <class T1, class T2, class T3, class T4, class Policy> + typename tools::promote_args<T1, T2, T3, T4>::type + ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inv(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inv(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inva(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inva(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_invb(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_invb(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class T1, class T2, class T3, class T4> + typename tools::promote_args<T1, T2, T3, T4>::type + ibetac_inv(T1 a, T2 b, T3 q, T4* py); + + template <class T1, class T2, class T3, class T4, class Policy> + typename tools::promote_args<T1, T2, T3, T4>::type + ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inv(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inva(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inva(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_invb(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_invb(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_derivative(RT1 a, RT2 b, RT3 x); // derivative of incomplete beta + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy& pol); // derivative of incomplete beta + + // erf & erfc error functions. + template <class RT> // Error function. + typename tools::promote_args<RT>::type erf(RT z); + template <class RT, class Policy> // Error function. + typename tools::promote_args<RT>::type erf(RT z, const Policy&); + + template <class RT>// Error function complement. + typename tools::promote_args<RT>::type erfc(RT z); + template <class RT, class Policy>// Error function complement. + typename tools::promote_args<RT>::type erfc(RT z, const Policy&); |
Swift