diff options
author | brgayazov <brgayazov@yandex-team.com> | 2022-10-09 01:35:10 +0300 |
---|---|---|
committer | brgayazov <brgayazov@yandex-team.com> | 2022-10-09 01:35:10 +0300 |
commit | ee1f58dfc0201eaf78c0a767680f3c9f9f347740 (patch) | |
tree | 375ae9bcfa05e7fe58192c9d595a84afd997a14e | |
parent | 35b65c84fba4bca4976ace7ae00a4e4bef6e1ca8 (diff) | |
download | ydb-ee1f58dfc0201eaf78c0a767680f3c9f9f347740.tar.gz |
Added commands profile update and profile replace
111 files changed, 218 insertions, 16692 deletions
diff --git a/contrib/restricted/boost/LICENSE_1_0.txt b/contrib/restricted/boost/LICENSE_1_0.txt deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/README.md b/contrib/restricted/boost/README.md deleted file mode 100644 index a33f951cc3..0000000000 --- a/contrib/restricted/boost/README.md +++ /dev/null @@ -1,15 +0,0 @@ -Ограничения при использовании библиотеки boost в Аркадии -======================================================== - -1. Старые проекты извне аркадии могут использовать `boost` -2. Можно использовать `boost`, когда нет альтернативы (внутренней или внешней). - Если хочется использовать boost, заведите тикет в очереди CONTRIB [1], - обоснуйте в нём необходимость и получите OK от Комитета CONTRIB [2]. -3. Можно использовать `boost` по зависимостям от `contrib/`. В `library/` нельзя. - Есть единственное исключение в `library/`, но это недоработка того, - что никак не положат новую версию `hyperscan`: IGNIETFERRO-588 [3] -4. Рекомендуется прятать в `.cpp`, чтобы не светилось в заголовках. - -[1] https://st.yandex-team.ru/CONTRIB -[2] https://wiki.yandex-team.ru/arcadia/faq/add-to-contrib-howto/ -[3] https://st.yandex-team.ru/IGNIETFERRO-588 diff --git a/contrib/restricted/boost/arcadia_test/python/mod/module.cpp b/contrib/restricted/boost/arcadia_test/python/mod/module.cpp deleted file mode 100644 index 6053f30c81..0000000000 --- a/contrib/restricted/boost/arcadia_test/python/mod/module.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include <boost/python.hpp> - -using namespace boost::python; - -static const char* hello() { - return "hello world!"; -} - -BOOST_PYTHON_MODULE(arcadia_boost_python_test) { - def("hello", &hello); -} diff --git a/contrib/restricted/boost/arcadia_test/python/py2/test_hello.py b/contrib/restricted/boost/arcadia_test/python/py2/test_hello.py deleted file mode 100644 index 67d1d8f06a..0000000000 --- a/contrib/restricted/boost/arcadia_test/python/py2/test_hello.py +++ /dev/null @@ -1,5 +0,0 @@ -import arcadia_boost_python_test as M - - -def test_hello(): - assert M.hello() == "hello world!" diff --git a/contrib/restricted/boost/arcadia_test/python/py3/test_hello.py b/contrib/restricted/boost/arcadia_test/python/py3/test_hello.py deleted file mode 100644 index 67d1d8f06a..0000000000 --- a/contrib/restricted/boost/arcadia_test/python/py3/test_hello.py +++ /dev/null @@ -1,5 +0,0 @@ -import arcadia_boost_python_test as M - - -def test_hello(): - assert M.hello() == "hello world!" diff --git a/contrib/restricted/boost/arcadia_test/test_shared_ptr.cpp b/contrib/restricted/boost/arcadia_test/test_shared_ptr.cpp deleted file mode 100644 index 10d0589248..0000000000 --- a/contrib/restricted/boost/arcadia_test/test_shared_ptr.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Иногда требуется создать умные указатели (shared_ptr) на константные объекты. - * Если при этом используется enable_shared_from_this, то первый shared_ptr не - * инициализирует weak_ptr лежищий внутри enable_shared_from_this. - * Это приводит к тому, что метод shared_from_this() кидает исключение. - * Это происходит из-за того, что шаблонная функция ipcdetails::sp_enable_shared_from_this, - * вызываемая в конструкторе shared_ptr не может сматчить входящие аргументы. - * Данная ошибка исправляется путем довления константности к типу входящего артумента 'pe'. - */ - -#include <library/cpp/testing/unittest/registar.h> -#include <boost/interprocess/smart_ptr/shared_ptr.hpp> -#include <boost/interprocess/smart_ptr/enable_shared_from_this.hpp> -#include <type_traits> -#include <stdlib.h> - -using Allocator = std::allocator<void>; - -template <bool Const> -struct TestTypes { - class TestClass; - - class Deleter { - public: - using const_pointer = TestClass const*; - using pointer = const_pointer; - - Deleter& operator ()(pointer p) { - delete p; - return *this; - } - }; - - class TestClass: - public boost::interprocess::enable_shared_from_this<typename std::conditional<Const, const TestClass, TestClass>::type, Allocator, Deleter> - { - }; - - using shared_ptr = boost::interprocess::shared_ptr<typename std::conditional<Const, const TestClass, TestClass>::type, Allocator, Deleter>; -}; - -template <bool ConstPtr, bool ConstSharedPtr> -void test() { - using T = typename TestTypes<ConstSharedPtr>::TestClass; - using shared_ptr = typename TestTypes<ConstSharedPtr>::shared_ptr; - T* p = new T; - typename std::conditional<ConstPtr, T* const, T*>::type ptr = p; - shared_ptr sptr1(ptr); - UNIT_ASSERT_VALUES_EQUAL(sptr1.use_count(), 1); - { - shared_ptr sptr2 = p->shared_from_this(); - UNIT_ASSERT_VALUES_EQUAL(sptr2.use_count(), 2); - } - UNIT_ASSERT_VALUES_EQUAL(sptr1.use_count(), 1); -} - -Y_UNIT_TEST_SUITE(TestSharedPtr) { - Y_UNIT_TEST(NonConst_NonConst) { - test<false, false>(); - } - Y_UNIT_TEST(NonConst_Const) { - test<false, true>(); - } - Y_UNIT_TEST(Const_Const) { - test<true, true>(); - } -}; - diff --git a/contrib/restricted/boost/bind/include/boost/bind/protect.hpp b/contrib/restricted/boost/bind/include/boost/bind/protect.hpp deleted file mode 100644 index ef26fe989f..0000000000 --- a/contrib/restricted/boost/bind/include/boost/bind/protect.hpp +++ /dev/null @@ -1,348 +0,0 @@ -#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED -#define BOOST_BIND_PROTECT_HPP_INCLUDED - -// -// protect.hpp -// -// Copyright 2002, 2020 Peter Dimov -// Copyright 2009 Steven Watanabe -// -// Distributed under the 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> -#include <boost/config/workaround.hpp> -#include <utility> - -namespace boost -{ - -namespace _bi -{ - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !(defined(BOOST_GCC) && BOOST_GCC < 40600) - -template<class T> struct protect_make_void -{ - typedef void type; -}; - -template<class F, class E = void> struct protect_result_type -{ -}; - -template<class F> struct protect_result_type< F, typename protect_make_void<typename F::result_type>::type > -{ - typedef typename F::result_type result_type; -}; - -template<class F> class protected_bind_t: public protect_result_type<F> -{ -private: - - F f_; - -public: - - explicit protected_bind_t( F f ): f_( f ) - { - } - - template<class... A> auto operator()( A&&... a ) -> decltype( f_( std::forward<A>(a)... ) ) - { - return f_( std::forward<A>(a)... ); - } - - template<class... A> auto operator()( A&&... a ) const -> decltype( f_( std::forward<A>(a)... ) ) - { - return f_( std::forward<A>(a)... ); - } -}; - -#else - -template<class F> class protected_bind_t -{ -private: - - F f_; - -public: - - typedef typename F::result_type result_type; - - explicit protected_bind_t(F f): f_(f) - { - } - - result_type operator()() - { - return f_(); - } - - result_type operator()() const - { - return f_(); - } - - template<class A1> result_type operator()(A1 & a1) - { - return f_(a1); - } - - template<class A1> result_type operator()(A1 & a1) const - { - return f_(a1); - } - - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1> result_type operator()(const A1 & a1) - { - return f_(a1); - } - - template<class A1> result_type operator()(const A1 & a1) const - { - return f_(a1); - } - -#endif - - template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) - { - return f_(a1, a2); - } - - template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const - { - return f_(a1, a2); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2) - { - return f_(a1, a2); - } - - template<class A1, class A2> result_type operator()(A1 const & a1, A2 & a2) const - { - return f_(a1, a2); - } - - template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2) - { - return f_(a1, a2); - } - - template<class A1, class A2> result_type operator()(A1 & a1, A2 const & a2) const - { - return f_(a1, a2); - } - - template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2) - { - return f_(a1, a2); - } - - template<class A1, class A2> result_type operator()(A1 const & a1, A2 const & a2) const - { - return f_(a1, a2); - } - -#endif - - template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) - { - return f_(a1, a2, a3); - } - - template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const - { - return f_(a1, a2, a3); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) - { - return f_(a1, a2, a3); - } - - template<class A1, class A2, class A3> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const - { - return f_(a1, a2, a3); - } - -#endif - - template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) - { - return f_(a1, a2, a3, a4); - } - - template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const - { - return f_(a1, a2, a3, a4); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) - { - return f_(a1, a2, a3, a4); - } - - template<class A1, class A2, class A3, class A4> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const - { - return f_(a1, a2, a3, a4); - } - -#endif - - template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) - { - return f_(a1, a2, a3, a4, a5); - } - - template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const - { - return f_(a1, a2, a3, a4, a5); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) - { - return f_(a1, a2, a3, a4, a5); - } - - template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const - { - return f_(a1, a2, a3, a4, a5); - } - -#endif - - template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) - { - return f_(a1, a2, a3, a4, a5, a6); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const - { - return f_(a1, a2, a3, a4, a5, a6); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) - { - return f_(a1, a2, a3, a4, a5, a6); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const - { - return f_(a1, a2, a3, a4, a5, a6); - } - -#endif - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) - { - return f_(a1, a2, a3, a4, a5, a6, a7); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const - { - return f_(a1, a2, a3, a4, a5, a6, a7); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) - { - return f_(a1, a2, a3, a4, a5, a6, a7); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const - { - return f_(a1, a2, a3, a4, a5, a6, a7); - } - -#endif - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) - { - return f_(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> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) - { - return f_(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> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8); - } - -#endif - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); - } - -#endif -}; - -#endif - -} // namespace _bi - -template<class F> _bi::protected_bind_t<F> protect(F f) -{ - return _bi::protected_bind_t<F>(f); -} - -} // namespace boost - -#endif // #ifndef BOOST_BIND_PROTECT_HPP_INCLUDED diff --git a/contrib/restricted/boost/container/include/boost/container/detail/minimal_char_traits_header.hpp b/contrib/restricted/boost/container/include/boost/container/detail/minimal_char_traits_header.hpp deleted file mode 100644 index a92a31a2b4..0000000000 --- a/contrib/restricted/boost/container/include/boost/container/detail/minimal_char_traits_header.hpp +++ /dev/null @@ -1,32 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2014-2015 -// -// Distributed under the 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_MINIMAL_CHAR_TRAITS_HEADER_HPP -#define BOOST_CONTAINER_DETAIL_MINIMAL_CHAR_TRAITS_HEADER_HPP -# -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif -# -#//Try to avoid including <string>, as it's quite big -#if defined(_MSC_VER) && defined(BOOST_DINKUMWARE_STDLIB) - #include <iosfwd> //Dinkum libraries for MSVC define std::char_traits there -#elif defined(BOOST_GNU_STDLIB) - #include <bits/char_traits.h> -#else - #include <string> //Fallback -#endif - -#endif //BOOST_CONTAINER_DETAIL_MINIMAL_CHAR_TRAITS_HEADER_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/allocators/allocator.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/allocators/allocator.hpp deleted file mode 100644 index 9a5bf32631..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/allocators/allocator.hpp +++ /dev/null @@ -1,307 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// (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_INTERPROCESS_ALLOCATOR_HPP -#define BOOST_INTERPROCESS_ALLOCATOR_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/intrusive/pointer_traits.hpp> - -#include <boost/interprocess/interprocess_fwd.hpp> -#include <boost/interprocess/containers/allocation_type.hpp> -#include <boost/container/detail/multiallocation_chain.hpp> -#include <boost/interprocess/allocators/detail/allocator_common.hpp> -#include <boost/interprocess/detail/utilities.hpp> -#include <boost/interprocess/containers/version_type.hpp> -#include <boost/interprocess/exceptions.hpp> -#include <boost/assert.hpp> -#include <boost/utility/addressof.hpp> -#include <boost/interprocess/detail/type_traits.hpp> -#include <boost/container/detail/placement_new.hpp> - -#include <cstddef> -#include <stdexcept> - -//!\file -//!Describes an allocator that allocates portions of fixed size -//!memory buffer (shared memory, mapped file...) - -namespace boost { -namespace interprocess { - - -//!An STL compatible allocator that uses a segment manager as -//!memory source. The internal pointer type will of the same type (raw, smart) as -//!"typename SegmentManager::void_pointer" type. This allows -//!placing the allocator in shared memory, memory mapped-files, etc... -template<class T, class SegmentManager> -class allocator -{ - public: - //Segment manager - typedef SegmentManager segment_manager; - typedef typename SegmentManager::void_pointer void_pointer; - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - private: - - //Self type - typedef allocator<T, SegmentManager> self_t; - - //Pointer to void - typedef typename segment_manager::void_pointer aux_pointer_t; - - //Typedef to const void pointer - typedef typename boost::intrusive:: - pointer_traits<aux_pointer_t>::template - rebind_pointer<const void>::type cvoid_ptr; - - //Pointer to the allocator - typedef typename boost::intrusive:: - pointer_traits<cvoid_ptr>::template - rebind_pointer<segment_manager>::type alloc_ptr_t; - - //Not assignable from related allocator - template<class T2, class SegmentManager2> - allocator& operator=(const allocator<T2, SegmentManager2>&); - - //Not assignable from other allocator - allocator& operator=(const allocator&); - - //Pointer to the allocator - alloc_ptr_t mp_mngr; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - - public: - typedef T value_type; - typedef typename boost::intrusive:: - pointer_traits<cvoid_ptr>::template - rebind_pointer<T>::type pointer; - typedef typename boost::intrusive:: - pointer_traits<pointer>::template - rebind_pointer<const T>::type const_pointer; - typedef typename ipcdetail::add_reference - <value_type>::type reference; - typedef typename ipcdetail::add_reference - <const value_type>::type const_reference; - typedef typename segment_manager::size_type size_type; - typedef typename segment_manager::difference_type difference_type; - - typedef boost::interprocess::version_type<allocator, 2> version; - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - - //Experimental. Don't use. - typedef boost::container::dtl::transform_multiallocation_chain - <typename SegmentManager::multiallocation_chain, T>multiallocation_chain; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - - //!Obtains an allocator that allocates - //!objects of type T2 - template<class T2> - struct rebind - { - typedef allocator<T2, SegmentManager> other; - }; - - //!Returns the segment manager. - //!Never throws - segment_manager* get_segment_manager()const - { return ipcdetail::to_raw_pointer(mp_mngr); } - - //!Constructor from the segment manager. - //!Never throws - allocator(segment_manager *segment_mngr) - : mp_mngr(segment_mngr) { } - - //!Constructor from other allocator. - //!Never throws - allocator(const allocator &other) - : mp_mngr(other.get_segment_manager()){ } - - //!Constructor from related allocator. - //!Never throws - template<class T2> - allocator(const allocator<T2, SegmentManager> &other) - : mp_mngr(other.get_segment_manager()){} - - //!Allocates memory for an array of count elements. - //!Throws boost::interprocess::bad_alloc if there is no enough memory - pointer allocate(size_type count, cvoid_ptr hint = 0) - { - (void)hint; - if(size_overflows<sizeof(T)>(count)){ - throw bad_alloc(); - } - return pointer(static_cast<value_type*>(mp_mngr->allocate(count*sizeof(T)))); - } - - //!Deallocates memory previously allocated. - //!Never throws - void deallocate(const pointer &ptr, size_type) - { mp_mngr->deallocate((void*)ipcdetail::to_raw_pointer(ptr)); } - - //!Returns the number of elements that could be allocated. - //!Never throws - size_type max_size() const - { return mp_mngr->get_size()/sizeof(T); } - - //!Swap segment manager. Does not throw. If each allocator is placed in - //!different memory segments, the result is undefined. - friend void swap(self_t &alloc1, self_t &alloc2) - { boost::adl_move_swap(alloc1.mp_mngr, alloc2.mp_mngr); } - - //!Returns maximum the number of objects the previously allocated memory - //!pointed by p can hold. This size only works for memory allocated with - //!allocate, allocation_command and allocate_many. - size_type size(const pointer &p) const - { - return (size_type)mp_mngr->size(ipcdetail::to_raw_pointer(p))/sizeof(T); - } - - pointer allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) - { - value_type *reuse_raw = ipcdetail::to_raw_pointer(reuse); - pointer const p = mp_mngr->allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse_raw); - reuse = reuse_raw; - return p; - } - - //!Allocates many elements of size elem_size in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. The elements must be deallocated - //!with deallocate(...) - void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain) - { - if(size_overflows<sizeof(T)>(elem_size)){ - throw bad_alloc(); - } - mp_mngr->allocate_many(elem_size*sizeof(T), num_elements, chain); - } - - //!Allocates n_elements elements, each one of size elem_sizes[i]in a - //!contiguous block - //!of memory. The elements must be deallocated - void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) - { - mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T), chain); - } - - //!Allocates many elements of size elem_size in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. The elements must be deallocated - //!with deallocate(...) - void deallocate_many(multiallocation_chain &chain) - { mp_mngr->deallocate_many(chain); } - - //!Allocates just one object. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - //!Throws boost::interprocess::bad_alloc if there is no enough memory - pointer allocate_one() - { return this->allocate(1); } - - //!Allocates many elements of size == 1 in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - void allocate_individual(size_type num_elements, multiallocation_chain &chain) - { this->allocate_many(1, num_elements, chain); } - - //!Deallocates memory previously allocated with allocate_one(). - //!You should never use deallocate_one to deallocate memory allocated - //!with other functions different from allocate_one(). Never throws - void deallocate_one(const pointer &p) - { return this->deallocate(p, 1); } - - //!Allocates many elements of size == 1 in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain &chain) - { this->deallocate_many(chain); } - - //!Returns address of mutable object. - //!Never throws - pointer address(reference value) const - { return pointer(boost::addressof(value)); } - - //!Returns address of non mutable object. - //!Never throws - const_pointer address(const_reference value) const - { return const_pointer(boost::addressof(value)); } - - //!Constructs an object - //!Throws if T's constructor throws - //!For backwards compatibility with libraries using C++03 allocators - template<class P> - void construct(const pointer &ptr, BOOST_FWD_REF(P) p) - { ::new((void*)ipcdetail::to_raw_pointer(ptr), boost_container_new_t()) value_type(::boost::forward<P>(p)); } - - //!Destroys object. Throws if object's - //!destructor throws - void destroy(const pointer &ptr) - { BOOST_ASSERT(ptr != 0); (*ptr).~value_type(); } - -}; - -//!Equality test for same type -//!of allocator -template<class T, class SegmentManager> inline -bool operator==(const allocator<T , SegmentManager> &alloc1, - const allocator<T, SegmentManager> &alloc2) - { return alloc1.get_segment_manager() == alloc2.get_segment_manager(); } - -//!Inequality test for same type -//!of allocator -template<class T, class SegmentManager> inline -bool operator!=(const allocator<T, SegmentManager> &alloc1, - const allocator<T, SegmentManager> &alloc2) - { return alloc1.get_segment_manager() != alloc2.get_segment_manager(); } - -} //namespace interprocess { - -#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - -template<class T> -struct has_trivial_destructor; - -template<class T, class SegmentManager> -struct has_trivial_destructor - <boost::interprocess::allocator <T, SegmentManager> > -{ - static const bool value = true; -}; -#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //BOOST_INTERPROCESS_ALLOCATOR_HPP - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/allocators/detail/allocator_common.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/allocators/detail/allocator_common.hpp deleted file mode 100644 index bb301ebfbb..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/allocators/detail/allocator_common.hpp +++ /dev/null @@ -1,857 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_ALLOCATOR_DETAIL_ALLOCATOR_COMMON_HPP -#define BOOST_INTERPROCESS_ALLOCATOR_DETAIL_ALLOCATOR_COMMON_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/intrusive/pointer_traits.hpp> - -#include <boost/interprocess/interprocess_fwd.hpp> -#include <boost/interprocess/detail/utilities.hpp> //to_raw_pointer -#include <boost/utility/addressof.hpp> //boost::addressof -#include <boost/assert.hpp> //BOOST_ASSERT -#include <boost/interprocess/exceptions.hpp> //bad_alloc -#include <boost/interprocess/sync/scoped_lock.hpp> //scoped_lock -#include <boost/interprocess/containers/allocation_type.hpp> //boost::interprocess::allocation_type -#include <boost/container/detail/multiallocation_chain.hpp> -#include <boost/interprocess/mem_algo/detail/mem_algo_common.hpp> -#include <boost/interprocess/detail/segment_manager_helper.hpp> -#include <boost/move/utility_core.hpp> -#include <boost/interprocess/detail/type_traits.hpp> -#include <boost/interprocess/detail/utilities.hpp> -#include <boost/container/detail/placement_new.hpp> -#include <boost/move/adl_move_swap.hpp> - -namespace boost { -namespace interprocess { - -template <class T> -struct sizeof_value -{ - static const std::size_t value = sizeof(T); -}; - -template <> -struct sizeof_value<void> -{ - static const std::size_t value = sizeof(void*); -}; - -template <> -struct sizeof_value<const void> -{ - static const std::size_t value = sizeof(void*); -}; - -template <> -struct sizeof_value<volatile void> -{ - static const std::size_t value = sizeof(void*); -}; - -template <> -struct sizeof_value<const volatile void> -{ - static const std::size_t value = sizeof(void*); -}; - -namespace ipcdetail { - -//!Object function that creates the node allocator if it is not created and -//!increments reference count if it is already created -template<class NodePool> -struct get_or_create_node_pool_func -{ - - //!This connects or constructs the unique instance of node_pool_t - //!Can throw boost::interprocess::bad_alloc - void operator()() - { - //Find or create the node_pool_t - mp_node_pool = mp_segment_manager->template find_or_construct - <NodePool>(boost::interprocess::unique_instance)(mp_segment_manager); - //If valid, increment link count - if(mp_node_pool != 0) - mp_node_pool->inc_ref_count(); - } - - //!Constructor. Initializes function - //!object parameters - get_or_create_node_pool_func(typename NodePool::segment_manager *mngr) - : mp_segment_manager(mngr){} - - NodePool *mp_node_pool; - typename NodePool::segment_manager *mp_segment_manager; -}; - -template<class NodePool> -inline NodePool *get_or_create_node_pool(typename NodePool::segment_manager *mgnr) -{ - ipcdetail::get_or_create_node_pool_func<NodePool> func(mgnr); - mgnr->atomic_func(func); - return func.mp_node_pool; -} - -//!Object function that decrements the reference count. If the count -//!reaches to zero destroys the node allocator from memory. -//!Never throws -template<class NodePool> -struct destroy_if_last_link_func -{ - //!Decrements reference count and destroys the object if there is no - //!more attached allocators. Never throws - void operator()() - { - //If not the last link return - if(mp_node_pool->dec_ref_count() != 0) return; - - //Last link, let's destroy the segment_manager - mp_node_pool->get_segment_manager()->template destroy<NodePool>(boost::interprocess::unique_instance); - } - - //!Constructor. Initializes function - //!object parameters - destroy_if_last_link_func(NodePool *pool) - : mp_node_pool(pool) - {} - - NodePool *mp_node_pool; -}; - -//!Destruction function, initializes and executes destruction function -//!object. Never throws -template<class NodePool> -inline void destroy_node_pool_if_last_link(NodePool *pool) -{ - //Get segment manager - typename NodePool::segment_manager *mngr = pool->get_segment_manager(); - //Execute destruction functor atomically - destroy_if_last_link_func<NodePool>func(pool); - mngr->atomic_func(func); -} - -template<class NodePool> -class cache_impl -{ - typedef typename NodePool::segment_manager:: - void_pointer void_pointer; - typedef typename boost::intrusive:: - pointer_traits<void_pointer>::template - rebind_pointer<NodePool>::type node_pool_ptr; - typedef typename NodePool::multiallocation_chain multiallocation_chain; - typedef typename NodePool::segment_manager::size_type size_type; - node_pool_ptr mp_node_pool; - multiallocation_chain m_cached_nodes; - size_type m_max_cached_nodes; - - public: - typedef typename NodePool::segment_manager segment_manager; - - cache_impl(segment_manager *segment_mngr, size_type max_cached_nodes) - : mp_node_pool(get_or_create_node_pool<NodePool>(segment_mngr)) - , m_max_cached_nodes(max_cached_nodes) - {} - - cache_impl(const cache_impl &other) - : mp_node_pool(other.get_node_pool()) - , m_max_cached_nodes(other.get_max_cached_nodes()) - { - mp_node_pool->inc_ref_count(); - } - - ~cache_impl() - { - this->deallocate_all_cached_nodes(); - ipcdetail::destroy_node_pool_if_last_link(ipcdetail::to_raw_pointer(mp_node_pool)); - } - - NodePool *get_node_pool() const - { return ipcdetail::to_raw_pointer(mp_node_pool); } - - segment_manager *get_segment_manager() const - { return mp_node_pool->get_segment_manager(); } - - size_type get_max_cached_nodes() const - { return m_max_cached_nodes; } - - void *cached_allocation() - { - //If don't have any cached node, we have to get a new list of free nodes from the pool - if(m_cached_nodes.empty()){ - mp_node_pool->allocate_nodes(m_max_cached_nodes/2, m_cached_nodes); - } - void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.pop_front()); - return ret; - } - - void cached_allocation(size_type n, multiallocation_chain &chain) - { - size_type count = n, allocated(0); - BOOST_TRY{ - //If don't have any cached node, we have to get a new list of free nodes from the pool - while(!m_cached_nodes.empty() && count--){ - void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.pop_front()); - chain.push_back(ret); - ++allocated; - } - - if(allocated != n){ - mp_node_pool->allocate_nodes(n - allocated, chain); - } - } - BOOST_CATCH(...){ - this->cached_deallocation(chain); - BOOST_RETHROW - } BOOST_CATCH_END - } - - void cached_deallocation(void *ptr) - { - //Check if cache is full - if(m_cached_nodes.size() >= m_max_cached_nodes){ - //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more - //deallocations are probably coming, we'll make some room in cache - //in a single, efficient multi node deallocation. - this->priv_deallocate_n_nodes(m_cached_nodes.size() - m_max_cached_nodes/2); - } - m_cached_nodes.push_front(ptr); - } - - void cached_deallocation(multiallocation_chain &chain) - { - m_cached_nodes.splice_after(m_cached_nodes.before_begin(), chain); - - //Check if cache is full - if(m_cached_nodes.size() >= m_max_cached_nodes){ - //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more - //deallocations are probably coming, we'll make some room in cache - //in a single, efficient multi node deallocation. - this->priv_deallocate_n_nodes(m_cached_nodes.size() - m_max_cached_nodes/2); - } - } - - //!Sets the new max cached nodes value. This can provoke deallocations - //!if "newmax" is less than current cached nodes. Never throws - void set_max_cached_nodes(size_type newmax) - { - m_max_cached_nodes = newmax; - this->priv_deallocate_remaining_nodes(); - } - - //!Frees all cached nodes. - //!Never throws - void deallocate_all_cached_nodes() - { - if(m_cached_nodes.empty()) return; - mp_node_pool->deallocate_nodes(m_cached_nodes); - } - - private: - //!Frees all cached nodes at once. - //!Never throws - void priv_deallocate_remaining_nodes() - { - if(m_cached_nodes.size() > m_max_cached_nodes){ - priv_deallocate_n_nodes(m_cached_nodes.size()-m_max_cached_nodes); - } - } - - //!Frees n cached nodes at once. Never throws - void priv_deallocate_n_nodes(size_type n) - { - //This only occurs if this allocator deallocate memory allocated - //with other equal allocator. Since the cache is full, and more - //deallocations are probably coming, we'll make some room in cache - //in a single, efficient multi node deallocation. - size_type count(n); - typename multiallocation_chain::iterator it(m_cached_nodes.before_begin()); - while(count--){ - ++it; - } - multiallocation_chain chain; - chain.splice_after(chain.before_begin(), m_cached_nodes, m_cached_nodes.before_begin(), it, n); - //Deallocate all new linked list at once - mp_node_pool->deallocate_nodes(chain); - } - - public: - void swap(cache_impl &other) - { - ::boost::adl_move_swap(mp_node_pool, other.mp_node_pool); - ::boost::adl_move_swap(m_cached_nodes, other.m_cached_nodes); - ::boost::adl_move_swap(m_max_cached_nodes, other.m_max_cached_nodes); - } -}; - -template<class Derived, class T, class SegmentManager> -class array_allocation_impl -{ - const Derived *derived() const - { return static_cast<const Derived*>(this); } - Derived *derived() - { return static_cast<Derived*>(this); } - - typedef typename SegmentManager::void_pointer void_pointer; - - public: - typedef typename boost::intrusive:: - pointer_traits<void_pointer>::template - rebind_pointer<T>::type pointer; - typedef typename boost::intrusive:: - pointer_traits<void_pointer>::template - rebind_pointer<const T>::type const_pointer; - typedef T value_type; - typedef typename ipcdetail::add_reference - <value_type>::type reference; - typedef typename ipcdetail::add_reference - <const value_type>::type const_reference; - typedef typename SegmentManager::size_type size_type; - typedef typename SegmentManager::difference_type difference_type; - typedef boost::container::dtl::transform_multiallocation_chain - <typename SegmentManager::multiallocation_chain, T>multiallocation_chain; - - - public: - //!Returns maximum the number of objects the previously allocated memory - //!pointed by p can hold. This size only works for memory allocated with - //!allocate, allocation_command and allocate_many. - size_type size(const pointer &p) const - { - return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::to_raw_pointer(p))/sizeof(T); - } - - pointer allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) - { - value_type *reuse_raw = ipcdetail::to_raw_pointer(reuse); - pointer const p = this->derived()->get_segment_manager()->allocation_command - (command, limit_size, prefer_in_recvd_out_size, reuse_raw); - reuse = reuse_raw; - return p; - } - - //!Allocates many elements of size elem_size in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. The elements must be deallocated - //!with deallocate(...) - void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain) - { - if(size_overflows<sizeof(T)>(elem_size)){ - throw bad_alloc(); - } - this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements, chain); - } - - //!Allocates n_elements elements, each one of size elem_sizes[i]in a - //!contiguous block - //!of memory. The elements must be deallocated - void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) - { - this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T), chain); - } - - //!Allocates many elements of size elem_size in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. The elements must be deallocated - //!with deallocate(...) - void deallocate_many(multiallocation_chain &chain) - { this->derived()->get_segment_manager()->deallocate_many(chain); } - - //!Returns the number of elements that could be - //!allocated. Never throws - size_type max_size() const - { return this->derived()->get_segment_manager()->get_size()/sizeof(T); } - - //!Returns address of mutable object. - //!Never throws - pointer address(reference value) const - { return pointer(boost::addressof(value)); } - - //!Returns address of non mutable object. - //!Never throws - const_pointer address(const_reference value) const - { return const_pointer(boost::addressof(value)); } - - //!Constructs an object - //!Throws if T's constructor throws - //!For backwards compatibility with libraries using C++03 allocators - template<class P> - void construct(const pointer &ptr, BOOST_FWD_REF(P) p) - { ::new((void*)ipcdetail::to_raw_pointer(ptr), boost_container_new_t()) value_type(::boost::forward<P>(p)); } - - //!Destroys object. Throws if object's - //!destructor throws - void destroy(const pointer &ptr) - { BOOST_ASSERT(ptr != 0); (*ptr).~value_type(); } -}; - - -template<class Derived, unsigned int Version, class T, class SegmentManager> -class node_pool_allocation_impl - : public array_allocation_impl - < Derived - , T - , SegmentManager> -{ - const Derived *derived() const - { return static_cast<const Derived*>(this); } - Derived *derived() - { return static_cast<Derived*>(this); } - - typedef typename SegmentManager::void_pointer void_pointer; - typedef typename boost::intrusive:: - pointer_traits<void_pointer>::template - rebind_pointer<const void>::type cvoid_pointer; - - public: - typedef typename boost::intrusive:: - pointer_traits<void_pointer>::template - rebind_pointer<T>::type pointer; - typedef typename boost::intrusive:: - pointer_traits<void_pointer>::template - rebind_pointer<const T>::type const_pointer; - typedef T value_type; - typedef typename ipcdetail::add_reference - <value_type>::type reference; - typedef typename ipcdetail::add_reference - <const value_type>::type const_reference; - typedef typename SegmentManager::size_type size_type; - typedef typename SegmentManager::difference_type difference_type; - typedef boost::container::dtl::transform_multiallocation_chain - <typename SegmentManager::multiallocation_chain, T>multiallocation_chain; - - - template <int Dummy> - struct node_pool - { - typedef typename Derived::template node_pool<0>::type type; - static type *get(void *p) - { return static_cast<type*>(p); } - }; - - public: - //!Allocate memory for an array of count elements. - //!Throws boost::interprocess::bad_alloc if there is no enough memory - pointer allocate(size_type count, cvoid_pointer hint = 0) - { - (void)hint; - typedef typename node_pool<0>::type node_pool_t; - node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - if(size_overflows<sizeof(T)>(count)){ - throw bad_alloc(); - } - else if(Version == 1 && count == 1){ - return pointer(static_cast<value_type*> - (pool->allocate_node())); - } - else{ - return pointer(static_cast<value_type*> - (pool->get_segment_manager()->allocate(count*sizeof(T)))); - } - } - - //!Deallocate allocated memory. Never throws - void deallocate(const pointer &ptr, size_type count) - { - (void)count; - typedef typename node_pool<0>::type node_pool_t; - node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - if(Version == 1 && count == 1) - pool->deallocate_node(ipcdetail::to_raw_pointer(ptr)); - else - pool->get_segment_manager()->deallocate((void*)ipcdetail::to_raw_pointer(ptr)); - } - - //!Allocates just one object. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - //!Throws boost::interprocess::bad_alloc if there is no enough memory - pointer allocate_one() - { - typedef typename node_pool<0>::type node_pool_t; - node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - return pointer(static_cast<value_type*>(pool->allocate_node())); - } - - //!Allocates many elements of size == 1 in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - void allocate_individual(size_type num_elements, multiallocation_chain &chain) - { - typedef typename node_pool<0>::type node_pool_t; - node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - pool->allocate_nodes(num_elements, chain); - } - - //!Deallocates memory previously allocated with allocate_one(). - //!You should never use deallocate_one to deallocate memory allocated - //!with other functions different from allocate_one(). Never throws - void deallocate_one(const pointer &p) - { - typedef typename node_pool<0>::type node_pool_t; - node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool()); - pool->deallocate_node(ipcdetail::to_raw_pointer(p)); - } - - //!Allocates many elements of size == 1 in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain &chain) - { - node_pool<0>::get(this->derived()->get_node_pool())->deallocate_nodes - (chain); - } - - //!Deallocates all free blocks of the pool - void deallocate_free_blocks() - { node_pool<0>::get(this->derived()->get_node_pool())->deallocate_free_blocks(); } - - //!Deprecated, use deallocate_free_blocks. - //!Deallocates all free chunks of the pool. - void deallocate_free_chunks() - { node_pool<0>::get(this->derived()->get_node_pool())->deallocate_free_blocks(); } -}; - -template<class T, class NodePool, unsigned int Version> -class cached_allocator_impl - : public array_allocation_impl - <cached_allocator_impl<T, NodePool, Version>, T, typename NodePool::segment_manager> -{ - cached_allocator_impl & operator=(const cached_allocator_impl& other); - typedef array_allocation_impl - < cached_allocator_impl - <T, NodePool, Version> - , T - , typename NodePool::segment_manager> base_t; - - public: - typedef NodePool node_pool_t; - typedef typename NodePool::segment_manager segment_manager; - typedef typename segment_manager::void_pointer void_pointer; - typedef typename boost::intrusive:: - pointer_traits<void_pointer>::template - rebind_pointer<const void>::type cvoid_pointer; - typedef typename base_t::pointer pointer; - typedef typename base_t::size_type size_type; - typedef typename base_t::multiallocation_chain multiallocation_chain; - typedef typename base_t::value_type value_type; - - public: - static const std::size_t DEFAULT_MAX_CACHED_NODES = 64; - - cached_allocator_impl(segment_manager *segment_mngr, size_type max_cached_nodes) - : m_cache(segment_mngr, max_cached_nodes) - {} - - cached_allocator_impl(const cached_allocator_impl &other) - : m_cache(other.m_cache) - {} - - //!Copy constructor from related cached_adaptive_pool_base. If not present, constructs - //!a node pool. Increments the reference count of the associated node pool. - //!Can throw boost::interprocess::bad_alloc - template<class T2, class NodePool2> - cached_allocator_impl - (const cached_allocator_impl - <T2, NodePool2, Version> &other) - : m_cache(other.get_segment_manager(), other.get_max_cached_nodes()) - {} - - //!Returns a pointer to the node pool. - //!Never throws - node_pool_t* get_node_pool() const - { return m_cache.get_node_pool(); } - - //!Returns the segment manager. - //!Never throws - segment_manager* get_segment_manager()const - { return m_cache.get_segment_manager(); } - - //!Sets the new max cached nodes value. This can provoke deallocations - //!if "newmax" is less than current cached nodes. Never throws - void set_max_cached_nodes(size_type newmax) - { m_cache.set_max_cached_nodes(newmax); } - - //!Returns the max cached nodes parameter. - //!Never throws - size_type get_max_cached_nodes() const - { return m_cache.get_max_cached_nodes(); } - - //!Allocate memory for an array of count elements. - //!Throws boost::interprocess::bad_alloc if there is no enough memory - pointer allocate(size_type count, cvoid_pointer hint = 0) - { - (void)hint; - void * ret; - if(size_overflows<sizeof(T)>(count)){ - throw bad_alloc(); - } - else if(Version == 1 && count == 1){ - ret = m_cache.cached_allocation(); - } - else{ - ret = this->get_segment_manager()->allocate(count*sizeof(T)); - } - return pointer(static_cast<T*>(ret)); - } - - //!Deallocate allocated memory. Never throws - void deallocate(const pointer &ptr, size_type count) - { - (void)count; - if(Version == 1 && count == 1){ - m_cache.cached_deallocation(ipcdetail::to_raw_pointer(ptr)); - } - else{ - this->get_segment_manager()->deallocate((void*)ipcdetail::to_raw_pointer(ptr)); - } - } - - //!Allocates just one object. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - //!Throws boost::interprocess::bad_alloc if there is no enough memory - pointer allocate_one() - { return pointer(static_cast<value_type*>(this->m_cache.cached_allocation())); } - - //!Allocates many elements of size == 1 in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - void allocate_individual(size_type num_elements, multiallocation_chain &chain) - { this->m_cache.cached_allocation(num_elements, chain); } - - //!Deallocates memory previously allocated with allocate_one(). - //!You should never use deallocate_one to deallocate memory allocated - //!with other functions different from allocate_one(). Never throws - void deallocate_one(const pointer &p) - { this->m_cache.cached_deallocation(ipcdetail::to_raw_pointer(p)); } - - //!Allocates many elements of size == 1 in a contiguous block - //!of memory. The minimum number to be allocated is min_elements, - //!the preferred and maximum number is - //!preferred_elements. The number of actually allocated elements is - //!will be assigned to received_size. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - void deallocate_individual(multiallocation_chain &chain) - { m_cache.cached_deallocation(chain); } - - //!Deallocates all free blocks of the pool - void deallocate_free_blocks() - { m_cache.get_node_pool()->deallocate_free_blocks(); } - - //!Swaps allocators. Does not throw. If each allocator is placed in a - //!different shared memory segments, the result is undefined. - friend void swap(cached_allocator_impl &alloc1, cached_allocator_impl &alloc2) - { ::boost::adl_move_swap(alloc1.m_cache, alloc2.m_cache); } - - void deallocate_cache() - { m_cache.deallocate_all_cached_nodes(); } - - //!Deprecated use deallocate_free_blocks. - void deallocate_free_chunks() - { m_cache.get_node_pool()->deallocate_free_blocks(); } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - private: - cache_impl<node_pool_t> m_cache; - #endif //!defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) -}; - -//!Equality test for same type of -//!cached_allocator_impl -template<class T, class N, unsigned int V> inline -bool operator==(const cached_allocator_impl<T, N, V> &alloc1, - const cached_allocator_impl<T, N, V> &alloc2) - { return alloc1.get_node_pool() == alloc2.get_node_pool(); } - -//!Inequality test for same type of -//!cached_allocator_impl -template<class T, class N, unsigned int V> inline -bool operator!=(const cached_allocator_impl<T, N, V> &alloc1, - const cached_allocator_impl<T, N, V> &alloc2) - { return alloc1.get_node_pool() != alloc2.get_node_pool(); } - - -//!Pooled shared memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is -//!responsibility of user classes. Node size (NodeSize) and the number of -//!nodes allocated per block (NodesPerBlock) are known at compile time -template<class private_node_allocator_t> -class shared_pool_impl - : public private_node_allocator_t -{ - public: - //!Segment manager typedef - typedef typename private_node_allocator_t:: - segment_manager segment_manager; - typedef typename private_node_allocator_t:: - multiallocation_chain multiallocation_chain; - typedef typename private_node_allocator_t:: - size_type size_type; - - private: - typedef typename segment_manager::mutex_family::mutex_type mutex_type; - - public: - //!Constructor from a segment manager. Never throws - shared_pool_impl(segment_manager *segment_mngr) - : private_node_allocator_t(segment_mngr) - {} - - //!Destructor. Deallocates all allocated blocks. Never throws - ~shared_pool_impl() - {} - - //!Allocates array of count elements. Can throw boost::interprocess::bad_alloc - void *allocate_node() - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - return private_node_allocator_t::allocate_node(); - } - - //!Deallocates an array pointed by ptr. Never throws - void deallocate_node(void *ptr) - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - private_node_allocator_t::deallocate_node(ptr); - } - - //!Allocates n nodes. - //!Can throw boost::interprocess::bad_alloc - void allocate_nodes(const size_type n, multiallocation_chain &chain) - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - private_node_allocator_t::allocate_nodes(n, chain); - } - - //!Deallocates a linked list of nodes ending in null pointer. Never throws - void deallocate_nodes(multiallocation_chain &nodes, size_type num) - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - private_node_allocator_t::deallocate_nodes(nodes, num); - } - - //!Deallocates the nodes pointed by the multiallocation iterator. Never throws - void deallocate_nodes(multiallocation_chain &chain) - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - private_node_allocator_t::deallocate_nodes(chain); - } - - //!Deallocates all the free blocks of memory. Never throws - void deallocate_free_blocks() - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - private_node_allocator_t::deallocate_free_blocks(); - } - - //!Deallocates all used memory from the common pool. - //!Precondition: all nodes allocated from this pool should - //!already be deallocated. Otherwise, undefined behavior. Never throws - void purge_blocks() - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - private_node_allocator_t::purge_blocks(); - } - - //!Increments internal reference count and returns new count. Never throws - size_type inc_ref_count() - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - return ++m_header.m_usecount; - } - - //!Decrements internal reference count and returns new count. Never throws - size_type dec_ref_count() - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - BOOST_ASSERT(m_header.m_usecount > 0); - return --m_header.m_usecount; - } - - //!Deprecated, use deallocate_free_blocks. - void deallocate_free_chunks() - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - private_node_allocator_t::deallocate_free_blocks(); - } - - //!Deprecated, use purge_blocks. - void purge_chunks() - { - //----------------------- - boost::interprocess::scoped_lock<mutex_type> guard(m_header); - //----------------------- - private_node_allocator_t::purge_blocks(); - } - - private: - //!This struct includes needed data and derives from - //!the mutex type to allow EBO when using null_mutex - struct header_t : mutex_type - { - size_type m_usecount; //Number of attached allocators - - header_t() - : m_usecount(0) {} - } m_header; -}; - -} //namespace ipcdetail { -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_ALLOCATOR_DETAIL_ALLOCATOR_COMMON_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/containers/allocation_type.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/containers/allocation_type.hpp deleted file mode 100644 index d99b7ab51d..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/containers/allocation_type.hpp +++ /dev/null @@ -1,44 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_CONTAINERS_ALLOCATION_TYPE_HPP -#define BOOST_INTERPROCESS_CONTAINERS_ALLOCATION_TYPE_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/container/detail/allocation_type.hpp> - -namespace boost { -namespace interprocess { - -#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) -using boost::container::allocation_type; -#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED -static const allocation_type allocate_new = boost::container::allocate_new; -static const allocation_type expand_fwd = boost::container::expand_fwd; -static const allocation_type expand_bwd = boost::container::expand_bwd; -static const allocation_type shrink_in_place = boost::container::shrink_in_place; -static const allocation_type try_shrink_in_place= boost::container::try_shrink_in_place; -static const allocation_type nothrow_allocation = boost::container::nothrow_allocation; -static const allocation_type zero_memory = boost::container::zero_memory; - -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_CONTAINERS_ALLOCATION_TYPE_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/containers/version_type.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/containers/version_type.hpp deleted file mode 100644 index 6885072992..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/containers/version_type.hpp +++ /dev/null @@ -1,37 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_CONTAINERS_VERSION_TYPE_HPP -#define BOOST_INTERPROCESS_CONTAINERS_VERSION_TYPE_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/container/detail/version_type.hpp> - -namespace boost { -namespace interprocess { - -using boost::container::dtl::version_type; -using boost::container::dtl::version; - -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_CONTAINERS_VERSION_TYPE_HPP - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/atomic.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/atomic.hpp deleted file mode 100644 index 3dda5c4031..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/atomic.hpp +++ /dev/null @@ -1,674 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2006-2012 -// (C) Copyright Markus Schoepflin 2007 -// (C) Copyright Bryce Lelbach 2010 -// -// Distributed under the 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_INTERPROCESS_DETAIL_ATOMIC_HPP -#define BOOST_INTERPROCESS_DETAIL_ATOMIC_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> -#include <boost/cstdint.hpp> - -#if !defined(_AIX) -#define BOOST_INTERPROCESS_DETAIL_PPC_ASM_LABEL(label) label ":\n\t" -#define BOOST_INTERPROCESS_DETAIL_PPC_ASM_JUMP(insn, label, offset) insn " " label "\n\t" -#else -#define BOOST_INTERPROCESS_DETAIL_PPC_ASM_LABEL(label) -#define BOOST_INTERPROCESS_DETAIL_PPC_ASM_JUMP(insn, label, offset) insn " $" offset "\n\t" -#endif - -namespace boost{ -namespace interprocess{ -namespace ipcdetail{ - -//! Atomically increment an boost::uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem); - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem); - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val); - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with": what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp); - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - -#if defined (BOOST_INTERPROCESS_WINDOWS) - -#include <boost/interprocess/detail/win32_api.hpp> - -#if defined( _MSC_VER ) - extern "C" void _ReadWriteBarrier(void); - #pragma intrinsic(_ReadWriteBarrier) - -#define BOOST_INTERPROCESS_READ_WRITE_BARRIER \ - BOOST_INTERPROCESS_DISABLE_DEPRECATED_WARNING \ - _ReadWriteBarrier() \ - BOOST_INTERPROCESS_RESTORE_WARNING - -#elif defined(__GNUC__) - #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 - #define BOOST_INTERPROCESS_READ_WRITE_BARRIER __sync_synchronize() - #else - #define BOOST_INTERPROCESS_READ_WRITE_BARRIER __asm__ __volatile__("" : : : "memory") - #endif -#endif - -namespace boost{ -namespace interprocess{ -namespace ipcdetail{ - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return (boost::uint32_t)winapi::interlocked_decrement(reinterpret_cast<volatile long*>(mem)) + 1; } - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return (boost::uint32_t)winapi::interlocked_increment(reinterpret_cast<volatile long*>(mem))-1; } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ - const boost::uint32_t val = *mem; - BOOST_INTERPROCESS_READ_WRITE_BARRIER; - return val; -} - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ winapi::interlocked_exchange(reinterpret_cast<volatile long*>(mem), (long)val); } - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with": what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ return (boost::uint32_t)winapi::interlocked_compare_exchange(reinterpret_cast<volatile long*>(mem), (long)with, (long)cmp); } - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && !defined(_CRAYC) - -namespace boost { -namespace interprocess { -namespace ipcdetail{ - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ - boost::uint32_t prev = cmp; - // This version by Mans Rullgard of Pathscale - __asm__ __volatile__ ( "lock\n\t" - "cmpxchg %2,%0" - : "+m"(*mem), "+a"(prev) - : "r"(with) - : "cc"); - - return prev; -} - -//! Atomically add 'val' to an boost::uint32_t -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32 - (volatile boost::uint32_t *mem, boost::uint32_t val) -{ - // int r = *pw; - // *mem += val; - // return r; - boost::uint32_t r; - - asm volatile - ( - "lock\n\t" - "xadd %1, %0": - "+m"( *mem ), "=r"( r ): // outputs (%0, %1) - "1"( val ): // inputs (%2 == %1) - "memory", "cc" // clobbers - ); - - return r; -} - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, 1); } - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, (boost::uint32_t)-1); } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ - const boost::uint32_t val = *mem; - __asm__ __volatile__ ( "" ::: "memory" ); - return val; -} - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ - __asm__ __volatile__ - ( - "xchgl %0, %1" - : "+r" (val), "+m" (*mem) - :: "memory" - ); -} - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - -#elif defined(__GNUC__) && (defined(__PPC__) || defined(__ppc__)) - -namespace boost { -namespace interprocess { -namespace ipcdetail{ - -//! Atomically add 'val' to an boost::uint32_t -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ - boost::uint32_t prev, temp; - - asm volatile - ( - BOOST_INTERPROCESS_DETAIL_PPC_ASM_LABEL("1") - "lwarx %0,0,%2\n\t" - "add %1,%0,%3\n\t" - "stwcx. %1,0,%2\n\t" - BOOST_INTERPROCESS_DETAIL_PPC_ASM_JUMP("bne-", "1b", "-12") - : "=&r" (prev), "=&r" (temp) - : "b" (mem), "r" (val) - : "cc", "memory" - ); - return prev; -} - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ - boost::uint32_t prev; - - asm volatile - ( - BOOST_INTERPROCESS_DETAIL_PPC_ASM_LABEL("1") - "lwarx %0,0,%1\n\t" - "cmpw %0,%3\n\t" - BOOST_INTERPROCESS_DETAIL_PPC_ASM_JUMP("bne-", "2f", "+12") - "stwcx. %2,0,%1\n\t" - BOOST_INTERPROCESS_DETAIL_PPC_ASM_JUMP("bne-", "1b", "-16") - BOOST_INTERPROCESS_DETAIL_PPC_ASM_LABEL("2") - : "=&r"(prev) - : "b" (mem), "r" (with), "r" (cmp) - : "cc", "memory" - ); - return prev; -} - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, 1); } - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, boost::uint32_t(-1u)); } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ - const boost::uint32_t val = *mem; - __asm__ __volatile__ ( "" ::: "memory" ); - return val; -} - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ *mem = val; } - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - -#elif (defined(sun) || defined(__sun)) - -#error #include <atomic.h> - -namespace boost{ -namespace interprocess{ -namespace ipcdetail{ - -//! Atomically add 'val' to an boost::uint32_t -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ return atomic_add_32_nv(reinterpret_cast<volatile ::uint32_t*>(mem), (int32_t)val) - val; } - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ return atomic_cas_32(reinterpret_cast<volatile ::uint32_t*>(mem), cmp, with); } - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add_32_nv(reinterpret_cast<volatile ::uint32_t*>(mem), 1) - 1; } - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add_32_nv(reinterpret_cast<volatile ::uint32_t*>(mem), (boost::uint32_t)-1) + 1; } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ return *mem; } - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ *mem = val; } - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - -#elif defined(__osf__) && defined(__DECCXX) - -#include <machine/builtins.h> -#include <c_asm.h> - -namespace boost{ -namespace interprocess{ -namespace ipcdetail{ - -//! Atomically decrement a uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -//! Acquire, memory barrier after decrement. -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ boost::uint32_t old_val = __ATOMIC_DECREMENT_LONG(mem); __MB(); return old_val; } - -//! Atomically increment a uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -//! Release, memory barrier before increment. -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ __MB(); return __ATOMIC_INCREMENT_LONG(mem); } - -// Rational for the implementation of the atomic read and write functions. -// -// 1. The Alpha Architecture Handbook requires that access to a byte, -// an aligned word, an aligned longword, or an aligned quadword is -// atomic. (See 'Alpha Architecture Handbook', version 4, chapter 5.2.2.) -// -// 2. The CXX User's Guide states that volatile quantities are accessed -// with single assembler instructions, and that a compilation error -// occurs when declaring a quantity as volatile which is not properly -// aligned. - -//! Atomically read an boost::uint32_t from memory -//! Acquire, memory barrier after load. -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ boost::uint32_t old_val = *mem; __MB(); return old_val; } - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -//! Release, memory barrier before store. -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ __MB(); *mem = val; } - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -//! Memory barrier between load and store. -inline boost::uint32_t atomic_cas32( - volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ - // Note: - // - // Branch prediction prefers backward branches, and the Alpha Architecture - // Handbook explicitely states that the loop should not be implemented like - // it is below. (See chapter 4.2.5.) Therefore the code should probably look - // like this: - // - // return asm( - // "10: ldl_l %v0,(%a0) ;" - // " cmpeq %v0,%a2,%t0 ;" - // " beq %t0,20f ;" - // " mb ;" - // " mov %a1,%t0 ;" - // " stl_c %t0,(%a0) ;" - // " beq %t0,30f ;" - // "20: ret ;" - // "30: br 10b;", - // mem, with, cmp); - // - // But as the compiler always transforms this into the form where a backward - // branch is taken on failure, we can as well implement it in the straight - // forward form, as this is what it will end up in anyway. - - return asm( - "10: ldl_l %v0,(%a0) ;" // load prev value from mem and lock mem - " cmpeq %v0,%a2,%t0 ;" // compare with given value - " beq %t0,20f ;" // if not equal, we're done - " mb ;" // memory barrier - " mov %a1,%t0 ;" // load new value into scratch register - " stl_c %t0,(%a0) ;" // store new value to locked mem (overwriting scratch) - " beq %t0,10b ;" // store failed because lock has been stolen, retry - "20: ", - mem, with, cmp); -} - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - -#elif defined(__IBMCPP__) && (__IBMCPP__ >= 800) && defined(_AIX) - -#include <builtins.h> - -namespace boost { -namespace interprocess { -namespace ipcdetail{ - -//first define boost::uint32_t versions of __lwarx and __stwcx to avoid poluting -//all the functions with casts - -//! From XLC documenation : -//! This function can be used with a subsequent stwcxu call to implement a -//! read-modify-write on a specified memory location. The two functions work -//! together to ensure that if the store is successfully performed, no other -//! processor or mechanism can modify the target doubleword between the time -//! lwarxu function is executed and the time the stwcxu functio ncompletes. -//! "mem" : pointer to the object -//! Returns the value at pointed to by mem -inline boost::uint32_t lwarxu(volatile boost::uint32_t *mem) -{ - return static_cast<boost::uint32_t>(__lwarx(reinterpret_cast<volatile int*>(mem))); -} - -//! "mem" : pointer to the object -//! "val" : the value to store -//! Returns true if the update of mem is successful and false if it is -//!unsuccessful -inline bool stwcxu(volatile boost::uint32_t* mem, boost::uint32_t val) -{ - return (__stwcx(reinterpret_cast<volatile int*>(mem), static_cast<int>(val)) != 0); -} - -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32 - (volatile boost::uint32_t *mem, boost::uint32_t val) -{ - boost::uint32_t oldValue; - do - { - oldValue = lwarxu(mem); - }while (!stwcxu(mem, oldValue+val)); - return oldValue; -} - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, 1); } - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, (boost::uint32_t)-1); } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ return *mem; } - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ - boost::uint32_t oldValue; - boost::uint32_t valueToStore; - do - { - oldValue = lwarxu(mem); - } while (!stwcxu(mem, (oldValue == with) ? cmp : oldValue)); - - return oldValue; -} - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ *mem = val; } - -} //namespace ipcdetail -} //namespace interprocess -} //namespace boost - -#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) - -namespace boost { -namespace interprocess { -namespace ipcdetail{ - -//! Atomically add 'val' to an boost::uint32_t -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32 - (volatile boost::uint32_t *mem, boost::uint32_t val) -{ return __sync_fetch_and_add(const_cast<boost::uint32_t *>(mem), val); } - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, 1); } - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return atomic_add32(mem, (boost::uint32_t)-1); } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ boost::uint32_t old_val = *mem; __sync_synchronize(); return old_val; } - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ return __sync_val_compare_and_swap(const_cast<boost::uint32_t *>(mem), cmp, with); } - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ __sync_synchronize(); *mem = val; } - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ -#elif defined(__VXWORKS__) - -#error #include <vxAtomicLib.h> -// VxWorks atomic32_t is not volatile, for some unknown reason -#define vx_atomic_cast(_i) (reinterpret_cast< ::atomic32_t *>( const_cast<boost::uint32_t *>(_i))) - -namespace boost { -namespace interprocess { -namespace ipcdetail{ - -//! Atomically add 'val' to an boost::uint32_t -//! "mem": pointer to the object -//! "val": amount to add -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_add32 - (volatile boost::uint32_t *mem, boost::uint32_t val) -{ return ::vxAtomic32Add( vx_atomic_cast(mem), val); } - -//! Atomically increment an apr_uint32_t by 1 -//! "mem": pointer to the object -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) -{ return ::vxAtomic32Inc( vx_atomic_cast(mem) ); } - -//! Atomically decrement an boost::uint32_t by 1 -//! "mem": pointer to the atomic value -//! Returns the old value pointed to by mem -inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) -{ return ::vxAtomic32Dec( vx_atomic_cast(mem) ); } - -//! Atomically read an boost::uint32_t from memory -inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) -{ return ::vxAtomic32Get( vx_atomic_cast(mem) ); } - -//! Compare an boost::uint32_t's value with "cmp". -//! If they are the same swap the value with "with" -//! "mem": pointer to the value -//! "with" what to swap it with -//! "cmp": the value to compare it to -//! Returns the old value of *mem -inline boost::uint32_t atomic_cas32 - (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) -{ return ::vxAtomic32Cas( vx_atomic_cast(mem), cmp, with); } - -//! Atomically set an boost::uint32_t in memory -//! "mem": pointer to the object -//! "param": val value that the object will assume -inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) -{ ::vxAtomic32Set( vx_atomic_cast(mem), val); } - - -} //namespace ipcdetail{ -} //namespace interprocess{ -} //namespace boost{ - -#else - -#error No atomic operations implemented for this platform, sorry! - -#endif - -namespace boost{ -namespace interprocess{ -namespace ipcdetail{ - -inline bool atomic_add_unless32 - (volatile boost::uint32_t *mem, boost::uint32_t value, boost::uint32_t unless_this) -{ - boost::uint32_t old, c(atomic_read32(mem)); - while(c != unless_this && (old = atomic_cas32(mem, c + value, c)) != c){ - c = old; - } - return c != unless_this; -} - -} //namespace ipcdetail -} //namespace interprocess -} //namespace boost - - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //BOOST_INTERPROCESS_DETAIL_ATOMIC_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/cast_tags.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/cast_tags.hpp deleted file mode 100644 index e47b86344c..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/cast_tags.hpp +++ /dev/null @@ -1,31 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_INTERPROCESS_DETAIL_CAST_TAGS_HPP -#define BOOST_INTERPROCESS_DETAIL_CAST_TAGS_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -namespace boost { namespace interprocess { namespace ipcdetail { - -struct static_cast_tag {}; -struct const_cast_tag {}; -struct dynamic_cast_tag {}; -struct reinterpret_cast_tag {}; - -}}} //namespace boost { namespace interprocess { namespace ipcdetail { - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_CAST_TAGS_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/in_place_interface.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/in_place_interface.hpp deleted file mode 100644 index 6ba6229bfc..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/in_place_interface.hpp +++ /dev/null @@ -1,77 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_INTERPROCESS_IN_PLACE_INTERFACE_HPP -#define BOOST_INTERPROCESS_IN_PLACE_INTERFACE_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> -#include <boost/interprocess/detail/type_traits.hpp> -#include <boost/container/detail/type_traits.hpp> //alignment_of, aligned_storage -#include <typeinfo> //typeid - -//!\file -//!Describes an abstract interface for placement construction and destruction. - -namespace boost { -namespace interprocess { -namespace ipcdetail { - -struct in_place_interface -{ - in_place_interface(std::size_t alignm, std::size_t sz, const char *tname) - : alignment(alignm), size(sz), type_name(tname) - {} - - std::size_t alignment; - std::size_t size; - const char *type_name; - - virtual void construct_n(void *mem, std::size_t num, std::size_t &constructed) = 0; - virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed) = 0; - virtual ~in_place_interface(){} -}; - -template<class T> -struct placement_destroy : public in_place_interface -{ - placement_destroy() - : in_place_interface(::boost::container::dtl::alignment_of<T>::value, sizeof(T), typeid(T).name()) - {} - - virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed) BOOST_OVERRIDE - { - T* memory = static_cast<T*>(mem); - for(destroyed = 0; destroyed < num; ++destroyed) - (memory++)->~T(); - } - - virtual void construct_n(void *, std::size_t, std::size_t &) BOOST_OVERRIDE {} - - private: - void destroy(void *mem) - { static_cast<T*>(mem)->~T(); } -}; - -} -} -} //namespace boost { namespace interprocess { namespace ipcdetail { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_IN_PLACE_INTERFACE_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/math_functions.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/math_functions.hpp deleted file mode 100644 index a19efac1a4..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/math_functions.hpp +++ /dev/null @@ -1,118 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Stephen Cleary 2000. -// (C) Copyright Ion Gaztanaga 2007-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. -// -// This file is a slightly modified file from Boost.Pool -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP -#define BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <climits> -#include <boost/static_assert.hpp> - -namespace boost { -namespace interprocess { -namespace ipcdetail { - -// Greatest common divisor and least common multiple - -// -// gcd is an algorithm that calculates the greatest common divisor of two -// integers, using Euclid's algorithm. -// -// Pre: A > 0 && B > 0 -// Recommended: A > B -template <typename Integer> -inline Integer gcd(Integer A, Integer B) -{ - do - { - const Integer tmp(B); - B = A % B; - A = tmp; - } while (B != 0); - - return A; -} - -// -// lcm is an algorithm that calculates the least common multiple of two -// integers. -// -// Pre: A > 0 && B > 0 -// Recommended: A > B -template <typename Integer> -inline Integer lcm(const Integer & A, const Integer & B) -{ - Integer ret = A; - ret /= gcd(A, B); - ret *= B; - return ret; -} - -template <typename Integer> -inline Integer log2_ceil(const Integer & A) -{ - Integer i = 0; - Integer power_of_2 = 1; - - while(power_of_2 < A){ - power_of_2 <<= 1; - ++i; - } - return i; -} - -template <typename Integer> -inline Integer upper_power_of_2(const Integer & A) -{ - Integer power_of_2 = 1; - - while(power_of_2 < A){ - power_of_2 <<= 1; - } - return power_of_2; -} - -//This function uses binary search to discover the -//highest set bit of the integer -inline std::size_t floor_log2 (std::size_t x) -{ - const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT; - const bool Size_t_Bits_Power_2= !(Bits & (Bits-1)); - BOOST_STATIC_ASSERT(((Size_t_Bits_Power_2)== true)); - - std::size_t n = x; - std::size_t log2 = 0; - - for(std::size_t shift = Bits >> 1; shift; shift >>= 1){ - std::size_t tmp = n >> shift; - if (tmp) - log2 += shift, n = tmp; - } - - return log2; -} - -} // namespace ipcdetail -} // namespace interprocess -} // namespace boost - -#endif diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/min_max.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/min_max.hpp deleted file mode 100644 index 2097ff4246..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/min_max.hpp +++ /dev/null @@ -1,44 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_INTERPROCESS_DETAIL_MIN_MAX_HPP -#define BOOST_INTERPROCESS_DETAIL_MIN_MAX_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -namespace boost { -namespace interprocess { - -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; } - -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_MIN_MAX_HPP - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/mpl.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/mpl.hpp deleted file mode 100644 index 3dd8d63e17..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/mpl.hpp +++ /dev/null @@ -1,122 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2016. -// -// Distributed under the 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_INTERPROCESS_DETAIL_MPL_HPP -#define BOOST_INTERPROCESS_DETAIL_MPL_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <cstddef> - -namespace boost { -namespace interprocess { -namespace ipcdetail { - -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_; -}; - -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 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<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; -}; - -} //namespace ipcdetail { -} //namespace interprocess { -} //namespace boost { - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/nothrow.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/nothrow.hpp deleted file mode 100644 index d79ba7647e..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/nothrow.hpp +++ /dev/null @@ -1,42 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the 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_INTERPROCESS_DETAIL_NOTHROW_HPP -#define BOOST_INTERPROCESS_DETAIL_NOTHROW_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -namespace std { //no namespace versioning in clang+libc++ - -struct nothrow_t; - -} //namespace std { - -namespace boost{ namespace interprocess { - -template <int Dummy = 0> -struct nothrow -{ - static const std::nothrow_t &get() { return *pnothrow; } - static std::nothrow_t *pnothrow; -}; - -template <int Dummy> -std::nothrow_t *nothrow<Dummy>::pnothrow = - reinterpret_cast<std::nothrow_t *>(0x1234); //Avoid sanitizer warnings on references to null - -}} //namespace boost{ namespace interprocess { - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_NOTHROW_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/pointer_type.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/pointer_type.hpp deleted file mode 100644 index 125858653e..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/pointer_type.hpp +++ /dev/null @@ -1,78 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2012. -// (C) Copyright Gennaro Prota 2003 - 2004. -// -// Distributed under the 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_INTERPROCESS_DETAIL_POINTER_TYPE_HPP -#define BOOST_INTERPROCESS_DETAIL_POINTER_TYPE_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> -#include <boost/interprocess/detail/type_traits.hpp> - -namespace boost { -namespace interprocess { -namespace ipcdetail { - -struct two {char _[2];}; - -namespace pointer_type_imp { - -template <class U> static two test(...); -template <class U> static char test(typename U::pointer* = 0); - -} //namespace pointer_type_imp { - -template <class T> -struct has_pointer_type -{ - static const bool value = sizeof(pointer_type_imp::test<T>(0)) == 1; -}; - -namespace pointer_type_imp { - -template <class T, class D, bool = has_pointer_type<D>::value> -struct pointer_type -{ - typedef typename D::pointer type; -}; - -template <class T, class D> -struct pointer_type<T, D, false> -{ - typedef T* type; -}; - -} //namespace pointer_type_imp { - -template <class T, class D> -struct pointer_type -{ - typedef typename pointer_type_imp::pointer_type<T, - typename remove_reference<D>::type>::type type; -}; - -} //namespace ipcdetail { -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_POINTER_TYPE_HPP - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/segment_manager_helper.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/segment_manager_helper.hpp deleted file mode 100644 index 036dab5cc7..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/segment_manager_helper.hpp +++ /dev/null @@ -1,518 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_INTERPROCESS_SEGMENT_MANAGER_BASE_HPP -#define BOOST_INTERPROCESS_SEGMENT_MANAGER_BASE_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -// interprocess -#include <boost/interprocess/exceptions.hpp> -// interprocess/detail -#include <boost/interprocess/detail/type_traits.hpp> -#include <boost/interprocess/detail/utilities.hpp> -#include <boost/interprocess/detail/in_place_interface.hpp> -// container/detail -#include <boost/container/detail/type_traits.hpp> //alignment_of -#include <boost/container/detail/minimal_char_traits_header.hpp> -// intrusive -#include <boost/intrusive/pointer_traits.hpp> -// move/detail -#include <boost/move/detail/type_traits.hpp> //make_unsigned -#include <boost/move/detail/force_ptr.hpp> -// other boost -#include <boost/assert.hpp> //BOOST_ASSERT -#include <boost/core/no_exceptions_support.hpp> -// std -#include <cstddef> //std::size_t - -//!\file -//!Describes the object placed in a memory segment that provides -//!named object allocation capabilities. - -namespace boost{ -namespace interprocess{ - -template<class MemoryManager> -class segment_manager_base; - -//!An integer that describes the type of the -//!instance constructed in memory -enum instance_type { anonymous_type, named_type, unique_type, max_allocation_type }; - -namespace ipcdetail{ - -template<class MemoryAlgorithm> -class mem_algo_deallocator -{ - void * m_ptr; - MemoryAlgorithm & m_algo; - - public: - mem_algo_deallocator(void *ptr, MemoryAlgorithm &algo) - : m_ptr(ptr), m_algo(algo) - {} - - void release() - { m_ptr = 0; } - - ~mem_algo_deallocator() - { if(m_ptr) m_algo.deallocate(m_ptr); } -}; - -template<class size_type> -struct block_header -{ - size_type m_value_bytes; - unsigned short m_num_char; - unsigned char m_value_alignment; - unsigned char m_alloc_type_sizeof_char; - - block_header(size_type val_bytes - ,size_type val_alignment - ,unsigned char al_type - ,std::size_t szof_char - ,std::size_t num_char - ) - : m_value_bytes(val_bytes) - , m_num_char((unsigned short)num_char) - , m_value_alignment((unsigned char)val_alignment) - , m_alloc_type_sizeof_char( (unsigned char)((al_type << 5u) | ((unsigned char)szof_char & 0x1F)) ) - {}; - - template<class T> - block_header &operator= (const T& ) - { return *this; } - - size_type total_size() const - { - if(alloc_type() != anonymous_type){ - return name_offset() + (m_num_char+1u)*sizeof_char(); - } - else{ - return this->value_offset() + m_value_bytes; - } - } - - size_type value_bytes() const - { return m_value_bytes; } - - template<class Header> - size_type total_size_with_header() const - { - return get_rounded_size - ( size_type(sizeof(Header)) - , size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value)) - + total_size(); - } - - unsigned char alloc_type() const - { return (m_alloc_type_sizeof_char >> 5u)&(unsigned char)0x7; } - - unsigned char sizeof_char() const - { return m_alloc_type_sizeof_char & (unsigned char)0x1F; } - - template<class CharType> - CharType *name() const - { - return const_cast<CharType*>(move_detail::force_ptr<const CharType*> - (reinterpret_cast<const char*>(this) + name_offset())); - } - - unsigned short name_length() const - { return m_num_char; } - - size_type name_offset() const - { - return this->value_offset() + get_rounded_size(size_type(m_value_bytes), size_type(sizeof_char())); - } - - void *value() const - { - return const_cast<char*>((reinterpret_cast<const char*>(this) + this->value_offset())); - } - - size_type value_offset() const - { - return get_rounded_size(size_type(sizeof(block_header<size_type>)), size_type(m_value_alignment)); - } - - template<class CharType> - bool less_comp(const block_header<size_type> &b) const - { - return m_num_char < b.m_num_char || - (m_num_char < b.m_num_char && - std::char_traits<CharType>::compare(name<CharType>(), b.name<CharType>(), m_num_char) < 0); - } - - template<class CharType> - bool equal_comp(const block_header<size_type> &b) const - { - return m_num_char == b.m_num_char && - std::char_traits<CharType>::compare(name<CharType>(), b.name<CharType>(), m_num_char) == 0; - } - - template<class T> - static block_header<size_type> *block_header_from_value(T *value) - { return block_header_from_value(value, sizeof(T), ::boost::container::dtl::alignment_of<T>::value); } - - static block_header<size_type> *block_header_from_value(const void *value, std::size_t sz, std::size_t algn) - { - block_header * hdr = - const_cast<block_header*> - (move_detail::force_ptr<const block_header*>(reinterpret_cast<const char*>(value) - - get_rounded_size(sizeof(block_header), algn))); - (void)sz; - //Some sanity checks - BOOST_ASSERT(hdr->m_value_alignment == algn); - BOOST_ASSERT(hdr->m_value_bytes % sz == 0); - return hdr; - } - - template<class Header> - static block_header<size_type> *from_first_header(Header *header) - { - block_header<size_type> * hdr = - move_detail::force_ptr<block_header<size_type>*>(reinterpret_cast<char*>(header) + - get_rounded_size( size_type(sizeof(Header)) - , size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value))); - //Some sanity checks - return hdr; - } - - template<class Header> - static Header *to_first_header(block_header<size_type> *bheader) - { - Header * hdr = - move_detail::force_ptr<Header*>(reinterpret_cast<char*>(bheader) - - get_rounded_size( size_type(sizeof(Header)) - , size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value))); - //Some sanity checks - return hdr; - } -}; - -inline void array_construct(void *mem, std::size_t num, in_place_interface &table) -{ - //Try constructors - std::size_t constructed = 0; - BOOST_TRY{ - table.construct_n(mem, num, constructed); - } - //If there is an exception call destructors and erase index node - BOOST_CATCH(...){ - std::size_t destroyed = 0; - table.destroy_n(mem, constructed, destroyed); - BOOST_RETHROW - } BOOST_CATCH_END -} - -template<class CharT> -struct intrusive_compare_key -{ - typedef CharT char_type; - - intrusive_compare_key(const CharT *str, std::size_t len) - : mp_str(str), m_len(len) - {} - - const CharT * mp_str; - std::size_t m_len; -}; - -//!This struct indicates an anonymous object creation -//!allocation -template<instance_type type> -class instance_t -{ - instance_t(){} -}; - -template<class T> -struct char_if_void -{ - typedef T type; -}; - -template<> -struct char_if_void<void> -{ - typedef char type; -}; - -typedef instance_t<anonymous_type> anonymous_instance_t; -typedef instance_t<unique_type> unique_instance_t; - - -template<class Hook, class CharType, class SizeType> -struct intrusive_value_type_impl - : public Hook -{ - private: - //Non-copyable - intrusive_value_type_impl(const intrusive_value_type_impl &); - intrusive_value_type_impl& operator=(const intrusive_value_type_impl &); - - public: - typedef CharType char_type; - typedef SizeType size_type; - - intrusive_value_type_impl(){} - - enum { BlockHdrAlignment = ::boost::container::dtl::alignment_of<block_header<size_type> >::value }; - - block_header<size_type> *get_block_header() const - { - return const_cast<block_header<size_type>*> - (move_detail::force_ptr<const block_header<size_type> *>(reinterpret_cast<const char*>(this) + - get_rounded_size(size_type(sizeof(*this)), size_type(BlockHdrAlignment)))); - } - - bool operator <(const intrusive_value_type_impl<Hook, CharType, SizeType> & other) const - { return (this->get_block_header())->template less_comp<CharType>(*other.get_block_header()); } - - bool operator ==(const intrusive_value_type_impl<Hook, CharType, SizeType> & other) const - { return (this->get_block_header())->template equal_comp<CharType>(*other.get_block_header()); } - - static intrusive_value_type_impl *get_intrusive_value_type(block_header<size_type> *hdr) - { - return move_detail::force_ptr<intrusive_value_type_impl*>(reinterpret_cast<char*>(hdr) - - get_rounded_size(size_type(sizeof(intrusive_value_type_impl)), size_type(BlockHdrAlignment))); - } - - CharType *name() const - { return get_block_header()->template name<CharType>(); } - - unsigned short name_length() const - { return get_block_header()->name_length(); } - - void *value() const - { return get_block_header()->value(); } -}; - -template<class CharType> -class char_ptr_holder -{ - public: - char_ptr_holder(const CharType *name) - : m_name(name) - {} - - char_ptr_holder(const anonymous_instance_t *) - : m_name(static_cast<CharType*>(0)) - {} - - char_ptr_holder(const unique_instance_t *) - : m_name(reinterpret_cast<CharType*>(-1)) - {} - - operator const CharType *() - { return m_name; } - - const CharType *get() const - { return m_name; } - - bool is_unique() const - { return m_name == reinterpret_cast<CharType*>(-1); } - - bool is_anonymous() const - { return m_name == static_cast<CharType*>(0); } - - private: - const CharType *m_name; -}; - -//!The key of the the named allocation information index. Stores an offset pointer -//!to a null terminated string and the length of the string to speed up sorting -template<class CharT, class VoidPointer> -struct index_key -{ - typedef typename boost::intrusive:: - pointer_traits<VoidPointer>::template - rebind_pointer<const CharT>::type const_char_ptr_t; - typedef CharT char_type; - typedef typename boost::intrusive::pointer_traits<const_char_ptr_t>::difference_type difference_type; - typedef typename boost::move_detail::make_unsigned<difference_type>::type size_type; - - private: - //Offset pointer to the object's name - const_char_ptr_t mp_str; - //Length of the name buffer (null NOT included) - size_type m_len; - public: - - //!Constructor of the key - index_key (const char_type *nm, size_type length) - : mp_str(nm), m_len(length) - {} - - //!Less than function for index ordering - bool operator < (const index_key & right) const - { - return (m_len < right.m_len) || - (m_len == right.m_len && - std::char_traits<char_type>::compare - (to_raw_pointer(mp_str),to_raw_pointer(right.mp_str), m_len) < 0); - } - - //!Equal to function for index ordering - bool operator == (const index_key & right) const - { - return m_len == right.m_len && - std::char_traits<char_type>::compare - (to_raw_pointer(mp_str), to_raw_pointer(right.mp_str), m_len) == 0; - } - - void name(const CharT *nm) - { mp_str = nm; } - - void name_length(size_type len) - { m_len = len; } - - const CharT *name() const - { return to_raw_pointer(mp_str); } - - size_type name_length() const - { return m_len; } -}; - -//!The index_data stores a pointer to a buffer and the element count needed -//!to know how many destructors must be called when calling destroy -template<class VoidPointer> -struct index_data -{ - typedef VoidPointer void_pointer; - void_pointer m_ptr; - explicit index_data(void *ptr) : m_ptr(ptr){} - - void *value() const - { return static_cast<void*>(to_raw_pointer(m_ptr)); } -}; - -template<class MemoryAlgorithm> -struct segment_manager_base_type -{ typedef segment_manager_base<MemoryAlgorithm> type; }; - -template<class CharT, class MemoryAlgorithm> -struct index_config -{ - typedef typename MemoryAlgorithm::void_pointer void_pointer; - typedef CharT char_type; - typedef index_key<CharT, void_pointer> key_type; - typedef index_data<void_pointer> mapped_type; - typedef typename segment_manager_base_type - <MemoryAlgorithm>::type segment_manager_base; - - template<class HeaderBase> - struct intrusive_value_type - { typedef intrusive_value_type_impl<HeaderBase, CharT, typename segment_manager_base::size_type> type; }; - - typedef intrusive_compare_key<CharT> intrusive_compare_key_type; -}; - -template<class Iterator, bool intrusive> -class segment_manager_iterator_value_adaptor -{ - typedef typename Iterator::value_type iterator_val_t; - typedef typename iterator_val_t::char_type char_type; - - public: - segment_manager_iterator_value_adaptor(const typename Iterator::value_type &val) - : m_val(&val) - {} - - const char_type *name() const - { return m_val->name(); } - - unsigned short name_length() const - { return m_val->name_length(); } - - const void *value() const - { return m_val->value(); } - - const typename Iterator::value_type *m_val; -}; - - -template<class Iterator> -class segment_manager_iterator_value_adaptor<Iterator, false> -{ - typedef typename Iterator::value_type iterator_val_t; - typedef typename iterator_val_t::first_type first_type; - typedef typename iterator_val_t::second_type second_type; - typedef typename first_type::char_type char_type; - typedef typename first_type::size_type size_type; - - public: - segment_manager_iterator_value_adaptor(const typename Iterator::value_type &val) - : m_val(&val) - {} - - const char_type *name() const - { return m_val->first.name(); } - - size_type name_length() const - { return m_val->first.name_length(); } - - const void *value() const - { - return move_detail::force_ptr<block_header<size_type>*> - (to_raw_pointer(m_val->second.m_ptr))->value(); - } - - const typename Iterator::value_type *m_val; -}; - -template<class Iterator, bool intrusive> -struct segment_manager_iterator_transform -{ - typedef segment_manager_iterator_value_adaptor<Iterator, intrusive> result_type; - - template <class T> result_type operator()(const T &arg) const - { return result_type(arg); } -}; - -} //namespace ipcdetail { - -//These pointers are the ones the user will use to -//indicate previous allocation types -static const ipcdetail::anonymous_instance_t * anonymous_instance = 0; -static const ipcdetail::unique_instance_t * unique_instance = 0; - -namespace ipcdetail_really_deep_namespace { - -//Otherwise, gcc issues a warning of previously defined -//anonymous_instance and unique_instance -struct dummy -{ - dummy() - { - (void)anonymous_instance; - (void)unique_instance; - } -}; - -} //detail_really_deep_namespace - -}} //namespace boost { namespace interprocess - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_SEGMENT_MANAGER_BASE_HPP - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/simple_swap.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/simple_swap.hpp deleted file mode 100644 index 797a997075..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/simple_swap.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef BOOST_INTERPROCESS_DETAIL_SWAP_HPP -#define BOOST_INTERPROCESS_DETAIL_SWAP_HPP -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the 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_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -namespace boost { namespace interprocess { - -template<class T> -void simple_swap(T&x, T&y) -{ T tmp(x); x = y; y = tmp; } - -}} //namespace boost{ namespace interprocess { - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_SWAP_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/std_fwd.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/std_fwd.hpp deleted file mode 100644 index 282771c3e6..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/std_fwd.hpp +++ /dev/null @@ -1,57 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the 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_INTERPROCESS_DETAIL_STD_FWD_HPP -#define BOOST_INTERPROCESS_DETAIL_STD_FWD_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -////////////////////////////////////////////////////////////////////////////// -// Standard predeclarations -////////////////////////////////////////////////////////////////////////////// - -#include <boost/move/detail/std_ns_begin.hpp> -BOOST_MOVE_STD_NS_BEG - -struct input_iterator_tag; -struct forward_iterator_tag; -struct bidirectional_iterator_tag; -struct random_access_iterator_tag; - -template<class T> -struct char_traits; - -#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1800) &&defined(BOOST_DINKUMWARE_STDLIB) -#define BOOST_INTERPROCESS_STD_FWD_MSVC_IOS_BUG -// Compiler bug workaround. Previous versions (<= VC11) -// used dummy virtual functions -# pragma vtordisp(push, 2) -#endif - -template<class CharT, class Traits> -class basic_ostream; - -template<class CharT, class Traits> -class basic_istream; - -#ifdef BOOST_INTERPROCESS_STD_FWD_MSVC_IOS_BUG -# pragma vtordisp(pop) -# undef BOOST_INTERPROCESS_STD_FWD_MSVC_IOS_BUG -#endif - -BOOST_MOVE_STD_NS_END -#include <boost/move/detail/std_ns_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_STD_FWD_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/type_traits.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/type_traits.hpp deleted file mode 100644 index 5765c888e7..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/type_traits.hpp +++ /dev/null @@ -1,162 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP -#define BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> - -namespace boost { -namespace interprocess { -namespace ipcdetail { - -struct nat{}; - -template<class T> -struct remove_reference -{ - typedef T type; -}; - -template<class T> -struct remove_reference<T&> -{ - typedef T type; -}; - -template<class T> -struct is_reference -{ - static const bool value = false; -}; - -template<class T> -struct is_reference<T&> -{ - static const bool value = true; -}; - -template<class T> -struct is_pointer -{ - static const bool value = false; -}; - -template<class T> -struct is_pointer<T*> -{ - static const bool 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<class T> -struct remove_const -{ - typedef T type; -}; - -template<class T> -struct remove_const<const T> -{ - typedef T type; -}; - -template<class T> -struct remove_volatile -{ - typedef T type; -}; - -template<class T> -struct remove_volatile<volatile T> -{ - typedef T type; -}; - -template<class T> -struct remove_const_volatile -{ - typedef typename remove_const<typename remove_volatile<T>::type>::type 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, class U> -struct is_cv_same -{ - static const bool value = is_same< typename remove_const_volatile<T>::type - , typename remove_const_volatile<U>::type >::value; -}; - -} // namespace ipcdetail -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/utilities.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/utilities.hpp deleted file mode 100644 index 247dff1e88..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/utilities.hpp +++ /dev/null @@ -1,213 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2015. -// (C) Copyright Gennaro Prota 2003 - 2004. -// -// Distributed under the 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_INTERPROCESS_DETAIL_UTILITIES_HPP -#define BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/interprocess/interprocess_fwd.hpp> -#include <boost/move/utility_core.hpp> -#include <boost/interprocess/detail/min_max.hpp> -#include <boost/interprocess/detail/type_traits.hpp> -#include <boost/interprocess/detail/mpl.hpp> -#include <boost/intrusive/pointer_traits.hpp> -#include <boost/move/utility_core.hpp> -#include <boost/static_assert.hpp> -#include <boost/cstdint.hpp> -#include <climits> - -namespace boost { -namespace interprocess { -namespace ipcdetail { - -template <class T> -inline T* to_raw_pointer(T* p) -{ return p; } - -template <class Pointer> -inline typename boost::intrusive::pointer_traits<Pointer>::element_type* -to_raw_pointer(const Pointer &p) -{ return boost::interprocess::ipcdetail::to_raw_pointer(p.operator->()); } - -//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; -} - -//Truncates "orig_size" to a multiple of "multiple" bytes. -template<class SizeType> -inline SizeType get_truncated_size(SizeType orig_size, SizeType multiple) -{ - return orig_size/multiple*multiple; -} - -//Rounds "orig_size" by excess to round_to bytes. round_to must be power of two -template<class SizeType> -inline SizeType get_rounded_size_po2(SizeType orig_size, SizeType round_to) -{ - return ((orig_size-1)&(~(round_to-1))) + round_to; -} - -//Truncates "orig_size" to a multiple of "multiple" bytes. multiple must be power of two -template<class SizeType> -inline SizeType get_truncated_size_po2(SizeType orig_size, SizeType multiple) -{ - return (orig_size & (~(multiple-1))); -} - -template <std::size_t OrigSize, std::size_t RoundTo> -struct ct_rounded_size -{ - BOOST_STATIC_ASSERT((RoundTo != 0)); - static const std::size_t intermediate_value = (OrigSize-1)/RoundTo+1; - BOOST_STATIC_ASSERT(intermediate_value <= std::size_t(-1)/RoundTo); - static const std::size_t value = intermediate_value*RoundTo; -}; - -// Gennaro Prota wrote this. Thanks! -template <std::size_t p, std::size_t n = 4> -struct ct_max_pow2_less -{ - static const std::size_t c = 2*n < p; - - static const std::size_t value = - c ? (ct_max_pow2_less< c*p, 2*c*n>::value) : n; -}; - -template <> -struct ct_max_pow2_less<0, 0> -{ - static const std::size_t value = 0; -}; - -} //namespace ipcdetail { - -//!Trait class to detect if an index is a node -//!index. This allows more efficient operations -//!when deallocating named objects. -template <class Index> -struct is_node_index -{ - static const bool value = false; -}; - -//!Trait class to detect if an index is an intrusive -//!index. This will embed the derivation hook in each -//!allocation header, to provide memory for the intrusive -//!container. -template <class Index> -struct is_intrusive_index -{ - static const bool value = false; -}; - -template <typename T> -BOOST_INTERPROCESS_FORCEINLINE T* addressof(T& v) -{ - return reinterpret_cast<T*>( - &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); -} - -template<class SizeType> -struct sqrt_size_type_max -{ - static const SizeType value = (SizeType(1) << (sizeof(SizeType)*(CHAR_BIT/2)))-1; -}; - -template<class SizeType> -inline bool multiplication_overflows(SizeType a, SizeType b) -{ - const SizeType sqrt_size_max = sqrt_size_type_max<SizeType>::value; - return //Fast runtime check - ( (a | b) > sqrt_size_max && - //Slow division check - b && a > SizeType(-1)/b - ); -} - -template<std::size_t SztSizeOfType, class SizeType> -BOOST_INTERPROCESS_FORCEINLINE bool size_overflows(SizeType count) -{ - //Compile time-check - BOOST_STATIC_ASSERT(SztSizeOfType <= SizeType(-1)); - //Runtime check - return multiplication_overflows(SizeType(SztSizeOfType), count); -} - -template<class RawPointer, class OffsetType> -class pointer_offset_caster; - -template<class T, class OffsetType> -class pointer_offset_caster<T*, OffsetType> -{ - public: - BOOST_INTERPROCESS_FORCEINLINE explicit pointer_offset_caster(OffsetType off) - : m_offset(off) - {} - - BOOST_INTERPROCESS_FORCEINLINE explicit pointer_offset_caster(const volatile T *p) - : m_offset(reinterpret_cast<OffsetType>(p)) - {} - - BOOST_INTERPROCESS_FORCEINLINE OffsetType offset() const - { return m_offset; } - - BOOST_INTERPROCESS_FORCEINLINE T* pointer() const - { return reinterpret_cast<T*>(m_offset); } - - private: - OffsetType m_offset; -}; - - -template<class SizeType> -inline bool sum_overflows(SizeType a, SizeType b) -{ return SizeType(-1) - a < b; } - -//Anti-exception node eraser -template<class Cont> -class value_eraser -{ - public: - value_eraser(Cont & cont, typename Cont::iterator it) - : m_cont(cont), m_index_it(it), m_erase(true){} - ~value_eraser() - { if(m_erase) m_cont.erase(m_index_it); } - - BOOST_INTERPROCESS_FORCEINLINE void release() { m_erase = false; } - - private: - Cont &m_cont; - typename Cont::iterator m_index_it; - bool m_erase; -}; - -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/win32_api.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/win32_api.hpp deleted file mode 100644 index 3967b0b299..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/detail/win32_api.hpp +++ /dev/null @@ -1,1891 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2015. Distributed under the 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_INTERPROCESS_WIN32_API_HPP -#define BOOST_INTERPROCESS_WIN32_API_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> -#include <boost/cstdint.hpp> -#include <cstddef> -#include <cstring> -#include <cstdlib> -#include <cstdio> - -#include <boost/assert.hpp> -#include <string> -#include <vector> - -#ifdef BOOST_USE_WINDOWS_H -#include <windows.h> -#endif - -#if defined(_MSC_VER) -# pragma once -# pragma comment( lib, "Advapi32.lib" ) -# pragma comment( lib, "oleaut32.lib" ) -# pragma comment( lib, "Ole32.lib" ) -#endif - -#if defined (BOOST_INTERPROCESS_WINDOWS) -# include <cstdarg> -# include <boost/detail/interlocked.hpp> -#else -# error "This file can only be included in Windows OS" -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// Declaration of Windows structures or typedefs if BOOST_USE_WINDOWS_H is used -// -////////////////////////////////////////////////////////////////////////////// - - -#if defined(BOOST_GCC) -//Ignore -pedantic errors here (anonymous structs, etc.) -# if (BOOST_GCC >= 40600) -# pragma GCC diagnostic push -# if (BOOST_GCC >= 40800) -# pragma GCC diagnostic ignored "-Wpedantic" -# else -# pragma GCC diagnostic ignored "-pedantic" -# endif -# pragma GCC diagnostic ignored "-Wnon-virtual-dtor" -# else -# pragma GCC system_header -# endif -//When loading DLLs we have no option but reinterpret casting function types -# if (BOOST_GCC >= 80000) -# pragma GCC diagnostic ignored "-Wcast-function-type" -# endif -#endif - - -//#define BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED -//#define BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED - -#ifdef BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED -# define BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED_VALUE 1 -#else -# define BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED_VALUE 0 -#endif - -#ifdef BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED -# define BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED_VALUE 1 -#else -# define BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED_VALUE 0 -#endif - -#define BOOST_INTERPROCESS_BOOTSTAMP_VALUE_SUM \ - (BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED_VALUE + \ - BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED_VALUE) - -#if 1 < BOOST_INTERPROCESS_BOOTSTAMP_VALUE_SUM -# error "Only one of \ - BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED and \ - BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED can be defined" -#endif - -#if 0 == BOOST_INTERPROCESS_BOOTSTAMP_VALUE_SUM -# define BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED -#endif - - -namespace boost { -namespace interprocess { -namespace winapi { - -//Own defines -static const unsigned long MaxPath = 260; - -////////////////////////////////////////////////////////////////////////////// -// -// Nt native structures -// -////////////////////////////////////////////////////////////////////////////// - -struct interprocess_semaphore_basic_information -{ - unsigned long count; // current semaphore count - unsigned long limit; // max semaphore count -}; - -struct interprocess_section_basic_information -{ - void * base_address; - unsigned long section_attributes; - __int64 section_size; -}; - -struct file_rename_information_t { - int Replace; - void *RootDir; - unsigned long FileNameLength; - wchar_t FileName[1]; -}; - -struct unicode_string_t { - unsigned short Length; - unsigned short MaximumLength; - wchar_t *Buffer; -}; - -struct object_attributes_t { - unsigned long Length; - void * RootDirectory; - unicode_string_t *ObjectName; - unsigned long Attributes; - void *SecurityDescriptor; - void *SecurityQualityOfService; -}; - -struct io_status_block_t { - union { - long Status; - void *Pointer; - }; - - unsigned long *Information; -}; - -union system_timeofday_information -{ - struct data_t - { - __int64 liKeBootTime; - __int64 liKeSystemTime; - __int64 liExpTimeZoneBias; - unsigned long uCurrentTimeZoneId; - unsigned long dwReserved; - ::boost::ulong_long_type ullBootTimeBias; - ::boost::ulong_long_type ullSleepTimeBias; - } data; - unsigned char Reserved1[sizeof(data_t)]; -}; - -static const long BootstampLength = sizeof(__int64); -static const long BootAndSystemstampLength = sizeof(__int64)*2; -static const long SystemTimeOfDayInfoLength = sizeof(system_timeofday_information::data_t); - -struct object_name_information_t -{ - unicode_string_t Name; - wchar_t NameBuffer[1]; -}; - -enum file_information_class_t { - file_directory_information = 1, - file_full_directory_information, - file_both_directory_information, - file_basic_information, - file_standard_information, - file_internal_information, - file_ea_information, - file_access_information, - file_name_information, - file_rename_information, - file_link_information, - file_names_information, - file_disposition_information, - file_position_information, - file_full_ea_information, - file_mode_information, - file_alignment_information, - file_all_information, - file_allocation_information, - file_end_of_file_information, - file_alternate_name_information, - file_stream_information, - file_pipe_information, - file_pipe_local_information, - file_pipe_remote_information, - file_mailslot_query_information, - file_mailslot_set_information, - file_compression_information, - file_copy_on_write_information, - file_completion_information, - file_move_cluster_information, - file_quota_information, - file_reparse_point_information, - file_network_open_information, - file_object_id_information, - file_tracking_information, - file_ole_directory_information, - file_content_index_information, - file_inherit_content_index_information, - file_ole_information, - file_maximum_information -}; - -enum semaphore_information_class { - semaphore_basic_information = 0 -}; - - -enum system_information_class { - system_basic_information = 0, - system_performance_information = 2, - system_time_of_day_information = 3, - system_process_information = 5, - system_processor_performance_information = 8, - system_interrupt_information = 23, - system_exception_information = 33, - system_registry_quota_information = 37, - system_lookaside_information = 45 -}; - -enum object_information_class -{ - object_basic_information, - object_name_information, - object_type_information, - object_all_information, - object_data_information -}; - -enum section_information_class -{ - section_basic_information, - section_image_information -}; - -} //namespace winapi { -} //namespace interprocess { -} //namespace boost { - - -////////////////////////////////////////////////////////////////////////////// -// -// Forward declaration of winapi -// -////////////////////////////////////////////////////////////////////////////// - -#include <boost/winapi/get_current_process_id.hpp> -#include <boost/winapi/get_current_thread_id.hpp> -#include <boost/winapi/get_current_process.hpp> -#include <boost/winapi/get_process_times.hpp> -#include <boost/winapi/error_codes.hpp> -#include <boost/winapi/thread.hpp> -#include <boost/winapi/system.hpp> -#include <boost/winapi/time.hpp> -#include <boost/winapi/timers.hpp> -#include <boost/winapi/get_last_error.hpp> -#include <boost/winapi/handles.hpp> -#include <boost/winapi/file_management.hpp> -#include <boost/winapi/mutex.hpp> -#include <boost/winapi/wait.hpp> -#include <boost/winapi/file_mapping.hpp> -#include <boost/winapi/semaphore.hpp> -#include <boost/winapi/system.hpp> -#include <boost/winapi/error_handling.hpp> -#include <boost/winapi/local_memory.hpp> -#include <boost/winapi/directory_management.hpp> -#include <boost/winapi/security.hpp> -#include <boost/winapi/dll.hpp> -#include <boost/winapi/basic_types.hpp> - -//This should go in winapi's basic_types.hpp -namespace boost { -namespace ipwinapiext { -typedef boost::winapi::LONG_ LSTATUS; - -typedef boost::winapi::DWORD_ (__stdcall *LPTHREAD_START_ROUTINE_) - (boost::winapi::LPVOID_ lpThreadParameter); - - -//#ifndef BOOST_USE_WINDOWS_H -//typedef boost::winapi::LARGE_INTEGER_ LARGE_INTEGER_EXT; -//#else -//typedef LARGE_INTEGER LARGE_INTEGER_EXT; -//#endif - -}} //namespace boost::ipwinapiext - -#ifndef BOOST_USE_WINDOWS_H - -extern "C" { - -//Error handling -BOOST_SYMBOL_IMPORT BOOST_WINAPI_DETAIL_VOID BOOST_WINAPI_WINAPI_CC SetLastError(boost::winapi::DWORD_ dwErrCode); - -//File management -BOOST_SYMBOL_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC GetFileType(boost::winapi::HANDLE_ hTemplateFile); -BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC FlushFileBuffers(boost::winapi::HANDLE_ hFile); - -//threading - -BOOST_SYMBOL_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC CreateThread - ( ::_SECURITY_ATTRIBUTES* lpThreadAttributes - , boost::winapi::SIZE_T_ dwStackSize - , boost::ipwinapiext::LPTHREAD_START_ROUTINE_ lpStartAddress - , boost::winapi::LPVOID_ lpParameter - , boost::winapi::DWORD_ dwCreationFlags - , boost::winapi::LPDWORD_ lpThreadId - ); - -//Virtual Memory -BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC VirtualLock(boost::winapi::LPVOID_ lpAddress, boost::winapi::SIZE_T_ dwSize); -BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC VirtualUnlock(boost::winapi::LPVOID_ lpAddress, boost::winapi::SIZE_T_ dwSize); -BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC VirtualProtect( boost::winapi::LPVOID_ lpAddress, boost::winapi::SIZE_T_ dwSize - , boost::winapi::DWORD_ flNewProtect, boost::winapi::PDWORD_ lpflOldProtect); -//registry.hpp -BOOST_WINAPI_DETAIL_DECLARE_HANDLE(HKEY); - - -BOOST_SYMBOL_IMPORT boost::ipwinapiext::LSTATUS BOOST_WINAPI_WINAPI_CC RegOpenKeyExA - (::HKEY hKey, const char *lpSubKey, boost::winapi::DWORD_ ulOptions, boost::winapi::DWORD_ samDesired, ::HKEY *phkResult); -BOOST_SYMBOL_IMPORT boost::ipwinapiext::LSTATUS BOOST_WINAPI_WINAPI_CC RegOpenKeyExW - (::HKEY hKey, const wchar_t *lpSubKey, boost::winapi::DWORD_ ulOptions, boost::winapi::DWORD_ samDesired, ::HKEY *phkResult); -BOOST_SYMBOL_IMPORT boost::ipwinapiext::LSTATUS BOOST_WINAPI_WINAPI_CC RegQueryValueExA - (::HKEY hKey, const char *lpValueName, boost::winapi::DWORD_ *lpReserved, boost::winapi::DWORD_ *lpType, boost::winapi::BYTE_ *lpData, boost::winapi::DWORD_ *lpcbData); -BOOST_SYMBOL_IMPORT boost::ipwinapiext::LSTATUS BOOST_WINAPI_WINAPI_CC RegQueryValueExW - (::HKEY hKey, const wchar_t *lpValueName, boost::winapi::DWORD_ *lpReserved, boost::winapi::DWORD_ *lpType, boost::winapi::BYTE_ *lpData, boost::winapi::DWORD_ *lpcbData); -BOOST_SYMBOL_IMPORT boost::ipwinapiext::LSTATUS BOOST_WINAPI_WINAPI_CC RegCloseKey(::HKEY hKey); - - -//Event Log -BOOST_SYMBOL_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC OpenEventLogA(const char* lpUNCServerName, const char* lpSourceName); -BOOST_SYMBOL_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC OpenEventLogW(const wchar_t* lpUNCServerName, const wchar_t* lpSourceName); -BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC CloseEventLog(boost::winapi::HANDLE_ hEventLog); -BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC ReadEventLogA - ( boost::winapi::HANDLE_ hEventLog, boost::winapi::DWORD_ dwReadFlags, boost::winapi::DWORD_ dwRecordOffset, void* lpBuffer - , boost::winapi::DWORD_ nNumberOfBytesToRead, boost::winapi::DWORD_ *pnBytesRead, boost::winapi::DWORD_ *pnMinNumberOfBytesNeeded); -BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC ReadEventLogW - ( boost::winapi::HANDLE_ hEventLog, boost::winapi::DWORD_ dwReadFlags, boost::winapi::DWORD_ dwRecordOffset, void* lpBuffer - , boost::winapi::DWORD_ nNumberOfBytesToRead, boost::winapi::DWORD_ *pnBytesRead, boost::winapi::DWORD_ *pnMinNumberOfBytesNeeded); - -} //extern "C" { - -#endif //#ifndef BOOST_USE_WINDOWS_H - -namespace boost { -namespace ipwinapiext { - -typedef ::HKEY HKEY_; - -#if BOOST_WINAPI_PARTITION_APP_SYSTEM - -//Threads -BOOST_FORCEINLINE boost::winapi::HANDLE_ CreateThread - ( boost::winapi::SECURITY_ATTRIBUTES_* lpThreadAttributes - , boost::winapi::SIZE_T_ dwStackSize - , boost::ipwinapiext::LPTHREAD_START_ROUTINE_ lpStartAddress - , boost::winapi::LPVOID_ lpParameter - , boost::winapi::DWORD_ dwCreationFlags - , boost::winapi::LPDWORD_ lpThreadId -) -{ - return ::CreateThread( reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes) - , dwStackSize, lpStartAddress - , lpParameter, dwCreationFlags, lpThreadId); -} - -//Error handling -BOOST_FORCEINLINE BOOST_WINAPI_DETAIL_VOID SetLastError(boost::winapi::DWORD_ dwErrCode) -{ ::SetLastError(dwErrCode); } - -//File management -BOOST_FORCEINLINE boost::winapi::DWORD_ GetFileType(boost::winapi::HANDLE_ hTemplateFile) -{ return ::GetFileType(hTemplateFile); } - -BOOST_FORCEINLINE boost::winapi::BOOL_ FlushFileBuffers(boost::winapi::HANDLE_ hFile) -{ return ::FlushFileBuffers(hFile); } - -//Virtual Memory -BOOST_FORCEINLINE boost::winapi::BOOL_ VirtualLock(boost::winapi::LPVOID_ lpAddress, boost::winapi::SIZE_T_ dwSize) -{ return ::VirtualLock(lpAddress, dwSize); } - -BOOST_FORCEINLINE boost::winapi::BOOL_ VirtualUnlock(boost::winapi::LPVOID_ lpAddress, boost::winapi::SIZE_T_ dwSize) -{ return ::VirtualUnlock(lpAddress, dwSize); } - -BOOST_FORCEINLINE boost::winapi::BOOL_ VirtualProtect( boost::winapi::LPVOID_ lpAddress, boost::winapi::SIZE_T_ dwSize - , boost::winapi::DWORD_ flNewProtect, boost::winapi::PDWORD_ lpflOldProtect) -{ return ::VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect); } - -//registry.hpp -BOOST_FORCEINLINE boost::ipwinapiext::LSTATUS RegOpenKeyExA - (boost::ipwinapiext::HKEY_ hKey, const char *lpSubKey, boost::winapi::DWORD_ ulOptions, boost::winapi::DWORD_ samDesired, boost::ipwinapiext::HKEY_ *phkResult) -{ - return ::RegOpenKeyExA(reinterpret_cast< ::HKEY >(hKey), lpSubKey, ulOptions, samDesired, reinterpret_cast< ::HKEY* >(phkResult)); -} - -BOOST_FORCEINLINE boost::ipwinapiext::LSTATUS RegOpenKeyExW - (boost::ipwinapiext::HKEY_ hKey, const wchar_t *lpSubKey, boost::winapi::DWORD_ ulOptions, boost::winapi::DWORD_ samDesired, boost::ipwinapiext::HKEY_ *phkResult) -{ - return ::RegOpenKeyExW(reinterpret_cast< ::HKEY >(hKey), lpSubKey, ulOptions, samDesired, reinterpret_cast< ::HKEY* >(phkResult)); -} - -BOOST_FORCEINLINE boost::ipwinapiext::LSTATUS RegQueryValueExA - (boost::ipwinapiext::HKEY_ hKey, const char *lpValueName, boost::winapi::DWORD_ *lpReserved, boost::winapi::DWORD_ *lpType, boost::winapi::BYTE_ *lpData, boost::winapi::DWORD_ *lpcbData) -{ - return ::RegQueryValueExA(reinterpret_cast< ::HKEY >(hKey), lpValueName, lpReserved, lpType, lpData, lpcbData); -} - -BOOST_FORCEINLINE boost::ipwinapiext::LSTATUS RegQueryValueExW - (boost::ipwinapiext::HKEY_ hKey, const wchar_t *lpValueName, boost::winapi::DWORD_ *lpReserved, boost::winapi::DWORD_ *lpType, boost::winapi::BYTE_ *lpData, boost::winapi::DWORD_ *lpcbData) -{ - return ::RegQueryValueExW(reinterpret_cast< ::HKEY >(hKey), lpValueName, lpReserved, lpType, lpData, lpcbData); -} - -BOOST_FORCEINLINE boost::ipwinapiext::LSTATUS RegCloseKey(boost::ipwinapiext::HKEY_ hKey) -{ - return ::RegCloseKey(reinterpret_cast< ::HKEY >(hKey)); -} - -BOOST_FORCEINLINE void GetSystemInfo(boost::winapi::LPSYSTEM_INFO_ lpSystemInfo) -{ return ::GetSystemInfo(reinterpret_cast< ::_SYSTEM_INFO* >(lpSystemInfo)); } - -#endif //BOOST_WINAPI_PARTITION_APP_SYSTEM - -} //namespace ipwinapiext { -} //namespace boost { - -namespace boost { -namespace interprocess { -namespace winapi { - -typedef boost::winapi::SYSTEM_INFO_ interprocess_system_info; -typedef boost::winapi::OVERLAPPED_ interprocess_overlapped; -typedef boost::winapi::FILETIME_ interprocess_filetime; -typedef boost::winapi::WIN32_FIND_DATAA_ win32_find_data_a; -typedef boost::winapi::WIN32_FIND_DATAW_ win32_find_data_w; -typedef boost::winapi::SECURITY_ATTRIBUTES_ interprocess_security_attributes; -typedef boost::winapi::SECURITY_DESCRIPTOR_ interprocess_security_descriptor; -typedef boost::winapi::BY_HANDLE_FILE_INFORMATION_ interprocess_by_handle_file_information; -typedef boost::winapi::HMODULE_ hmodule; -typedef boost::ipwinapiext::HKEY_ hkey; -typedef boost::winapi::FARPROC_ farproc_t; - -//ntdll.dll -typedef long (__stdcall *NtDeleteFile_t)(object_attributes_t *ObjectAttributes); -typedef long (__stdcall *NtSetInformationFile_t)(void *FileHandle, io_status_block_t *IoStatusBlock, void *FileInformation, unsigned long Length, int FileInformationClass ); -typedef long (__stdcall *NtOpenFile)(void **FileHandle, unsigned long DesiredAccess, object_attributes_t *ObjectAttributes - , io_status_block_t *IoStatusBlock, unsigned long ShareAccess, unsigned long Length, unsigned long OpenOptions); -typedef long (__stdcall *NtQuerySystemInformation_t)(int, void*, unsigned long, unsigned long *); -typedef long (__stdcall *NtQueryObject_t)(void*, object_information_class, void *, unsigned long, unsigned long *); -typedef long (__stdcall *NtQuerySemaphore_t)(void*, unsigned int info_class, interprocess_semaphore_basic_information *pinfo, unsigned int info_size, unsigned int *ret_len); -typedef long (__stdcall *NtQuerySection_t)(void*, section_information_class, interprocess_section_basic_information *pinfo, unsigned long info_size, unsigned long *ret_len); -typedef long (__stdcall *NtQueryInformationFile_t)(void *,io_status_block_t *,void *, long, int); -typedef long (__stdcall *NtOpenFile_t)(void*,unsigned long ,object_attributes_t*,io_status_block_t*,unsigned long,unsigned long); -typedef long (__stdcall *NtClose_t) (void*); -typedef long (__stdcall *NtQueryTimerResolution_t) (unsigned long* LowestResolution, unsigned long* HighestResolution, unsigned long* CurrentResolution); -typedef long (__stdcall *NtSetTimerResolution_t) (unsigned long RequestedResolution, int Set, unsigned long* ActualResolution); - -} //namespace winapi { -} //namespace interprocess { -} //namespace boost { - -////////////////////////////////////////////////////////////////////////////// -// -// Forward declaration of constants -// -////////////////////////////////////////////////////////////////////////////// - -namespace boost { -namespace interprocess { -namespace winapi { - -//Some used constants -static const unsigned long infinite_time = 0xFFFFFFFF; -static const unsigned long error_already_exists = 183L; -static const unsigned long error_invalid_handle = 6L; -static const unsigned long error_sharing_violation = 32L; -static const unsigned long error_file_not_found = 2u; -static const unsigned long error_no_more_files = 18u; -static const unsigned long error_not_locked = 158L; -//Retries in CreateFile, see http://support.microsoft.com/kb/316609 -static const unsigned long error_sharing_violation_tries = 3L; -static const unsigned long error_sharing_violation_sleep_ms = 250L; -static const unsigned long error_file_too_large = 223L; -static const unsigned long error_insufficient_buffer = 122L; -static const unsigned long error_handle_eof = 38L; -static const unsigned long semaphore_all_access = (0x000F0000L)|(0x00100000L)|0x3; -static const unsigned long mutex_all_access = (0x000F0000L)|(0x00100000L)|0x0001; - -static const unsigned long page_readonly = 0x02; -static const unsigned long page_readwrite = 0x04; -static const unsigned long page_writecopy = 0x08; -static const unsigned long page_noaccess = 0x01; - -static const unsigned long standard_rights_required = 0x000F0000L; -static const unsigned long section_query = 0x0001; -static const unsigned long section_map_write = 0x0002; -static const unsigned long section_map_read = 0x0004; -static const unsigned long section_map_execute = 0x0008; -static const unsigned long section_extend_size = 0x0010; -static const unsigned long section_all_access = standard_rights_required | - section_query | - section_map_write | - section_map_read | - section_map_execute | - section_extend_size; - -static const unsigned long file_map_copy = section_query; -static const unsigned long file_map_write = section_map_write; -static const unsigned long file_map_read = section_map_read; -static const unsigned long file_map_all_access = section_all_access; -static const unsigned long delete_access = 0x00010000L; -static const unsigned long file_flag_backup_semantics = 0x02000000; -static const long file_flag_delete_on_close = 0x04000000; - -//Native API constants -static const unsigned long file_open_for_backup_intent = 0x00004000; -static const int file_share_valid_flags = 0x00000007; -static const long file_delete_on_close = 0x00001000L; -static const long obj_case_insensitive = 0x00000040L; -static const long delete_flag = 0x00010000L; - -static const unsigned long movefile_copy_allowed = 0x02; -static const unsigned long movefile_delay_until_reboot = 0x04; -static const unsigned long movefile_replace_existing = 0x01; -static const unsigned long movefile_write_through = 0x08; -static const unsigned long movefile_create_hardlink = 0x10; -static const unsigned long movefile_fail_if_not_trackable = 0x20; - -static const unsigned long file_share_read = 0x00000001; -static const unsigned long file_share_write = 0x00000002; -static const unsigned long file_share_delete = 0x00000004; - -static const unsigned long file_attribute_readonly = 0x00000001; -static const unsigned long file_attribute_hidden = 0x00000002; -static const unsigned long file_attribute_system = 0x00000004; -static const unsigned long file_attribute_directory = 0x00000010; -static const unsigned long file_attribute_archive = 0x00000020; -static const unsigned long file_attribute_device = 0x00000040; -static const unsigned long file_attribute_normal = 0x00000080; -static const unsigned long file_attribute_temporary = 0x00000100; - -static const unsigned long generic_read = 0x80000000L; -static const unsigned long generic_write = 0x40000000L; - -static const unsigned long wait_object_0 = 0; -static const unsigned long wait_abandoned = 0x00000080L; -static const unsigned long wait_timeout = 258L; -static const unsigned long wait_failed = (unsigned long)0xFFFFFFFF; - -static const unsigned long duplicate_close_source = (unsigned long)0x00000001; -static const unsigned long duplicate_same_access = (unsigned long)0x00000002; - -static const unsigned long format_message_allocate_buffer - = (unsigned long)0x00000100; -static const unsigned long format_message_ignore_inserts - = (unsigned long)0x00000200; -static const unsigned long format_message_from_string - = (unsigned long)0x00000400; -static const unsigned long format_message_from_hmodule - = (unsigned long)0x00000800; -static const unsigned long format_message_from_system - = (unsigned long)0x00001000; -static const unsigned long format_message_argument_array - = (unsigned long)0x00002000; -static const unsigned long format_message_max_width_mask - = (unsigned long)0x000000FF; -static const unsigned long lang_neutral = (unsigned long)0x00; -static const unsigned long sublang_default = (unsigned long)0x01; -static const unsigned long invalid_file_size = (unsigned long)0xFFFFFFFF; -static const unsigned long invalid_file_attributes = ((unsigned long)-1); -static void * const invalid_handle_value = ((void*)(long)(-1)); - -static const unsigned long file_type_char = 0x0002L; -static const unsigned long file_type_disk = 0x0001L; -static const unsigned long file_type_pipe = 0x0003L; -static const unsigned long file_type_remote = 0x8000L; -static const unsigned long file_type_unknown = 0x0000L; - -static const unsigned long create_new = 1; -static const unsigned long create_always = 2; -static const unsigned long open_existing = 3; -static const unsigned long open_always = 4; -static const unsigned long truncate_existing = 5; - -static const unsigned long file_begin = 0; -static const unsigned long file_current = 1; -static const unsigned long file_end = 2; - -static const unsigned long lockfile_fail_immediately = 1; -static const unsigned long lockfile_exclusive_lock = 2; -static const unsigned long error_lock_violation = 33; -static const unsigned long security_descriptor_revision = 1; - -const unsigned long max_record_buffer_size = 0x10000L; // 64K -const unsigned long max_path = 260; - -//Keys -static const hkey hkey_local_machine = (hkey)(unsigned long*)(long)(0x80000002); -static unsigned long key_query_value = 0x0001; - -// Registry types -#define reg_none ( 0 ) // No value type -#define reg_sz ( 1 ) // Unicode nul terminated string -#define reg_expand_sz ( 2 ) // Unicode nul terminated string - // (with environment variable references) -#define reg_binary ( 3 ) // Free form binary -#define reg_dword ( 4 ) // 32-bit number -#define reg_dword_little_endian ( 4 ) // 32-bit number (same as REG_DWORD) -#define reg_dword_big_endian ( 5 ) // 32-bit number -#define reg_link ( 6 ) // Symbolic Link (unicode) -#define reg_multi_sz ( 7 ) // Multiple Unicode strings -#define reg_resource_list ( 8 ) // Resource list in the resource map -#define reg_full_resource_descriptor ( 9 ) // Resource list in the hardware description -#define reg_resource_requirements_list ( 10 ) -#define reg_qword ( 11 ) // 64-bit number -#define reg_qword_little_endian ( 11 ) // 64-bit number (same as reg_qword) - - -} //namespace winapi { -} //namespace interprocess { -} //namespace boost { - - -namespace boost { -namespace interprocess { -namespace winapi { - -inline unsigned long get_last_error() -{ return GetLastError(); } - -inline void set_last_error(unsigned long err) -{ return SetLastError(err); } - -inline unsigned long format_message - (unsigned long dwFlags, const void *lpSource, - unsigned long dwMessageId, unsigned long dwLanguageId, - char *lpBuffer, unsigned long nSize, std::va_list *Arguments) -{ - return FormatMessageA - (dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments); -} - -//And now, wrapper functions -inline void * local_free(void *hmem) -{ return LocalFree(hmem); } - -inline unsigned long make_lang_id(unsigned long p, unsigned long s) -{ - const unsigned short s_us = (unsigned short)s; - const unsigned short p_us = (unsigned short)p; - return (unsigned long)((s_us << 10) | p_us); -} - -inline void sched_yield() -{ - if(!SwitchToThread()){ - Sleep(0); - } -} - -inline void sleep_tick() -{ Sleep(1); } - -inline void sleep(unsigned long ms) -{ Sleep(ms); } - -inline unsigned long get_current_thread_id() -{ return GetCurrentThreadId(); } - -inline bool get_process_times - ( void *hProcess, interprocess_filetime* lpCreationTime - , interprocess_filetime *lpExitTime, interprocess_filetime *lpKernelTime - , interprocess_filetime *lpUserTime ) -{ return 0 != GetProcessTimes(hProcess, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime); } - -inline unsigned long get_current_process_id() -{ return GetCurrentProcessId(); } - -inline bool close_handle(void* handle) -{ return CloseHandle(handle) != 0; } - -inline void * find_first_file(const char *lpFileName, win32_find_data_a *lpFindFileData) -{ return FindFirstFileA(lpFileName, lpFindFileData); } - -inline void * find_first_file(const wchar_t *lpFileName, win32_find_data_w *lpFindFileData) -{ return FindFirstFileW(lpFileName, lpFindFileData); } - -inline bool find_next_file(void *hFindFile, win32_find_data_a *lpFindFileData) -{ return FindNextFileA(hFindFile, lpFindFileData) != 0; } - -inline bool find_next_file(void *hFindFile, win32_find_data_w *lpFindFileData) -{ return FindNextFileW(hFindFile, lpFindFileData) != 0; } - -inline bool find_close(void *handle) -{ return FindClose(handle) != 0; } - -inline bool duplicate_current_process_handle - (void *hSourceHandle, void **lpTargetHandle) -{ - return 0 != DuplicateHandle - ( GetCurrentProcess(), hSourceHandle, GetCurrentProcess() - , lpTargetHandle, 0, 0 - , duplicate_same_access); -} - -inline unsigned long get_file_type(void *hFile) -{ - return GetFileType(hFile); -} - -/* -inline void get_system_time_as_file_time(interprocess_filetime *filetime) -{ GetSystemTimeAsFileTime(filetime); } - -inline bool file_time_to_local_file_time - (const interprocess_filetime *in, const interprocess_filetime *out) -{ return 0 != FileTimeToLocalFileTime(in, out); } -*/ -inline void *open_or_create_mutex(const char *name, bool initial_owner, interprocess_security_attributes *attr) -{ return CreateMutexA(attr, (int)initial_owner, name); } - -inline void *open_or_create_mutex(const wchar_t *name, bool initial_owner, interprocess_security_attributes *attr) -{ return CreateMutexW(attr, (int)initial_owner, name); } - -inline unsigned long wait_for_single_object(void *handle, unsigned long time) -{ return WaitForSingleObject(handle, time); } - -inline int release_mutex(void *handle) -{ return ReleaseMutex(handle); } - -inline int unmap_view_of_file(void *address) -{ return UnmapViewOfFile(address); } - -inline void *open_or_create_semaphore(const char *name, long initial_count, long maximum_count, interprocess_security_attributes *attr) -{ return CreateSemaphoreA(attr, initial_count, maximum_count, name); } - -inline void *open_or_create_semaphore(const wchar_t *name, long initial_count, long maximum_count, interprocess_security_attributes *attr) -{ return CreateSemaphoreW(attr, initial_count, maximum_count, name); } - -inline void *open_semaphore(const char *name) -{ return OpenSemaphoreA(semaphore_all_access, 0, name); } - -inline void *open_semaphore(const wchar_t *name) -{ return OpenSemaphoreW(semaphore_all_access, 0, name); } - -inline int release_semaphore(void *handle, long release_count, long *prev_count) -{ return ReleaseSemaphore(handle, release_count, prev_count); } - -class interprocess_all_access_security -{ - interprocess_security_attributes sa; - interprocess_security_descriptor sd; - bool initialized; - - public: - interprocess_all_access_security() - : initialized(false) - { - if(!boost::winapi::InitializeSecurityDescriptor(&sd, security_descriptor_revision)) - return; - if(!boost::winapi::SetSecurityDescriptorDacl(&sd, true, 0, false)) - return; - sa.lpSecurityDescriptor = &sd; - sa.nLength = sizeof(interprocess_security_attributes); - sa.bInheritHandle = false; - initialized = true; - } - - interprocess_security_attributes *get_attributes() - { return &sa; } -}; - -inline void * create_file_mapping (void * handle, unsigned long access, ::boost::ulong_long_type file_offset, const char * name, interprocess_security_attributes *psec) -{ - const boost::winapi::DWORD_ high_size = boost::winapi::DWORD_(file_offset >> 32); - const boost::winapi::DWORD_ low_size = boost::winapi::DWORD_(file_offset); - return CreateFileMappingA (handle, psec, access, high_size, low_size, name); -} - -inline void * create_file_mapping (void * handle, unsigned long access, ::boost::ulong_long_type file_offset, const wchar_t * name, interprocess_security_attributes *psec) -{ - const boost::winapi::DWORD_ high_size = boost::winapi::DWORD_(file_offset >> 32); - const boost::winapi::DWORD_ low_size = boost::winapi::DWORD_(file_offset); - return CreateFileMappingW (handle, psec, access, high_size, low_size, name); -} - -inline void * open_file_mapping (unsigned long access, const char *name) -{ return OpenFileMappingA (access, 0, name); } - -inline void * open_file_mapping (unsigned long access, const wchar_t *name) -{ return OpenFileMappingW (access, 0, name); } - -inline void *map_view_of_file_ex(void *handle, unsigned long file_access, ::boost::ulong_long_type offset, std::size_t numbytes, void *base_addr) -{ - const boost::winapi::DWORD_ offset_low = boost::winapi::DWORD_(offset & ((::boost::ulong_long_type)0xFFFFFFFF)); - const boost::winapi::DWORD_ offset_high = boost::winapi::DWORD_(offset >> 32); - return MapViewOfFileEx(handle, file_access, offset_high, offset_low, numbytes, base_addr); -} - -template<class CharT> -inline void *create_file(const CharT *name, unsigned long access, unsigned long creation_flags, unsigned long attributes, interprocess_security_attributes *psec) -{ - for (unsigned int attempt(0); attempt < error_sharing_violation_tries; ++attempt){ - void * const handle = boost::winapi::create_file(name, access, - file_share_read | file_share_write | file_share_delete, - psec, creation_flags, attributes, 0); - bool const invalid(invalid_handle_value == handle); - if (!invalid){ - return handle; - } - if (error_sharing_violation != get_last_error()){ - return handle; - } - sleep(error_sharing_violation_sleep_ms); - } - return invalid_handle_value; -} - -inline void get_system_info(interprocess_system_info *info) -{ boost::ipwinapiext::GetSystemInfo(info); } - -inline bool flush_view_of_file(void *base_addr, std::size_t numbytes) -{ return 0 != boost::winapi::FlushViewOfFile(base_addr, numbytes); } - -inline bool virtual_unlock(void *base_addr, std::size_t numbytes) -{ return 0 != boost::ipwinapiext::VirtualUnlock(base_addr, numbytes); } - -inline bool virtual_protect(void *base_addr, std::size_t numbytes, unsigned long flNewProtect, unsigned long &lpflOldProtect) -{ return 0 != boost::ipwinapiext::VirtualProtect(base_addr, numbytes, flNewProtect, &lpflOldProtect); } - -inline bool flush_file_buffers(void *handle) -{ return 0 != boost::ipwinapiext::FlushFileBuffers(handle); } - -inline bool get_file_size(void *handle, __int64 &size) -{ return 0 != boost::winapi::GetFileSizeEx(handle, (boost::winapi::LARGE_INTEGER_*)&size); } - -template<class CharT> -inline bool create_directory(const CharT *name) -{ - interprocess_all_access_security sec; - return 0 != boost::winapi::create_directory(name, sec.get_attributes()); -} - -template<class CharT> -inline bool remove_directory(const CharT *lpPathName) -{ return 0 != boost::winapi::remove_directory(lpPathName); } - -template<class CharT> -inline unsigned long get_temp_path(unsigned long length, CharT *buffer) -{ return boost::winapi::get_temp_path(length, buffer); } - -inline int set_end_of_file(void *handle) -{ return 0 != boost::winapi::SetEndOfFile(handle); } - -inline bool set_file_pointer(void *handle, __int64 distance, __int64 *new_file_pointer, unsigned long move_method) -{ - boost::winapi::LONG_ highPart = boost::winapi::LONG_(distance >> 32u); - boost::winapi::DWORD_ r = boost::winapi::SetFilePointer(handle, (long)distance, &highPart, move_method); - bool br = r != boost::winapi::INVALID_SET_FILE_POINTER_ || boost::winapi::GetLastError() != 0; - if (br && new_file_pointer){ - *new_file_pointer = (__int64)r + ((__int64)highPart << 32); - } - - return br; -} - -inline bool lock_file_ex(void *hnd, unsigned long flags, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped *overlapped) -{ return 0 != boost::winapi::LockFileEx(hnd, flags, reserved, size_low, size_high, overlapped); } - -inline bool unlock_file_ex(void *hnd, unsigned long reserved, unsigned long size_low, unsigned long size_high, interprocess_overlapped *overlapped) -{ return 0 != boost::winapi::UnlockFileEx(hnd, reserved, size_low, size_high, overlapped); } - -inline bool write_file(void *hnd, const void *buffer, unsigned long bytes_to_write, unsigned long *bytes_written, interprocess_overlapped* overlapped) -{ return 0 != boost::winapi::WriteFile(hnd, buffer, bytes_to_write, bytes_written, overlapped); } - -inline bool read_file(void *hnd, void *buffer, unsigned long bytes_to_read, unsigned long *bytes_read, interprocess_overlapped* overlapped) -{ return 0 != boost::winapi::ReadFile(hnd, buffer, bytes_to_read, bytes_read, overlapped); } - -inline bool get_file_information_by_handle(void *hnd, interprocess_by_handle_file_information *info) -{ return 0 != boost::winapi::GetFileInformationByHandle(hnd, info); } - -inline long interlocked_increment(long volatile *addr) -{ return BOOST_INTERLOCKED_INCREMENT(const_cast<long*>(addr)); } - -inline long interlocked_decrement(long volatile *addr) -{ return BOOST_INTERLOCKED_DECREMENT(const_cast<long*>(addr)); } - -inline long interlocked_compare_exchange(long volatile *addr, long val1, long val2) -{ return BOOST_INTERLOCKED_COMPARE_EXCHANGE(const_cast<long*>(addr), val1, val2); } - -inline long interlocked_exchange_add(long volatile* addend, long value) -{ return BOOST_INTERLOCKED_EXCHANGE_ADD(const_cast<long*>(addend), value); } - -inline long interlocked_exchange(long volatile* addend, long value) -{ return BOOST_INTERLOCKED_EXCHANGE(const_cast<long*>(addend), value); } - -//Forward functions -inline hmodule load_library(const char *name) -{ return boost::winapi::LoadLibraryA(name); } - -inline bool free_library(hmodule module) -{ return 0 != boost::winapi::FreeLibrary(module); } - -inline farproc_t get_proc_address(hmodule module, const char *name) -{ return boost::winapi::GetProcAddress(module, name); } - -inline void *get_current_process() -{ return boost::winapi::GetCurrentProcess(); } - -inline hmodule get_module_handle(const char *name) -{ return boost::winapi::GetModuleHandleA(name); } - -inline long reg_open_key_ex(hkey hKey, const char *lpSubKey, unsigned long ulOptions, unsigned long samDesired, hkey *phkResult) -{ return boost::ipwinapiext::RegOpenKeyExA(hKey, lpSubKey, ulOptions, samDesired, phkResult); } - -inline long reg_open_key_ex(hkey hKey, const wchar_t *lpSubKey, unsigned long ulOptions, unsigned long samDesired, hkey *phkResult) -{ return boost::ipwinapiext::RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult); } - - -inline long reg_query_value_ex(hkey hKey, const char *lpValueName, unsigned long*lpReserved, unsigned long*lpType, unsigned char *lpData, unsigned long*lpcbData) -{ return boost::ipwinapiext::RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData); } - -inline long reg_query_value_ex(hkey hKey, const wchar_t *lpValueName, unsigned long*lpReserved, unsigned long*lpType, unsigned char *lpData, unsigned long*lpcbData) -{ return boost::ipwinapiext::RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData); } - -inline long reg_close_key(hkey hKey) -{ return boost::ipwinapiext::RegCloseKey(hKey); } - -inline void initialize_object_attributes -( object_attributes_t *pobject_attr, unicode_string_t *name - , unsigned long attr, void *rootdir, void *security_descr) - -{ - pobject_attr->Length = sizeof(object_attributes_t); - pobject_attr->RootDirectory = rootdir; - pobject_attr->Attributes = attr; - pobject_attr->ObjectName = name; - pobject_attr->SecurityDescriptor = security_descr; - pobject_attr->SecurityQualityOfService = 0; -} - -inline void rtl_init_empty_unicode_string(unicode_string_t *ucStr, wchar_t *buf, unsigned short bufSize) -{ - ucStr->Buffer = buf; - ucStr->Length = 0; - ucStr->MaximumLength = bufSize; -} - -//A class that locates and caches loaded DLL function addresses. -template<int Dummy> -struct function_address_holder -{ - enum { NtSetInformationFile - , NtQuerySystemInformation - , NtQueryObject - , NtQuerySemaphore - , NtQuerySection - , NtOpenFile - , NtClose - , NtQueryTimerResolution - , NumFunction - }; - enum { NtDll_dll, Kernel32_dll, NumModule }; - - private: - static const char *FunctionNames[NumFunction]; - static const char *ModuleNames[NumModule]; - static farproc_t FunctionAddresses[NumFunction]; - static unsigned int FunctionModules[NumFunction]; - static volatile long FunctionStates[NumFunction]; - static hmodule ModuleAddresses[NumModule]; - static volatile long ModuleStates[NumModule]; - - static hmodule get_module_from_id(unsigned int id) - { - BOOST_ASSERT(id < (unsigned int)NumModule); - hmodule addr = get_module_handle(ModuleNames[id]); - BOOST_ASSERT(addr); - return addr; - } - - static hmodule get_module(const unsigned int id) - { - BOOST_ASSERT(id < (unsigned int)NumModule); - for(unsigned i = 0; ModuleStates[id] < 2; ++i){ - if(interlocked_compare_exchange(&ModuleStates[id], 1, 0) == 0){ - ModuleAddresses[id] = get_module_from_id(id); - interlocked_increment(&ModuleStates[id]); - break; - } - else if(i & 1){ - sched_yield(); - } - else{ - sleep_tick(); - } - } - return ModuleAddresses[id]; - } - - static farproc_t get_address_from_dll(const unsigned int id) - { - BOOST_ASSERT(id < (unsigned int)NumFunction); - farproc_t addr = get_proc_address(get_module(FunctionModules[id]), FunctionNames[id]); - BOOST_ASSERT(addr); - return addr; - } - - public: - static farproc_t get(const unsigned int id) - { - BOOST_ASSERT(id < (unsigned int)NumFunction); - for(unsigned i = 0; FunctionStates[id] < 2; ++i){ - if(interlocked_compare_exchange(&FunctionStates[id], 1, 0) == 0){ - FunctionAddresses[id] = get_address_from_dll(id); - interlocked_increment(&FunctionStates[id]); - break; - } - else if(i & 1){ - sched_yield(); - } - else{ - sleep_tick(); - } - } - return FunctionAddresses[id]; - } -}; - -template<int Dummy> -const char *function_address_holder<Dummy>::FunctionNames[function_address_holder<Dummy>::NumFunction] = -{ - "NtSetInformationFile", - "NtQuerySystemInformation", - "NtQueryObject", - "NtQuerySemaphore", - "NtQuerySection", - "NtOpenFile", - "NtClose", - "NtQueryTimerResolution", -}; - -template<int Dummy> -unsigned int function_address_holder<Dummy>::FunctionModules[function_address_holder<Dummy>::NumFunction] = -{ - NtDll_dll, - NtDll_dll, - NtDll_dll, - NtDll_dll, - NtDll_dll, - NtDll_dll, - NtDll_dll, - NtDll_dll, -}; - -template<int Dummy> -const char *function_address_holder<Dummy>::ModuleNames[function_address_holder<Dummy>::NumModule] = -{ - "ntdll.dll"//, "kernel32.dll" -}; - - -template<int Dummy> -farproc_t function_address_holder<Dummy>::FunctionAddresses[function_address_holder<Dummy>::NumFunction]; - -template<int Dummy> -volatile long function_address_holder<Dummy>::FunctionStates[function_address_holder<Dummy>::NumFunction]; - -template<int Dummy> -hmodule function_address_holder<Dummy>::ModuleAddresses[function_address_holder<Dummy>::NumModule]; - -template<int Dummy> -volatile long function_address_holder<Dummy>::ModuleStates[function_address_holder<Dummy>::NumModule]; - - -struct dll_func - : public function_address_holder<0> -{}; - -//Complex winapi based functions... -struct library_unloader -{ - hmodule lib_; - library_unloader(hmodule module) : lib_(module){} - ~library_unloader(){ free_library(lib_); } -}; - - -inline bool get_system_time_of_day_information(system_timeofday_information &info) -{ - NtQuerySystemInformation_t pNtQuerySystemInformation = reinterpret_cast<NtQuerySystemInformation_t> - (dll_func::get(dll_func::NtQuerySystemInformation)); - unsigned long res; - long status = pNtQuerySystemInformation(system_time_of_day_information, &info, sizeof(info), &res); - if(status){ - return false; - } - return true; -} - -inline bool get_boot_time(unsigned char (&bootstamp) [BootstampLength]) -{ - system_timeofday_information info; - bool ret = get_system_time_of_day_information(info); - if(!ret){ - return false; - } - std::memcpy(&bootstamp[0], &info.Reserved1, sizeof(bootstamp)); - return true; -} - -inline bool get_boot_and_system_time(unsigned char (&bootsystemstamp) [BootAndSystemstampLength]) -{ - system_timeofday_information info; - bool ret = get_system_time_of_day_information(info); - if(!ret){ - return false; - } - std::memcpy(&bootsystemstamp[0], &info.Reserved1, sizeof(bootsystemstamp)); - return true; -} - -//Writes the hexadecimal value of the buffer, in the wide character string. -//str must be twice length -inline void buffer_to_wide_str(const void *buf, std::size_t length, wchar_t *str) -{ - const wchar_t Characters [] = - { L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7' - , L'8', L'9', L'A', L'B', L'C', L'D', L'E', L'F' }; - std::size_t char_counter = 0; - const char *chbuf = static_cast<const char *>(buf); - for(std::size_t i = 0; i != length; ++i){ - str[char_counter++] = Characters[(chbuf[i]&0xF0)>>4]; - str[char_counter++] = Characters[(chbuf[i]&0x0F)]; - } -} - -//Writes the hexadecimal value of the buffer, in the narrow character string. -//str must be twice length -inline void buffer_to_narrow_str(const void *buf, std::size_t length, char *str) -{ - const char Characters [] = - { '0', '1', '2', '3', '4', '5', '6', '7' - , '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - std::size_t char_counter = 0; - const char *chbuf = static_cast<const char *>(buf); - for(std::size_t i = 0; i != length; ++i){ - str[char_counter++] = Characters[(chbuf[i]&0xF0)>>4]; - str[char_counter++] = Characters[(chbuf[i]&0x0F)]; - } -} - -inline bool get_boot_time_str(char *bootstamp_str, std::size_t &s) - //will write BootstampLength chars -{ - if(s < (BootstampLength*2)) - return false; - system_timeofday_information info; - bool ret = get_system_time_of_day_information(info); - if(!ret){ - return false; - } - - buffer_to_narrow_str(info.Reserved1, BootstampLength, bootstamp_str); - s = BootstampLength*2; - return true; -} - -inline bool get_boot_and_system_time_wstr(wchar_t *bootsystemstamp, std::size_t &s) - //will write BootAndSystemstampLength chars -{ - if(s < (BootAndSystemstampLength*2)) - return false; - system_timeofday_information info; - bool ret = get_system_time_of_day_information(info); - if(!ret){ - return false; - } - - buffer_to_wide_str(&info.Reserved1[0], BootAndSystemstampLength, bootsystemstamp); - s = BootAndSystemstampLength*2; - return true; -} - -class handle_closer -{ - void *handle_; - handle_closer(const handle_closer &); - handle_closer& operator=(const handle_closer &); - public: - explicit handle_closer(void *handle) : handle_(handle){} - ~handle_closer() - { close_handle(handle_); } -}; - -union ntquery_mem_t -{ - object_name_information_t name; - struct ren_t - { - file_rename_information_t info; - wchar_t buf[1]; - } ren; -}; - -class nt_query_mem_deleter -{ - static const std::size_t rename_offset = offsetof(ntquery_mem_t, ren.info.FileName) - - offsetof(ntquery_mem_t, name.Name.Buffer); - // Timestamp process id atomic count - static const std::size_t rename_suffix = - (SystemTimeOfDayInfoLength + sizeof(unsigned long) + sizeof(boost::winapi::DWORD_))*2; - - public: - explicit nt_query_mem_deleter(std::size_t object_name_info_size) - : m_size(object_name_info_size + rename_offset + rename_suffix) - , m_buf(new char [m_size]) - {} - - ~nt_query_mem_deleter() - { - delete[]m_buf; - } - - void realloc_mem(std::size_t num_bytes) - { - num_bytes += rename_suffix + rename_offset; - char *buf = m_buf; - m_buf = new char[num_bytes]; - delete[]buf; - m_size = num_bytes; - } - - ntquery_mem_t *query_mem() const - { return static_cast<ntquery_mem_t *>(static_cast<void*>(m_buf)); } - - unsigned long object_name_information_size() const - { - return static_cast<unsigned long>(m_size - rename_offset - SystemTimeOfDayInfoLength*2); - } - - std::size_t file_rename_information_size() const - { return static_cast<unsigned long>(m_size); } - - private: - std::size_t m_size; - char *m_buf; -}; - -class c_heap_deleter -{ - public: - explicit c_heap_deleter(std::size_t size) - : m_buf(::malloc(size)) - {} - - ~c_heap_deleter() - { - if(m_buf) ::free(m_buf); - } - - void realloc_mem(std::size_t num_bytes) - { - void *oldBuf = m_buf; - m_buf = ::realloc(m_buf, num_bytes); - if (!m_buf){ - free(oldBuf); - } - } - - void *get() const - { return m_buf; } - - private: - void *m_buf; -}; - -template<class CharT> -inline bool unlink_file(const CharT *filename) -{ - //Don't try to optimize doing a DeleteFile first - //as there are interactions with permissions and - //in-use files. - // - //if(!delete_file(filename)){ - // (...) - // - - //This functions tries to emulate UNIX unlink semantics in windows. - // - //- Open the file and mark the handle as delete-on-close - //- Rename the file to an arbitrary name based on a random number - //- Close the handle. If there are no file users, it will be deleted. - // Otherwise it will be used by already connected handles but the - // file name can't be used to open this file again - BOOST_TRY{ - NtSetInformationFile_t pNtSetInformationFile = - reinterpret_cast<NtSetInformationFile_t>(dll_func::get(dll_func::NtSetInformationFile)); - - NtQueryObject_t pNtQueryObject = reinterpret_cast<NtQueryObject_t>(dll_func::get(dll_func::NtQueryObject)); - - //First step: Obtain a handle to the file using Win32 rules. This resolves relative paths - void *fh = create_file(filename, generic_read | delete_access, open_existing, 0, 0); - if(fh == invalid_handle_value){ - return false; - } - - handle_closer h_closer(fh); - { - //Obtain name length - unsigned long size; - const std::size_t initial_string_mem = 512u; - - nt_query_mem_deleter nt_query_mem(sizeof(ntquery_mem_t)+initial_string_mem); - //Obtain file name with guessed length - if(pNtQueryObject(fh, object_name_information, nt_query_mem.query_mem(), nt_query_mem.object_name_information_size(), &size)){ - //Obtain file name with exact length buffer - nt_query_mem.realloc_mem(size); - if(pNtQueryObject(fh, object_name_information, nt_query_mem.query_mem(), nt_query_mem.object_name_information_size(), &size)){ - return false; - } - } - ntquery_mem_t *pmem = nt_query_mem.query_mem(); - file_rename_information_t *pfri = &pmem->ren.info; - const std::size_t RenMaxNumChars = - std::size_t(((char*)(pmem) + nt_query_mem.file_rename_information_size()) - (char*)&pmem->ren.info.FileName[0])/sizeof(wchar_t); - - //Copy filename to the rename member - std::memmove(pmem->ren.info.FileName, pmem->name.Name.Buffer, pmem->name.Name.Length); - std::size_t filename_string_length = pmem->name.Name.Length/sizeof(wchar_t); - - //Search '\\' character to replace from it - for(std::size_t i = filename_string_length; i != 0; --filename_string_length){ - if(pmem->ren.info.FileName[--i] == L'\\') - break; - } - - //Add random number - std::size_t s = RenMaxNumChars - filename_string_length; - if(!get_boot_and_system_time_wstr(&pfri->FileName[filename_string_length], s)){ - return false; - } - filename_string_length += s; - - //Sometimes the precission of the timestamp is not enough and we need to add another random number. - //The process id (to exclude concurrent processes) and an atomic count (to exclude concurrent threads). - //should be enough - const unsigned long pid = get_current_process_id(); - buffer_to_wide_str(&pid, sizeof(pid), &pfri->FileName[filename_string_length]); - filename_string_length += sizeof(pid)*2; - - static volatile boost::uint32_t u32_count = 0; - interlocked_decrement(reinterpret_cast<volatile long*>(&u32_count)); - buffer_to_wide_str(const_cast<const boost::uint32_t *>(&u32_count), sizeof(boost::uint32_t), &pfri->FileName[filename_string_length]); - filename_string_length += sizeof(boost::uint32_t)*2; - - //Fill rename information (FileNameLength is in bytes) - pfri->FileNameLength = static_cast<unsigned long>(sizeof(wchar_t)*(filename_string_length)); - pfri->Replace = 1; - pfri->RootDir = 0; - - //Cange the name of the in-use file... - io_status_block_t io; - if(0 != pNtSetInformationFile(fh, &io, pfri, nt_query_mem.file_rename_information_size(), file_rename_information)){ - return false; - } - } - //...and mark it as delete-on-close - { - //Don't use pNtSetInformationFile with file_disposition_information as it can return STATUS_CANNOT_DELETE - //if the file is still mapped. Reopen it with NtOpenFile and file_delete_on_close - NtOpenFile_t pNtOpenFile = reinterpret_cast<NtOpenFile_t>(dll_func::get(dll_func::NtOpenFile)); - NtClose_t pNtClose = reinterpret_cast<NtClose_t>(dll_func::get(dll_func::NtClose)); - const wchar_t empty_str [] = L""; - unicode_string_t ustring = { sizeof(empty_str) - sizeof (wchar_t) //length in bytes without null - , sizeof(empty_str) //total size in bytes of memory allocated for Buffer. - , const_cast<wchar_t*>(empty_str) - }; - object_attributes_t object_attr; - initialize_object_attributes(&object_attr, &ustring, 0, fh, 0); - void* fh2 = 0; - io_status_block_t io; - pNtOpenFile( &fh2, delete_flag, &object_attr, &io - , file_share_read | file_share_write | file_share_delete, file_delete_on_close); - pNtClose(fh2); - //Even if NtOpenFile fails, the file was renamed and the original no longer exists, so return a success status - return true; - } - } - BOOST_CATCH(...){ - return false; - } BOOST_CATCH_END - return true; -} - -struct reg_closer -{ - hkey key_; - reg_closer(hkey key) : key_(key){} - ~reg_closer(){ reg_close_key(key_); } -}; - -template <class CharT> -inline bool get_registry_value_buffer(hkey key_type, const CharT *subkey_name, const CharT *value_name, void *buf, std::size_t &buflen) -{ - bool bret = false; - hkey key; - if (reg_open_key_ex( key_type - , subkey_name - , 0 - , key_query_value - , &key) == 0){ - reg_closer key_closer(key); - - //Obtain the value - unsigned long size = buflen; - unsigned long type; - buflen = 0; - bret = 0 == reg_query_value_ex( key, value_name, 0, &type, (unsigned char*)buf, &size); - if(bret) - buflen = (std::size_t)size; - } - return bret; -} - -template<class CharT> -inline bool get_registry_value_string(hkey key_type, const CharT *subkey_name, const CharT *value_name, std::basic_string<CharT> &s) -{ - bool bret = false; - s.clear(); - hkey key; - if (reg_open_key_ex( key_type - , subkey_name - , 0 - , key_query_value - , &key) == 0){ - reg_closer key_closer(key); - - //Obtain the value - unsigned long size; - unsigned long type; - long err = reg_query_value_ex( key, value_name, 0, &type, 0, &size); - if((reg_sz == type || reg_expand_sz == type) && !err){ - //Size includes terminating NULL - s.resize(size/sizeof(CharT)); - err = reg_query_value_ex( key, value_name, 0, &type, (unsigned char*)(&s[0]), &size); - if(!err){ - s.erase(s.end()-1); - bret = true; - } - (void)err; - } - } - return bret; -} - -template<class CharT> -inline void get_shared_documents_folder(std::basic_string<CharT> &s) -{ - get_registry_value_string( hkey_local_machine - , "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" - , "Common AppData" - , s); -} - -inline void get_shared_documents_folder(std::wstring &s) -{ - get_registry_value_string( hkey_local_machine - , L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" - , L"Common AppData" - , s); -} - -template<class CharT> -inline void get_registry_value(const CharT *folder, const CharT *value_key, std::vector<unsigned char> &s) -{ - s.clear(); - hkey key; - if (reg_open_key_ex( hkey_local_machine - , folder - , 0 - , key_query_value - , &key) == 0){ - reg_closer key_closer(key); - - //Obtain the value - unsigned long size; - unsigned long type; - const char *const reg_value = value_key; - //long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); - long err = reg_query_value_ex( key, reg_value, 0, &type, 0, &size); - if(!err){ - //Size includes terminating NULL - s.resize(size); - //err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - err = reg_query_value_ex( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); - if(!err) - s.erase(s.end()-1); - (void)err; - } - } -} - -inline bool is_directory(const char *path) -{ - unsigned long attrib = GetFileAttributesA(path); - - return (attrib != invalid_file_attributes && - (attrib & file_attribute_directory)); -} - -inline bool get_file_mapping_size(void *file_mapping_hnd, __int64 &size) -{ - NtQuerySection_t pNtQuerySection = - reinterpret_cast<NtQuerySection_t>(dll_func::get(dll_func::NtQuerySection)); - //Obtain file name - interprocess_section_basic_information info; - long ntstatus = - pNtQuerySection(file_mapping_hnd, section_basic_information, &info, sizeof(info), 0); - size = info.section_size; - return !ntstatus; -} - -inline bool get_semaphore_info(void *handle, long &count, long &limit) -{ - winapi::interprocess_semaphore_basic_information info; - winapi::NtQuerySemaphore_t pNtQuerySemaphore = - reinterpret_cast<winapi::NtQuerySemaphore_t>(dll_func::get(winapi::dll_func::NtQuerySemaphore)); - unsigned int ret_len; - long status = pNtQuerySemaphore(handle, winapi::semaphore_basic_information, &info, sizeof(info), &ret_len); - count = (long)info.count; - limit = (long)info.limit; - return !status; -} - -inline bool query_timer_resolution(unsigned long *lowres, unsigned long *highres, unsigned long *curres) -{ - winapi::NtQueryTimerResolution_t pNtQueryTimerResolution = - reinterpret_cast<winapi::NtQueryTimerResolution_t>(dll_func::get(winapi::dll_func::NtQueryTimerResolution)); - return !pNtQueryTimerResolution(lowres, highres, curres); -} - -inline bool query_performance_counter(__int64 *lpPerformanceCount) -{ - return 0 != boost::winapi::QueryPerformanceCounter(reinterpret_cast<boost::winapi::LARGE_INTEGER_*>(lpPerformanceCount)); -} - -inline bool query_performance_frequency(__int64 *lpFrequency) -{ - return 0 != boost::winapi::QueryPerformanceFrequency(reinterpret_cast<boost::winapi::LARGE_INTEGER_*>(lpFrequency)); -} - -inline unsigned long get_tick_count() -{ return GetTickCount(); } - - -template<class CharT> -struct winapi_traits; - -template<> -struct winapi_traits<char> -{ - static int cmp(const char *a, const char *b) - { return std::strcmp(a, b); } -}; - -template<> -struct winapi_traits<wchar_t> -{ - static int cmp(const wchar_t *a, const wchar_t *b) - { return std::wcscmp(a, b); } -}; - - -#if defined(BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED) - - -inline bool get_last_bootup_time(std::string &stamp) -{ - unsigned dword_val = 0; - std::size_t dword_size = sizeof(dword_val); - bool b_ret = get_registry_value_buffer( hkey_local_machine - , "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\\PrefetchParameters" - , "BootId", &dword_val, dword_size); - if (b_ret) - { - char dword_str[sizeof(dword_val)*2u+1]; - buffer_to_narrow_str(&dword_val, dword_size, dword_str); - dword_str[sizeof(dword_val)*2] = '\0'; - stamp = dword_str; - - b_ret = get_registry_value_buffer( hkey_local_machine - , "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power" - , "HybridBootAnimationTime", &dword_val, dword_size); - //Old Windows versions have no HybridBootAnimationTime - if(b_ret) - { - buffer_to_narrow_str(&dword_val, dword_size, dword_str); - dword_str[sizeof(dword_val)*2] = '\0'; - stamp += "_"; - stamp += dword_str; - } - b_ret = true; - } - return b_ret; -} - -inline bool get_last_bootup_time(std::wstring &stamp) -{ - unsigned dword_val = 0; - std::size_t dword_size = sizeof(dword_val); - bool b_ret = get_registry_value_buffer( hkey_local_machine - , L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\\PrefetchParameters" - , L"BootId", &dword_val, dword_size); - if (b_ret) - { - wchar_t dword_str[sizeof(dword_val)*2u+1]; - buffer_to_wide_str(&dword_val, dword_size, dword_str); - dword_str[sizeof(dword_val)*2] = L'\0'; - stamp = dword_str; - - b_ret = get_registry_value_buffer( hkey_local_machine - , L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power" - , L"HybridBootAnimationTime", &dword_val, dword_size); - //Old Windows versions have no HybridBootAnimationTime - if(b_ret) - { - buffer_to_wide_str(&dword_val, dword_size, dword_str); - dword_str[sizeof(dword_val)*2] = L'\0'; - stamp += L"_"; - stamp += dword_str; - } - b_ret = true; - } - return b_ret; -} - -#elif defined(BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED) - -static const unsigned long eventlog_sequential_read = 0x0001; -static const unsigned long eventlog_backwards_read = 0x0008; - -struct interprocess_eventlogrecord -{ - unsigned long Length; // Length of full record - unsigned long Reserved; // Used by the service - unsigned long RecordNumber; // Absolute record number - unsigned long TimeGenerated; // Seconds since 1-1-1970 - unsigned long TimeWritten; // Seconds since 1-1-1970 - unsigned long EventID; - unsigned short EventType; - unsigned short NumStrings; - unsigned short EventCategory; - unsigned short ReservedFlags; // For use with paired events (auditing) - unsigned long ClosingRecordNumber; // For use with paired events (auditing) - unsigned long StringOffset; // Offset from beginning of record - unsigned long UserSidLength; - unsigned long UserSidOffset; - unsigned long DataLength; - unsigned long DataOffset; // Offset from beginning of record - // - // Then follow: - // - // wchar_t SourceName[] - // wchar_t Computername[] - // SID UserSid - // wchar_t Strings[] - // BYTE Data[] - // CHAR Pad[] - // unsigned long Length; - // -}; - -class eventlog_handle_closer -{ - void *handle_; - eventlog_handle_closer(const handle_closer &); - eventlog_handle_closer& operator=(const eventlog_handle_closer &); - public: - explicit eventlog_handle_closer(void *handle) : handle_(handle){} - ~eventlog_handle_closer() - { CloseEventLog(handle_); } -}; - -// Loop through the buffer and obtain the contents of the -// requested record in the buffer. -template<class CharT> -inline bool find_record_in_buffer( const void* pBuffer, unsigned long dwBytesRead, const CharT *provider_name - , unsigned int id_to_find, interprocess_eventlogrecord *&pevent_log_record) -{ - const unsigned char * pRecord = static_cast<const unsigned char*>(pBuffer); - const unsigned char * pEndOfRecords = pRecord + dwBytesRead; - - while (pRecord < pEndOfRecords){ - interprocess_eventlogrecord *pTypedRecord = (interprocess_eventlogrecord*)(void*)pRecord; - // Check provider, written at the end of the fixed-part of the record - - if (0 == winapi_traits<CharT>::cmp(provider_name, (CharT*)(void*)(pRecord + sizeof(interprocess_eventlogrecord)))) - { - // Check event id - if(id_to_find == (pTypedRecord->EventID & 0xFFFF)){ - pevent_log_record = pTypedRecord; - return true; - } - } - - pRecord += pTypedRecord->Length; - } - pevent_log_record = 0; - return false; -} - -//Obtains the bootup time from the System Event Log, -//event ID == 6005 (event log started). -//Adapted from http://msdn.microsoft.com/en-us/library/windows/desktop/bb427356.aspx -inline bool get_last_bootup_time(std::string &stamp) -{ - const char *source_name = "System"; - const char *provider_name = "EventLog"; - const unsigned short event_id = 6005u; - - unsigned long status = 0; - unsigned long dwBytesToRead = 0; - unsigned long dwBytesRead = 0; - unsigned long dwMinimumBytesToRead = 0; - - // The source name (provider) must exist as a subkey of Application. - void *hEventLog = OpenEventLogA(0, source_name); - if (hEventLog){ - eventlog_handle_closer hnd_closer(hEventLog); (void)hnd_closer; - // Allocate an initial block of memory used to read event records. The number - // of records read into the buffer will vary depending on the size of each event. - // The size of each event will vary based on the size of the user-defined - // data included with each event, the number and length of insertion - // strings, and other data appended to the end of the event record. - dwBytesToRead = max_record_buffer_size; - c_heap_deleter heap_deleter(dwBytesToRead); - - // Read blocks of records until you reach the end of the log or an - // error occurs. The records are read from newest to oldest. If the buffer - // is not big enough to hold a complete event record, reallocate the buffer. - if (heap_deleter.get() != 0){ - while (0 == status){ - if (!ReadEventLogA(hEventLog, - eventlog_sequential_read | eventlog_backwards_read, - 0, - heap_deleter.get(), - dwBytesToRead, - &dwBytesRead, - &dwMinimumBytesToRead)) { - status = get_last_error(); - if (error_insufficient_buffer == status) { - status = 0; - dwBytesToRead = dwMinimumBytesToRead; - heap_deleter.realloc_mem(dwMinimumBytesToRead); - if (!heap_deleter.get()){ - return false; - } - } - else{ //Not found or EOF - return false; - } - } - else - { - interprocess_eventlogrecord *pTypedRecord; - // Print the contents of each record in the buffer. - if(find_record_in_buffer(heap_deleter.get(), dwBytesRead, provider_name, event_id, pTypedRecord)){ - char stamp_str[sizeof(unsigned long)*3+1]; - std::sprintf(&stamp_str[0], "%u", ((unsigned int)pTypedRecord->TimeGenerated)); - stamp = stamp_str; - break; - } - } - } - } - } - return true; -} - - -inline bool get_last_bootup_time(std::wstring &stamp) -{ - const wchar_t *source_name = L"System"; - const wchar_t *provider_name = L"EventLog"; - const unsigned short event_id = 6005u; - - unsigned long status = 0; - unsigned long dwBytesToRead = 0; - unsigned long dwBytesRead = 0; - unsigned long dwMinimumBytesToRead = 0; - - // The source name (provider) must exist as a subkey of Application. - void *hEventLog = OpenEventLogW(0, source_name); - if (hEventLog){ - eventlog_handle_closer hnd_closer(hEventLog); (void)hnd_closer; - // Allocate an initial block of memory used to read event records. The number - // of records read into the buffer will vary depending on the size of each event. - // The size of each event will vary based on the size of the user-defined - // data included with each event, the number and length of insertion - // strings, and other data appended to the end of the event record. - dwBytesToRead = max_record_buffer_size; - c_heap_deleter heap_deleter(dwBytesToRead); - - // Read blocks of records until you reach the end of the log or an - // error occurs. The records are read from newest to oldest. If the buffer - // is not big enough to hold a complete event record, reallocate the buffer. - if (heap_deleter.get() != 0){ - while (0 == status){ - if (!ReadEventLogW(hEventLog, - eventlog_sequential_read | eventlog_backwards_read, - 0, - heap_deleter.get(), - dwBytesToRead, - &dwBytesRead, - &dwMinimumBytesToRead)) { - status = get_last_error(); - if (error_insufficient_buffer == status) { - status = 0; - dwBytesToRead = dwMinimumBytesToRead; - heap_deleter.realloc_mem(dwMinimumBytesToRead); - if (!heap_deleter.get()){ - return false; - } - } - else{ //Not found or EOF - return false; - } - } - else - { - interprocess_eventlogrecord *pTypedRecord; - // Print the contents of each record in the buffer. - if(find_record_in_buffer(heap_deleter.get(), dwBytesRead, provider_name, event_id, pTypedRecord)){ - wchar_t stamp_str[sizeof(unsigned long)*3+1]; - std::swprintf(&stamp_str[0], L"%u", ((unsigned int)pTypedRecord->TimeGenerated)); - stamp = stamp_str; - break; - } - } - } - } - } - return true; -} - -#endif //BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED - - -} //namespace winapi -} //namespace interprocess -} //namespace boost - -#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) -# pragma GCC diagnostic pop -#endif - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifdef BOOST_INTERPROCESS_WIN32_API_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/errors.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/errors.hpp deleted file mode 100644 index 95bca55a17..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/errors.hpp +++ /dev/null @@ -1,246 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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. -// -// Parts of this code are taken from boost::filesystem library -// -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2002 Beman Dawes -// Copyright (C) 2001 Dietmar Kuehl -// 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_INTERPROCESS_ERRORS_HPP -#define BOOST_INTERPROCESS_ERRORS_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> -#include <string> - -#if defined (BOOST_INTERPROCESS_WINDOWS) -# include <boost/interprocess/detail/win32_api.hpp> -#else -# ifdef BOOST_HAS_UNISTD_H -# include <cerrno> //Errors -# include <cstring> //strerror -# else //ifdef BOOST_HAS_UNISTD_H -# error Unknown platform -# endif //ifdef BOOST_HAS_UNISTD_H -#endif //#if defined (BOOST_INTERPROCESS_WINDOWS) - -//!\file -//!Describes the error numbering of interprocess classes - -namespace boost { -namespace interprocess { -#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) -inline int system_error_code() // artifact of POSIX and WINDOWS error reporting -{ - #if defined (BOOST_INTERPROCESS_WINDOWS) - return (int)winapi::get_last_error(); - #else - return errno; // GCC 3.1 won't accept ::errno - #endif -} - - -#if defined (BOOST_INTERPROCESS_WINDOWS) -inline void fill_system_message(int sys_err_code, std::string &str) -{ - void *lpMsgBuf; - unsigned long ret = winapi::format_message( - winapi::format_message_allocate_buffer | - winapi::format_message_from_system | - winapi::format_message_ignore_inserts, - 0, - (unsigned long)sys_err_code, - winapi::make_lang_id(winapi::lang_neutral, winapi::sublang_default), // Default language - reinterpret_cast<char *>(&lpMsgBuf), - 0, - 0 - ); - if (ret != 0){ - str += static_cast<const char*>(lpMsgBuf); - winapi::local_free( lpMsgBuf ); // free the buffer - while ( str.size() - && (str[str.size()-1] == '\n' || str[str.size()-1] == '\r') ) - str.erase( str.size()-1 ); - } - else{ - str += "WinApi FormatMessage returned error"; - } -} -# else -inline void fill_system_message( int system_error, std::string &str) -{ str = std::strerror(system_error); } -# endif -#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - -enum error_code_t -{ - no_error = 0, - system_error, // system generated error; if possible, is translated - // to one of the more specific errors below. - other_error, // library generated error - security_error, // includes access rights, permissions failures - read_only_error, - io_error, - path_error, - not_found_error, -// not_directory_error, - busy_error, // implies trying again might succeed - already_exists_error, - not_empty_error, - is_directory_error, - out_of_space_error, - out_of_memory_error, - out_of_resource_error, - lock_error, - sem_error, - mode_error, - size_error, - corrupted_error, - not_such_file_or_directory, - invalid_argument, - timeout_when_locking_error, - timeout_when_waiting_error, - owner_dead_error, - not_recoverable -}; - -typedef int native_error_t; - -#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) -struct ec_xlate -{ - native_error_t sys_ec; - error_code_t ec; -}; - -static const ec_xlate ec_table[] = -{ - #if defined (BOOST_INTERPROCESS_WINDOWS) - { /*ERROR_ACCESS_DENIED*/5L, security_error }, - { /*ERROR_INVALID_ACCESS*/12L, security_error }, - { /*ERROR_SHARING_VIOLATION*/32L, security_error }, - { /*ERROR_LOCK_VIOLATION*/33L, security_error }, - { /*ERROR_LOCKED*/212L, security_error }, - { /*ERROR_NOACCESS*/998L, security_error }, - { /*ERROR_WRITE_PROTECT*/19L, read_only_error }, - { /*ERROR_NOT_READY*/21L, io_error }, - { /*ERROR_SEEK*/25L, io_error }, - { /*ERROR_READ_FAULT*/30L, io_error }, - { /*ERROR_WRITE_FAULT*/29L, io_error }, - { /*ERROR_CANTOPEN*/1011L, io_error }, - { /*ERROR_CANTREAD*/1012L, io_error }, - { /*ERROR_CANTWRITE*/1013L, io_error }, - { /*ERROR_DIRECTORY*/267L, path_error }, - { /*ERROR_INVALID_NAME*/123L, path_error }, - { /*ERROR_FILE_NOT_FOUND*/2L, not_found_error }, - { /*ERROR_PATH_NOT_FOUND*/3L, not_found_error }, - { /*ERROR_DEV_NOT_EXIST*/55L, not_found_error }, - { /*ERROR_DEVICE_IN_USE*/2404L, busy_error }, - { /*ERROR_OPEN_FILES*/2401L, busy_error }, - { /*ERROR_BUSY_DRIVE*/142L, busy_error }, - { /*ERROR_BUSY*/170L, busy_error }, - { /*ERROR_FILE_EXISTS*/80L, already_exists_error }, - { /*ERROR_ALREADY_EXISTS*/183L, already_exists_error }, - { /*ERROR_DIR_NOT_EMPTY*/145L, not_empty_error }, - { /*ERROR_HANDLE_DISK_FULL*/39L, out_of_space_error }, - { /*ERROR_DISK_FULL*/112L, out_of_space_error }, - { /*ERROR_OUTOFMEMORY*/14L, out_of_memory_error }, - { /*ERROR_NOT_ENOUGH_MEMORY*/8L, out_of_memory_error }, - { /*ERROR_TOO_MANY_OPEN_FILES*/4L, out_of_resource_error }, - { /*ERROR_INVALID_ADDRESS*/487L, busy_error } - #else //#if defined (BOOST_INTERPROCESS_WINDOWS) - { EACCES, security_error }, - { EROFS, read_only_error }, - { EIO, io_error }, - { ENAMETOOLONG, path_error }, - { ENOENT, not_found_error }, - // { ENOTDIR, not_directory_error }, - { EAGAIN, busy_error }, - { EBUSY, busy_error }, - { ETXTBSY, busy_error }, - { EEXIST, already_exists_error }, - { ENOTEMPTY, not_empty_error }, - { EISDIR, is_directory_error }, - { ENOSPC, out_of_space_error }, - { ENOMEM, out_of_memory_error }, - { EMFILE, out_of_resource_error }, - { ENOENT, not_such_file_or_directory }, - { EINVAL, invalid_argument } - #endif //#if defined (BOOST_INTERPROCESS_WINDOWS) -}; - -inline error_code_t lookup_error(native_error_t err) -{ - const ec_xlate *cur = &ec_table[0], - *end = cur + sizeof(ec_table)/sizeof(ec_xlate); - for (;cur != end; ++cur ){ - if ( err == cur->sys_ec ) return cur->ec; - } - return system_error; // general system error code -} - -struct error_info -{ - error_info(error_code_t ec = other_error ) - : m_nat(0), m_ec(ec) - {} - - error_info(native_error_t sys_err_code) - : m_nat(sys_err_code), m_ec(lookup_error(sys_err_code)) - {} - - error_info & operator =(error_code_t ec) - { - m_nat = 0; - m_ec = ec; - return *this; - } - - error_info & operator =(native_error_t sys_err_code) - { - m_nat = sys_err_code; - m_ec = lookup_error(sys_err_code); - return *this; - } - - native_error_t get_native_error()const - { return m_nat; } - - error_code_t get_error_code()const - { return m_ec; } - - private: - native_error_t m_nat; - error_code_t m_ec; -}; -#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - -} // namespace interprocess { -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // BOOST_INTERPROCESS_ERRORS_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/exceptions.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/exceptions.hpp deleted file mode 100644 index 3eeb9f6e0b..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/exceptions.hpp +++ /dev/null @@ -1,111 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2015. Distributed under the 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_INTERPROCESS_EXCEPTIONS_HPP -#define BOOST_INTERPROCESS_EXCEPTIONS_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> -#include <boost/interprocess/errors.hpp> -#include <stdexcept> - -//!\file -//!Describes exceptions thrown by interprocess classes - -namespace boost { - -namespace interprocess { - -//!This class is the base class of all exceptions -//!thrown by boost::interprocess -class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception -{ - public: - interprocess_exception(const char *err) BOOST_NOEXCEPT - : m_err(other_error) - { - BOOST_TRY { m_str = err; } - BOOST_CATCH(...) {} BOOST_CATCH_END - } - - interprocess_exception(const error_info &err_info, const char *str = 0) - : m_err(err_info) - { - BOOST_TRY{ - if(m_err.get_native_error() != 0){ - fill_system_message(m_err.get_native_error(), m_str); - } - else if(str){ - m_str = str; - } - else{ - m_str = "boost::interprocess_exception::library_error"; - } - } - BOOST_CATCH(...){} BOOST_CATCH_END - } - - ~interprocess_exception() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {} - - const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE - { return m_str.c_str(); } - - native_error_t get_native_error() const BOOST_NOEXCEPT { return m_err.get_native_error(); } - - // Note: a value of other_error implies a library (rather than system) error - error_code_t get_error_code() const BOOST_NOEXCEPT { return m_err.get_error_code(); } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - private: - error_info m_err; - std::string m_str; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED -}; - -//!This is the exception thrown by shared interprocess_mutex family when a deadlock situation -//!is detected or when using a interprocess_condition the interprocess_mutex is not locked -class BOOST_SYMBOL_VISIBLE lock_exception : public interprocess_exception -{ - public: - lock_exception(error_code_t err = lock_error) BOOST_NOEXCEPT - : interprocess_exception(err) - {} - - const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE - { return "boost::interprocess::lock_exception"; } -}; - - -//!This exception is thrown when a memory request can't be -//!fulfilled. -class BOOST_SYMBOL_VISIBLE bad_alloc : public interprocess_exception -{ - public: - bad_alloc() : interprocess_exception("::boost::interprocess::bad_alloc") {} - - const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE - { return "boost::interprocess::bad_alloc"; } -}; - -} // namespace interprocess { - -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // BOOST_INTERPROCESS_EXCEPTIONS_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/interprocess_fwd.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/interprocess_fwd.hpp deleted file mode 100644 index 882256e934..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/interprocess_fwd.hpp +++ /dev/null @@ -1,516 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_INTERPROCESS_FWD_HPP -#define BOOST_INTERPROCESS_FWD_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -#ifndef BOOST_CSTDINT_HPP -# include <boost/cstdint.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/std_fwd.hpp> - -//! \file -//! This header file forward declares the basic interprocess types: -//! - boost::interprocess::offset_ptr; -//! - boost::interprocess::permissions; -//! - boost::interprocess::mapped_region; -//! - boost::interprocess::file_mapping; -//! - boost::interprocess::shared_memory_object; -//! - boost::interprocess::windows_shared_memory; -//! - boost::interprocess::xsi_shared_memory; -//! -//! The following synchronization mechanisms and locks: -//! - boost::interprocess::null_mutex; -//! - boost::interprocess::interprocess_mutex; -//! - boost::interprocess::interprocess_recursive_mutex; -//! - boost::interprocess::interprocess_semaphore; -//! - boost::interprocess::named_mutex; -//! - boost::interprocess::named_recursive_mutex; -//! - boost::interprocess::named_semaphore; -//! - boost::interprocess::interprocess_sharable_mutex; -//! - boost::interprocess::interprocess_condition; -//! - boost::interprocess::scoped_lock; -//! - boost::interprocess::sharable_lock; -//! - boost::interprocess::upgradable_lock; -//! -//! The following mutex families: -//! - boost::interprocess::mutex_family; -//! - boost::interprocess::null_mutex_family; -//! -//! The following allocators: -//! - boost::interprocess::allocator; -//! - boost::interprocess::node_allocator; -//! - boost::interprocess::private_node_allocator; -//! - boost::interprocess::cached_node_allocator; -//! - boost::interprocess::adaptive_pool; -//! - boost::interprocess::private_adaptive_pool; -//! - boost::interprocess::cached_adaptive_pool; -//! -//! The following allocation algorithms: -//! - boost::interprocess::simple_seq_fit; -//! - boost::interprocess::rbtree_best_fit; -//! -//! The following index types: -//! - boost::interprocess::flat_map_index; -//! - boost::interprocess::iset_index; -//! - boost::interprocess::iunordered_set_index; -//! - boost::interprocess::map_index; -//! - boost::interprocess::null_index; -//! - boost::interprocess::unordered_map_index; -//! -//! The following managed memory types: -//! - boost::interprocess::segment_manager; -//! - boost::interprocess::basic_managed_external_buffer -//! - boost::interprocess::managed_external_buffer -//! - boost::interprocess::wmanaged_external_buffer -//! - boost::interprocess::basic_managed_shared_memory -//! - boost::interprocess::managed_shared_memory -//! - boost::interprocess::wmanaged_shared_memory -//! - boost::interprocess::basic_managed_windows_shared_memory -//! - boost::interprocess::managed_windows_shared_memory -//! - boost::interprocess::wmanaged_windows_shared_memory -//! - boost::interprocess::basic_managed_xsi_shared_memory -//! - boost::interprocess::managed_xsi_shared_memory -//! - boost::interprocess::wmanaged_xsi_shared_memory -//! - boost::interprocess::fixed_managed_shared_memory -//! - boost::interprocess::wfixed_managed_shared_memory -//! - boost::interprocess::basic_managed_heap_memory -//! - boost::interprocess::managed_heap_memory -//! - boost::interprocess::wmanaged_heap_memory -//! - boost::interprocess::basic_managed_mapped_file -//! - boost::interprocess::managed_mapped_file -//! - boost::interprocess::wmanaged_mapped_file -//! -//! The following exception types: -//! - boost::interprocess::interprocess_exception -//! - boost::interprocess::lock_exception -//! - boost::interprocess::bad_alloc -//! -//! The following stream types: -//! - boost::interprocess::basic_bufferbuf -//! - boost::interprocess::basic_ibufferstream -//! - boost::interprocess::basic_obufferstream -//! - boost::interprocess::basic_bufferstream -//! - boost::interprocess::basic_vectorbuf -//! - boost::interprocess::basic_ivectorstream -//! - boost::interprocess::basic_ovectorstream -//! - boost::interprocess::basic_vectorstream -//! -//! The following smart pointer types: -//! - boost::interprocess::scoped_ptr -//! - boost::interprocess::intrusive_ptr -//! - boost::interprocess::shared_ptr -//! - boost::interprocess::weak_ptr -//! -//! The following interprocess communication types: -//! - boost::interprocess::message_queue_t; -//! - boost::interprocess::message_queue; - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - -#include <cstddef> - -////////////////////////////////////////////////////////////////////////////// -// Standard predeclarations -////////////////////////////////////////////////////////////////////////////// - -namespace boost{ namespace intrusive{ } } -namespace boost{ namespace interprocess{ namespace bi = boost::intrusive; } } - -namespace boost { namespace interprocess { - -////////////////////////////////////////////////////////////////////////////// -// permissions -////////////////////////////////////////////////////////////////////////////// - -class permissions; - -////////////////////////////////////////////////////////////////////////////// -// shared_memory -////////////////////////////////////////////////////////////////////////////// - -class shared_memory_object; - -#if defined (BOOST_INTERPROCESS_WINDOWS) -class windows_shared_memory; -#endif //#if defined (BOOST_INTERPROCESS_WINDOWS) - -#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) -class xsi_shared_memory; -#endif //#if defined (BOOST_INTERPROCESS_WINDOWS) - -////////////////////////////////////////////////////////////////////////////// -// file mapping / mapped region -////////////////////////////////////////////////////////////////////////////// - -class file_mapping; -class mapped_region; - -////////////////////////////////////////////////////////////////////////////// -// Mutexes -////////////////////////////////////////////////////////////////////////////// - -class null_mutex; - -class interprocess_mutex; -class interprocess_recursive_mutex; - -class named_mutex; -class named_recursive_mutex; - -class interprocess_semaphore; -class named_semaphore; - -////////////////////////////////////////////////////////////////////////////// -// Mutex families -////////////////////////////////////////////////////////////////////////////// - -struct mutex_family; -struct null_mutex_family; - -////////////////////////////////////////////////////////////////////////////// -// Other synchronization classes -////////////////////////////////////////////////////////////////////////////// - -class interprocess_sharable_mutex; -class interprocess_condition; - -////////////////////////////////////////////////////////////////////////////// -// Locks -////////////////////////////////////////////////////////////////////////////// - -template <class Mutex> -class scoped_lock; - -template <class SharableMutex> -class sharable_lock; - -template <class UpgradableMutex> -class upgradable_lock; - -////////////////////////////////////////////////////////////////////////////// -// STL compatible allocators -////////////////////////////////////////////////////////////////////////////// - -template<class T, class SegmentManager> -class allocator; - -template<class T, class SegmentManager, std::size_t NodesPerBlock = 64> -class node_allocator; - -template<class T, class SegmentManager, std::size_t NodesPerBlock = 64> -class private_node_allocator; - -template<class T, class SegmentManager, std::size_t NodesPerBlock = 64> -class cached_node_allocator; - -template< class T, class SegmentManager, std::size_t NodesPerBlock = 64 - , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 > -class adaptive_pool; - -template< class T, class SegmentManager, std::size_t NodesPerBlock = 64 - , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 > -class private_adaptive_pool; - -template< class T, class SegmentManager, std::size_t NodesPerBlock = 64 - , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 > -class cached_adaptive_pool; - - -////////////////////////////////////////////////////////////////////////////// -// offset_ptr -////////////////////////////////////////////////////////////////////////////// - -static const std::size_t offset_type_alignment = 0; - -#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) -# ifdef BOOST_HAS_INTPTR_T - using ::boost::uintptr_t; -# else - typedef std::size_t uintptr_t; -# endif -#endif - -template < class T, class DifferenceType = std::ptrdiff_t - , class OffsetType = uintptr_t, std::size_t Alignment = offset_type_alignment> -class offset_ptr; - -////////////////////////////////////////////////////////////////////////////// -// Memory allocation algorithms -////////////////////////////////////////////////////////////////////////////// - -//Single segment memory allocation algorithms -template<class MutexFamily, class VoidMutex = offset_ptr<void> > -class simple_seq_fit; - -template<class MutexFamily, class VoidMutex = offset_ptr<void>, std::size_t MemAlignment = 0> -class rbtree_best_fit; - -////////////////////////////////////////////////////////////////////////////// -// Index Types -////////////////////////////////////////////////////////////////////////////// - -template<class IndexConfig> class flat_map_index; -template<class IndexConfig> class iset_index; -template<class IndexConfig> class iunordered_set_index; -template<class IndexConfig> class map_index; -template<class IndexConfig> class null_index; -template<class IndexConfig> class unordered_map_index; - -////////////////////////////////////////////////////////////////////////////// -// Segment manager -////////////////////////////////////////////////////////////////////////////// - -template <class CharType - ,class MemoryAlgorithm - ,template<class IndexConfig> class IndexType> -class segment_manager; - -////////////////////////////////////////////////////////////////////////////// -// External buffer managed memory classes -////////////////////////////////////////////////////////////////////////////// - -template <class CharType - ,class MemoryAlgorithm - ,template<class IndexConfig> class IndexType> -class basic_managed_external_buffer; - -typedef basic_managed_external_buffer - <char - ,rbtree_best_fit<null_mutex_family> - ,iset_index> -managed_external_buffer; - -typedef basic_managed_external_buffer - <wchar_t - ,rbtree_best_fit<null_mutex_family> - ,iset_index> -wmanaged_external_buffer; - -////////////////////////////////////////////////////////////////////////////// -// managed memory classes -////////////////////////////////////////////////////////////////////////////// - -template <class CharType - ,class MemoryAlgorithm - ,template<class IndexConfig> class IndexType> -class basic_managed_shared_memory; - -typedef basic_managed_shared_memory - <char - ,rbtree_best_fit<mutex_family> - ,iset_index> -managed_shared_memory; - -typedef basic_managed_shared_memory - <wchar_t - ,rbtree_best_fit<mutex_family> - ,iset_index> -wmanaged_shared_memory; - - -////////////////////////////////////////////////////////////////////////////// -// Windows shared memory managed memory classes -////////////////////////////////////////////////////////////////////////////// - -#if defined (BOOST_INTERPROCESS_WINDOWS) - -template <class CharType - ,class MemoryAlgorithm - ,template<class IndexConfig> class IndexType> -class basic_managed_windows_shared_memory; - -typedef basic_managed_windows_shared_memory - <char - ,rbtree_best_fit<mutex_family> - ,iset_index> -managed_windows_shared_memory; - -typedef basic_managed_windows_shared_memory - <wchar_t - ,rbtree_best_fit<mutex_family> - ,iset_index> -wmanaged_windows_shared_memory; - -#endif //#if defined (BOOST_INTERPROCESS_WINDOWS) - -#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) - -template <class CharType - ,class MemoryAlgorithm - ,template<class IndexConfig> class IndexType> -class basic_managed_xsi_shared_memory; - -typedef basic_managed_xsi_shared_memory - <char - ,rbtree_best_fit<mutex_family> - ,iset_index> -managed_xsi_shared_memory; - -typedef basic_managed_xsi_shared_memory - <wchar_t - ,rbtree_best_fit<mutex_family> - ,iset_index> -wmanaged_xsi_shared_memory; - -#endif //#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) - -////////////////////////////////////////////////////////////////////////////// -// Fixed address shared memory -////////////////////////////////////////////////////////////////////////////// - -typedef basic_managed_shared_memory - <char - ,rbtree_best_fit<mutex_family, void*> - ,iset_index> -fixed_managed_shared_memory; - -typedef basic_managed_shared_memory - <wchar_t - ,rbtree_best_fit<mutex_family, void*> - ,iset_index> -wfixed_managed_shared_memory; - -////////////////////////////////////////////////////////////////////////////// -// Heap memory managed memory classes -////////////////////////////////////////////////////////////////////////////// - -template - <class CharType - ,class MemoryAlgorithm - ,template<class IndexConfig> class IndexType> -class basic_managed_heap_memory; - -typedef basic_managed_heap_memory - <char - ,rbtree_best_fit<null_mutex_family> - ,iset_index> -managed_heap_memory; - -typedef basic_managed_heap_memory - <wchar_t - ,rbtree_best_fit<null_mutex_family> - ,iset_index> -wmanaged_heap_memory; - -////////////////////////////////////////////////////////////////////////////// -// Mapped file managed memory classes -////////////////////////////////////////////////////////////////////////////// - -template - <class CharType - ,class MemoryAlgorithm - ,template<class IndexConfig> class IndexType> -class basic_managed_mapped_file; - -typedef basic_managed_mapped_file - <char - ,rbtree_best_fit<mutex_family> - ,iset_index> -managed_mapped_file; - -typedef basic_managed_mapped_file - <wchar_t - ,rbtree_best_fit<mutex_family> - ,iset_index> -wmanaged_mapped_file; - -////////////////////////////////////////////////////////////////////////////// -// Exceptions -////////////////////////////////////////////////////////////////////////////// - -class interprocess_exception; -class lock_exception; -class bad_alloc; - -////////////////////////////////////////////////////////////////////////////// -// Bufferstream -////////////////////////////////////////////////////////////////////////////// - -//bufferstream -template <class CharT - ,class CharTraits = std::char_traits<CharT> > -class basic_bufferbuf; - -template <class CharT - ,class CharTraits = std::char_traits<CharT> > -class basic_ibufferstream; - -template <class CharT - ,class CharTraits = std::char_traits<CharT> > -class basic_obufferstream; - -template <class CharT - ,class CharTraits = std::char_traits<CharT> > -class basic_bufferstream; - -////////////////////////////////////////////////////////////////////////////// -// Vectorstream -////////////////////////////////////////////////////////////////////////////// - -template <class CharVector - ,class CharTraits = std::char_traits<typename CharVector::value_type> > -class basic_vectorbuf; - -template <class CharVector - ,class CharTraits = std::char_traits<typename CharVector::value_type> > -class basic_ivectorstream; - -template <class CharVector - ,class CharTraits = std::char_traits<typename CharVector::value_type> > -class basic_ovectorstream; - -template <class CharVector - ,class CharTraits = std::char_traits<typename CharVector::value_type> > -class basic_vectorstream; - -////////////////////////////////////////////////////////////////////////////// -// Smart pointers -////////////////////////////////////////////////////////////////////////////// - -template<class T, class Deleter> -class scoped_ptr; - -template<class T, class VoidPointer> -class intrusive_ptr; - -template<class T, class VoidAllocator, class Deleter> -class shared_ptr; - -template<class T, class VoidAllocator, class Deleter> -class weak_ptr; - -////////////////////////////////////////////////////////////////////////////// -// IPC -////////////////////////////////////////////////////////////////////////////// - -template<class VoidPointer> -class message_queue_t; - -typedef message_queue_t<offset_ptr<void> > message_queue; - -}} //namespace boost { namespace interprocess { - -#endif //#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_FWD_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp deleted file mode 100644 index c036ce9490..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/mem_algo/detail/mem_algo_common.hpp +++ /dev/null @@ -1,599 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_INTERPROCESS_DETAIL_MEM_ALGO_COMMON_HPP -#define BOOST_INTERPROCESS_DETAIL_MEM_ALGO_COMMON_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -// interprocess -#include <boost/interprocess/interprocess_fwd.hpp> -#include <boost/interprocess/containers/allocation_type.hpp> -// interprocess/detail -#include <boost/interprocess/detail/math_functions.hpp> -#include <boost/interprocess/detail/min_max.hpp> -#include <boost/interprocess/detail/type_traits.hpp> -#include <boost/interprocess/detail/utilities.hpp> -// container/detail -#include <boost/container/detail/multiallocation_chain.hpp> -#include <boost/container/detail/placement_new.hpp> -// move -#include <boost/move/utility_core.hpp> -// move/detail -#include <boost/move/detail/force_ptr.hpp> -// other boost -#include <boost/static_assert.hpp> -#include <boost/assert.hpp> - -//!\file -//!Implements common operations for memory algorithms. - -namespace boost { -namespace interprocess { -namespace ipcdetail { - -template<class VoidPointer> -class basic_multiallocation_chain - : public boost::container::dtl:: - basic_multiallocation_chain<VoidPointer> -{ - BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain) - typedef boost::container::dtl:: - basic_multiallocation_chain<VoidPointer> base_t; - public: - - basic_multiallocation_chain() - : base_t() - {} - - basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other) - : base_t(::boost::move(static_cast<base_t&>(other))) - {} - - basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other) - { - this->base_t::operator=(::boost::move(static_cast<base_t&>(other))); - return *this; - } - - void *pop_front() - { - return boost::interprocess::ipcdetail::to_raw_pointer(this->base_t::pop_front()); - } -}; - - -//!This class implements several allocation functions shared by different algorithms -//!(aligned allocation, multiple allocation...). -template<class MemoryAlgorithm> -class memory_algorithm_common -{ - public: - typedef typename MemoryAlgorithm::void_pointer void_pointer; - typedef typename MemoryAlgorithm::block_ctrl block_ctrl; - typedef typename MemoryAlgorithm::multiallocation_chain multiallocation_chain; - typedef memory_algorithm_common<MemoryAlgorithm> this_type; - typedef typename MemoryAlgorithm::size_type size_type; - - static const size_type Alignment = MemoryAlgorithm::Alignment; - static const size_type MinBlockUnits = MemoryAlgorithm::MinBlockUnits; - static const size_type AllocatedCtrlBytes = MemoryAlgorithm::AllocatedCtrlBytes; - static const size_type AllocatedCtrlUnits = MemoryAlgorithm::AllocatedCtrlUnits; - static const size_type BlockCtrlBytes = MemoryAlgorithm::BlockCtrlBytes; - static const size_type BlockCtrlUnits = MemoryAlgorithm::BlockCtrlUnits; - static const size_type UsableByPreviousChunk = MemoryAlgorithm::UsableByPreviousChunk; - - static void assert_alignment(const void *ptr) - { assert_alignment((std::size_t)ptr); } - - static void assert_alignment(size_type uint_ptr) - { - (void)uint_ptr; - BOOST_ASSERT(uint_ptr % Alignment == 0); - } - - static bool check_alignment(const void *ptr) - { return (((std::size_t)ptr) % Alignment == 0); } - - static size_type ceil_units(size_type size) - { return get_rounded_size(size, Alignment)/Alignment; } - - static size_type floor_units(size_type size) - { return size/Alignment; } - - static size_type multiple_of_units(size_type size) - { return get_rounded_size(size, Alignment); } - - static void allocate_many - (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain) - { - return this_type::priv_allocate_many(memory_algo, &elem_bytes, n_elements, 0, chain); - } - - static void deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain &chain) - { - return this_type::priv_deallocate_many(memory_algo, chain); - } - - static bool calculate_lcm_and_needs_backwards_lcmed - (size_type backwards_multiple, size_type received_size, size_type size_to_achieve, - size_type &lcm_out, size_type &needs_backwards_lcmed_out) - { - // Now calculate lcm_val - size_type max = backwards_multiple; - size_type min = Alignment; - size_type needs_backwards; - size_type needs_backwards_lcmed; - size_type lcm_val; - size_type current_forward; - //Swap if necessary - if(max < min){ - size_type tmp = min; - min = max; - max = tmp; - } - //Check if it's power of two - if((backwards_multiple & (backwards_multiple-1)) == 0){ - if(0 != (size_to_achieve & ((backwards_multiple-1)))){ - return false; - } - - lcm_val = max; - //If we want to use minbytes data to get a buffer between maxbytes - //and minbytes if maxbytes can't be achieved, calculate the - //biggest of all possibilities - current_forward = get_truncated_size_po2(received_size, backwards_multiple); - needs_backwards = size_to_achieve - current_forward; - BOOST_ASSERT((needs_backwards % backwards_multiple) == 0); - needs_backwards_lcmed = get_rounded_size_po2(needs_backwards, lcm_val); - lcm_out = lcm_val; - needs_backwards_lcmed_out = needs_backwards_lcmed; - return true; - } - //Check if it's multiple of alignment - else if((backwards_multiple & (Alignment - 1u)) == 0){ - lcm_val = backwards_multiple; - current_forward = get_truncated_size(received_size, backwards_multiple); - //No need to round needs_backwards because backwards_multiple == lcm_val - needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward; - BOOST_ASSERT((needs_backwards_lcmed & (Alignment - 1u)) == 0); - lcm_out = lcm_val; - needs_backwards_lcmed_out = needs_backwards_lcmed; - return true; - } - //Check if it's multiple of the half of the alignmment - else if((backwards_multiple & ((Alignment/2u) - 1u)) == 0){ - lcm_val = backwards_multiple*2u; - current_forward = get_truncated_size(received_size, backwards_multiple); - needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward; - if(0 != (needs_backwards_lcmed & (Alignment-1))) - //while(0 != (needs_backwards_lcmed & (Alignment-1))) - needs_backwards_lcmed += backwards_multiple; - BOOST_ASSERT((needs_backwards_lcmed % lcm_val) == 0); - lcm_out = lcm_val; - needs_backwards_lcmed_out = needs_backwards_lcmed; - return true; - } - //Check if it's multiple of the quarter of the alignmment - else if((backwards_multiple & ((Alignment/4u) - 1u)) == 0){ - size_type remainder; - lcm_val = backwards_multiple*4u; - current_forward = get_truncated_size(received_size, backwards_multiple); - needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward; - //while(0 != (needs_backwards_lcmed & (Alignment-1))) - //needs_backwards_lcmed += backwards_multiple; - if(0 != (remainder = ((needs_backwards_lcmed & (Alignment-1))>>(Alignment/8u)))){ - if(backwards_multiple & Alignment/2u){ - needs_backwards_lcmed += (remainder)*backwards_multiple; - } - else{ - needs_backwards_lcmed += (4-remainder)*backwards_multiple; - } - } - BOOST_ASSERT((needs_backwards_lcmed % lcm_val) == 0); - lcm_out = lcm_val; - needs_backwards_lcmed_out = needs_backwards_lcmed; - return true; - } - else{ - lcm_val = lcm(max, min); - } - //If we want to use minbytes data to get a buffer between maxbytes - //and minbytes if maxbytes can't be achieved, calculate the - //biggest of all possibilities - current_forward = get_truncated_size(received_size, backwards_multiple); - needs_backwards = size_to_achieve - current_forward; - BOOST_ASSERT((needs_backwards % backwards_multiple) == 0); - needs_backwards_lcmed = get_rounded_size(needs_backwards, lcm_val); - lcm_out = lcm_val; - needs_backwards_lcmed_out = needs_backwards_lcmed; - return true; - } - - static void allocate_many - ( MemoryAlgorithm *memory_algo - , const size_type *elem_sizes - , size_type n_elements - , size_type sizeof_element - , multiallocation_chain &chain) - { - this_type::priv_allocate_many(memory_algo, elem_sizes, n_elements, sizeof_element, chain); - } - - static void* allocate_aligned - (MemoryAlgorithm *memory_algo, size_type nbytes, size_type alignment) - { - - //Ensure power of 2 - if ((alignment & (alignment - size_type(1u))) != 0){ - //Alignment is not power of two - BOOST_ASSERT((alignment & (alignment - size_type(1u))) == 0); - return 0; - } - - size_type real_size = nbytes; - if(alignment <= Alignment){ - void *ignore_reuse = 0; - return memory_algo->priv_allocate - (boost::interprocess::allocate_new, nbytes, real_size, ignore_reuse); - } - - if(nbytes > UsableByPreviousChunk) - nbytes -= UsableByPreviousChunk; - - //We can find a aligned portion if we allocate a block that has alignment - //nbytes + alignment bytes or more. - size_type minimum_allocation = max_value - (nbytes + alignment, size_type(MinBlockUnits*Alignment)); - //Since we will split that block, we must request a bit more memory - //if the alignment is near the beginning of the buffer, because otherwise, - //there is no space for a new block before the alignment. - // - // ____ Aligned here - // | - // ----------------------------------------------------- - // | MBU | - // ----------------------------------------------------- - size_type request = - minimum_allocation + (2*MinBlockUnits*Alignment - AllocatedCtrlBytes - //prevsize - UsableByPreviousChunk - ); - - //Now allocate the buffer - real_size = request; - void *ignore_reuse = 0; - void *buffer = memory_algo->priv_allocate(boost::interprocess::allocate_new, request, real_size, ignore_reuse); - if(!buffer){ - return 0; - } - else if ((((std::size_t)(buffer)) % alignment) == 0){ - //If we are lucky and the buffer is aligned, just split it and - //return the high part - block_ctrl *first = memory_algo->priv_get_block(buffer); - size_type old_size = first->m_size; - const size_type first_min_units = - max_value(ceil_units(nbytes) + AllocatedCtrlUnits, size_type(MinBlockUnits)); - //We can create a new block in the end of the segment - if(old_size >= (first_min_units + MinBlockUnits)){ - block_ctrl *second = move_detail::force_ptr<block_ctrl*> - (reinterpret_cast<char*>(first) + Alignment*first_min_units); - first->m_size = first_min_units & block_ctrl::size_mask; - second->m_size = (old_size - first->m_size) & block_ctrl::size_mask; - BOOST_ASSERT(second->m_size >= MinBlockUnits); - memory_algo->priv_mark_new_allocated_block(first); - memory_algo->priv_mark_new_allocated_block(second); - memory_algo->priv_deallocate(memory_algo->priv_get_user_buffer(second)); - } - return buffer; - } - - //Buffer not aligned, find the aligned part. - // - // ____ Aligned here - // | - // ----------------------------------------------------- - // | MBU +more | ACB | - // ----------------------------------------------------- - char *pos = reinterpret_cast<char*> - (reinterpret_cast<std::size_t>(static_cast<char*>(buffer) + - //This is the minimum size of (2) - (MinBlockUnits*Alignment - AllocatedCtrlBytes) + - //This is the next MBU for the aligned memory - AllocatedCtrlBytes + - //This is the alignment trick - alignment - 1) & -alignment); - - //Now obtain the address of the blocks - block_ctrl *first = memory_algo->priv_get_block(buffer); - block_ctrl *second = memory_algo->priv_get_block(pos); - BOOST_ASSERT(pos <= (reinterpret_cast<char*>(first) + first->m_size*Alignment)); - BOOST_ASSERT(first->m_size >= 2*MinBlockUnits); - BOOST_ASSERT((pos + MinBlockUnits*Alignment - AllocatedCtrlBytes + nbytes*Alignment/Alignment) <= - (reinterpret_cast<char*>(first) + first->m_size*Alignment)); - //Set the new size of the first block - size_type old_size = first->m_size; - first->m_size = size_type(size_type(reinterpret_cast<char*>(second) - reinterpret_cast<char*>(first))/Alignment - & block_ctrl::size_mask); - memory_algo->priv_mark_new_allocated_block(first); - - //Now check if we can create a new buffer in the end - // - // __"second" block - // | __Aligned here - // | | __"third" block - // -----------|-----|-----|------------------------------ - // | MBU +more | ACB | (3) | BCU | - // ----------------------------------------------------- - //This size will be the minimum size to be able to create a - //new block in the end. - const size_type second_min_units = max_value(size_type(MinBlockUnits), - ceil_units(nbytes) + AllocatedCtrlUnits ); - - //Check if we can create a new block (of size MinBlockUnits) in the end of the segment - if((old_size - first->m_size) >= (second_min_units + MinBlockUnits)){ - //Now obtain the address of the end block - block_ctrl *third = new (reinterpret_cast<char*>(second) + Alignment*second_min_units)block_ctrl; - second->m_size = second_min_units & block_ctrl::size_mask; - third->m_size = (old_size - first->m_size - second->m_size) & block_ctrl::size_mask; - BOOST_ASSERT(third->m_size >= MinBlockUnits); - memory_algo->priv_mark_new_allocated_block(second); - memory_algo->priv_mark_new_allocated_block(third); - memory_algo->priv_deallocate(memory_algo->priv_get_user_buffer(third)); - } - else{ - second->m_size = (old_size - first->m_size) & block_ctrl::size_mask; - BOOST_ASSERT(second->m_size >= MinBlockUnits); - memory_algo->priv_mark_new_allocated_block(second); - } - - memory_algo->priv_deallocate(memory_algo->priv_get_user_buffer(first)); - return memory_algo->priv_get_user_buffer(second); - } - - static bool try_shrink - (MemoryAlgorithm *memory_algo, void *ptr - ,const size_type max_size, size_type &received_size) - { - size_type const preferred_size = received_size; - (void)memory_algo; - //Obtain the real block - block_ctrl *block = memory_algo->priv_get_block(ptr); - size_type old_block_units = (size_type)block->m_size; - - //The block must be marked as allocated - BOOST_ASSERT(memory_algo->priv_is_allocated_block(block)); - - //Check if alignment and block size are right - assert_alignment(ptr); - - //Put this to a safe value - received_size = (old_block_units - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk; - - //Now translate it to Alignment units - const size_type max_user_units = floor_units(max_size - UsableByPreviousChunk); - const size_type preferred_user_units = ceil_units(preferred_size - UsableByPreviousChunk); - - //Check if rounded max and preferred are possible correct - if(max_user_units < preferred_user_units) - return false; - - //Check if the block is smaller than the requested minimum - size_type old_user_units = old_block_units - AllocatedCtrlUnits; - - if(old_user_units < preferred_user_units) - return false; - - //If the block is smaller than the requested minimum - if(old_user_units == preferred_user_units) - return true; - - size_type shrunk_user_units = - ((BlockCtrlUnits - AllocatedCtrlUnits) >= preferred_user_units) - ? (BlockCtrlUnits - AllocatedCtrlUnits) - : preferred_user_units; - - //Some parameter checks - if(max_user_units < shrunk_user_units) - return false; - - //We must be able to create at least a new empty block - if((old_user_units - shrunk_user_units) < BlockCtrlUnits ){ - return false; - } - - //Update new size - received_size = shrunk_user_units*Alignment + UsableByPreviousChunk; - return true; - } - - static bool shrink - (MemoryAlgorithm *memory_algo, void *ptr - ,const size_type max_size, size_type &received_size) - { - size_type const preferred_size = received_size; - //Obtain the real block - block_ctrl *block = memory_algo->priv_get_block(ptr); - size_type old_block_units = (size_type)block->m_size; - - if(!try_shrink(memory_algo, ptr, max_size, received_size)){ - return false; - } - - //Check if the old size was just the shrunk size (no splitting) - if((old_block_units - AllocatedCtrlUnits) == ceil_units(preferred_size - UsableByPreviousChunk)) - return true; - - //Now we can just rewrite the size of the old buffer - block->m_size = ((received_size-UsableByPreviousChunk)/Alignment + AllocatedCtrlUnits) & block_ctrl::size_mask; - BOOST_ASSERT(block->m_size >= BlockCtrlUnits); - - //We create the new block - block_ctrl *new_block = move_detail::force_ptr<block_ctrl*> - (reinterpret_cast<char*>(block) + block->m_size*Alignment); - //Write control data to simulate this new block was previously allocated - //and deallocate it - new_block->m_size = (old_block_units - block->m_size) & block_ctrl::size_mask; - BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits); - memory_algo->priv_mark_new_allocated_block(block); - memory_algo->priv_mark_new_allocated_block(new_block); - memory_algo->priv_deallocate(memory_algo->priv_get_user_buffer(new_block)); - return true; - } - - private: - static void priv_allocate_many - ( MemoryAlgorithm *memory_algo - , const size_type *elem_sizes - , size_type n_elements - , size_type sizeof_element - , multiallocation_chain &chain) - { - //Note: sizeof_element == 0 indicates that we want to - //allocate n_elements of the same size "*elem_sizes" - - //Calculate the total size of all requests - size_type total_request_units = 0; - size_type elem_units = 0; - const size_type ptr_size_units = memory_algo->priv_get_total_units(sizeof(void_pointer)); - if(!sizeof_element){ - elem_units = memory_algo->priv_get_total_units(*elem_sizes); - elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; - total_request_units = n_elements*elem_units; - } - else{ - for(size_type i = 0; i < n_elements; ++i){ - if(multiplication_overflows(elem_sizes[i], sizeof_element)){ - total_request_units = 0; - break; - } - elem_units = memory_algo->priv_get_total_units(elem_sizes[i]*sizeof_element); - elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; - if(sum_overflows(total_request_units, elem_units)){ - total_request_units = 0; - break; - } - total_request_units += elem_units; - } - } - - if(total_request_units && !multiplication_overflows(total_request_units, Alignment)){ - size_type low_idx = 0; - while(low_idx < n_elements){ - size_type total_bytes = total_request_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - size_type min_allocation = (!sizeof_element) - ? elem_units - : memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); - min_allocation = min_allocation*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - - size_type received_size = total_bytes; - void *ignore_reuse = 0; - void *ret = memory_algo->priv_allocate - (boost::interprocess::allocate_new, min_allocation, received_size, ignore_reuse); - if(!ret){ - break; - } - - block_ctrl *block = memory_algo->priv_get_block(ret); - size_type received_units = (size_type)block->m_size; - char *block_address = reinterpret_cast<char*>(block); - - size_type total_used_units = 0; - while(total_used_units < received_units){ - if(sizeof_element){ - elem_units = memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element); - elem_units = ptr_size_units > elem_units ? ptr_size_units : elem_units; - } - if(total_used_units + elem_units > received_units) - break; - total_request_units -= elem_units; - //This is the position where the new block must be created - block_ctrl *new_block = move_detail::force_ptr<block_ctrl*>(block_address); - assert_alignment(new_block); - - //The last block should take all the remaining space - if((low_idx + 1) == n_elements || - (total_used_units + elem_units + - ((!sizeof_element) - ? elem_units - : max_value(memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element), ptr_size_units)) - > received_units)){ - //By default, the new block will use the rest of the buffer - new_block->m_size = (received_units - total_used_units) & block_ctrl::size_mask; - memory_algo->priv_mark_new_allocated_block(new_block); - - //If the remaining units are bigger than needed and we can - //split it obtaining a new free memory block do it. - if((received_units - total_used_units) >= (elem_units + MemoryAlgorithm::BlockCtrlUnits)){ - size_type shrunk_request = elem_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk; - size_type shrunk_received = shrunk_request; - bool shrink_ok = shrink - (memory_algo - ,memory_algo->priv_get_user_buffer(new_block) - ,shrunk_request - ,shrunk_received); - (void)shrink_ok; - //Shrink must always succeed with passed parameters - BOOST_ASSERT(shrink_ok); - //Some sanity checks - BOOST_ASSERT(shrunk_request == shrunk_received); - BOOST_ASSERT(elem_units == ((shrunk_request-UsableByPreviousChunk)/Alignment + AllocatedCtrlUnits)); - //"new_block->m_size" must have been reduced to elem_units by "shrink" - BOOST_ASSERT(new_block->m_size == elem_units); - //Now update the total received units with the reduction - received_units = elem_units + total_used_units; - } - } - else{ - new_block->m_size = elem_units & block_ctrl::size_mask; - memory_algo->priv_mark_new_allocated_block(new_block); - } - - block_address += new_block->m_size*Alignment; - total_used_units += (size_type)new_block->m_size; - //Check we have enough room to overwrite the intrusive pointer - BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer)); - void_pointer p = ::new(memory_algo->priv_get_user_buffer(new_block), boost_container_new_t())void_pointer(0); - chain.push_back(p); - ++low_idx; - } - //Sanity check - BOOST_ASSERT(total_used_units == received_units); - } - - if(low_idx != n_elements){ - priv_deallocate_many(memory_algo, chain); - } - } - } - - static void priv_deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain &chain) - { - while(!chain.empty()){ - memory_algo->priv_deallocate(to_raw_pointer(chain.pop_front())); - } - } -}; - -} //namespace ipcdetail { -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_DETAIL_MEM_ALGO_COMMON_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/deleter.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/deleter.hpp deleted file mode 100644 index bc0f8c8aaf..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/deleter.hpp +++ /dev/null @@ -1,68 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2007-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_INTERPROCESS_DELETER_HPP -#define BOOST_INTERPROCESS_DELETER_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/interprocess_fwd.hpp> -#include <boost/interprocess/detail/utilities.hpp> -#include <boost/intrusive/pointer_traits.hpp> - -//!\file -//!Describes the functor to delete objects from the segment. - -namespace boost { -namespace interprocess { - -//!A deleter that uses the segment manager's destroy_ptr -//!function to destroy the passed pointer resource. -//! -//!This deleter is used -template<class T, class SegmentManager> -class deleter -{ - public: - typedef typename boost::intrusive:: - pointer_traits<typename SegmentManager::void_pointer>::template - rebind_pointer<T>::type pointer; - - private: - typedef typename boost::intrusive:: - pointer_traits<pointer>::template - rebind_pointer<SegmentManager>::type segment_manager_pointer; - - segment_manager_pointer mp_mngr; - - public: - deleter(segment_manager_pointer pmngr) BOOST_NOEXCEPT - : mp_mngr(pmngr) - {} - - void operator()(const pointer &p) - { mp_mngr->destroy_ptr(ipcdetail::to_raw_pointer(p)); } -}; - -} //namespace interprocess { -} //namespace boost { - -#include <boost/interprocess/detail/config_end.hpp> - -#endif //#ifndef BOOST_INTERPROCESS_DELETER_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp deleted file mode 100644 index e2ce9a78d8..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp +++ /dev/null @@ -1,48 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// This file is the adaptation for Interprocess of boost/detail/bad_weak_ptr.hpp -// -// (C) Copyright Peter Dimov and Multi Media Ltd. 2001, 2002, 2003 -// (C) Copyright Ion Gaztanaga 2006. Distributed under the 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_INTERPROCESS_BAD_WEAK_PTR_HPP_INCLUDED -#define BOOST_INTERPROCESS_BAD_WEAK_PTR_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#ifndef BOOST_NO_EXCEPTIONS -#include <exception> -#endif - -namespace boost{ -namespace interprocess{ - -class bad_weak_ptr - : public std::exception -{ - public: - - virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE - { return "boost::interprocess::bad_weak_ptr"; } -}; - -} // namespace interprocess -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_BAD_WEAK_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/shared_count.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/shared_count.hpp deleted file mode 100644 index 9b0244e423..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/shared_count.hpp +++ /dev/null @@ -1,347 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// This file is the adaptation for Interprocess of boost/detail/shared_count.hpp -// -// (C) Copyright Peter Dimov and Multi Media Ltd. 2001, 2002, 2003 -// (C) Copyright Peter Dimov 2004-2005 -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_INTERPROCESS_DETAIL_SHARED_COUNT_HPP_INCLUDED -#define BOOST_INTERPROCESS_DETAIL_SHARED_COUNT_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/intrusive/pointer_traits.hpp> -#include <boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp> -#include <boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp> -#include <boost/interprocess/detail/utilities.hpp> -#include <boost/container/allocator_traits.hpp> -#include <boost/core/no_exceptions_support.hpp> -#include <boost/move/adl_move_swap.hpp> -#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less -#include <boost/container/detail/placement_new.hpp> - -namespace boost { -namespace interprocess { -namespace ipcdetail{ - -template<class T, class VoidAllocator, class Deleter> -class weak_count; - -template<class T, class VoidAllocator, class Deleter> -class shared_count -{ - public: - - typedef typename boost::container:: - allocator_traits<VoidAllocator>::pointer void_ptr; - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<T>::type pointer; - - private: - typedef sp_counted_impl_pd<VoidAllocator, Deleter> counted_impl; - - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<counted_impl>::type counted_impl_ptr; - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<sp_counted_base>::type counted_base_ptr; - - typedef boost::container::allocator_traits<VoidAllocator> vallocator_traits; - - typedef typename vallocator_traits::template - portable_rebind_alloc<counted_impl>::type counted_impl_allocator; - - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<const Deleter>::type const_deleter_pointer; - - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<const VoidAllocator>::type const_allocator_pointer; - - pointer m_px; - counted_impl_ptr m_pi; - - template <class T2, class VoidAllocator2, class Deleter2> - friend class weak_count; - - template <class T2, class VoidAllocator2, class Deleter2> - friend class shared_count; - - public: - - shared_count() - : m_px(0), m_pi(0) // nothrow - {} - - template <class Ptr> - shared_count(const shared_count &other_shared_count, const Ptr &p) - : m_px(p), m_pi(other_shared_count.m_pi) - {} - - template <class Ptr> - shared_count(const Ptr &p, const VoidAllocator &a, Deleter d) - : m_px(p), m_pi(0) - { - BOOST_TRY{ - if(p){ - counted_impl_allocator alloc(a); - m_pi = alloc.allocate(1); - //Anti-exception deallocator - scoped_ptr<counted_impl, - scoped_ptr_dealloc_functor<counted_impl_allocator> > - deallocator(m_pi, alloc); - //It's more correct to use VoidAllocator::construct but - //this needs copy constructor and we don't like it - ::new(ipcdetail::to_raw_pointer(m_pi), boost_container_new_t())counted_impl(p, a, d); - deallocator.release(); - } - } - BOOST_CATCH (...){ - d(p); // delete p - BOOST_RETHROW - } - BOOST_CATCH_END - } - - ~shared_count() // nothrow - { - if(m_pi) - m_pi->release(); - } - - shared_count(shared_count const & r) - : m_px(r.m_px), m_pi(r.m_pi) // nothrow - { if( m_pi != 0 ) m_pi->add_ref_copy(); } - - //this is a test - template<class Y> - explicit shared_count(shared_count<Y, VoidAllocator, Deleter> const & r) - : m_px(r.m_px), m_pi(r.m_pi) // nothrow - { if( m_pi != 0 ) m_pi->add_ref_copy(); } - - //this is a test - template<class Y> - explicit shared_count(const pointer & ptr, shared_count<Y, VoidAllocator, Deleter> const & r) - : m_px(ptr), m_pi(r.m_pi) // nothrow - { if( m_pi != 0 ) m_pi->add_ref_copy(); } - -/* - explicit shared_count(weak_count<Y, VoidAllocator, Deleter> const & r) - // throws bad_weak_ptr when r.use_count() == 0 - : m_pi( r.m_pi ) - { - if( m_pi == 0 || !m_pi->add_ref_lock() ){ - boost::throw_exception( boost::interprocess::bad_weak_ptr() ); - } - } -*/ - template<class Y> - explicit shared_count(weak_count<Y, VoidAllocator, Deleter> const & r) - // throws bad_weak_ptr when r.use_count() == 0 - : m_px(r.m_px), m_pi( r.m_pi ) - { - if( m_pi == 0 || !m_pi->add_ref_lock() ){ - throw( boost::interprocess::bad_weak_ptr() ); - } - } - - const pointer &to_raw_pointer() const - { return m_px; } - - pointer &to_raw_pointer() - { return m_px; } - - shared_count & operator= (shared_count const & r) // nothrow - { - m_px = r.m_px; - counted_impl_ptr tmp = r.m_pi; - if( tmp != m_pi ){ - if(tmp != 0) tmp->add_ref_copy(); - if(m_pi != 0) m_pi->release(); - m_pi = tmp; - } - return *this; - } - - template<class Y> - shared_count & operator= (shared_count<Y, VoidAllocator, Deleter> const & r) // nothrow - { - m_px = r.m_px; - counted_impl_ptr tmp = r.m_pi; - if( tmp != m_pi ){ - if(tmp != 0) tmp->add_ref_copy(); - if(m_pi != 0) m_pi->release(); - m_pi = tmp; - } - return *this; - } - - void swap(shared_count & r) // nothrow - { ::boost::adl_move_swap(m_px, r.m_px); ::boost::adl_move_swap(m_pi, r.m_pi); } - - long use_count() const // nothrow - { return m_pi != 0? m_pi->use_count(): 0; } - - bool unique() const // nothrow - { return use_count() == 1; } - - const_deleter_pointer get_deleter() const - { return m_pi ? m_pi->get_deleter() : 0; } - -// const_allocator_pointer get_allocator() const -// { return m_pi ? m_pi->get_allocator() : 0; } - - template<class T2, class VoidAllocator2, class Deleter2> - bool internal_equal (shared_count<T2, VoidAllocator2, Deleter2> const & other) const - { return this->m_pi == other.m_pi; } - - template<class T2, class VoidAllocator2, class Deleter2> - bool internal_less (shared_count<T2, VoidAllocator2, Deleter2> const & other) const - { return std::less<counted_base_ptr>()(this->m_pi, other.m_pi); } -}; - -template<class T, class VoidAllocator, class Deleter, class T2, class VoidAllocator2, class Deleter2> inline -bool operator==(shared_count<T, VoidAllocator, Deleter> const & a, shared_count<T2, VoidAllocator2, Deleter2> const & b) -{ return a.internal_equal(b); } - -template<class T, class VoidAllocator, class Deleter, class T2, class VoidAllocator2, class Deleter2> inline -bool operator<(shared_count<T, VoidAllocator, Deleter> const & a, shared_count<T2, VoidAllocator2, Deleter2> const & b) -{ return a.internal_less(b); } - - -template<class T, class VoidAllocator, class Deleter> -class weak_count -{ - public: - typedef typename boost::container:: - allocator_traits<VoidAllocator>::pointer void_ptr; - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<T>::type pointer; - - private: - - typedef sp_counted_impl_pd<VoidAllocator, Deleter> counted_impl; - - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<counted_impl>::type counted_impl_ptr; - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<sp_counted_base>::type counted_base_ptr; - - pointer m_px; - counted_impl_ptr m_pi; - - template <class T2, class VoidAllocator2, class Deleter2> - friend class weak_count; - - template <class T2, class VoidAllocator2, class Deleter2> - friend class shared_count; - - public: - - weak_count(): m_px(0), m_pi(0) // nothrow - {} - - template <class Y> - explicit weak_count(shared_count<Y, VoidAllocator, Deleter> const & r) - : m_px(r.m_px), m_pi(r.m_pi) // nothrow - { if(m_pi != 0) m_pi->weak_add_ref(); } - - weak_count(weak_count const & r) - : m_px(r.m_px), m_pi(r.m_pi) // nothrow - { if(m_pi != 0) m_pi->weak_add_ref(); } - - template<class Y> - weak_count(weak_count<Y, VoidAllocator, Deleter> const & r) - : m_px(r.m_px), m_pi(r.m_pi) // nothrow - { if(m_pi != 0) m_pi->weak_add_ref(); } - - ~weak_count() // nothrow - { if(m_pi != 0) m_pi->weak_release(); } - - template<class Y> - weak_count & operator= (shared_count<Y, VoidAllocator, Deleter> const & r) // nothrow - { - m_px = r.m_px; - counted_impl_ptr tmp = r.m_pi; - if(tmp != 0) tmp->weak_add_ref(); - if(m_pi != 0) m_pi->weak_release(); - m_pi = tmp; - return *this; - } - - weak_count & operator= (weak_count const & r) // nothrow - { - m_px = r.m_px; - counted_impl_ptr tmp = r.m_pi; - if(tmp != 0) tmp->weak_add_ref(); - if(m_pi != 0) m_pi->weak_release(); - m_pi = tmp; - return *this; - } - - void set_pointer(const pointer &ptr) - { m_px = ptr; } - - template<class Y> - weak_count & operator= (weak_count<Y, VoidAllocator, Deleter> const& r) // nothrow - { - counted_impl_ptr tmp = r.m_pi; - if(tmp != 0) tmp->weak_add_ref(); - if(m_pi != 0) m_pi->weak_release(); - m_pi = tmp; - return *this; - } - - void swap(weak_count & r) // nothrow - { ::boost::adl_move_swap(m_px, r.m_px); ::boost::adl_move_swap(m_pi, r.m_pi); } - - long use_count() const // nothrow - { return m_pi != 0? m_pi->use_count() : 0; } - - template<class T2, class VoidAllocator2, class Deleter2> - bool internal_equal (weak_count<T2, VoidAllocator2, Deleter2> const & other) const - { return this->m_pi == other.m_pi; } - - template<class T2, class VoidAllocator2, class Deleter2> - bool internal_less (weak_count<T2, VoidAllocator2, Deleter2> const & other) const - { return std::less<counted_base_ptr>()(this->m_pi, other.m_pi); } -}; - -template<class T, class VoidAllocator, class Deleter, class T2, class VoidAllocator2, class Deleter2> inline -bool operator==(weak_count<T, VoidAllocator, Deleter> const & a, weak_count<T2, VoidAllocator2, Deleter2> const & b) -{ return a.internal_equal(b); } - -template<class T, class VoidAllocator, class Deleter, class T2, class VoidAllocator2, class Deleter2> inline -bool operator<(weak_count<T, VoidAllocator, Deleter> const & a, weak_count<T2, VoidAllocator2, Deleter2> const & b) -{ return a.internal_less(b); } - -} // namespace ipcdetail -} // namespace interprocess -} // namespace boost - - -#include <boost/interprocess/detail/config_end.hpp> - - -#endif // #ifndef BOOST_INTERPROCESS_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp deleted file mode 100644 index 3b6a0876f9..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp +++ /dev/null @@ -1,26 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2007-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_INTERPROCESS_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED -#define BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -# include <boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp deleted file mode 100644 index 50392741d0..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_ATOMIC_HPP_INCLUDED -#define BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_ATOMIC_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2007-2012 Ion Gaztanaga -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/interprocess/detail/atomic.hpp> -#include <typeinfo> - -namespace boost { - -namespace interprocess { - -namespace ipcdetail { - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - boost::uint32_t use_count_; // #shared - boost::uint32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - {} - - ~sp_counted_base() // nothrow - {} - - void add_ref_copy() - { - ipcdetail::atomic_inc32( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - for( ;; ) - { - boost::uint32_t tmp = static_cast< boost::uint32_t const volatile& >( use_count_ ); - if( tmp == 0 ) return false; - if( ipcdetail::atomic_cas32( &use_count_, tmp + 1, tmp ) == tmp ) - return true; - } - } - - bool ref_release() // nothrow - { return 1 == ipcdetail::atomic_dec32( &use_count_ ); } - - void weak_add_ref() // nothrow - { ipcdetail::atomic_inc32( &weak_count_ ); } - - bool weak_release() // nothrow - { return 1 == ipcdetail::atomic_dec32( &weak_count_ ); } - - long use_count() const // nothrow - { return (long)static_cast<boost::uint32_t const volatile &>( use_count_ ); } -}; - -} // namespace ipcdetail - -} // namespace interprocess - -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp deleted file mode 100644 index ed1d72706f..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED -#define BOOST_INTERPROCESS_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -// -// This file is the adaptation for shared memory memory mapped -// files of boost/detail/sp_counted_impl.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2006 Ion Gaztanaga -// -// Distributed under the 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/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/interprocess/containers/version_type.hpp> -#include <boost/interprocess/smart_ptr/detail/sp_counted_base.hpp> -#include <boost/interprocess/smart_ptr/scoped_ptr.hpp> -#include <boost/interprocess/detail/utilities.hpp> -#include <boost/container/allocator_traits.hpp> -#include <boost/intrusive/pointer_traits.hpp> - -namespace boost { - -namespace interprocess { - -namespace ipcdetail { - -//!A deleter for scoped_ptr that deallocates the memory -//!allocated for an object using a STL allocator. -template <class Allocator> -struct scoped_ptr_dealloc_functor -{ - typedef typename boost::container:: - allocator_traits<Allocator>::pointer pointer; - - typedef ipcdetail::integral_constant<unsigned, - boost::interprocess::version<Allocator>::value> alloc_version; - typedef ipcdetail::integral_constant<unsigned, 1> allocator_v1; - typedef ipcdetail::integral_constant<unsigned, 2> allocator_v2; - - private: - void priv_deallocate(const pointer &p, allocator_v1) - { m_alloc.deallocate(p, 1); } - - void priv_deallocate(const pointer &p, allocator_v2) - { m_alloc.deallocate_one(p); } - - public: - Allocator& m_alloc; - - scoped_ptr_dealloc_functor(Allocator& a) - : m_alloc(a) {} - - void operator()(pointer ptr) - { if (ptr) priv_deallocate(ptr, alloc_version()); } -}; - - - -template<class A, class D> -class sp_counted_impl_pd - : public sp_counted_base - , boost::container::allocator_traits<A>::template - portable_rebind_alloc< sp_counted_impl_pd<A, D> >::type - , D // copy constructor must not throw -{ - private: - typedef sp_counted_impl_pd<A, D> this_type; - typedef typename boost::container:: - allocator_traits<A>::template - portable_rebind_alloc - < this_type >::type this_allocator; - typedef typename boost::container:: - allocator_traits<A>::template - portable_rebind_alloc - < const this_type >::type const_this_allocator; - typedef typename boost::container:: - allocator_traits<this_allocator> - ::pointer this_pointer; - typedef typename boost::container:: - allocator_traits<A>::pointer a_pointer; - typedef typename boost::intrusive:: - pointer_traits<this_pointer> this_pointer_traits; - - sp_counted_impl_pd( sp_counted_impl_pd const & ); - sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & ); - - typedef typename boost::intrusive:: - pointer_traits<a_pointer>::template - rebind_pointer<const D>::type const_deleter_pointer; - typedef typename boost::intrusive:: - pointer_traits<a_pointer>::template - rebind_pointer<const A>::type const_allocator_pointer; - - typedef typename D::pointer pointer; - pointer m_ptr; - - public: - // pre: d(p) must not throw - template<class Ptr> - sp_counted_impl_pd(const Ptr & p, const A &a, const D &d ) - : this_allocator(a), D(d), m_ptr(p) - {} - - const_deleter_pointer get_deleter() const - { return const_deleter_pointer(&static_cast<const D&>(*this)); } - - const_allocator_pointer get_allocator() const - { return const_allocator_pointer(&static_cast<const A&>(*this)); } - - void dispose() // nothrow - { static_cast<D&>(*this)(m_ptr); } - - void destroy() // nothrow - { - //Self destruction, so move the allocator - this_allocator a_copy(::boost::move(static_cast<this_allocator&>(*this))); - BOOST_ASSERT(a_copy == *this); - this_pointer this_ptr(this_pointer_traits::pointer_to(*this)); - //Do it now! - scoped_ptr< this_type, scoped_ptr_dealloc_functor<this_allocator> > - deleter_ptr(this_ptr, a_copy); - ipcdetail::to_raw_pointer(this_ptr)->~this_type(); - } - - void release() // nothrow - { - if(this->ref_release()){ - this->dispose(); - this->weak_release(); - } - } - - void weak_release() // nothrow - { - if(sp_counted_base::weak_release()){ - this->destroy(); - } - } -}; - - -} // namespace ipcdetail - -} // namespace interprocess - -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp deleted file mode 100644 index 188b68d678..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/enable_shared_from_this.hpp +++ /dev/null @@ -1,87 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// This file is the adaptation for Interprocess of boost/enable_shared_from_this.hpp -// -// (C) Copyright Peter Dimov 2002 -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED -#define BOOST_INTERPROCESS_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/assert.hpp> -#include <boost/interprocess/smart_ptr/weak_ptr.hpp> -#include <boost/interprocess/smart_ptr/shared_ptr.hpp> - -//!\file -//!Describes an utility to form a shared pointer from this - -namespace boost{ -namespace interprocess{ - -//!This class is used as a base class that allows a shared_ptr to the current -//!object to be obtained from within a member function. -//!enable_shared_from_this defines two member functions called shared_from_this -//!that return a shared_ptr<T> and shared_ptr<T const>, depending on constness, to this. -template<class T, class A, class D> -class enable_shared_from_this -{ - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - protected: - enable_shared_from_this() - {} - - enable_shared_from_this(enable_shared_from_this const &) - {} - - enable_shared_from_this & operator=(enable_shared_from_this const &) - { return *this; } - - ~enable_shared_from_this() - {} - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - - public: - shared_ptr<T, A, D> shared_from_this() - { - shared_ptr<T, A, D> p(_internal_weak_this); - BOOST_ASSERT(ipcdetail::to_raw_pointer(p.get()) == this); - return p; - } - - shared_ptr<T const, A, D> shared_from_this() const - { - shared_ptr<T const, A, D> p(_internal_weak_this); - BOOST_ASSERT(ipcdetail::to_raw_pointer(p.get()) == this); - return p; - } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - typedef T element_type; - mutable weak_ptr<element_type, A, D> _internal_weak_this; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED -}; - -} // namespace interprocess -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED - diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/scoped_ptr.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/scoped_ptr.hpp deleted file mode 100644 index f480428ca8..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/scoped_ptr.hpp +++ /dev/null @@ -1,176 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// This file is the adaptation for Interprocess of boost/scoped_ptr.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// (C) Copyright Peter Dimov 2001, 2002 -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_SCOPED_PTR_HPP_INCLUDED -#define BOOST_INTERPROCESS_SCOPED_PTR_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> -#include <boost/interprocess/detail/pointer_type.hpp> -#include <boost/interprocess/detail/utilities.hpp> -#include <boost/assert.hpp> -#include <boost/move/adl_move_swap.hpp> - -//!\file -//!Describes the smart pointer scoped_ptr - -namespace boost { -namespace interprocess { - -//!scoped_ptr stores a pointer to a dynamically allocated object. -//!The object pointed to is guaranteed to be deleted, either on destruction -//!of the scoped_ptr, or via an explicit reset. The user can avoid this -//!deletion using release(). -//!scoped_ptr is parameterized on T (the type of the object pointed to) and -//!Deleter (the functor to be executed to delete the internal pointer). -//!The internal pointer will be of the same pointer type as typename -//!Deleter::pointer type (that is, if typename Deleter::pointer is -//!offset_ptr<void>, the internal pointer will be offset_ptr<T>). -template<class T, class Deleter> -class scoped_ptr - : private Deleter -{ - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - scoped_ptr(scoped_ptr const &); - scoped_ptr & operator=(scoped_ptr const &); - - typedef scoped_ptr<T, Deleter> this_type; - typedef typename ipcdetail::add_reference<T>::type reference; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - - public: - - typedef T element_type; - typedef Deleter deleter_type; - typedef typename ipcdetail::pointer_type<T, Deleter>::type pointer; - - //!Constructs a scoped_ptr, storing a copy of p(which can be 0) and d. - //!Does not throw. - explicit scoped_ptr(const pointer &p = 0, const Deleter &d = Deleter()) - : Deleter(d), m_ptr(p) // throws if pointer/Deleter copy ctor throws - {} - - //!If the stored pointer is not 0, destroys the object pointed to by the stored pointer. - //!calling the operator() of the stored deleter. Never throws - ~scoped_ptr() - { - if(m_ptr){ - Deleter &del = static_cast<Deleter&>(*this); - del(m_ptr); - } - } - - //!Deletes the object pointed to by the stored pointer and then - //!stores a copy of p. Never throws - void reset(const pointer &p = 0) // never throws - { BOOST_ASSERT(p == 0 || p != m_ptr); this_type(p).swap(*this); } - - //!Deletes the object pointed to by the stored pointer and then - //!stores a copy of p and a copy of d. - void reset(const pointer &p, const Deleter &d) // never throws - { BOOST_ASSERT(p == 0 || p != m_ptr); this_type(p, d).swap(*this); } - - //!Assigns internal pointer as 0 and returns previous pointer. This will - //!avoid deletion on destructor - pointer release() BOOST_NOEXCEPT - { pointer tmp(m_ptr); m_ptr = 0; return tmp; } - - //!Returns a reference to the object pointed to by the stored pointer. - //!Never throws. - reference operator*() const BOOST_NOEXCEPT - { BOOST_ASSERT(m_ptr != 0); return *m_ptr; } - - //!Returns the internal stored pointer. - //!Never throws. - pointer &operator->() BOOST_NOEXCEPT - { BOOST_ASSERT(m_ptr != 0); return m_ptr; } - - //!Returns the internal stored pointer. - //!Never throws. - const pointer &operator->() const BOOST_NOEXCEPT - { BOOST_ASSERT(m_ptr != 0); return m_ptr; } - - //!Returns the stored pointer. - //!Never throws. - pointer & get() BOOST_NOEXCEPT - { return m_ptr; } - - //!Returns the stored pointer. - //!Never throws. - const pointer & get() const BOOST_NOEXCEPT - { return m_ptr; } - - typedef pointer this_type::*unspecified_bool_type; - - //!Conversion to bool - //!Never throws - operator unspecified_bool_type() const BOOST_NOEXCEPT - { return m_ptr == 0? 0: &this_type::m_ptr; } - - //!Returns true if the stored pointer is 0. - //!Never throws. - bool operator! () const BOOST_NOEXCEPT // never throws - { return m_ptr == 0; } - - //!Exchanges the internal pointer and deleter with other scoped_ptr - //!Never throws. - void swap(scoped_ptr & b) BOOST_NOEXCEPT // never throws - { - ::boost::adl_move_swap(static_cast<Deleter&>(*this), static_cast<Deleter&>(b)); - ::boost::adl_move_swap(m_ptr, b.m_ptr); - } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - private: - pointer m_ptr; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED -}; - -//!Exchanges the internal pointer and deleter with other scoped_ptr -//!Never throws. -template<class T, class D> inline -void swap(scoped_ptr<T, D> & a, scoped_ptr<T, D> & b) BOOST_NOEXCEPT -{ a.swap(b); } - -//!Returns a copy of the stored pointer -//!Never throws -template<class T, class D> inline -typename scoped_ptr<T, D>::pointer to_raw_pointer(scoped_ptr<T, D> const & p) -{ return p.get(); } - -} // namespace interprocess - -#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - -#if defined(_MSC_VER) && (_MSC_VER < 1400) -template<class T, class D> inline -T *to_raw_pointer(boost::interprocess::scoped_ptr<T, D> const & p) -{ return p.get(); } -#endif - -#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_SCOPED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/shared_ptr.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/shared_ptr.hpp deleted file mode 100644 index c50f2cbf7e..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/shared_ptr.hpp +++ /dev/null @@ -1,430 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// This file is the adaptation for Interprocess of boost/shared_ptr.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// (C) Copyright Peter Dimov 2001, 2002, 2003 -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_SHARED_PTR_HPP_INCLUDED -#define BOOST_INTERPROCESS_SHARED_PTR_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/interprocess/detail/utilities.hpp> -#include <boost/interprocess/detail/cast_tags.hpp> -#include <boost/assert.hpp> -#include <boost/interprocess/smart_ptr/detail/shared_count.hpp> -#include <boost/interprocess/detail/mpl.hpp> -#include <boost/interprocess/detail/nothrow.hpp> -#include <boost/move/utility_core.hpp> -#include <boost/interprocess/detail/type_traits.hpp> -#include <boost/interprocess/allocators/allocator.hpp> -#include <boost/interprocess/smart_ptr/deleter.hpp> -#include <boost/static_assert.hpp> -#include <boost/intrusive/pointer_traits.hpp> - -#include <iosfwd> // for std::basic_ostream - -//!\file -//!Describes the smart pointer shared_ptr - -namespace boost{ -namespace interprocess{ - -template<class T, class VoidAllocator, class Deleter> class weak_ptr; -template<class T, class VoidAllocator, class Deleter> class enable_shared_from_this; - -namespace ipcdetail{ - -template<class T, class VoidAllocator, class Deleter> -inline void sp_enable_shared_from_this - (shared_count<T, VoidAllocator, Deleter> const & pn - ,enable_shared_from_this<T, VoidAllocator, Deleter> const*pe - ,T *ptr) - -{ - (void)ptr; - if(pe != 0){ - pe->_internal_weak_this._internal_assign(pn); - } -} - -template<class T, class VoidAllocator, class Deleter> -inline void sp_enable_shared_from_this(shared_count<T, VoidAllocator, Deleter> const &, ...) -{} - -} // namespace ipcdetail - -//!shared_ptr stores a pointer to a dynamically allocated object. -//!The object pointed to is guaranteed to be deleted when the last shared_ptr pointing to -//!it is destroyed or reset. -//! -//!shared_ptr is parameterized on -//!T (the type of the object pointed to), VoidAllocator (the void allocator to be used -//!to allocate the auxiliary data) and Deleter (the deleter whose -//!operator() will be used to delete the object. -//! -//!The internal pointer will be of the same pointer type as typename -//!VoidAllocator::pointer type (that is, if typename VoidAllocator::pointer is -//!offset_ptr<void>, the internal pointer will be offset_ptr<T>). -//! -//!Because the implementation uses reference counting, cycles of shared_ptr -//!instances will not be reclaimed. For example, if main() holds a -//!shared_ptr to A, which directly or indirectly holds a shared_ptr back -//!to A, A's use count will be 2. Destruction of the original shared_ptr -//!will leave A dangling with a use count of 1. -//!Use weak_ptr to "break cycles." -template<class T, class VoidAllocator, class Deleter> -class shared_ptr -{ - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - private: - typedef shared_ptr<T, VoidAllocator, Deleter> this_type; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - - public: - - typedef T element_type; - typedef T value_type; - typedef typename boost::container:: - allocator_traits<VoidAllocator>::pointer void_ptr; - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<T>::type pointer; - typedef typename ipcdetail::add_reference - <value_type>::type reference; - typedef typename ipcdetail::add_reference - <const value_type>::type const_reference; - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<const Deleter>::type const_deleter_pointer; - typedef typename boost::intrusive:: - pointer_traits<void_ptr>::template - rebind_pointer<const VoidAllocator>::type const_allocator_pointer; - - BOOST_COPYABLE_AND_MOVABLE(shared_ptr) - public: - - //!Constructs an empty shared_ptr. - //!Use_count() == 0 && get()== 0. - shared_ptr() - : m_pn() // never throws - {} - - //!Constructs a shared_ptr that owns the pointer p. Auxiliary data will be allocated - //!with a copy of a and the object will be deleted with a copy of d. - //!Requirements: Deleter and A's copy constructor must not throw. - explicit shared_ptr(const pointer&p, const VoidAllocator &a = VoidAllocator(), const Deleter &d = Deleter()) - : m_pn(p, a, d) - { - //Check that the pointer passed is of the same type that - //the pointer the allocator defines or it's a raw pointer - typedef typename boost::intrusive:: - pointer_traits<pointer>::template - rebind_pointer<T>::type ParameterPointer; - - BOOST_STATIC_ASSERT((ipcdetail::is_same<pointer, ParameterPointer>::value) || - (ipcdetail::is_pointer<pointer>::value)); - ipcdetail::sp_enable_shared_from_this<T, VoidAllocator, Deleter>( m_pn, ipcdetail::to_raw_pointer(p), ipcdetail::to_raw_pointer(p) ); - } - - //!Copy constructs a shared_ptr. If r is empty, constructs an empty shared_ptr. Otherwise, constructs - //!a shared_ptr that shares ownership with r. Never throws. - shared_ptr(const shared_ptr &r) - : m_pn(r.m_pn) // never throws - {} - - //!Constructs a shared_ptr that shares ownership with other and stores p. - //!Postconditions: get() == p && use_count() == r.use_count(). - //!Throws: nothing. - shared_ptr(const shared_ptr &other, const pointer &p) - : m_pn(other.m_pn, p) - {} - - //!If r is empty, constructs an empty shared_ptr. Otherwise, constructs - //!a shared_ptr that shares ownership with r. Never throws. - template<class Y> - shared_ptr(shared_ptr<Y, VoidAllocator, Deleter> const & r) - : m_pn(r.m_pn) // never throws - {} - - //!Constructs a shared_ptr that shares ownership with r and stores - //!a copy of the pointer stored in r. - template<class Y> - explicit shared_ptr(weak_ptr<Y, VoidAllocator, Deleter> const & r) - : m_pn(r.m_pn) // may throw - {} - - //!Move-Constructs a shared_ptr that takes ownership of other resource and - //!other is put in default-constructed state. - //!Throws: nothing. - explicit shared_ptr(BOOST_RV_REF(shared_ptr) other) - : m_pn() - { this->swap(other); } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - template<class Y> - shared_ptr(shared_ptr<Y, VoidAllocator, Deleter> const & r, ipcdetail::static_cast_tag) - : m_pn( pointer(static_cast<T*>(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) - {} - - template<class Y> - shared_ptr(shared_ptr<Y, VoidAllocator, Deleter> const & r, ipcdetail::const_cast_tag) - : m_pn( pointer(const_cast<T*>(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) - {} - - template<class Y> - shared_ptr(shared_ptr<Y, VoidAllocator, Deleter> const & r, ipcdetail::dynamic_cast_tag) - : m_pn( pointer(dynamic_cast<T*>(ipcdetail::to_raw_pointer(r.m_pn.to_raw_pointer()))) - , r.m_pn) - { - if(!m_pn.to_raw_pointer()){ // need to allocate new counter -- the cast failed - m_pn = ipcdetail::shared_count<T, VoidAllocator, Deleter>(); - } - } - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - - //!Equivalent to shared_ptr(r).swap(*this). - //!Never throws - template<class Y> - shared_ptr & operator=(shared_ptr<Y, VoidAllocator, Deleter> const & r) - { - m_pn = r.m_pn; // shared_count::op= doesn't throw - return *this; - } - - //!Equivalent to shared_ptr(r).swap(*this). - //!Never throws - shared_ptr & operator=(BOOST_COPY_ASSIGN_REF(shared_ptr) r) - { - m_pn = r.m_pn; // shared_count::op= doesn't throw - return *this; - } - - //!Move-assignment. Equivalent to shared_ptr(other).swap(*this). - //!Never throws - shared_ptr & operator=(BOOST_RV_REF(shared_ptr) other) // never throws - { - this_type(other).swap(*this); - return *this; - } - - //!This is equivalent to: - //!this_type().swap(*this); - void reset() - { - this_type().swap(*this); - } - - //!This is equivalent to: - //!this_type(p, a, d).swap(*this); - template<class Pointer> - void reset(const Pointer &p, const VoidAllocator &a = VoidAllocator(), const Deleter &d = Deleter()) - { - //Check that the pointer passed is of the same type that - //the pointer the allocator defines or it's a raw pointer - typedef typename boost::intrusive:: - pointer_traits<Pointer>::template - rebind_pointer<T>::type ParameterPointer; - BOOST_STATIC_ASSERT((ipcdetail::is_same<pointer, ParameterPointer>::value) || - (ipcdetail::is_pointer<Pointer>::value)); - this_type(p, a, d).swap(*this); - } - - template<class Y> - void reset(shared_ptr<Y, VoidAllocator, Deleter> const & r, const pointer &p) - { - this_type(r, p).swap(*this); - } - - //!Returns a reference to the - //!pointed type - reference operator* () const // never throws - { BOOST_ASSERT(m_pn.to_raw_pointer() != 0); return *m_pn.to_raw_pointer(); } - - //!Returns the pointer pointing - //!to the owned object - pointer operator-> () const // never throws - { BOOST_ASSERT(m_pn.to_raw_pointer() != 0); return m_pn.to_raw_pointer(); } - - //!Returns the pointer pointing - //!to the owned object - pointer get() const // never throws - { return m_pn.to_raw_pointer(); } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - // implicit conversion to "bool" - void unspecified_bool_type_func() const {} - typedef void (this_type::*unspecified_bool_type)() const; - - operator unspecified_bool_type() const // never throws - { return !m_pn.to_raw_pointer() ? 0 : &this_type::unspecified_bool_type_func; } - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - - //!Not operator. - //!Returns true if this->get() != 0, false otherwise - bool operator! () const // never throws - { return !m_pn.to_raw_pointer(); } - - //!Returns use_count() == 1. - //!unique() might be faster than use_count() - bool unique() const // never throws - { return m_pn.unique(); } - - //!Returns the number of shared_ptr objects, *this included, - //!that share ownership with *this, or an unspecified nonnegative - //!value when *this is empty. - //!use_count() is not necessarily efficient. Use only for - //!debugging and testing purposes, not for production code. - long use_count() const // never throws - { return m_pn.use_count(); } - - //!Exchanges the contents of the two - //!smart pointers. - void swap(shared_ptr<T, VoidAllocator, Deleter> & other) // never throws - { m_pn.swap(other.m_pn); } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - - template<class T2, class A2, class Deleter2> - bool _internal_less(shared_ptr<T2, A2, Deleter2> const & rhs) const - { return m_pn < rhs.m_pn; } - - const_deleter_pointer get_deleter() const - { return m_pn.get_deleter(); } - -// const_allocator_pointer get_allocator() const -// { return m_pn.get_allocator(); } - - private: - - template<class T2, class A2, class Deleter2> friend class shared_ptr; - template<class T2, class A2, class Deleter2> friend class weak_ptr; - - ipcdetail::shared_count<T, VoidAllocator, Deleter> m_pn; // reference counter - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED -}; // shared_ptr - -template<class T, class VoidAllocator, class Deleter, class U, class VoidAllocator2, class Deleter2> inline -bool operator==(shared_ptr<T, VoidAllocator, Deleter> const & a, shared_ptr<U, VoidAllocator2, Deleter2> const & b) -{ return a.get() == b.get(); } - -template<class T, class VoidAllocator, class Deleter, class U, class VoidAllocator2, class Deleter2> inline -bool operator!=(shared_ptr<T, VoidAllocator, Deleter> const & a, shared_ptr<U, VoidAllocator2, Deleter2> const & b) -{ return a.get() != b.get(); } - -template<class T, class VoidAllocator, class Deleter, class U, class VoidAllocator2, class Deleter2> inline -bool operator<(shared_ptr<T, VoidAllocator, Deleter> const & a, shared_ptr<U, VoidAllocator2, Deleter2> const & b) -{ return a._internal_less(b); } - -template<class T, class VoidAllocator, class Deleter> inline -void swap(shared_ptr<T, VoidAllocator, Deleter> & a, shared_ptr<T, VoidAllocator, Deleter> & b) -{ a.swap(b); } - -template<class T, class VoidAllocator, class Deleter, class U> inline -shared_ptr<T, VoidAllocator, Deleter> static_pointer_cast(shared_ptr<U, VoidAllocator, Deleter> const & r) -{ return shared_ptr<T, VoidAllocator, Deleter>(r, ipcdetail::static_cast_tag()); } - -template<class T, class VoidAllocator, class Deleter, class U> inline -shared_ptr<T, VoidAllocator, Deleter> const_pointer_cast(shared_ptr<U, VoidAllocator, Deleter> const & r) -{ return shared_ptr<T, VoidAllocator, Deleter>(r, ipcdetail::const_cast_tag()); } - -template<class T, class VoidAllocator, class Deleter, class U> inline -shared_ptr<T, VoidAllocator, Deleter> dynamic_pointer_cast(shared_ptr<U, VoidAllocator, Deleter> const & r) -{ return shared_ptr<T, VoidAllocator, Deleter>(r, ipcdetail::dynamic_cast_tag()); } - -// to_raw_pointer() enables boost::mem_fn to recognize shared_ptr -template<class T, class VoidAllocator, class Deleter> inline -T * to_raw_pointer(shared_ptr<T, VoidAllocator, Deleter> const & p) -{ return p.get(); } - -// operator<< -template<class E, class T, class Y, class VoidAllocator, class Deleter> inline -std::basic_ostream<E, T> & operator<< - (std::basic_ostream<E, T> & os, shared_ptr<Y, VoidAllocator, Deleter> const & p) -{ os << p.get(); return os; } - -//!Returns the type of a shared pointer -//!of type T with the allocator boost::interprocess::allocator allocator -//!and boost::interprocess::deleter deleter -//!that can be constructed in the given managed segment type. -template<class T, class ManagedMemory> -struct managed_shared_ptr -{ - typedef typename ManagedMemory::template allocator<void>::type void_allocator; - typedef typename ManagedMemory::template deleter<T>::type deleter; - typedef shared_ptr< T, void_allocator, deleter> type; -}; - -//!Returns an instance of a shared pointer constructed -//!with the default allocator and deleter from a pointer -//!of type T that has been allocated in the passed managed segment -template<class T, class ManagedMemory> -inline typename managed_shared_ptr<T, ManagedMemory>::type - make_managed_shared_ptr(T *constructed_object, ManagedMemory &managed_memory) -{ - return typename managed_shared_ptr<T, ManagedMemory>::type - ( constructed_object - , managed_memory.template get_allocator<void>() - , managed_memory.template get_deleter<T>() - ); -} - -//!Returns an instance of a shared pointer constructed -//!with the default allocator and deleter from a pointer -//!of type T that has been allocated in the passed managed segment. -//!Does not throw, return null shared pointer in error. -template<class T, class ManagedMemory> -inline typename managed_shared_ptr<T, ManagedMemory>::type - make_managed_shared_ptr(T *constructed_object, ManagedMemory &managed_memory, const std::nothrow_t &) -{ - BOOST_TRY{ - return typename managed_shared_ptr<T, ManagedMemory>::type - ( constructed_object - , managed_memory.template get_allocator<void>() - , managed_memory.template get_deleter<T>() - ); - } - BOOST_CATCH(...){ - return typename managed_shared_ptr<T, ManagedMemory>::type(); - } BOOST_CATCH_END -} - - -} // namespace interprocess - -#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - -#if defined(_MSC_VER) && (_MSC_VER < 1400) -// to_raw_pointer() enables boost::mem_fn to recognize shared_ptr -template<class T, class VoidAllocator, class Deleter> inline -T * to_raw_pointer(boost::interprocess::shared_ptr<T, VoidAllocator, Deleter> const & p) -{ return p.get(); } -#endif - -#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_SHARED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/weak_ptr.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/weak_ptr.hpp deleted file mode 100644 index e4873122d8..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/smart_ptr/weak_ptr.hpp +++ /dev/null @@ -1,271 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// This file is the adaptation for Interprocess of boost/weak_ptr.hpp -// -// (C) Copyright Peter Dimov 2001, 2002, 2003 -// (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/interprocess for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_WEAK_PTR_HPP_INCLUDED -#define BOOST_INTERPROCESS_WEAK_PTR_HPP_INCLUDED - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -#include <boost/interprocess/smart_ptr/shared_ptr.hpp> -#include <boost/core/no_exceptions_support.hpp> -#include <boost/interprocess/allocators/allocator.hpp> -#include <boost/interprocess/smart_ptr/deleter.hpp> -#include <boost/intrusive/pointer_traits.hpp> -#include <boost/move/adl_move_swap.hpp> - -//!\file -//!Describes the smart pointer weak_ptr. - -namespace boost{ -namespace interprocess{ - -//!The weak_ptr class template stores a "weak reference" to an object -//!that's already managed by a shared_ptr. To access the object, a weak_ptr -//!can be converted to a shared_ptr using the shared_ptr constructor or the -//!member function lock. When the last shared_ptr to the object goes away -//!and the object is deleted, the attempt to obtain a shared_ptr from the -//!weak_ptr instances that refer to the deleted object will fail: the constructor -//!will throw an exception of type bad_weak_ptr, and weak_ptr::lock will -//!return an empty shared_ptr. -//! -//!Every weak_ptr meets the CopyConstructible and Assignable requirements -//!of the C++ Standard Library, and so can be used in standard library containers. -//!Comparison operators are supplied so that weak_ptr works with the standard -//!library's associative containers. -//! -//!weak_ptr operations never throw exceptions. -//! -//!The class template is parameterized on T, the type of the object pointed to. -template<class T, class A, class D> -class weak_ptr -{ - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - private: - // Borland 5.5.1 specific workarounds - typedef weak_ptr<T, A, D> this_type; - typedef typename boost::container:: - allocator_traits<A>::pointer alloc_ptr; - typedef typename boost::intrusive:: - pointer_traits<alloc_ptr>::template - rebind_pointer<T>::type pointer; - typedef typename ipcdetail::add_reference - <T>::type reference; - typedef typename ipcdetail::add_reference - <T>::type const_reference; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - - public: - typedef T element_type; - typedef T value_type; - - //!Effects: Constructs an empty weak_ptr. - //!Postconditions: use_count() == 0. - weak_ptr() - : m_pn() // never throws - {} - // generated copy constructor, assignment, destructor are fine - // - // The "obvious" converting constructor implementation: - // - // template<class Y> - // weak_ptr(weak_ptr<Y> const & r): m_px(r.m_px), m_pn(r.m_pn) // never throws - // { - // } - // - // has a serious problem. - // - // r.m_px may already have been invalidated. The m_px(r.m_px) - // conversion may require access to *r.m_px (virtual inheritance). - // - // It is not possible to avoid spurious access violations since - // in multithreaded programs r.m_px may be invalidated at any point. - - //!Effects: If r is empty, constructs an empty weak_ptr; otherwise, - //!constructs a weak_ptr that shares ownership with r as if by storing a - //!copy of the pointer stored in r. - //! - //!Postconditions: use_count() == r.use_count(). - //! - //!Throws: nothing. - template<class Y> - weak_ptr(weak_ptr<Y, A, D> const & r) - : m_pn(r.m_pn) // never throws - { - //Construct a temporary shared_ptr so that nobody - //can destroy the value while constructing this - const shared_ptr<T, A, D> &ref = r.lock(); - m_pn.set_pointer(ref.get()); - } - - //!Effects: If r is empty, constructs an empty weak_ptr; otherwise, - //!constructs a weak_ptr that shares ownership with r as if by storing a - //!copy of the pointer stored in r. - //! - //!Postconditions: use_count() == r.use_count(). - //! - //!Throws: nothing. - template<class Y> - weak_ptr(shared_ptr<Y, A, D> const & r) - : m_pn(r.m_pn) // never throws - {} - - //!Effects: Equivalent to weak_ptr(r).swap(*this). - //! - //!Throws: nothing. - //! - //!Notes: The implementation is free to meet the effects (and the - //!implied guarantees) via different means, without creating a temporary. - template<class Y> - weak_ptr & operator=(weak_ptr<Y, A, D> const & r) // never throws - { - //Construct a temporary shared_ptr so that nobody - //can destroy the value while constructing this - const shared_ptr<T, A, D> &ref = r.lock(); - m_pn = r.m_pn; - m_pn.set_pointer(ref.get()); - return *this; - } - - //!Effects: Equivalent to weak_ptr(r).swap(*this). - //! - //!Throws: nothing. - //! - //!Notes: The implementation is free to meet the effects (and the - //!implied guarantees) via different means, without creating a temporary. - template<class Y> - weak_ptr & operator=(shared_ptr<Y, A, D> const & r) // never throws - { m_pn = r.m_pn; return *this; } - - //!Returns: expired()? shared_ptr<T>(): shared_ptr<T>(*this). - //! - //!Throws: nothing. - shared_ptr<T, A, D> lock() const // never throws - { - // optimization: avoid throw overhead - if(expired()){ - return shared_ptr<element_type, A, D>(); - } - BOOST_TRY{ - return shared_ptr<element_type, A, D>(*this); - } - BOOST_CATCH(bad_weak_ptr const &){ - // Q: how can we get here? - // A: another thread may have invalidated r after the use_count test above. - return shared_ptr<element_type, A, D>(); - } - BOOST_CATCH_END - } - - //!Returns: 0 if *this is empty; otherwise, the number of shared_ptr objects - //!that share ownership with *this. - //! - //!Throws: nothing. - //! - //!Notes: use_count() is not necessarily efficient. Use only for debugging and - //!testing purposes, not for production code. - long use_count() const // never throws - { return m_pn.use_count(); } - - //!Returns: Returns: use_count() == 0. - //! - //!Throws: nothing. - //! - //!Notes: expired() may be faster than use_count(). - bool expired() const // never throws - { return m_pn.use_count() == 0; } - - //!Effects: Equivalent to: - //!weak_ptr().swap(*this). - void reset() // never throws in 1.30+ - { this_type().swap(*this); } - - //!Effects: Exchanges the contents of the two - //!smart pointers. - //! - //!Throws: nothing. - void swap(this_type & other) // never throws - { ::boost::adl_move_swap(m_pn, other.m_pn); } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - template<class T2, class A2, class D2> - bool _internal_less(weak_ptr<T2, A2, D2> const & rhs) const - { return m_pn < rhs.m_pn; } - - template<class Y> - void _internal_assign(const ipcdetail::shared_count<Y, A, D> & pn2) - { - - m_pn = pn2; - } - - private: - - template<class T2, class A2, class D2> friend class shared_ptr; - template<class T2, class A2, class D2> friend class weak_ptr; - - ipcdetail::weak_count<T, A, D> m_pn; // reference counter - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED -}; // weak_ptr - -template<class T, class A, class D, class U, class A2, class D2> inline -bool operator<(weak_ptr<T, A, D> const & a, weak_ptr<U, A2, D2> const & b) -{ return a._internal_less(b); } - -template<class T, class A, class D> inline -void swap(weak_ptr<T, A, D> & a, weak_ptr<T, A, D> & b) -{ a.swap(b); } - -//!Returns the type of a weak pointer -//!of type T with the allocator boost::interprocess::allocator allocator -//!and boost::interprocess::deleter deleter -//!that can be constructed in the given managed segment type. -template<class T, class ManagedMemory> -struct managed_weak_ptr -{ - typedef weak_ptr - < T - , typename ManagedMemory::template allocator<void>::type - , typename ManagedMemory::template deleter<T>::type - > type; -}; - -//!Returns an instance of a weak pointer constructed -//!with the default allocator and deleter from a pointer -//!of type T that has been allocated in the passed managed segment -template<class T, class ManagedMemory> -inline typename managed_weak_ptr<T, ManagedMemory>::type - make_managed_weak_ptr(T *constructed_object, ManagedMemory &managed_memory) -{ - return typename managed_weak_ptr<T, ManagedMemory>::type - ( constructed_object - , managed_memory.template get_allocator<void>() - , managed_memory.template get_deleter<T>() - ); -} - -} // namespace interprocess -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // #ifndef BOOST_INTERPROCESS_WEAK_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/sync/lock_options.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/sync/lock_options.hpp deleted file mode 100644 index a79159a480..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/sync/lock_options.hpp +++ /dev/null @@ -1,55 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_INTERPROCESS_LOCK_OPTIONS_HPP -#define BOOST_INTERPROCESS_LOCK_OPTIONS_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> - -//!\file -//!Describes the lock options with associated with interprocess_mutex lock constructors. - -namespace boost { -namespace interprocess { - -//!Type to indicate to a mutex lock constructor that must not lock the mutex. -struct defer_lock_type{}; -//!Type to indicate to a mutex lock constructor that must try to lock the mutex. -struct try_to_lock_type {}; -//!Type to indicate to a mutex lock constructor that the mutex is already locked. -struct accept_ownership_type{}; - -//!An object indicating that the locking -//!must be deferred. -static const defer_lock_type defer_lock = defer_lock_type(); - -//!An object indicating that a try_lock() -//!operation must be executed. -static const try_to_lock_type try_to_lock = try_to_lock_type(); - -//!An object indicating that the ownership of lockable -//!object must be accepted by the new owner. -static const accept_ownership_type accept_ownership = accept_ownership_type(); - -} // namespace interprocess { -} // namespace boost{ - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // BOOST_INTERPROCESS_LOCK_OPTIONS_HPP diff --git a/contrib/restricted/boost/interprocess/include/boost/interprocess/sync/scoped_lock.hpp b/contrib/restricted/boost/interprocess/include/boost/interprocess/sync/scoped_lock.hpp deleted file mode 100644 index 35e1cc4cf7..0000000000 --- a/contrib/restricted/boost/interprocess/include/boost/interprocess/sync/scoped_lock.hpp +++ /dev/null @@ -1,410 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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. -// -////////////////////////////////////////////////////////////////////////////// -// -// This interface is inspired by Howard Hinnant's lock proposal. -// http://home.twcny.rr.com/hinnant/cpp_extensions/threads_move.html -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTERPROCESS_SCOPED_LOCK_HPP -#define BOOST_INTERPROCESS_SCOPED_LOCK_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif -# -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/interprocess/detail/config_begin.hpp> -#include <boost/interprocess/detail/workaround.hpp> -#include <boost/interprocess/interprocess_fwd.hpp> -#include <boost/interprocess/sync/lock_options.hpp> -#include <boost/interprocess/exceptions.hpp> -#include <boost/interprocess/detail/mpl.hpp> -#include <boost/interprocess/detail/type_traits.hpp> -#include <boost/move/utility_core.hpp> -#include <boost/interprocess/detail/simple_swap.hpp> - -//!\file -//!Describes the scoped_lock class. - -namespace boost { -namespace interprocess { - - -//!scoped_lock is meant to carry out the tasks for locking, unlocking, try-locking -//!and timed-locking (recursive or not) for the Mutex. The Mutex need not supply all -//!of this functionality. If the client of scoped_lock<Mutex> does not use -//!functionality which the Mutex does not supply, no harm is done. Mutex ownership -//!transfer is supported through the syntax of move semantics. Ownership transfer -//!is allowed both by construction and assignment. The scoped_lock does not support -//!copy semantics. A compile time error results if copy construction or copy -//!assignment is attempted. Mutex ownership can also be moved from an -//!upgradable_lock and sharable_lock via constructor. In this role, scoped_lock -//!shares the same functionality as a write_lock. -template <class Mutex> -class scoped_lock -{ - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - private: - typedef scoped_lock<Mutex> this_type; - BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_lock) - typedef bool this_type::*unspecified_bool_type; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED - public: - - typedef Mutex mutex_type; - - //!Effects: Default constructs a scoped_lock. - //!Postconditions: owns() == false and mutex() == 0. - scoped_lock() BOOST_NOEXCEPT - : mp_mutex(0), m_locked(false) - {} - - //!Effects: m.lock(). - //!Postconditions: owns() == true and mutex() == &m. - //!Notes: The constructor will take ownership of the mutex. If another thread - //! already owns the mutex, this thread will block until the mutex is released. - //! Whether or not this constructor handles recursive locking depends upon the mutex. - explicit scoped_lock(mutex_type& m) - : mp_mutex(&m), m_locked(false) - { mp_mutex->lock(); m_locked = true; } - - //!Postconditions: owns() == false, and mutex() == &m. - //!Notes: The constructor will not take ownership of the mutex. There is no effect - //! required on the referenced mutex. - scoped_lock(mutex_type& m, defer_lock_type) - : mp_mutex(&m), m_locked(false) - {} - - //!Postconditions: owns() == true, and mutex() == &m. - //!Notes: The constructor will suppose that the mutex is already locked. There - //! is no effect required on the referenced mutex. - scoped_lock(mutex_type& m, accept_ownership_type) - : mp_mutex(&m), m_locked(true) - {} - - //!Effects: m.try_lock(). - //!Postconditions: mutex() == &m. owns() == the return value of the - //! m.try_lock() executed within the constructor. - //!Notes: The constructor will take ownership of the mutex if it can do - //! so without waiting. Whether or not this constructor handles recursive - //! locking depends upon the mutex. If the mutex_type does not support try_lock, - //! this constructor will fail at compile time if instantiated, but otherwise - //! have no effect. - scoped_lock(mutex_type& m, try_to_lock_type) - : mp_mutex(&m), m_locked(mp_mutex->try_lock()) - {} - - //!Effects: m.timed_lock(abs_time). - //!Postconditions: mutex() == &m. owns() == the return value of the - //! m.timed_lock(abs_time) executed within the constructor. - //!Notes: The constructor will take ownership of the mutex if it can do - //! it until abs_time is reached. Whether or not this constructor - //! handles recursive locking depends upon the mutex. If the mutex_type - //! does not support try_lock, this constructor will fail at compile - //! time if instantiated, but otherwise have no effect. - template<class TimePoint> - scoped_lock(mutex_type& m, const TimePoint& abs_time) - : mp_mutex(&m), m_locked(mp_mutex->timed_lock(abs_time)) - {} - - //!Postconditions: mutex() == the value scop.mutex() had before the - //! constructor executes. s1.mutex() == 0. owns() == the value of - //! scop.owns() before the constructor executes. scop.owns(). - //!Notes: If the scop scoped_lock owns the mutex, ownership is moved - //! to thisscoped_lock with no blocking. If the scop scoped_lock does not - //! own the mutex, then neither will this scoped_lock. Only a moved - //! scoped_lock's will match this signature. An non-moved scoped_lock - //! can be moved with the expression: "boost::move(lock);". This - //! constructor does not alter the state of the mutex, only potentially - //! who owns it. - scoped_lock(BOOST_RV_REF(scoped_lock) scop) BOOST_NOEXCEPT - : mp_mutex(0), m_locked(scop.owns()) - { mp_mutex = scop.release(); } - - //!Effects: If upgr.owns() then calls unlock_upgradable_and_lock() on the - //! referenced mutex. upgr.release() is called. - //!Postconditions: mutex() == the value upgr.mutex() had before the construction. - //! upgr.mutex() == 0. owns() == upgr.owns() before the construction. - //! upgr.owns() == false after the construction. - //!Notes: If upgr is locked, this constructor will lock this scoped_lock while - //! unlocking upgr. If upgr is unlocked, then this scoped_lock will be - //! unlocked as well. Only a moved upgradable_lock's will match this - //! signature. An non-moved upgradable_lock can be moved with - //! the expression: "boost::move(lock);" This constructor may block if - //! other threads hold a sharable_lock on this mutex (sharable_lock's can - //! share ownership with an upgradable_lock). - template<class T> - explicit scoped_lock(BOOST_RV_REF(upgradable_lock<T>) upgr - , typename ipcdetail::enable_if< ipcdetail::is_same<T, Mutex> >::type * = 0) - : mp_mutex(0), m_locked(false) - { - upgradable_lock<mutex_type> &u_lock = upgr; - if(u_lock.owns()){ - u_lock.mutex()->unlock_upgradable_and_lock(); - m_locked = true; - } - mp_mutex = u_lock.release(); - } - - //!Effects: If upgr.owns() then calls try_unlock_upgradable_and_lock() on the - //!referenced mutex: - //! a)if try_unlock_upgradable_and_lock() returns true then mutex() obtains - //! the value from upgr.release() and owns() is set to true. - //! b)if try_unlock_upgradable_and_lock() returns false then upgr is - //! unaffected and this scoped_lock construction as the same effects as - //! a default construction. - //! c)Else upgr.owns() is false. mutex() obtains the value from upgr.release() - //! and owns() is set to false - //!Notes: This construction will not block. It will try to obtain mutex - //! ownership from upgr immediately, while changing the lock type from a - //! "read lock" to a "write lock". If the "read lock" isn't held in the - //! first place, the mutex merely changes type to an unlocked "write lock". - //! If the "read lock" is held, then mutex transfer occurs only if it can - //! do so in a non-blocking manner. - template<class T> - scoped_lock(BOOST_RV_REF(upgradable_lock<T>) upgr, try_to_lock_type - , typename ipcdetail::enable_if< ipcdetail::is_same<T, Mutex> >::type * = 0) - : mp_mutex(0), m_locked(false) - { - upgradable_lock<mutex_type> &u_lock = upgr; - if(u_lock.owns()){ - if((m_locked = u_lock.mutex()->try_unlock_upgradable_and_lock()) == true){ - mp_mutex = u_lock.release(); - } - } - else{ - u_lock.release(); - } - } - - //!Effects: If upgr.owns() then calls timed_unlock_upgradable_and_lock(abs_time) - //! on the referenced mutex: - //! a)if timed_unlock_upgradable_and_lock(abs_time) returns true then mutex() - //! obtains the value from upgr.release() and owns() is set to true. - //! b)if timed_unlock_upgradable_and_lock(abs_time) returns false then upgr - //! is unaffected and this scoped_lock construction as the same effects - //! as a default construction. - //! c)Else upgr.owns() is false. mutex() obtains the value from upgr.release() - //! and owns() is set to false - //!Notes: This construction will not block. It will try to obtain mutex ownership - //! from upgr immediately, while changing the lock type from a "read lock" to a - //! "write lock". If the "read lock" isn't held in the first place, the mutex - //! merely changes type to an unlocked "write lock". If the "read lock" is held, - //! then mutex transfer occurs only if it can do so in a non-blocking manner. - template<class T, class TimePoint> - scoped_lock(BOOST_RV_REF(upgradable_lock<T>) upgr, const TimePoint &abs_time - , typename ipcdetail::enable_if< ipcdetail::is_same<T, Mutex> >::type * = 0) - : mp_mutex(0), m_locked(false) - { - upgradable_lock<mutex_type> &u_lock = upgr; - if(u_lock.owns()){ - if((m_locked = u_lock.mutex()->timed_unlock_upgradable_and_lock(abs_time)) == true){ - mp_mutex = u_lock.release(); - } - } - else{ - u_lock.release(); - } - } - - //!Effects: If shar.owns() then calls try_unlock_sharable_and_lock() on the - //!referenced mutex. - //! a)if try_unlock_sharable_and_lock() returns true then mutex() obtains - //! the value from shar.release() and owns() is set to true. - //! b)if try_unlock_sharable_and_lock() returns false then shar is - //! unaffected and this scoped_lock construction has the same - //! effects as a default construction. - //! c)Else shar.owns() is false. mutex() obtains the value from - //! shar.release() and owns() is set to false - //!Notes: This construction will not block. It will try to obtain mutex - //! ownership from shar immediately, while changing the lock type from a - //! "read lock" to a "write lock". If the "read lock" isn't held in the - //! first place, the mutex merely changes type to an unlocked "write lock". - //! If the "read lock" is held, then mutex transfer occurs only if it can - //! do so in a non-blocking manner. - template<class T> - scoped_lock(BOOST_RV_REF(sharable_lock<T>) shar, try_to_lock_type - , typename ipcdetail::enable_if< ipcdetail::is_same<T, Mutex> >::type * = 0) - : mp_mutex(0), m_locked(false) - { - sharable_lock<mutex_type> &s_lock = shar; - if(s_lock.owns()){ - if((m_locked = s_lock.mutex()->try_unlock_sharable_and_lock()) == true){ - mp_mutex = s_lock.release(); - } - } - else{ - s_lock.release(); - } - } - - //!Effects: if (owns()) mp_mutex->unlock(). - //!Notes: The destructor behavior ensures that the mutex lock is not leaked.*/ - ~scoped_lock() - { - BOOST_TRY{ if(m_locked && mp_mutex) mp_mutex->unlock(); } - BOOST_CATCH(...){} BOOST_CATCH_END - } - - //!Effects: If owns() before the call, then unlock() is called on mutex(). - //! *this gets the state of scop and scop gets set to a default constructed state. - //!Notes: With a recursive mutex it is possible that both this and scop own - //! the same mutex before the assignment. In this case, this will own the - //! mutex after the assignment (and scop will not), but the mutex's lock - //! count will be decremented by one. - scoped_lock &operator=(BOOST_RV_REF(scoped_lock) scop) - { - if(this->owns()) - this->unlock(); - m_locked = scop.owns(); - mp_mutex = scop.release(); - return *this; - } - - //!Effects: If mutex() == 0 or if already locked, throws a lock_exception() - //! exception. Calls lock() on the referenced mutex. - //!Postconditions: owns() == true. - //!Notes: The scoped_lock changes from a state of not owning the mutex, to - //! owning the mutex, blocking if necessary. - void lock() - { - if(!mp_mutex || m_locked) - throw lock_exception(); - mp_mutex->lock(); - m_locked = true; - } - - //!Effects: If mutex() == 0 or if already locked, throws a lock_exception() - //! exception. Calls try_lock() on the referenced mutex. - //!Postconditions: owns() == the value returned from mutex()->try_lock(). - //!Notes: The scoped_lock changes from a state of not owning the mutex, to - //! owning the mutex, but only if blocking was not required. If the - //! mutex_type does not support try_lock(), this function will fail at - //! compile time if instantiated, but otherwise have no effect.*/ - bool try_lock() - { - if(!mp_mutex || m_locked) - throw lock_exception(); - m_locked = mp_mutex->try_lock(); - return m_locked; - } - - //!Effects: If mutex() == 0 or if already locked, throws a lock_exception() - //! exception. Calls timed_lock(abs_time) on the referenced mutex. - //!Postconditions: owns() == the value returned from mutex()-> timed_lock(abs_time). - //!Notes: The scoped_lock changes from a state of not owning the mutex, to - //! owning the mutex, but only if it can obtain ownership by the specified - //! time. If the mutex_type does not support timed_lock (), this function - //! will fail at compile time if instantiated, but otherwise have no effect.*/ - template<class TimePoint> - bool timed_lock(const TimePoint& abs_time) - { - if(!mp_mutex || m_locked) - throw lock_exception(); - m_locked = mp_mutex->timed_lock(abs_time); - return m_locked; - } - - //!Effects: If mutex() == 0 or if already locked, throws a lock_exception() - //! exception. Calls try_lock_until(abs_time) on the referenced mutex. - //!Postconditions: owns() == the value returned from mutex()-> timed_lock(abs_time). - //!Notes: The scoped_lock changes from a state of not owning the mutex, to - //! owning the mutex, but only if it can obtain ownership by the specified - //! time. If the mutex_type does not support timed_lock (), this function - //! will fail at compile time if instantiated, but otherwise have no effect.*/ - template<class TimePoint> - bool try_lock_until(const TimePoint& abs_time) - { - if(!mp_mutex || m_locked) - throw lock_exception(); - m_locked = mp_mutex->try_lock_until(abs_time); - return m_locked; - } - - //!Effects: If mutex() == 0 or if already locked, throws a lock_exception() - //! exception. Calls try_lock_until(abs_time) on the referenced mutex. - //!Postconditions: owns() == the value returned from mutex()-> timed_lock(abs_time). - //!Notes: The scoped_lock changes from a state of not owning the mutex, to - //! owning the mutex, but only if it can obtain ownership by the specified - //! time. If the mutex_type does not support timed_lock (), this function - //! will fail at compile time if instantiated, but otherwise have no effect.*/ - template<class Duration> - bool try_lock_for(const Duration& dur) - { - if(!mp_mutex || m_locked) - throw lock_exception(); - m_locked = mp_mutex->try_lock_for(dur); - return m_locked; - } - - //!Effects: If mutex() == 0 or if not locked, throws a lock_exception() - //! exception. Calls unlock() on the referenced mutex. - //!Postconditions: owns() == false. - //!Notes: The scoped_lock changes from a state of owning the mutex, to not - //! owning the mutex.*/ - void unlock() - { - if(!mp_mutex || !m_locked) - throw lock_exception(); - mp_mutex->unlock(); - m_locked = false; - } - - //!Effects: Returns true if this scoped_lock has acquired - //!the referenced mutex. - bool owns() const BOOST_NOEXCEPT - { return m_locked && mp_mutex; } - - //!Conversion to bool. - //!Returns owns(). - operator unspecified_bool_type() const BOOST_NOEXCEPT - { return m_locked? &this_type::m_locked : 0; } - - //!Effects: Returns a pointer to the referenced mutex, or 0 if - //!there is no mutex to reference. - mutex_type* mutex() const BOOST_NOEXCEPT - { return mp_mutex; } - - //!Effects: Returns a pointer to the referenced mutex, or 0 if there is no - //! mutex to reference. - //!Postconditions: mutex() == 0 and owns() == false. - mutex_type* release() BOOST_NOEXCEPT - { - mutex_type *mut = mp_mutex; - mp_mutex = 0; - m_locked = false; - return mut; - } - - //!Effects: Swaps state with moved lock. - //!Throws: Nothing. - void swap( scoped_lock<mutex_type> &other) BOOST_NOEXCEPT - { - (simple_swap)(mp_mutex, other.mp_mutex); - (simple_swap)(m_locked, other.m_locked); - } - - #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) - private: - mutex_type *mp_mutex; - bool m_locked; - #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED -}; - -} // namespace interprocess -} // namespace boost - -#include <boost/interprocess/detail/config_end.hpp> - -#endif // BOOST_INTERPROCESS_SCOPED_LOCK_HPP diff --git a/contrib/restricted/boost/python/include/boost/python.hpp b/contrib/restricted/boost/python/include/boost/python.hpp deleted file mode 100644 index e484034103..0000000000 --- a/contrib/restricted/boost/python/include/boost/python.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright David Abrahams 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/libs/python for documentation. - -#ifndef PYTHON_DWA2002810_HPP -# define PYTHON_DWA2002810_HPP - -# include <boost/python/args.hpp> -# include <boost/python/args_fwd.hpp> -# include <boost/python/back_reference.hpp> -# include <boost/python/bases.hpp> -# include <boost/python/borrowed.hpp> -# include <boost/python/call.hpp> -# include <boost/python/call_method.hpp> -# include <boost/python/class.hpp> -# include <boost/python/copy_const_reference.hpp> -# include <boost/python/copy_non_const_reference.hpp> -# include <boost/python/data_members.hpp> -# include <boost/python/def.hpp> -# include <boost/python/default_call_policies.hpp> -# include <boost/python/dict.hpp> -# include <boost/python/docstring_options.hpp> -# include <boost/python/enum.hpp> -# include <boost/python/errors.hpp> -# include <boost/python/exception_translator.hpp> -# include <boost/python/exec.hpp> -# include <boost/python/extract.hpp> -# include <boost/python/handle.hpp> -# include <boost/python/has_back_reference.hpp> -# include <boost/python/implicit.hpp> -# include <boost/python/init.hpp> -# include <boost/python/import.hpp> -# include <boost/python/instance_holder.hpp> -# include <boost/python/iterator.hpp> -# include <boost/python/list.hpp> -# include <boost/python/long.hpp> -# include <boost/python/lvalue_from_pytype.hpp> -# include <boost/python/make_constructor.hpp> -# include <boost/python/make_function.hpp> -# include <boost/python/manage_new_object.hpp> -# include <boost/python/module.hpp> -# include <boost/python/object.hpp> -# include <boost/python/object_protocol.hpp> -# include <boost/python/object_protocol_core.hpp> -# include <boost/python/opaque_pointer_converter.hpp> -# include <boost/python/operators.hpp> -# include <boost/python/other.hpp> -# include <boost/python/overloads.hpp> -# include <boost/python/pointee.hpp> -# include <boost/python/pure_virtual.hpp> -# include <boost/python/ptr.hpp> -# include <boost/python/raw_function.hpp> -# include <boost/python/reference_existing_object.hpp> -# include <boost/python/register_ptr_to_python.hpp> -# include <boost/python/return_arg.hpp> -# include <boost/python/return_internal_reference.hpp> -# include <boost/python/return_opaque_pointer.hpp> -# include <boost/python/return_value_policy.hpp> -# include <boost/python/scope.hpp> -# include <boost/python/self.hpp> -# include <boost/python/slice.hpp> -# include <boost/python/slice_nil.hpp> -# include <boost/python/stl_iterator.hpp> -# include <boost/python/str.hpp> -# include <boost/python/to_python_converter.hpp> -# include <boost/python/to_python_indirect.hpp> -# include <boost/python/to_python_value.hpp> -# include <boost/python/tuple.hpp> -# include <boost/python/type_id.hpp> -# include <boost/python/with_custodian_and_ward.hpp> - -#endif // PYTHON_DWA2002810_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/bases.hpp b/contrib/restricted/boost/python/include/boost/python/bases.hpp deleted file mode 100644 index efcac3f389..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/bases.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef BASES_DWA2002321_HPP -# define BASES_DWA2002321_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/type_list.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/mpl/if.hpp> -# include <boost/mpl/bool.hpp> -# include <boost/preprocessor/enum_params_with_a_default.hpp> -# include <boost/preprocessor/enum_params.hpp> - -namespace boost { namespace python { - -# define BOOST_PYTHON_BASE_PARAMS BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, Base) - - // A type list for specifying bases - template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_MAX_BASES, typename Base, mpl::void_) > - struct bases : detail::type_list< BOOST_PYTHON_BASE_PARAMS >::type - {}; - - namespace detail - { - template <class T> struct specifies_bases - : mpl::false_ - { - }; - - template < BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, class Base) > - struct specifies_bases< bases< BOOST_PYTHON_BASE_PARAMS > > - : mpl::true_ - { - }; - template <class T, class Prev = bases<> > - struct select_bases - : mpl::if_< - specifies_bases<T> - , T - , Prev - > - { - }; - } -# undef BOOST_PYTHON_BASE_PARAMS -}} // namespace boost::python - -#endif // BASES_DWA2002321_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/call_method.hpp b/contrib/restricted/boost/python/include/boost/python/call_method.hpp deleted file mode 100644 index 424077eab4..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/call_method.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 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) -# ifndef CALL_METHOD_DWA2002411_HPP -# define CALL_METHOD_DWA2002411_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/type.hpp> - -# include <boost/python/converter/arg_to_python.hpp> -# include <boost/python/converter/return_from_python.hpp> -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/detail/void_return.hpp> - -# include <boost/preprocessor/comma_if.hpp> -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/debug/line.hpp> -# include <boost/preprocessor/repetition/enum_trailing_params.hpp> -# include <boost/preprocessor/repetition/enum_binary_params.hpp> - -namespace boost { namespace python { - -# define BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET(z, n, _) \ - , converter::arg_to_python<A##n>(a##n).get() - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/call_method.hpp>)) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET - -}} // namespace boost::python - -# endif // CALL_METHOD_DWA2002411_HPP - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, call_method.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -template < - class R - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A) - > -typename detail::returnable<R>::type -call_method(PyObject* self, char const* name - BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) - , boost::type<R>* = 0 - ) -{ - PyObject* const result = - PyEval_CallMethod( - self - , const_cast<char*>(name) - , const_cast<char*>("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")") - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET, nil) - ); - - // This conversion *must not* be done in the same expression as - // the call, because, in the special case where the result is a - // reference a Python object which was created by converting a C++ - // argument for passing to PyObject_CallFunction, its reference - // count will be 2 until the end of the full expression containing - // the conversion, and that interferes with dangling - // pointer/reference detection. - converter::return_from_python<R> converter; - return converter(result); -} - -# undef N - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif // BOOST_PP_IS_ITERATING diff --git a/contrib/restricted/boost/python/include/boost/python/class.hpp b/contrib/restricted/boost/python/include/boost/python/class.hpp deleted file mode 100644 index 77f915ba0a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/class.hpp +++ /dev/null @@ -1,608 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef CLASS_DWA200216_HPP -# define CLASS_DWA200216_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/noncopyable.hpp> - -# include <boost/python/class_fwd.hpp> -# include <boost/python/object/class.hpp> - -# include <boost/python/object.hpp> -# include <boost/python/type_id.hpp> -# include <boost/python/data_members.hpp> -# include <boost/python/make_function.hpp> -# include <boost/python/signature.hpp> -# include <boost/python/init.hpp> -# include <boost/python/args_fwd.hpp> - -# include <boost/python/object/class_metadata.hpp> -# include <boost/python/object/pickle_support.hpp> -# include <boost/python/object/add_to_namespace.hpp> - -# include <boost/python/detail/overloads_fwd.hpp> -# include <boost/python/detail/operator_id.hpp> -# include <boost/python/detail/def_helper.hpp> -# include <boost/python/detail/force_instantiate.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/detail/unwrap_type_id.hpp> -# include <boost/python/detail/unwrap_wrapper.hpp> - -# include <boost/mpl/size.hpp> -# include <boost/mpl/for_each.hpp> -# include <boost/mpl/bool.hpp> -# include <boost/mpl/not.hpp> - -# include <boost/detail/workaround.hpp> - -# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) \ - /* pro9 reintroduced the bug */ \ - || (BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) - -# define BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING 1 - -# endif - -# ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING -# include <boost/mpl/and.hpp> -# endif - -namespace boost { namespace python { - -template <class DerivedVisitor> class def_visitor; - -enum no_init_t { no_init }; - -namespace detail -{ - // This function object is used with mpl::for_each to write the id - // of the type a pointer to which is passed as its 2nd compile-time - // argument. into the iterator pointed to by its runtime argument - struct write_type_id - { - write_type_id(type_info**p) : p(p) {} - - // Here's the runtime behavior - template <class T> - void operator()(T*) const - { - *(*p)++ = type_id<T>(); - } - - type_info** p; - }; - - template <class T> - struct is_data_member_pointer - : mpl::and_< - detail::is_member_pointer<T> - , mpl::not_<detail::is_member_function_pointer<T> > - > - {}; - -# ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING -# define BOOST_PYTHON_DATA_MEMBER_HELPER(D) , detail::is_data_member_pointer<D>() -# define BOOST_PYTHON_YES_DATA_MEMBER , mpl::true_ -# define BOOST_PYTHON_NO_DATA_MEMBER , mpl::false_ -# elif defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) -# define BOOST_PYTHON_DATA_MEMBER_HELPER(D) , 0 -# define BOOST_PYTHON_YES_DATA_MEMBER , int -# define BOOST_PYTHON_NO_DATA_MEMBER , ... -# else -# define BOOST_PYTHON_DATA_MEMBER_HELPER(D) -# define BOOST_PYTHON_YES_DATA_MEMBER -# define BOOST_PYTHON_NO_DATA_MEMBER -# endif - - namespace error - { - // - // A meta-assertion mechanism which prints nice error messages and - // backtraces on lots of compilers. Usage: - // - // assertion<C>::failed - // - // where C is an MPL metafunction class - // - - template <class C> struct assertion_failed { }; - template <class C> struct assertion_ok { typedef C failed; }; - - template <class C> - struct assertion - : mpl::if_<C, assertion_ok<C>, assertion_failed<C> >::type - {}; - - // - // Checks for validity of arguments used to define virtual - // functions with default implementations. - // - - template <class Default> - void not_a_derived_class_member(Default) {} - - template <class T, class Fn> - struct virtual_function_default - { - template <class Default> - static void - must_be_derived_class_member(Default const&) - { - // https://svn.boost.org/trac/boost/ticket/5803 - //typedef typename assertion<mpl::not_<detail::is_same<Default,Fn> > >::failed test0; -# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - typedef typename assertion<detail::is_polymorphic<T> >::failed test1 BOOST_ATTRIBUTE_UNUSED; -# endif - typedef typename assertion<detail::is_member_function_pointer<Fn> >::failed test2 BOOST_ATTRIBUTE_UNUSED; - not_a_derived_class_member<Default>(Fn()); - } - }; - } -} - -// This is the primary mechanism through which users will expose -// C++ classes to Python. -template < - class W // class being wrapped - , class X1 // = detail::not_specified - , class X2 // = detail::not_specified - , class X3 // = detail::not_specified - > -class class_ : public objects::class_base -{ - public: // types - typedef objects::class_base base; - typedef class_<W,X1,X2,X3> self; - typedef typename objects::class_metadata<W,X1,X2,X3> metadata; - typedef W wrapped_type; - - private: // types - - // A helper class which will contain an array of id objects to be - // passed to the base class constructor - struct id_vector - { - typedef typename metadata::bases bases; - - id_vector() - { - // Stick the derived class id into the first element of the array - ids[0] = detail::unwrap_type_id((W*)0, (W*)0); - - // Write the rest of the elements into succeeding positions. - type_info* p = ids + 1; - mpl::for_each(detail::write_type_id(&p), (bases*)0, (add_pointer<mpl::_>*)0); - } - - BOOST_STATIC_CONSTANT( - std::size_t, size = mpl::size<bases>::value + 1); - type_info ids[size]; - }; - friend struct id_vector; - - public: // constructors - - // Construct with the class name, with or without docstring, and default __init__() function - class_(char const* name, char const* doc = 0); - - // Construct with class name, no docstring, and an uncallable __init__ function - class_(char const* name, no_init_t); - - // Construct with class name, docstring, and an uncallable __init__ function - class_(char const* name, char const* doc, no_init_t); - - // Construct with class name and init<> function - template <class DerivedT> - inline class_(char const* name, init_base<DerivedT> const& i) - : base(name, id_vector::size, id_vector().ids) - { - this->initialize(i); - } - - // Construct with class name, docstring and init<> function - template <class DerivedT> - inline class_(char const* name, char const* doc, init_base<DerivedT> const& i) - : base(name, id_vector::size, id_vector().ids, doc) - { - this->initialize(i); - } - - public: // member functions - - // Generic visitation - template <class Derived> - self& def(def_visitor<Derived> const& visitor) - { - visitor.visit(*this); - return *this; - } - - // Wrap a member function or a non-member function which can take - // a T, T cv&, or T cv* as its first parameter, a callable - // python object, or a generic visitor. - template <class F> - self& def(char const* name, F f) - { - this->def_impl( - detail::unwrap_wrapper((W*)0) - , name, f, detail::def_helper<char const*>(0), &f); - return *this; - } - - template <class A1, class A2> - self& def(char const* name, A1 a1, A2 const& a2) - { - this->def_maybe_overloads(name, a1, a2, &a2); - return *this; - } - - template <class Fn, class A1, class A2> - self& def(char const* name, Fn fn, A1 const& a1, A2 const& a2) - { - // The arguments are definitely: - // def(name, function, policy, doc_string) - // def(name, function, doc_string, policy) - - this->def_impl( - detail::unwrap_wrapper((W*)0) - , name, fn - , detail::def_helper<A1,A2>(a1,a2) - , &fn); - - return *this; - } - - template <class Fn, class A1, class A2, class A3> - self& def(char const* name, Fn fn, A1 const& a1, A2 const& a2, A3 const& a3) - { - this->def_impl( - detail::unwrap_wrapper((W*)0) - , name, fn - , detail::def_helper<A1,A2,A3>(a1,a2,a3) - , &fn); - - return *this; - } - - // - // Data member access - // - template <class D> - self& def_readonly(char const* name, D const& d, char const* doc=0) - { - return this->def_readonly_impl(name, d, doc BOOST_PYTHON_DATA_MEMBER_HELPER(D)); - } - - template <class D> - self& def_readwrite(char const* name, D const& d, char const* doc=0) - { - return this->def_readwrite_impl(name, d, doc BOOST_PYTHON_DATA_MEMBER_HELPER(D)); - } - - template <class D> - self& def_readonly(char const* name, D& d, char const* doc=0) - { - return this->def_readonly_impl(name, d, doc BOOST_PYTHON_DATA_MEMBER_HELPER(D)); - } - - template <class D> - self& def_readwrite(char const* name, D& d, char const* doc=0) - { - return this->def_readwrite_impl(name, d, doc BOOST_PYTHON_DATA_MEMBER_HELPER(D)); - } - - // Property creation - template <class Get> - self& add_property(char const* name, Get fget, char const* docstr = 0) - { - base::add_property(name, this->make_getter(fget), docstr); - return *this; - } - - template <class Get, class Set> - self& add_property(char const* name, Get fget, Set fset, char const* docstr = 0) - { - base::add_property( - name, this->make_getter(fget), this->make_setter(fset), docstr); - return *this; - } - - template <class Get> - self& add_static_property(char const* name, Get fget) - { - base::add_static_property(name, object(fget)); - return *this; - } - - template <class Get, class Set> - self& add_static_property(char const* name, Get fget, Set fset) - { - base::add_static_property(name, object(fget), object(fset)); - return *this; - } - - template <class U> - self& setattr(char const* name, U const& x) - { - this->base::setattr(name, object(x)); - return *this; - } - - // Pickle support - template <typename PickleSuiteType> - self& def_pickle(PickleSuiteType const& x) - { - error_messages::must_be_derived_from_pickle_suite(x); - detail::pickle_suite_finalize<PickleSuiteType>::register_( - *this, - &PickleSuiteType::getinitargs, - &PickleSuiteType::getstate, - &PickleSuiteType::setstate, - PickleSuiteType::getstate_manages_dict()); - return *this; - } - - self& enable_pickling() - { - this->base::enable_pickling_(false); - return *this; - } - - self& staticmethod(char const* name) - { - this->make_method_static(name); - return *this; - } - private: // helper functions - - // Builds a method for this class around the given [member] - // function pointer or object, appropriately adjusting the type of - // the first signature argument so that if f is a member of a - // (possibly not wrapped) base class of T, an lvalue argument of - // type T will be required. - // - // @group PropertyHelpers { - template <class F> - object make_getter(F f) - { - typedef typename api::is_object_operators<F>::type is_obj_or_proxy; - - return this->make_fn_impl( - detail::unwrap_wrapper((W*)0) - , f, is_obj_or_proxy(), (char*)0, detail::is_data_member_pointer<F>() - ); - } - - template <class F> - object make_setter(F f) - { - typedef typename api::is_object_operators<F>::type is_obj_or_proxy; - - return this->make_fn_impl( - detail::unwrap_wrapper((W*)0) - , f, is_obj_or_proxy(), (int*)0, detail::is_data_member_pointer<F>() - ); - } - - template <class T, class F> - object make_fn_impl(T*, F const& f, mpl::false_, void*, mpl::false_) - { - return python::make_function(f, default_call_policies(), detail::get_signature(f, (T*)0)); - } - - template <class T, class D, class B> - object make_fn_impl(T*, D B::*pm_, mpl::false_, char*, mpl::true_) - { - D T::*pm = pm_; - return python::make_getter(pm); - } - - template <class T, class D, class B> - object make_fn_impl(T*, D B::*pm_, mpl::false_, int*, mpl::true_) - { - D T::*pm = pm_; - return python::make_setter(pm); - } - - template <class T, class F> - object make_fn_impl(T*, F const& x, mpl::true_, void*, mpl::false_) - { - return x; - } - // } - - template <class D, class B> - self& def_readonly_impl( - char const* name, D B::*pm_, char const* doc BOOST_PYTHON_YES_DATA_MEMBER) - { - return this->add_property(name, pm_, doc); - } - - template <class D, class B> - self& def_readwrite_impl( - char const* name, D B::*pm_, char const* doc BOOST_PYTHON_YES_DATA_MEMBER) - { - return this->add_property(name, pm_, pm_, doc); - } - - template <class D> - self& def_readonly_impl( - char const* name, D& d, char const* BOOST_PYTHON_NO_DATA_MEMBER) - { - return this->add_static_property(name, python::make_getter(d)); - } - - template <class D> - self& def_readwrite_impl( - char const* name, D& d, char const* BOOST_PYTHON_NO_DATA_MEMBER) - { - return this->add_static_property(name, python::make_getter(d), python::make_setter(d)); - } - - template <class DefVisitor> - inline void initialize(DefVisitor const& i) - { - metadata::register_(); // set up runtime metadata/conversions - - typedef typename metadata::holder holder; - this->set_instance_size( objects::additional_instance_size<holder>::value ); - - this->def(i); - } - - inline void initialize(no_init_t) - { - metadata::register_(); // set up runtime metadata/conversions - this->def_no_init(); - } - - // - // These two overloads discriminate between def() as applied to a - // generic visitor and everything else. - // - // @group def_impl { - template <class T, class Helper, class LeafVisitor, class Visitor> - inline void def_impl( - T* - , char const* name - , LeafVisitor - , Helper const& helper - , def_visitor<Visitor> const* v - ) - { - v->visit(*this, name, helper); - } - - template <class T, class Fn, class Helper> - inline void def_impl( - T* - , char const* name - , Fn fn - , Helper const& helper - , ... - ) - { - objects::add_to_namespace( - *this - , name - , make_function( - fn - , helper.policies() - , helper.keywords() - , detail::get_signature(fn, (T*)0) - ) - , helper.doc() - ); - - this->def_default(name, fn, helper, mpl::bool_<Helper::has_default_implementation>()); - } - // } - - // - // These two overloads handle the definition of default - // implementation overloads for virtual functions. The second one - // handles the case where no default implementation was specified. - // - // @group def_default { - template <class Fn, class Helper> - inline void def_default( - char const* name - , Fn - , Helper const& helper - , mpl::bool_<true>) - { - detail::error::virtual_function_default<W,Fn>::must_be_derived_class_member( - helper.default_implementation()); - - objects::add_to_namespace( - *this, name, - make_function( - helper.default_implementation(), helper.policies(), helper.keywords()) - ); - } - - template <class Fn, class Helper> - inline void def_default(char const*, Fn, Helper const&, mpl::bool_<false>) - { } - // } - - // - // These two overloads discriminate between def() as applied to - // regular functions and def() as applied to the result of - // BOOST_PYTHON_FUNCTION_OVERLOADS(). The final argument is used to - // discriminate. - // - // @group def_maybe_overloads { - template <class OverloadsT, class SigT> - void def_maybe_overloads( - char const* name - , SigT sig - , OverloadsT const& overloads - , detail::overloads_base const*) - - { - // convert sig to a type_list (see detail::get_signature in signature.hpp) - // before calling detail::define_with_defaults. - detail::define_with_defaults( - name, overloads, *this, detail::get_signature(sig)); - } - - template <class Fn, class A1> - void def_maybe_overloads( - char const* name - , Fn fn - , A1 const& a1 - , ...) - { - this->def_impl( - detail::unwrap_wrapper((W*)0) - , name - , fn - , detail::def_helper<A1>(a1) - , &fn - ); - - } - // } -}; - - -// -// implementations -// - -template <class W, class X1, class X2, class X3> -inline class_<W,X1,X2,X3>::class_(char const* name, char const* doc) - : base(name, id_vector::size, id_vector().ids, doc) -{ - this->initialize(init<>()); -// select_holder::assert_default_constructible(); -} - -template <class W, class X1, class X2, class X3> -inline class_<W,X1,X2,X3>::class_(char const* name, no_init_t) - : base(name, id_vector::size, id_vector().ids) -{ - this->initialize(no_init); -} - -template <class W, class X1, class X2, class X3> -inline class_<W,X1,X2,X3>::class_(char const* name, char const* doc, no_init_t) - : base(name, id_vector::size, id_vector().ids, doc) -{ - this->initialize(no_init); -} - -}} // namespace boost::python - -# undef BOOST_PYTHON_DATA_MEMBER_HELPER -# undef BOOST_PYTHON_YES_DATA_MEMBER -# undef BOOST_PYTHON_NO_DATA_MEMBER -# undef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING - -#endif // CLASS_DWA200216_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/class_fwd.hpp b/contrib/restricted/boost/python/include/boost/python/class_fwd.hpp deleted file mode 100644 index 528e18a1dc..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/class_fwd.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef CLASS_FWD_DWA200222_HPP -# define CLASS_FWD_DWA200222_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/not_specified.hpp> - -namespace boost { namespace python { - -template < - class T // class being wrapped - // arbitrarily-ordered optional arguments. Full qualification needed for MSVC6 - , class X1 = ::boost::python::detail::not_specified - , class X2 = ::boost::python::detail::not_specified - , class X3 = ::boost::python::detail::not_specified - > -class class_; - -}} // namespace boost::python - -#endif // CLASS_FWD_DWA200222_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/as_to_python_function.hpp b/contrib/restricted/boost/python/include/boost/python/converter/as_to_python_function.hpp deleted file mode 100644 index 19a3efaafc..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/as_to_python_function.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef AS_TO_PYTHON_FUNCTION_DWA2002121_HPP -# define AS_TO_PYTHON_FUNCTION_DWA2002121_HPP -# include <boost/python/converter/to_python_function_type.hpp> - -namespace boost { namespace python { namespace converter { - -// Given a typesafe to_python conversion function, produces a -// to_python_function_t which can be registered in the usual way. -template <class T, class ToPython> -struct as_to_python_function -{ - // Assertion functions used to prevent wrapping of converters - // which take non-const reference parameters. The T* argument in - // the first overload ensures it isn't used in case T is a - // reference. - template <class U> - static void convert_function_must_take_value_or_const_reference(U(*)(T), int, T* = 0) {} - template <class U> - static void convert_function_must_take_value_or_const_reference(U(*)(T const&), long ...) {} - - static PyObject* convert(void const* x) - { - convert_function_must_take_value_or_const_reference(&ToPython::convert, 1L); - - // Yes, the const_cast below opens a hole in const-correctness, - // but it's needed to convert auto_ptr<U> to python. - // - // How big a hole is it? It allows ToPython::convert() to be - // a function which modifies its argument. The upshot is that - // client converters applied to const objects may invoke - // undefined behavior. The damage, however, is limited by the - // use of the assertion function. Thus, the only way this can - // modify its argument is if T is an auto_ptr-like type. There - // is still a const-correctness hole w.r.t. auto_ptr<U> const, - // but c'est la vie. - return ToPython::convert(*const_cast<T*>(static_cast<T const*>(x))); - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static PyTypeObject const * get_pytype() { return ToPython::get_pytype(); } -#endif -}; - -}}} // namespace boost::python::converter - -#endif // AS_TO_PYTHON_FUNCTION_DWA2002121_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/implicit.hpp b/contrib/restricted/boost/python/include/boost/python/converter/implicit.hpp deleted file mode 100644 index 8bbbfd5ac1..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/implicit.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef IMPLICIT_DWA2002326_HPP -# define IMPLICIT_DWA2002326_HPP - -# include <boost/python/converter/rvalue_from_python_data.hpp> -# include <boost/python/converter/registrations.hpp> -# include <boost/python/converter/registered.hpp> - -# include <boost/python/extract.hpp> - -namespace boost { namespace python { namespace converter { - -template <class Source, class Target> -struct implicit -{ - static void* convertible(PyObject* obj) - { - // Find a converter which can produce a Source instance from - // obj. The user has told us that Source can be converted to - // Target, and instantiating construct() below, ensures that - // at compile-time. - return implicit_rvalue_convertible_from_python(obj, registered<Source>::converters) - ? obj : 0; - } - - static void construct(PyObject* obj, rvalue_from_python_stage1_data* data) - { - void* storage = ((rvalue_from_python_storage<Target>*)data)->storage.bytes; - - arg_from_python<Source> get_source(obj); - bool convertible = get_source.convertible(); - BOOST_VERIFY(convertible); - - new (storage) Target(get_source()); - - // record successful construction - data->convertible = storage; - } -}; - -}}} // namespace boost::python::converter - -#endif // IMPLICIT_DWA2002326_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_from_python.hpp b/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_from_python.hpp deleted file mode 100644 index b5c62ba940..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_from_python.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright David Abrahams 2002. -// Copyright Stefan Seefeld 2016. -// Distributed under the 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_python_converter_shared_ptr_from_python_hpp_ -#define boost_python_converter_shared_ptr_from_python_hpp_ - -#include <boost/python/handle.hpp> -#include <boost/python/converter/shared_ptr_deleter.hpp> -#include <boost/python/converter/from_python.hpp> -#include <boost/python/converter/rvalue_from_python_data.hpp> -#include <boost/python/converter/registered.hpp> -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -# include <boost/python/converter/pytype_function.hpp> -#endif -#include <boost/shared_ptr.hpp> -#include <memory> - -namespace boost { namespace python { namespace converter { - -template <class T, template <typename> class SP> -struct shared_ptr_from_python -{ - shared_ptr_from_python() - { - converter::registry::insert(&convertible, &construct, type_id<SP<T> >() -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - , &converter::expected_from_python_type_direct<T>::get_pytype -#endif - ); - } - - private: - static void* convertible(PyObject* p) - { - if (p == Py_None) - return p; - - return converter::get_lvalue_from_python(p, registered<T>::converters); - } - - static void construct(PyObject* source, rvalue_from_python_stage1_data* data) - { - void* const storage = ((converter::rvalue_from_python_storage<SP<T> >*)data)->storage.bytes; - // Deal with the "None" case. - if (data->convertible == source) - new (storage) SP<T>(); - else - { - void *const storage = ((converter::rvalue_from_python_storage<SP<T> >*)data)->storage.bytes; - // Deal with the "None" case. - if (data->convertible == source) - new (storage) SP<T>(); - else - { - SP<void> hold_convertible_ref_count((void*)0, shared_ptr_deleter(handle<>(borrowed(source))) ); - // use aliasing constructor - new (storage) SP<T>(hold_convertible_ref_count, static_cast<T*>(data->convertible)); - } - } - data->convertible = storage; - } -}; - -}}} // namespace boost::python::converter - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/copy_const_reference.hpp b/contrib/restricted/boost/python/include/boost/python/copy_const_reference.hpp deleted file mode 100644 index 55bede136f..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/copy_const_reference.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef COPY_CONST_REFERENCE_DWA2002131_HPP -# define COPY_CONST_REFERENCE_DWA2002131_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/mpl/if.hpp> -# include <boost/python/to_python_value.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <class R> - struct copy_const_reference_expects_a_const_reference_return_type -# if defined(__GNUC__) || defined(__EDG__) - {} -# endif - ; -} - -template <class T> struct to_python_value; - -struct copy_const_reference -{ - template <class T> - struct apply - { - typedef typename mpl::if_c< - indirect_traits::is_reference_to_const<T>::value - , to_python_value<T> - , detail::copy_const_reference_expects_a_const_reference_return_type<T> - >::type type; - }; -}; - - -}} // namespace boost::python - -#endif // COPY_CONST_REFERENCE_DWA2002131_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/copy_non_const_reference.hpp b/contrib/restricted/boost/python/include/boost/python/copy_non_const_reference.hpp deleted file mode 100644 index 15fef62d67..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/copy_non_const_reference.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef COPY_NON_CONST_REFERENCE_DWA2002131_HPP -# define COPY_NON_CONST_REFERENCE_DWA2002131_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/mpl/if.hpp> -# include <boost/python/to_python_value.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <class R> - struct copy_non_const_reference_expects_a_non_const_reference_return_type -# if defined(__GNUC__) || defined(__EDG__) - {} -# endif - ; -} - -template <class T> struct to_python_value; - -struct copy_non_const_reference -{ - template <class T> - struct apply - { - typedef typename mpl::if_c< - indirect_traits::is_reference_to_non_const<T>::value - , to_python_value<T> - , detail::copy_non_const_reference_expects_a_non_const_reference_return_type<T> - >::type type; - }; -}; - - -}} // namespace boost::python - -#endif // COPY_NON_CONST_REFERENCE_DWA2002131_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/data_members.hpp b/contrib/restricted/boost/python/include/boost/python/data_members.hpp deleted file mode 100644 index 989f7d7f93..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/data_members.hpp +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef DATA_MEMBERS_DWA2002328_HPP -# define DATA_MEMBERS_DWA2002328_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/handle.hpp> - -# include <boost/python/return_value_policy.hpp> -# include <boost/python/return_by_value.hpp> -# include <boost/python/return_internal_reference.hpp> -# include <boost/python/make_function.hpp> - -# include <boost/python/converter/builtin_converters.hpp> - -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/python/detail/not_specified.hpp> -# include <boost/python/detail/value_arg.hpp> -# include <boost/python/detail/type_traits.hpp> - -# include <boost/mpl/eval_if.hpp> -# include <boost/mpl/if.hpp> -# include <boost/mpl/vector/vector10.hpp> - -# include <boost/detail/workaround.hpp> - -namespace boost { namespace python { - -// -// This file defines the make_getter and make_setter function -// families, which are responsible for turning pointers, references, -// and pointers-to-data-members into callable Python objects which -// can be used for attribute access on wrapped classes. -// - -namespace detail -{ - - // A small function object which handles the getting and setting of - // data members. - template <class Data, class Class> - struct member - { - public: - member(Data Class::*which) : m_which(which) {} - - Data& operator()(Class& c) const - { - return c.*m_which; - } - - void operator()(Class& c, typename value_arg<Data>::type d) const - { - c.*m_which = d; - } - private: - Data Class::*m_which; - }; - - // A small function object which handles the getting and setting of - // non-member objects. - template <class Data> - struct datum - { - public: - datum(Data *which) : m_which(which) {} - - Data& operator()() const - { - return *m_which; - } - - void operator()(typename value_arg<Data>::type d) const - { - *m_which = d; - } - private: - Data *m_which; - }; - - // - // Helper metafunction for determining the default CallPolicy to use - // for attribute access. If T is a [reference to a] class type X - // whose conversion to python would normally produce a new copy of X - // in a wrapped X class instance (as opposed to types such as - // std::string, which are converted to native Python types, and - // smart pointer types which produce a wrapped class instance of the - // pointee type), to-python conversions will attempt to produce an - // object which refers to the original C++ object, rather than a - // copy. See default_member_getter_policy for rationale. - // - template <class T> - struct default_getter_by_ref - : mpl::and_< - mpl::bool_< - to_python_value< - typename value_arg<T>::type - >::uses_registry - > - , indirect_traits::is_reference_to_class< - typename value_arg<T>::type - > - > - { - }; - - // Metafunction computing the default CallPolicy to use for reading - // data members - // - // If it's a regular class type (not an object manager or other - // type for which we have to_python specializations, use - // return_internal_reference so that we can do things like - // x.y.z = 1 - // and get the right result. - template <class T> - struct default_member_getter_policy - : mpl::if_< - default_getter_by_ref<T> - , return_internal_reference<> - , return_value_policy<return_by_value> - > - {}; - - // Metafunction computing the default CallPolicy to use for reading - // non-member data. - template <class T> - struct default_datum_getter_policy - : mpl::if_< - default_getter_by_ref<T> - , return_value_policy<reference_existing_object> - , return_value_policy<return_by_value> - > - {}; - - // - // make_getter helper function family -- These helpers to - // boost::python::make_getter are used to dispatch behavior. The - // third argument is a workaround for a CWPro8 partial ordering bug - // with pointers to data members. It should be convertible to - // detail::true_ iff the first argument is a pointer-to-member, and - // detail::false_ otherwise. The fourth argument is for compilers - // which don't support partial ordering at all and should always be - // passed 0L. - - -#if BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - template <class D, class P> - inline object make_getter(D& d, P& p, detail::false_, ...); -#endif - - // Handle non-member pointers with policies - template <class D, class Policies> - inline object make_getter(D* d, Policies const& policies, detail::false_, int) - { - return python::make_function( - detail::datum<D>(d), policies, mpl::vector1<D&>() - ); - } - - // Handle non-member pointers without policies - template <class D> - inline object make_getter(D* d, not_specified, detail::false_, long) - { - typedef typename default_datum_getter_policy<D>::type policies; - return detail::make_getter(d, policies(), detail::false_(), 0); - } - - // Handle pointers-to-members with policies - template <class C, class D, class Policies> - inline object make_getter(D C::*pm, Policies const& policies, detail::true_, int) - { -#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - typedef typename detail::remove_cv<C>::type Class; -#else - typedef C Class; -#endif - return python::make_function( - detail::member<D,Class>(pm) - , policies - , mpl::vector2<D&,Class&>() - ); - } - - // Handle pointers-to-members without policies - template <class C, class D> - inline object make_getter(D C::*pm, not_specified, detail::true_, long) - { - typedef typename default_member_getter_policy<D>::type policies; - return detail::make_getter(pm, policies(), detail::true_(), 0); - } - - // Handle references - template <class D, class P> - inline object make_getter(D& d, P& p, detail::false_, ...) - { - // Just dispatch to the handler for pointer types. - return detail::make_getter(&d, p, detail::false_(), 0L); - } - - // - // make_setter helper function family -- These helpers to - // boost::python::make_setter are used to dispatch behavior. The - // third argument is for compilers which don't support partial - // ordering at all and should always be passed 0. - // - - - // Handle non-member pointers - template <class D, class Policies> - inline object make_setter(D* p, Policies const& policies, detail::false_, int) - { - return python::make_function( - detail::datum<D>(p), policies, mpl::vector2<void,D const&>() - ); - } - - // Handle pointers-to-members - template <class C, class D, class Policies> - inline object make_setter(D C::*pm, Policies const& policies, detail::true_, int) - { - return python::make_function( - detail::member<D,C>(pm) - , policies - , mpl::vector3<void, C&, D const&>() - ); - } - - // Handle references - template <class D, class Policies> - inline object make_setter(D& x, Policies const& policies, detail::false_, ...) - { - return detail::make_setter(&x, policies, detail::false_(), 0L); - } -} - -// -// make_getter function family -- build a callable object which -// retrieves data through the first argument and is appropriate for -// use as the `get' function in Python properties . The second, -// policies argument, is optional. We need both D& and D const& -// overloads in order be able to handle rvalues. -// -template <class D, class Policies> -inline object make_getter(D& d, Policies const& policies) -{ - return detail::make_getter(d, policies, detail::is_member_pointer<D>(), 0L); -} - -template <class D, class Policies> -inline object make_getter(D const& d, Policies const& policies) -{ - return detail::make_getter(d, policies, detail::is_member_pointer<D>(), 0L); -} - -template <class D> -inline object make_getter(D& x) -{ - detail::not_specified policy - = detail::not_specified(); // suppress a SunPro warning - return detail::make_getter(x, policy, detail::is_member_pointer<D>(), 0L); -} - -# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) -template <class D> -inline object make_getter(D const& d) -{ - detail::not_specified policy - = detail::not_specified(); // Suppress a SunPro warning - return detail::make_getter(d, policy, detail::is_member_pointer<D>(), 0L); -} -# endif - -// -// make_setter function family -- build a callable object which -// writes data through the first argument and is appropriate for -// use as the `set' function in Python properties . The second, -// policies argument, is optional. We need both D& and D const& -// overloads in order be able to handle rvalues. -// -template <class D, class Policies> -inline object make_setter(D& x, Policies const& policies) -{ - return detail::make_setter(x, policies, detail::is_member_pointer<D>(), 0); -} - -template <class D, class Policies> -inline object make_setter(D const& x, Policies const& policies) -{ - return detail::make_setter(x, policies, detail::is_member_pointer<D>(), 0); -} - -template <class D> -inline object make_setter(D& x) -{ - return detail::make_setter(x, default_call_policies(), detail::is_member_pointer<D>(), 0); -} - -# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) -template <class D> -inline object make_setter(D const& x) -{ - return detail::make_setter(x, default_call_policies(), detail::is_member_pointer<D>(), 0); -} -# endif - -}} // namespace boost::python - -#endif // DATA_MEMBERS_DWA2002328_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/def.hpp b/contrib/restricted/boost/python/include/boost/python/def.hpp deleted file mode 100644 index fe2c65f938..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/def.hpp +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef DEF_DWA200292_HPP -# define DEF_DWA200292_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object_fwd.hpp> -# include <boost/python/make_function.hpp> -# include <boost/python/detail/def_helper.hpp> -# include <boost/python/detail/overloads_fwd.hpp> -# include <boost/python/scope.hpp> -# include <boost/python/signature.hpp> -# include <boost/python/detail/scope.hpp> - -namespace boost { namespace python { - -namespace detail -{ - namespace error - { - // Compile-time error messages - template <bool> struct multiple_functions_passed_to_def; - template <> struct multiple_functions_passed_to_def<false> { typedef char type; }; - } - - // - // def_from_helper -- - // - // Use a def_helper to define a regular wrapped function in the current scope. - template <class F, class Helper> - void def_from_helper( - char const* name, F const& fn, Helper const& helper) - { - // Must not try to use default implementations except with method definitions. - typedef typename error::multiple_functions_passed_to_def< - Helper::has_default_implementation - >::type assertion BOOST_ATTRIBUTE_UNUSED; - - detail::scope_setattr_doc( - name, boost::python::make_function( - fn - , helper.policies() - , helper.keywords()) - , helper.doc() - ); - } - - // - // These two overloads discriminate between def() as applied to - // regular functions and def() as applied to the result of - // BOOST_PYTHON_FUNCTION_OVERLOADS(). The final argument is used to - // discriminate. - // - template <class Fn, class A1> - void - def_maybe_overloads( - char const* name - , Fn fn - , A1 const& a1 - , ...) - { - detail::def_from_helper(name, fn, def_helper<A1>(a1)); - } - - template <class StubsT, class SigT> - void def_maybe_overloads( - char const* name - , SigT sig - , StubsT const& stubs - , detail::overloads_base const*) - { - scope current; - - detail::define_with_defaults( - name, stubs, current, detail::get_signature(sig)); - } - - template <class T> - object make_function1(T fn, ...) { return make_function(fn); } - - inline - object make_function1(object const& x, object const*) { return x; } -} - -template <class Fn> -void def(char const* name, Fn fn) -{ - detail::scope_setattr_doc(name, detail::make_function1(fn, &fn), 0); -} - -template <class Arg1T, class Arg2T> -void def(char const* name, Arg1T arg1, Arg2T const& arg2) -{ - detail::def_maybe_overloads(name, arg1, arg2, &arg2); -} - -template <class F, class A1, class A2> -void def(char const* name, F f, A1 const& a1, A2 const& a2) -{ - detail::def_from_helper(name, f, detail::def_helper<A1,A2>(a1,a2)); -} - -template <class F, class A1, class A2, class A3> -void def(char const* name, F f, A1 const& a1, A2 const& a2, A3 const& a3) -{ - detail::def_from_helper(name, f, detail::def_helper<A1,A2,A3>(a1,a2,a3)); -} - -}} // namespace boost::python - -#endif // DEF_DWA200292_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/dealloc.hpp b/contrib/restricted/boost/python/include/boost/python/detail/dealloc.hpp deleted file mode 100644 index ce07926ee1..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/dealloc.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright Gottfried Ganßauge 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 BOOST_PYTHON_DETAIL_DEALLOC_HPP_ -# define BOOST_PYTHON_DETAIL_DEALLOC_HPP_ -namespace boost { namespace python { namespace detail { - extern "C" - { - inline void dealloc(PyObject* self) - { - PyObject_Del(self); - } - } -}}} // namespace boost::python::detail -# endif // BOOST_PYTHON_DETAIL_DEALLOC_HPP_ diff --git a/contrib/restricted/boost/python/include/boost/python/detail/def_helper.hpp b/contrib/restricted/boost/python/include/boost/python/detail/def_helper.hpp deleted file mode 100644 index 24f9c5cdb2..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/def_helper.hpp +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef DEF_HELPER_DWA200287_HPP -# define DEF_HELPER_DWA200287_HPP - -# include <boost/python/args.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/mpl/not.hpp> -# include <boost/mpl/and.hpp> -# include <boost/mpl/or.hpp> -# include <boost/mpl/lambda.hpp> -# include <boost/mpl/apply.hpp> -# include <boost/tuple/tuple.hpp> -# include <boost/python/detail/not_specified.hpp> -# include <boost/python/detail/def_helper_fwd.hpp> - -namespace boost { namespace python { - -struct default_call_policies; - -namespace detail -{ - // tuple_extract<Tuple,Predicate>::extract(t) returns the first - // element of a Tuple whose type E satisfies the given Predicate - // applied to add_reference<E>. The Predicate must be an MPL - // metafunction class. - template <class Tuple, class Predicate> - struct tuple_extract; - - // Implementation class for when the tuple's head type does not - // satisfy the Predicate - template <bool matched> - struct tuple_extract_impl - { - template <class Tuple, class Predicate> - struct apply - { - typedef typename Tuple::head_type result_type; - - static typename Tuple::head_type extract(Tuple const& x) - { - return x.get_head(); - } - }; - }; - - // Implementation specialization for when the tuple's head type - // satisfies the predicate - template <> - struct tuple_extract_impl<false> - { - template <class Tuple, class Predicate> - struct apply - { - // recursive application of tuple_extract on the tail of the tuple - typedef tuple_extract<typename Tuple::tail_type, Predicate> next; - typedef typename next::result_type result_type; - - static result_type extract(Tuple const& x) - { - return next::extract(x.get_tail()); - } - }; - }; - - // A metafunction which selects a version of tuple_extract_impl to - // use for the implementation of tuple_extract - template <class Tuple, class Predicate> - struct tuple_extract_base_select - { - typedef typename Tuple::head_type head_type; - typedef typename mpl::apply1<Predicate, - typename add_lvalue_reference<head_type>::type>::type match_t; - BOOST_STATIC_CONSTANT(bool, match = match_t::value); - typedef typename tuple_extract_impl<match>::template apply<Tuple,Predicate> type; - }; - - template <class Tuple, class Predicate> - struct tuple_extract - : tuple_extract_base_select< - Tuple - , typename mpl::lambda<Predicate>::type - >::type - { - }; - - - // - // Specialized extractors for the docstring, keywords, CallPolicies, - // and default implementation of virtual functions - // - - template <class Tuple> - struct doc_extract - : tuple_extract< - Tuple - , mpl::not_< - mpl::or_< - indirect_traits::is_reference_to_class<mpl::_1> - , indirect_traits::is_reference_to_member_function_pointer<mpl::_1 > - > - > - > - { - }; - - template <class Tuple> - struct keyword_extract - : tuple_extract<Tuple, is_reference_to_keywords<mpl::_1 > > - { - }; - - template <class Tuple> - struct policy_extract - : tuple_extract< - Tuple - , mpl::and_< - mpl::not_<is_same<not_specified const&,mpl::_1> > - , indirect_traits::is_reference_to_class<mpl::_1 > - , mpl::not_<is_reference_to_keywords<mpl::_1 > > - > - > - { - }; - - template <class Tuple> - struct default_implementation_extract - : tuple_extract< - Tuple - , indirect_traits::is_reference_to_member_function_pointer<mpl::_1 > - > - { - }; - - // - // A helper class for decoding the optional arguments to def() - // invocations, which can be supplied in any order and are - // discriminated by their type properties. The template parameters - // are expected to be the types of the actual (optional) arguments - // passed to def(). - // - template <class T1, class T2, class T3, class T4> - struct def_helper - { - // A tuple type which begins with references to the supplied - // arguments and ends with actual representatives of the default - // types. - typedef boost::tuples::tuple< - T1 const& - , T2 const& - , T3 const& - , T4 const& - , default_call_policies - , detail::keywords<0> - , char const* - , void(not_specified::*)() // A function pointer type which is never an - // appropriate default implementation - > all_t; - - // Constructors; these initialize an member of the tuple type - // shown above. - def_helper(T1 const& a1) : m_all(a1,m_nil,m_nil,m_nil) {} - def_helper(T1 const& a1, T2 const& a2) : m_all(a1,a2,m_nil,m_nil) {} - def_helper(T1 const& a1, T2 const& a2, T3 const& a3) : m_all(a1,a2,a3,m_nil) {} - def_helper(T1 const& a1, T2 const& a2, T3 const& a3, T4 const& a4) : m_all(a1,a2,a3,a4) {} - - private: // types - typedef typename default_implementation_extract<all_t>::result_type default_implementation_t; - - public: // Constants which can be used for static assertions. - - // Users must not supply a default implementation for non-class - // methods. - BOOST_STATIC_CONSTANT( - bool, has_default_implementation = ( - !is_same<default_implementation_t, void(not_specified::*)()>::value)); - - public: // Extractor functions which pull the appropriate value out - // of the tuple - char const* doc() const - { - return doc_extract<all_t>::extract(m_all); - } - - typename keyword_extract<all_t>::result_type keywords() const - { - return keyword_extract<all_t>::extract(m_all); - } - - typename policy_extract<all_t>::result_type policies() const - { - return policy_extract<all_t>::extract(m_all); - } - - default_implementation_t default_implementation() const - { - return default_implementation_extract<all_t>::extract(m_all); - } - - private: // data members - all_t m_all; - not_specified m_nil; // for filling in not_specified slots - }; -} - -}} // namespace boost::python::detail - -#endif // DEF_HELPER_DWA200287_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/defaults_def.hpp b/contrib/restricted/boost/python/include/boost/python/detail/defaults_def.hpp deleted file mode 100644 index 607775842b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/defaults_def.hpp +++ /dev/null @@ -1,291 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright David Abrahams 2002, Joel de Guzman, 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) -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef DEFAULTS_DEF_JDG20020811_HPP -#define DEFAULTS_DEF_JDG20020811_HPP - -#include <boost/python/detail/defaults_gen.hpp> -#include <boost/python/detail/type_traits.hpp> -#include <boost/mpl/front.hpp> -#include <boost/mpl/size.hpp> -#include <boost/static_assert.hpp> -#include <boost/preprocessor/iterate.hpp> -#include <boost/python/class_fwd.hpp> -#include <boost/python/scope.hpp> -#include <boost/preprocessor/debug/line.hpp> -#include <boost/python/detail/scope.hpp> -#include <boost/python/detail/make_keyword_range_fn.hpp> -#include <boost/python/object/add_to_namespace.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace python { - -struct module; - -namespace objects -{ - struct class_base; -} - -namespace detail -{ - // Called as:: - // - // name_space_def(ns, "func", func, kw, policies, docstring, &ns) - // - // Dispatch to properly add f to namespace ns. - // - // @group define_stub_function helpers { - template <class Func, class CallPolicies, class NameSpaceT> - static void name_space_def( - NameSpaceT& name_space - , char const* name - , Func f - , keyword_range const& kw - , CallPolicies const& policies - , char const* doc - , objects::class_base* - ) - { - typedef typename NameSpaceT::wrapped_type wrapped_type; - - objects::add_to_namespace( - name_space, name, - detail::make_keyword_range_function( - f, policies, kw, get_signature(f, (wrapped_type*)0)) - , doc - ); - } - - template <class Func, class CallPolicies> - static void name_space_def( - object& name_space - , char const* name - , Func f - , keyword_range const& kw - , CallPolicies const& policies - , char const* doc - , ... - ) - { - scope within(name_space); - - detail::scope_setattr_doc( - name - , detail::make_keyword_range_function(f, policies, kw) - , doc); - } - - // For backward compatibility -- is this obsolete? - template <class Func, class CallPolicies, class NameSpaceT> - static void name_space_def( - NameSpaceT& name_space - , char const* name - , Func f - , keyword_range const& /* kw */ // ignored - , CallPolicies const& policies - , char const* doc - , module* - ) - { - name_space.def(name, f, policies, doc); - } - // } - - - // Expansions of :: - // - // template <typename OverloadsT, typename NameSpaceT> - // inline void - // define_stub_function( - // char const* name, OverloadsT s, NameSpaceT& name_space, mpl::int_<N>) - // { - // name_space.def(name, &OverloadsT::func_N); - // } - // - // where N runs from 0 to BOOST_PYTHON_MAX_ARITY. - // - // The set of overloaded functions (define_stub_function) expects: - // - // 1. char const* name: function name that will be visible to python - // 2. OverloadsT: a function overloads struct (see defaults_gen.hpp) - // 3. NameSpaceT& name_space: a python::class_ or python::module instance - // 4. int_t<N>: the Nth overloaded function (OverloadsT::func_N) - // (see defaults_gen.hpp) - // 5. char const* name: doc string - // - // @group define_stub_function<N> { - template <int N> - struct define_stub_function {}; - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/defaults_def.hpp>)) - -#include BOOST_PP_ITERATE() - - // } - - // This helper template struct does the actual recursive - // definition. There's a generic version - // define_with_defaults_helper<N> and a terminal case - // define_with_defaults_helper<0>. The struct and its - // specialization has a sole static member function def that - // expects: - // - // 1. char const* name: function name that will be - // visible to python - // - // 2. OverloadsT: a function overloads struct - // (see defaults_gen.hpp) - // - // 3. NameSpaceT& name_space: a python::class_ or - // python::module instance - // - // 4. char const* name: doc string - // - // The def static member function calls a corresponding - // define_stub_function<N>. The general case recursively calls - // define_with_defaults_helper<N-1>::def until it reaches the - // terminal case case define_with_defaults_helper<0>. - template <int N> - struct define_with_defaults_helper { - - template <class StubsT, class CallPolicies, class NameSpaceT> - static void - def( - char const* name, - StubsT stubs, - keyword_range kw, - CallPolicies const& policies, - NameSpaceT& name_space, - char const* doc) - { - // define the NTH stub function of stubs - define_stub_function<N>::define(name, stubs, kw, policies, name_space, doc); - - if (kw.second > kw.first) - --kw.second; - - // call the next define_with_defaults_helper - define_with_defaults_helper<N-1>::def(name, stubs, kw, policies, name_space, doc); - } - }; - - template <> - struct define_with_defaults_helper<0> { - - template <class StubsT, class CallPolicies, class NameSpaceT> - static void - def( - char const* name, - StubsT stubs, - keyword_range const& kw, - CallPolicies const& policies, - NameSpaceT& name_space, - char const* doc) - { - // define the Oth stub function of stubs - define_stub_function<0>::define(name, stubs, kw, policies, name_space, doc); - // return - } - }; - - // define_with_defaults - // - // 1. char const* name: function name that will be - // visible to python - // - // 2. OverloadsT: a function overloads struct - // (see defaults_gen.hpp) - // - // 3. CallPolicies& policies: Call policies - // 4. NameSpaceT& name_space: a python::class_ or - // python::module instance - // - // 5. SigT sig: Function signature typelist - // (see defaults_gen.hpp) - // - // 6. char const* name: doc string - // - // This is the main entry point. This function recursively - // defines all stub functions of StubT (see defaults_gen.hpp) in - // NameSpaceT name_space which can be either a python::class_ or - // a python::module. The sig argument is a typelist that - // specifies the return type, the class (for member functions, - // and the arguments. Here are some SigT examples: - // - // int foo(int) mpl::vector<int, int> - // void bar(int, int) mpl::vector<void, int, int> - // void C::foo(int) mpl::vector<void, C, int> - // - template <class OverloadsT, class NameSpaceT, class SigT> - inline void - define_with_defaults( - char const* name, - OverloadsT const& overloads, - NameSpaceT& name_space, - SigT const&) - { - typedef typename mpl::front<SigT>::type return_type; - typedef typename OverloadsT::void_return_type void_return_type; - typedef typename OverloadsT::non_void_return_type non_void_return_type; - - typedef typename mpl::if_c< - is_same<void, return_type>::value - , void_return_type - , non_void_return_type - >::type stubs_type; - - BOOST_STATIC_ASSERT( - (stubs_type::max_args) <= mpl::size<SigT>::value); - - typedef typename stubs_type::template gen<SigT> gen_type; - define_with_defaults_helper<stubs_type::n_funcs-1>::def( - name - , gen_type() - , overloads.keywords() - , overloads.call_policies() - , name_space - , overloads.doc_string()); - } - -} // namespace detail - -}} // namespace boost::python - -#endif // DEFAULTS_DEF_JDG20020811_HPP - -#else // defined(BOOST_PP_IS_ITERATING) -// PP vertical iteration code - - -template <> -struct define_stub_function<BOOST_PP_ITERATION()> { - template <class StubsT, class CallPolicies, class NameSpaceT> - static void define( - char const* name - , StubsT const& - , keyword_range const& kw - , CallPolicies const& policies - , NameSpaceT& name_space - , char const* doc) - { - detail::name_space_def( - name_space - , name - , &StubsT::BOOST_PP_CAT(func_, BOOST_PP_ITERATION()) - , kw - , policies - , doc - , &name_space); - } -}; - -#endif // !defined(BOOST_PP_IS_ITERATING) diff --git a/contrib/restricted/boost/python/include/boost/python/detail/defaults_gen.hpp b/contrib/restricted/boost/python/include/boost/python/detail/defaults_gen.hpp deleted file mode 100644 index 88beeedb02..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/defaults_gen.hpp +++ /dev/null @@ -1,388 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright David Abrahams 2002, Joel de Guzman, 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) -// -/////////////////////////////////////////////////////////////////////////////// -#ifndef DEFAULTS_GEN_JDG20020807_HPP -#define DEFAULTS_GEN_JDG20020807_HPP - -#include <boost/python/detail/preprocessor.hpp> -#include <boost/preprocessor/repeat.hpp> -#include <boost/preprocessor/repeat_from_to.hpp> -#include <boost/preprocessor/enum.hpp> -#include <boost/preprocessor/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/tuple.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/arithmetic/sub.hpp> -#include <boost/preprocessor/stringize.hpp> -#include <boost/preprocessor/inc.hpp> -#include <boost/preprocessor/empty.hpp> -#include <boost/preprocessor/comma_if.hpp> -#include <boost/config.hpp> -#include <boost/mpl/begin_end.hpp> -#include <boost/mpl/next.hpp> -#include <boost/mpl/deref.hpp> -#include <cstddef> - -namespace boost { namespace python { - -namespace detail -{ - // overloads_base is used as a base class for all function - // stubs. This class holds the doc_string of the stubs. - struct overloads_base - { - overloads_base(char const* doc_) - : m_doc(doc_) {} - - overloads_base(char const* doc_, detail::keyword_range const& kw) - : m_doc(doc_), m_keywords(kw) {} - - char const* doc_string() const - { - return m_doc; - } - - detail::keyword_range const& keywords() const - { - return m_keywords; - } - - private: - char const* m_doc; - detail::keyword_range m_keywords; - }; - - // overloads_proxy is generated by the overloads_common operator[] (see - // below). This class holds a user defined call policies of the stubs. - template <class CallPoliciesT, class OverloadsT> - struct overloads_proxy - : public overloads_base - { - typedef typename OverloadsT::non_void_return_type non_void_return_type; - typedef typename OverloadsT::void_return_type void_return_type; - - overloads_proxy( - CallPoliciesT const& policies_ - , char const* doc - , keyword_range const& kw - ) - : overloads_base(doc, kw) - , policies(policies_) - {} - - CallPoliciesT - call_policies() const - { - return policies; - } - - CallPoliciesT policies; - }; - - // overloads_common is our default function stubs base class. This - // class returns the default_call_policies in its call_policies() - // member function. It can generate a overloads_proxy however through - // its operator[] - template <class DerivedT> - struct overloads_common - : public overloads_base - { - overloads_common(char const* doc) - : overloads_base(doc) {} - - overloads_common(char const* doc, keyword_range const& kw) - : overloads_base(doc, kw) {} - - default_call_policies - call_policies() const - { - return default_call_policies(); - } - - template <class CallPoliciesT> - overloads_proxy<CallPoliciesT, DerivedT> - operator[](CallPoliciesT const& policies) const - { - return overloads_proxy<CallPoliciesT, DerivedT>( - policies, this->doc_string(), this->keywords()); - } - }; - -}}} // namespace boost::python::detail - - -#define BOOST_PYTHON_TYPEDEF_GEN(z, index, data) \ - typedef typename ::boost::mpl::next<BOOST_PP_CAT(iter, index)>::type \ - BOOST_PP_CAT(iter, BOOST_PP_INC(index)); \ - typedef typename ::boost::mpl::deref<BOOST_PP_CAT(iter, index)>::type \ - BOOST_PP_CAT(T, index); - -#define BOOST_PYTHON_FUNC_WRAPPER_GEN(z, index, data) \ - static RT BOOST_PP_CAT(func_, \ - BOOST_PP_SUB_D(1, index, BOOST_PP_TUPLE_ELEM(3, 1, data))) ( \ - BOOST_PP_ENUM_BINARY_PARAMS_Z( \ - 1, index, T, arg)) \ - { \ - BOOST_PP_TUPLE_ELEM(3, 2, data) \ - BOOST_PP_TUPLE_ELEM(3, 0, data)( \ - BOOST_PP_ENUM_PARAMS( \ - index, \ - arg)); \ - } - -#define BOOST_PYTHON_GEN_FUNCTION(fname, fstubs_name, n_args, n_dflts, ret) \ - struct fstubs_name \ - { \ - BOOST_STATIC_CONSTANT(int, n_funcs = BOOST_PP_INC(n_dflts)); \ - BOOST_STATIC_CONSTANT(int, max_args = n_funcs); \ - \ - template <typename SigT> \ - struct gen \ - { \ - typedef typename ::boost::mpl::begin<SigT>::type rt_iter; \ - typedef typename ::boost::mpl::deref<rt_iter>::type RT; \ - typedef typename ::boost::mpl::next<rt_iter>::type iter0; \ - \ - BOOST_PP_REPEAT_2ND( \ - n_args, \ - BOOST_PYTHON_TYPEDEF_GEN, \ - 0) \ - \ - BOOST_PP_REPEAT_FROM_TO_2( \ - BOOST_PP_SUB_D(1, n_args, n_dflts), \ - BOOST_PP_INC(n_args), \ - BOOST_PYTHON_FUNC_WRAPPER_GEN, \ - (fname, BOOST_PP_SUB_D(1, n_args, n_dflts), ret)) \ - }; \ - }; \ - -/////////////////////////////////////////////////////////////////////////////// -#define BOOST_PYTHON_MEM_FUNC_WRAPPER_GEN(z, index, data) \ - static RT BOOST_PP_CAT(func_, \ - BOOST_PP_SUB_D(1, index, BOOST_PP_TUPLE_ELEM(3, 1, data))) ( \ - ClassT obj BOOST_PP_COMMA_IF(index) \ - BOOST_PP_ENUM_BINARY_PARAMS_Z(1, index, T, arg) \ - ) \ - { \ - BOOST_PP_TUPLE_ELEM(3, 2, data) obj.BOOST_PP_TUPLE_ELEM(3, 0, data)( \ - BOOST_PP_ENUM_PARAMS(index, arg) \ - ); \ - } - -#define BOOST_PYTHON_GEN_MEM_FUNCTION(fname, fstubs_name, n_args, n_dflts, ret) \ - struct fstubs_name \ - { \ - BOOST_STATIC_CONSTANT(int, n_funcs = BOOST_PP_INC(n_dflts)); \ - BOOST_STATIC_CONSTANT(int, max_args = n_funcs + 1); \ - \ - template <typename SigT> \ - struct gen \ - { \ - typedef typename ::boost::mpl::begin<SigT>::type rt_iter; \ - typedef typename ::boost::mpl::deref<rt_iter>::type RT; \ - \ - typedef typename ::boost::mpl::next<rt_iter>::type class_iter; \ - typedef typename ::boost::mpl::deref<class_iter>::type ClassT; \ - typedef typename ::boost::mpl::next<class_iter>::type iter0; \ - \ - BOOST_PP_REPEAT_2ND( \ - n_args, \ - BOOST_PYTHON_TYPEDEF_GEN, \ - 0) \ - \ - BOOST_PP_REPEAT_FROM_TO_2( \ - BOOST_PP_SUB_D(1, n_args, n_dflts), \ - BOOST_PP_INC(n_args), \ - BOOST_PYTHON_MEM_FUNC_WRAPPER_GEN, \ - (fname, BOOST_PP_SUB_D(1, n_args, n_dflts), ret)) \ - }; \ - }; - -#define BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts) \ - fstubs_name(char const* doc = 0) \ - : ::boost::python::detail::overloads_common<fstubs_name>(doc) {} \ - template <std::size_t N> \ - fstubs_name(char const* doc, ::boost::python::detail::keywords<N> const& keywords) \ - : ::boost::python::detail::overloads_common<fstubs_name>( \ - doc, keywords.range()) \ - { \ - typedef typename ::boost::python::detail:: \ - error::more_keywords_than_function_arguments< \ - N,n_args>::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; \ - } \ - template <std::size_t N> \ - fstubs_name(::boost::python::detail::keywords<N> const& keywords, char const* doc = 0) \ - : ::boost::python::detail::overloads_common<fstubs_name>( \ - doc, keywords.range()) \ - { \ - typedef typename ::boost::python::detail:: \ - error::more_keywords_than_function_arguments< \ - N,n_args>::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; \ - } - -# if defined(BOOST_NO_VOID_RETURNS) - -# define BOOST_PYTHON_GEN_FUNCTION_STUB(fname, fstubs_name, n_args, n_dflts) \ - struct fstubs_name \ - : public ::boost::python::detail::overloads_common<fstubs_name> \ - { \ - BOOST_PYTHON_GEN_FUNCTION( \ - fname, non_void_return_type, n_args, n_dflts, return) \ - BOOST_PYTHON_GEN_FUNCTION( \ - fname, void_return_type, n_args, n_dflts, ;) \ - \ - BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts) \ - }; - -# define BOOST_PYTHON_GEN_MEM_FUNCTION_STUB(fname, fstubs_name, n_args, n_dflts) \ - struct fstubs_name \ - : public ::boost::python::detail::overloads_common<fstubs_name> \ - { \ - BOOST_PYTHON_GEN_MEM_FUNCTION( \ - fname, non_void_return_type, n_args, n_dflts, return) \ - BOOST_PYTHON_GEN_MEM_FUNCTION( \ - fname, void_return_type, n_args, n_dflts, ;) \ - \ - BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args + 1, n_dflts) \ - }; - -# else // !defined(BOOST_NO_VOID_RETURNS) - -# define BOOST_PYTHON_GEN_FUNCTION_STUB(fname, fstubs_name, n_args, n_dflts) \ - struct fstubs_name \ - : public ::boost::python::detail::overloads_common<fstubs_name> \ - { \ - BOOST_PYTHON_GEN_FUNCTION( \ - fname, non_void_return_type, n_args, n_dflts, return) \ - \ - typedef non_void_return_type void_return_type; \ - BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts) \ - }; - - -# define BOOST_PYTHON_GEN_MEM_FUNCTION_STUB(fname, fstubs_name, n_args, n_dflts) \ - struct fstubs_name \ - : public ::boost::python::detail::overloads_common<fstubs_name> \ - { \ - BOOST_PYTHON_GEN_MEM_FUNCTION( \ - fname, non_void_return_type, n_args, n_dflts, return) \ - \ - typedef non_void_return_type void_return_type; \ - BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args + 1, n_dflts) \ - }; - -# endif // !defined(BOOST_NO_VOID_RETURNS) - -/////////////////////////////////////////////////////////////////////////////// -// -// MAIN MACROS -// -// Given generator_name, fname, min_args and max_args, These macros -// generate function stubs that forward to a function or member function -// named fname. max_args is the arity of the function or member function -// fname. fname can have default arguments. min_args is the minimum -// arity that fname can accept. -// -// There are two versions: -// -// 1. BOOST_PYTHON_FUNCTION_OVERLOADS for free functions -// 2. BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS for member functions. -// -// For instance, given a function: -// -// int -// foo(int a, char b = 1, unsigned c = 2, double d = 3) -// { -// return a + b + c + int(d); -// } -// -// The macro invocation: -// -// BOOST_PYTHON_FUNCTION_OVERLOADS(foo_stubs, foo, 1, 4) -// -// Generates this code: -// -// struct foo_stubsNonVoid -// { -// static const int n_funcs = 4; -// static const int max_args = n_funcs; -// -// template <typename SigT> -// struct gen -// { -// typedef typename ::boost::mpl::begin<SigT>::type rt_iter; -// typedef typename rt_iter::type RT; -// typedef typename rt_iter::next iter0; -// typedef typename iter0::type T0; -// typedef typename iter0::next iter1; -// typedef typename iter1::type T1; -// typedef typename iter1::next iter2; -// typedef typename iter2::type T2; -// typedef typename iter2::next iter3; -// typedef typename iter3::type T3; -// typedef typename iter3::next iter4; -// -// static RT func_0(T0 arg0) -// { return foo(arg0); } -// -// static RT func_1(T0 arg0, T1 arg1) -// { return foo(arg0, arg1); } -// -// static RT func_2(T0 arg0, T1 arg1, T2 arg2) -// { return foo(arg0, arg1, arg2); } -// -// static RT func_3(T0 arg0, T1 arg1, T2 arg2, T3 arg3) -// { return foo(arg0, arg1, arg2, arg3); } -// }; -// }; -// -// struct foo_overloads -// : public boost::python::detail::overloads_common<foo_overloads> -// { -// typedef foo_overloadsNonVoid non_void_return_type; -// typedef foo_overloadsNonVoid void_return_type; -// -// foo_overloads(char const* doc = 0) -// : boost::python::detail::overloads_common<foo_overloads>(doc) {} -// }; -// -// The typedefs non_void_return_type and void_return_type are -// used to handle compilers that do not support void returns. The -// example above typedefs non_void_return_type and -// void_return_type to foo_overloadsNonVoid. On compilers that do -// not support void returns, there are two versions: -// foo_overloadsNonVoid and foo_overloadsVoid. The "Void" -// version is almost identical to the "NonVoid" version except -// for the return type (void) and the lack of the return keyword. -// -// See the overloads_common above for a description of the -// foo_overloads' base class. -// -/////////////////////////////////////////////////////////////////////////////// -#define BOOST_PYTHON_FUNCTION_OVERLOADS(generator_name, fname, min_args, max_args) \ - BOOST_PYTHON_GEN_FUNCTION_STUB( \ - fname, \ - generator_name, \ - max_args, \ - BOOST_PP_SUB_D(1, max_args, min_args)) - -#define BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generator_name, fname, min_args, max_args) \ - BOOST_PYTHON_GEN_MEM_FUNCTION_STUB( \ - fname, \ - generator_name, \ - max_args, \ - BOOST_PP_SUB_D(1, max_args, min_args)) - -// deprecated macro names (to be removed) -#define BOOST_PYTHON_FUNCTION_GENERATOR BOOST_PYTHON_FUNCTION_OVERLOADS -#define BOOST_PYTHON_MEM_FUN_GENERATOR BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS - -/////////////////////////////////////////////////////////////////////////////// -#endif // DEFAULTS_GEN_JDG20020807_HPP - - diff --git a/contrib/restricted/boost/python/include/boost/python/detail/is_wrapper.hpp b/contrib/restricted/boost/python/include/boost/python/detail/is_wrapper.hpp deleted file mode 100644 index d7bce7b627..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/is_wrapper.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the 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_WRAPPER_DWA2004723_HPP -# define IS_WRAPPER_DWA2004723_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/mpl/bool.hpp> - -namespace boost { namespace python { - -template <class T> class wrapper; - -namespace detail -{ - typedef char (&is_not_wrapper)[2]; - is_not_wrapper is_wrapper_helper(...); - template <class T> - char is_wrapper_helper(wrapper<T> const volatile*); - - // A metafunction returning true iff T is [derived from] wrapper<U> - template <class T> - struct is_wrapper - : mpl::bool_<(sizeof(detail::is_wrapper_helper((T*)0)) == 1)> - {}; - -}}} // namespace boost::python::detail - -#endif // IS_WRAPPER_DWA2004723_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/make_keyword_range_fn.hpp b/contrib/restricted/boost/python/include/boost/python/detail/make_keyword_range_fn.hpp deleted file mode 100644 index c4795cf887..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/make_keyword_range_fn.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP -# define MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP - -# include <boost/python/make_function.hpp> -# include <boost/python/args_fwd.hpp> - -# include <boost/python/object/make_holder.hpp> - -# include <boost/mpl/size.hpp> - - -namespace boost { namespace python { namespace detail { - -// Think of this as a version of make_function without a compile-time -// check that the size of kw is no greater than the expected arity of -// F. This version is needed when defining functions with default -// arguments, because compile-time information about the number of -// keywords is missing for all but the initial function definition. -// -// @group make_keyword_range_function { -template <class F, class Policies> -object make_keyword_range_function( - F f - , Policies const& policies - , keyword_range const& kw) -{ - return detail::make_function_aux( - f, policies, detail::get_signature(f), kw, mpl::int_<0>()); -} - -template <class F, class Policies, class Signature> -object make_keyword_range_function( - F f - , Policies const& policies - , keyword_range const& kw - , Signature const& sig) -{ - return detail::make_function_aux( - f, policies, sig, kw, mpl::int_<0>()); -} -// } - -// Builds an '__init__' function which inserts the given Holder type -// in a wrapped C++ class instance. ArgList is an MPL type sequence -// describing the C++ argument types to be passed to Holder's -// constructor. -// -// Holder and ArgList are intended to be explicitly specified. -template <class ArgList, class Arity, class Holder, class CallPolicies> -object make_keyword_range_constructor( - CallPolicies const& policies // The CallPolicies with which to invoke the Holder's constructor - , detail::keyword_range const& kw // The (possibly empty) set of associated argument keywords - , Holder* = 0 - , ArgList* = 0, Arity* = 0) -{ -#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE) - python_class<BOOST_DEDUCED_TYPENAME Holder::value_type>::register_(); -#endif - return detail::make_keyword_range_function( - objects::make_holder<Arity::value> - ::template apply<Holder,ArgList>::execute - , policies - , kw); -} - -}}} // namespace boost::python::detail - -#endif // MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/nullary_function_adaptor.hpp b/contrib/restricted/boost/python/include/boost/python/detail/nullary_function_adaptor.hpp deleted file mode 100644 index 9dcc434f8e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/nullary_function_adaptor.hpp +++ /dev/null @@ -1,46 +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 NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP -# define NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/preprocessor/iteration/local.hpp> -# include <boost/preprocessor/facilities/intercept.hpp> -# include <boost/preprocessor/repetition/enum_params.hpp> -# include <boost/preprocessor/repetition/enum_binary_params.hpp> - -namespace boost { namespace python { namespace detail { - -// nullary_function_adaptor -- a class template which ignores its -// arguments and calls a nullary function instead. Used for building -// error-reporting functions, c.f. pure_virtual -template <class NullaryFunction> -struct nullary_function_adaptor -{ - nullary_function_adaptor(NullaryFunction fn) - : m_fn(fn) - {} - - void operator()() const { m_fn(); } - -# define BOOST_PP_LOCAL_MACRO(i) \ - template <BOOST_PP_ENUM_PARAMS_Z(1, i, class A)> \ - void operator()( \ - BOOST_PP_ENUM_BINARY_PARAMS_Z(1, i, A, const& BOOST_PP_INTERCEPT) \ - ) const \ - { \ - m_fn(); \ - } - -# define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY) -# include BOOST_PP_LOCAL_ITERATE() - - private: - NullaryFunction m_fn; -}; - -}}} // namespace boost::python::detail - -#endif // NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/operator_id.hpp b/contrib/restricted/boost/python/include/boost/python/detail/operator_id.hpp deleted file mode 100644 index ecfc70f108..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/operator_id.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef OPERATOR_ID_DWA2002531_HPP -# define OPERATOR_ID_DWA2002531_HPP - -namespace boost { namespace python { namespace detail { - -enum operator_id -{ - op_add, - op_sub, - op_mul, - op_div, - op_mod, - op_divmod, - op_pow, - op_lshift, - op_rshift, - op_and, - op_xor, - op_or, - op_neg, - op_pos, - op_abs, - op_invert, - op_int, - op_long, - op_float, - op_str, - op_cmp, - op_gt, - op_ge, - op_lt, - op_le, - op_eq, - op_ne, - op_iadd, - op_isub, - op_imul, - op_idiv, - op_imod, - op_ilshift, - op_irshift, - op_iand, - op_ixor, - op_ior, - op_complex, -#if PY_VERSION_HEX >= 0x03000000 - op_bool, -#else - op_nonzero, -#endif - op_repr -#if PY_VERSION_HEX >= 0x03000000 - ,op_truediv -#endif -}; - -}}} // namespace boost::python::detail - -#endif // OPERATOR_ID_DWA2002531_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/overloads_fwd.hpp b/contrib/restricted/boost/python/include/boost/python/detail/overloads_fwd.hpp deleted file mode 100644 index 4c7fdf292b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/overloads_fwd.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef OVERLOADS_FWD_DWA2002101_HPP -# define OVERLOADS_FWD_DWA2002101_HPP - -namespace boost { namespace python { namespace detail { - -// forward declarations -struct overloads_base; - -template <class OverloadsT, class NameSpaceT, class SigT> -inline void define_with_defaults(char const* name, OverloadsT const&, NameSpaceT&, SigT const&); - -}}} // namespace boost::python::detail - -#endif // OVERLOADS_FWD_DWA2002101_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/python_type.hpp b/contrib/restricted/boost/python/include/boost/python/detail/python_type.hpp deleted file mode 100644 index f7630c175a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/python_type.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Nikolay Mladenov 2007. -// Distributed under the 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_PYTHON_OBJECT_PYTHON_TYPE_H -#define BOOST_PYTHON_OBJECT_PYTHON_TYPE_H - -#include <boost/python/converter/registered.hpp> - -namespace boost {namespace python {namespace detail{ - - -template <class T> struct python_class : PyObject -{ - typedef python_class<T> this_type; - - typedef T type; - - static void *converter (PyObject *p){ - return p; - } - - static void register_() - { - static bool first_time = true; - - if ( !first_time ) return; - - first_time = false; - converter::registry::insert(&converter, boost::python::type_id<this_type>(), &converter::registered_pytype_direct<T>::get_pytype); - } -}; - - -}}} //namespace boost :: python :: detail - -#endif //BOOST_PYTHON_OBJECT_PYTHON_TYPE_H diff --git a/contrib/restricted/boost/python/include/boost/python/detail/scope.hpp b/contrib/restricted/boost/python/include/boost/python/detail/scope.hpp deleted file mode 100644 index 5367bbd35c..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/scope.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef SCOPE_DWA2002927_HPP -# define SCOPE_DWA2002927_HPP - -# include <boost/python/detail/config.hpp> - -namespace boost { namespace python { namespace detail { - -void BOOST_PYTHON_DECL scope_setattr_doc(char const* name, object const& obj, char const* doc); - -}}} // namespace boost::python::detail - -#endif // SCOPE_DWA2002927_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/target.hpp b/contrib/restricted/boost/python/include/boost/python/detail/target.hpp deleted file mode 100644 index 137801bb2b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/target.hpp +++ /dev/null @@ -1,86 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 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) - -# ifndef TARGET_DWA2002521_HPP -# define TARGET_DWA2002521_HPP - -# include <boost/python/detail/preprocessor.hpp> - -# include <boost/type.hpp> - -# include <boost/preprocessor/comma_if.hpp> -# include <boost/preprocessor/if.hpp> -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/debug/line.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/repetition/enum_trailing_params.hpp> - -namespace boost { namespace python { namespace detail { - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/target.hpp>, BOOST_PYTHON_FUNCTION_POINTER)) -# include BOOST_PP_ITERATE() - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (4, (0, BOOST_PYTHON_CV_COUNT - 1, <boost/python/detail/target.hpp>, BOOST_PYTHON_POINTER_TO_MEMBER)) -# include BOOST_PP_ITERATE() - -template <class R, class T> -T& (* target(R (T::*)) )() { return 0; } - -}}} // namespace boost::python::detail - -# endif // TARGET_DWA2002521_HPP - -/* --------------- function pointers --------------- */ -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, target.hpp(function_pointers)) -# endif - -# define N BOOST_PP_ITERATION() - -template <class R BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)> -BOOST_PP_IF(N, A0, void)(* target(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A))) )() -{ - return 0; -} - -# undef N - -/* --------------- pointers-to-members --------------- */ -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_POINTER_TO_MEMBER -// Outer over cv-qualifiers - -# define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/target.hpp>)) -# include BOOST_PP_ITERATE() - -#elif BOOST_PP_ITERATION_DEPTH() == 2 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, target.hpp(pointers-to-members)) -# endif -// Inner over arities - -# define N BOOST_PP_ITERATION() -# define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1)) - -template <class R, class T BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A)> -T& (* target(R (T::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q) )() -{ - return 0; -} - -# undef N -# undef Q - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/detail/translate_exception.hpp b/contrib/restricted/boost/python/include/boost/python/detail/translate_exception.hpp deleted file mode 100644 index 877db2b2c6..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/translate_exception.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef TRANSLATE_EXCEPTION_TDS20091020_HPP -# define TRANSLATE_EXCEPTION_TDS20091020_HPP - -# include <boost/python/detail/exception_handler.hpp> -# include <boost/python/detail/type_traits.hpp> - -# include <boost/call_traits.hpp> - -# include <boost/function/function0.hpp> - -namespace boost { namespace python { namespace detail { - -// A ternary function object used to translate C++ exceptions of type -// ExceptionType into Python exceptions by invoking an object of type -// Translate. Typically the translate function will be curried with -// boost::bind(). -template <class ExceptionType, class Translate> -struct translate_exception -{ -// workaround for broken gcc that ships with SuSE 9.0 and SuSE 9.1 -# if defined(__linux__) && defined(__GNUC__) \ - && BOOST_WORKAROUND(__GNUC__, == 3) \ - && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) \ - && (BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 1) \ - || BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 3)) - typedef typename remove_reference< - typename add_const<ExceptionType>::type - >::type exception_non_ref; -# else - typedef typename add_lvalue_reference< - typename add_const<ExceptionType>::type - >::type exception_cref; -# endif - - inline bool operator()( - exception_handler const& handler - , function0<void> const& f - , typename call_traits<Translate>::param_type translate) const - { - try - { - return handler(f); - } -// workaround for broken gcc that ships with SuSE 9.0 and SuSE 9.1 -# if defined(__linux__) && defined(__GNUC__) \ - && BOOST_WORKAROUND(__GNUC__, == 3) \ - && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) \ - && (BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 1) \ - || BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 3)) - catch(exception_non_ref& e) -# else - catch(exception_cref e) -# endif - { - translate(e); - return true; - } - } -}; - -}}} // namespace boost::python::detail - -#endif // TRANSLATE_EXCEPTION_DWA2002810_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/unwrap_type_id.hpp b/contrib/restricted/boost/python/include/boost/python/detail/unwrap_type_id.hpp deleted file mode 100644 index 96c1f53013..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/unwrap_type_id.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the 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 UNWRAP_TYPE_ID_DWA2004722_HPP -# define UNWRAP_TYPE_ID_DWA2004722_HPP - -# include <boost/python/type_id.hpp> - -# include <boost/mpl/bool.hpp> - -namespace boost { namespace python { - -template <class T> class wrapper; - -namespace detail { - -template <class T> -inline type_info unwrap_type_id(T*, ...) -{ - return type_id<T>(); -} - -template <class U, class T> -inline type_info unwrap_type_id(U*, wrapper<T>*) -{ - return type_id<T>(); -} - -}}} // namespace boost::python::detail - -#endif // UNWRAP_TYPE_ID_DWA2004722_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/unwrap_wrapper.hpp b/contrib/restricted/boost/python/include/boost/python/detail/unwrap_wrapper.hpp deleted file mode 100644 index 95bc233a72..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/unwrap_wrapper.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the 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 UNWRAP_WRAPPER_DWA2004723_HPP -# define UNWRAP_WRAPPER_DWA2004723_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/is_wrapper.hpp> -# include <boost/mpl/eval_if.hpp> -# include <boost/mpl/identity.hpp> - -namespace boost { namespace python { namespace detail { - -template <class T> -struct unwrap_wrapper_helper -{ - typedef typename T::_wrapper_wrapped_type_ type; -}; - -template <class T> -struct unwrap_wrapper_ - : mpl::eval_if<is_wrapper<T>,unwrap_wrapper_helper<T>,mpl::identity<T> > -{}; - -template <class T> -typename unwrap_wrapper_<T>::type* -unwrap_wrapper(T*) -{ - return 0; -} - -}}} // namespace boost::python::detail - -#endif // UNWRAP_WRAPPER_DWA2004723_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/enum.hpp b/contrib/restricted/boost/python/include/boost/python/enum.hpp deleted file mode 100644 index 9631a0edc8..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/enum.hpp +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef ENUM_DWA200298_HPP -# define ENUM_DWA200298_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object/enum_base.hpp> -# include <boost/python/converter/rvalue_from_python_data.hpp> -# include <boost/python/converter/registered.hpp> - -namespace boost { namespace python { - -template <class T> -struct enum_ : public objects::enum_base -{ - typedef objects::enum_base base; - - // Declare a new enumeration type in the current scope() - enum_(char const* name, char const* doc = 0); - - // Add a new enumeration value with the given name and value. - inline enum_<T>& value(char const* name, T); - - // Add all of the defined enumeration values to the current scope with the - // same names used here. - inline enum_<T>& export_values(); - private: - static PyObject* to_python(void const* x); - static void* convertible_from_python(PyObject* obj); - static void construct(PyObject* obj, converter::rvalue_from_python_stage1_data* data); -}; - -template <class T> -inline enum_<T>::enum_(char const* name, char const* doc ) - : base( - name - , &enum_<T>::to_python - , &enum_<T>::convertible_from_python - , &enum_<T>::construct - , type_id<T>() - , doc - ) -{ -} - -// This is the conversion function that gets registered for converting -// these enums to Python. -template <class T> -PyObject* enum_<T>::to_python(void const* x) -{ - return base::to_python( - converter::registered<T>::converters.m_class_object - , static_cast<long>(*(T const*)x)); -} - -// -// The following two static functions serve as the elements of an -// rvalue from_python converter for the enumeration type. -// - -// This checks that a given Python object can be converted to the -// enumeration type. -template <class T> -void* enum_<T>::convertible_from_python(PyObject* obj) -{ - return PyObject_IsInstance( - obj - , upcast<PyObject>( - converter::registered<T>::converters.m_class_object)) - - ? obj : 0; -} - -// Constructs an instance of the enumeration type in the from_python -// data. -template <class T> -void enum_<T>::construct(PyObject* obj, converter::rvalue_from_python_stage1_data* data) -{ -#if PY_VERSION_HEX >= 0x03000000 - T x = static_cast<T>(PyLong_AS_LONG(obj)); -#else - T x = static_cast<T>(PyInt_AS_LONG(obj)); -#endif - void* const storage = ((converter::rvalue_from_python_storage<T>*)data)->storage.bytes; - new (storage) T(x); - data->convertible = storage; -} - -template <class T> -inline enum_<T>& enum_<T>::value(char const* name, T x) -{ - this->add_value(name, static_cast<long>(x)); - return *this; -} - -template <class T> -inline enum_<T>& enum_<T>::export_values() -{ - this->base::export_values(); - return *this; -} - -}} // namespace boost::python - -#endif // ENUM_DWA200298_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/exception_translator.hpp b/contrib/restricted/boost/python/include/boost/python/exception_translator.hpp deleted file mode 100644 index 1aa1465bdf..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/exception_translator.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef EXCEPTION_TRANSLATOR_DWA2002810_HPP -# define EXCEPTION_TRANSLATOR_DWA2002810_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/bind/bind.hpp> -# include <boost/bind/placeholders.hpp> -# include <boost/type.hpp> -# include <boost/python/detail/translate_exception.hpp> -# include <boost/python/detail/exception_handler.hpp> - -namespace boost { namespace python { - -template <class ExceptionType, class Translate> -void register_exception_translator(Translate translate, boost::type<ExceptionType>* = 0) -{ - using namespace boost::placeholders; - detail::register_exception_handler( - boost::bind<bool>(detail::translate_exception<ExceptionType,Translate>(), _1, _2, translate) - ); -} - -}} // namespace boost::python - -#endif // EXCEPTION_TRANSLATOR_DWA2002810_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/has_back_reference.hpp b/contrib/restricted/boost/python/include/boost/python/has_back_reference.hpp deleted file mode 100644 index 67fe24c5cf..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/has_back_reference.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef HAS_BACK_REFERENCE_DWA2002323_HPP -# define HAS_BACK_REFERENCE_DWA2002323_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/mpl/bool.hpp> - -namespace boost { namespace python { - -// traits class which users can specialize to indicate that a class -// contains a back-reference to its owning PyObject* -template <class T> -struct has_back_reference - : mpl::false_ -{ -}; - - -}} // namespace boost::python - -#endif // HAS_BACK_REFERENCE_DWA2002323_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/implicit.hpp b/contrib/restricted/boost/python/include/boost/python/implicit.hpp deleted file mode 100644 index 4d01b2fb22..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/implicit.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef IMPLICIT_DWA2002325_HPP -# define IMPLICIT_DWA2002325_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/type.hpp> -# include <boost/python/converter/implicit.hpp> -# include <boost/python/converter/registry.hpp> -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -# include <boost/python/converter/pytype_function.hpp> -#endif -# include <boost/python/type_id.hpp> - -namespace boost { namespace python { - -template <class Source, class Target> -void implicitly_convertible(boost::type<Source>* = 0, boost::type<Target>* = 0) -{ - typedef converter::implicit<Source,Target> functions; - - converter::registry::push_back( - &functions::convertible - , &functions::construct - , type_id<Target>() -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - , &converter::expected_from_python_type_direct<Source>::get_pytype -#endif - ); -} - -}} // namespace boost::python - -#endif // IMPLICIT_DWA2002325_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/init.hpp b/contrib/restricted/boost/python/include/boost/python/init.hpp deleted file mode 100644 index 0ee763cc26..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/init.hpp +++ /dev/null @@ -1,399 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright David Abrahams 2002, Joel de Guzman, 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) -// -/////////////////////////////////////////////////////////////////////////////// -#ifndef INIT_JDG20020820_HPP -#define INIT_JDG20020820_HPP - -# include <boost/python/detail/prefix.hpp> - -#include <boost/python/detail/type_list.hpp> -#include <boost/python/args_fwd.hpp> -#include <boost/python/detail/make_keyword_range_fn.hpp> -#include <boost/python/def_visitor.hpp> - -#include <boost/mpl/if.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/size.hpp> -#include <boost/mpl/iterator_range.hpp> -#include <boost/mpl/empty.hpp> -#include <boost/mpl/begin_end.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/prior.hpp> -#include <boost/mpl/joint_view.hpp> -#include <boost/mpl/back.hpp> - -#include <boost/python/detail/type_traits.hpp> - -#include <boost/preprocessor/enum_params_with_a_default.hpp> -#include <boost/preprocessor/enum_params.hpp> - -#include <utility> - -/////////////////////////////////////////////////////////////////////////////// -#define BOOST_PYTHON_OVERLOAD_TYPES_WITH_DEFAULT \ - BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \ - BOOST_PYTHON_MAX_ARITY, \ - class T, \ - mpl::void_) \ - -#define BOOST_PYTHON_OVERLOAD_TYPES \ - BOOST_PP_ENUM_PARAMS_Z(1, \ - BOOST_PYTHON_MAX_ARITY, \ - class T) \ - -#define BOOST_PYTHON_OVERLOAD_ARGS \ - BOOST_PP_ENUM_PARAMS_Z(1, \ - BOOST_PYTHON_MAX_ARITY, \ - T) \ - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace python { - -template <BOOST_PYTHON_OVERLOAD_TYPES_WITH_DEFAULT> -class init; // forward declaration - - -template <BOOST_PYTHON_OVERLOAD_TYPES_WITH_DEFAULT> -struct optional; // forward declaration - -namespace detail -{ - namespace error - { - template <int keywords, int init_args> - struct more_keywords_than_init_arguments - { - typedef char too_many_keywords[init_args - keywords >= 0 ? 1 : -1] BOOST_ATTRIBUTE_UNUSED; - }; - } - - // is_optional<T>::value - // - // This metaprogram checks if T is an optional - // - - template <class T> - struct is_optional - : mpl::false_ - {}; - - template <BOOST_PYTHON_OVERLOAD_TYPES> - struct is_optional<optional<BOOST_PYTHON_OVERLOAD_ARGS> > - : mpl::true_ - {}; - - - template <int NDefaults> - struct define_class_init_helper; - -} // namespace detail - -template <class DerivedT> -struct init_base : def_visitor<DerivedT> -{ - init_base(char const* doc_, detail::keyword_range const& keywords_) - : m_doc(doc_), m_keywords(keywords_) - {} - - init_base(char const* doc_) - : m_doc(doc_) - {} - - DerivedT const& derived() const - { - return *static_cast<DerivedT const*>(this); - } - - char const* doc_string() const - { - return m_doc; - } - - detail::keyword_range const& keywords() const - { - return m_keywords; - } - - static default_call_policies call_policies() - { - return default_call_policies(); - } - - private: - // visit - // - // Defines a set of n_defaults + 1 constructors for its - // class_<...> argument. Each constructor after the first has - // one less argument to its right. Example: - // - // init<int, optional<char, long, double> > - // - // Defines: - // - // __init__(int, char, long, double) - // __init__(int, char, long) - // __init__(int, char) - // __init__(int) - template <class classT> - void visit(classT& cl) const - { - typedef typename DerivedT::signature signature; - typedef typename DerivedT::n_arguments n_arguments; - typedef typename DerivedT::n_defaults n_defaults; - - detail::define_class_init_helper<n_defaults::value>::apply( - cl - , derived().call_policies() - , signature() - , n_arguments() - , derived().doc_string() - , derived().keywords()); - } - - friend class python::def_visitor_access; - - private: // data members - char const* m_doc; - detail::keyword_range m_keywords; -}; - -template <class CallPoliciesT, class InitT> -class init_with_call_policies - : public init_base<init_with_call_policies<CallPoliciesT, InitT> > -{ - typedef init_base<init_with_call_policies<CallPoliciesT, InitT> > base; - public: - typedef typename InitT::n_arguments n_arguments; - typedef typename InitT::n_defaults n_defaults; - typedef typename InitT::signature signature; - - init_with_call_policies( - CallPoliciesT const& policies_ - , char const* doc_ - , detail::keyword_range const& keywords - ) - : base(doc_, keywords) - , m_policies(policies_) - {} - - CallPoliciesT const& call_policies() const - { - return this->m_policies; - } - - private: // data members - CallPoliciesT m_policies; -}; - -// -// drop1<S> is the initial length(S) elements of S -// -namespace detail -{ - template <class S> - struct drop1 - : mpl::iterator_range< - typename mpl::begin<S>::type - , typename mpl::prior< - typename mpl::end<S>::type - >::type - > - {}; -} - -template <BOOST_PYTHON_OVERLOAD_TYPES> -class init : public init_base<init<BOOST_PYTHON_OVERLOAD_ARGS> > -{ - typedef init_base<init<BOOST_PYTHON_OVERLOAD_ARGS> > base; - public: - typedef init<BOOST_PYTHON_OVERLOAD_ARGS> self_t; - - init(char const* doc_ = 0) - : base(doc_) - { - } - - template <std::size_t N> - init(char const* doc_, detail::keywords<N> const& kw) - : base(doc_, kw.range()) - { - typedef typename detail::error::more_keywords_than_init_arguments< - N, n_arguments::value + 1 - >::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; - } - - template <std::size_t N> - init(detail::keywords<N> const& kw, char const* doc_ = 0) - : base(doc_, kw.range()) - { - typedef typename detail::error::more_keywords_than_init_arguments< - N, n_arguments::value + 1 - >::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; - } - - template <class CallPoliciesT> - init_with_call_policies<CallPoliciesT, self_t> - operator[](CallPoliciesT const& policies) const - { - return init_with_call_policies<CallPoliciesT, self_t>( - policies, this->doc_string(), this->keywords()); - } - - typedef detail::type_list<BOOST_PYTHON_OVERLOAD_ARGS> signature_; - - typedef detail::is_optional< - typename mpl::eval_if< - mpl::empty<signature_> - , mpl::false_ - , mpl::back<signature_> - >::type - > back_is_optional; - - typedef typename mpl::eval_if< - back_is_optional - , mpl::back<signature_> - , mpl::vector0<> - >::type optional_args; - - typedef typename mpl::eval_if< - back_is_optional - , mpl::if_< - mpl::empty<optional_args> - , detail::drop1<signature_> - , mpl::joint_view< - detail::drop1<signature_> - , optional_args - > - > - , signature_ - >::type signature; - - // TODO: static assert to make sure there are no other optional elements - - // Count the number of default args - typedef mpl::size<optional_args> n_defaults; - typedef mpl::size<signature> n_arguments; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// optional -// -// optional<T0...TN>::type returns a typelist. -// -/////////////////////////////////////////////////////////////////////////////// -template <BOOST_PYTHON_OVERLOAD_TYPES> -struct optional - : detail::type_list<BOOST_PYTHON_OVERLOAD_ARGS> -{ -}; - -namespace detail -{ - template <class ClassT, class CallPoliciesT, class Signature, class NArgs> - inline void def_init_aux( - ClassT& cl - , Signature const& - , NArgs - , CallPoliciesT const& policies - , char const* doc - , detail::keyword_range const& keywords_ - ) - { - cl.def( - "__init__" - , detail::make_keyword_range_constructor<Signature,NArgs>( - policies - , keywords_ - , (typename ClassT::metadata::holder*)0 - ) - , doc - ); - } - - /////////////////////////////////////////////////////////////////////////////// - // - // define_class_init_helper<N>::apply - // - // General case - // - // Accepts a class_ and an arguments list. Defines a constructor - // for the class given the arguments and recursively calls - // define_class_init_helper<N-1>::apply with one fewer argument (the - // rightmost argument is shaved off) - // - /////////////////////////////////////////////////////////////////////////////// - template <int NDefaults> - struct define_class_init_helper - { - - template <class ClassT, class CallPoliciesT, class Signature, class NArgs> - static void apply( - ClassT& cl - , CallPoliciesT const& policies - , Signature const& args - , NArgs - , char const* doc - , detail::keyword_range keywords) - { - detail::def_init_aux(cl, args, NArgs(), policies, doc, keywords); - - if (keywords.second > keywords.first) - --keywords.second; - - typedef typename mpl::prior<NArgs>::type next_nargs; - define_class_init_helper<NDefaults-1>::apply( - cl, policies, Signature(), next_nargs(), doc, keywords); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // - // define_class_init_helper<0>::apply - // - // Terminal case - // - // Accepts a class_ and an arguments list. Defines a constructor - // for the class given the arguments. - // - /////////////////////////////////////////////////////////////////////////////// - template <> - struct define_class_init_helper<0> { - - template <class ClassT, class CallPoliciesT, class Signature, class NArgs> - static void apply( - ClassT& cl - , CallPoliciesT const& policies - , Signature const& args - , NArgs - , char const* doc - , detail::keyword_range const& keywords) - { - detail::def_init_aux(cl, args, NArgs(), policies, doc, keywords); - } - }; -} - -}} // namespace boost::python - -#undef BOOST_PYTHON_OVERLOAD_TYPES_WITH_DEFAULT -#undef BOOST_PYTHON_OVERLOAD_TYPES -#undef BOOST_PYTHON_OVERLOAD_ARGS -#undef BOOST_PYTHON_IS_OPTIONAL_VALUE -#undef BOOST_PYTHON_APPEND_TO_INIT - -/////////////////////////////////////////////////////////////////////////////// -#endif // INIT_JDG20020820_HPP - - - - - - - - diff --git a/contrib/restricted/boost/python/include/boost/python/iterator.hpp b/contrib/restricted/boost/python/include/boost/python/iterator.hpp deleted file mode 100644 index b0ea578959..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/iterator.hpp +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef ITERATOR_DWA2002512_HPP -# define ITERATOR_DWA2002512_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/detail/target.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/object/iterator.hpp> -# include <boost/python/object_core.hpp> - -# if defined(BOOST_MSVC) && (BOOST_MSVC == 1400) /* -> warning C4180: qualifier applied to function type has no meaning; ignored -Peter Dimov wrote: -This warning is caused by an overload resolution bug in VC8 that cannot be -worked around and will probably not be fixed by MS in the VC8 line. The -problematic overload is only instantiated and never called, and the code -works correctly. */ -# pragma warning(disable: 4180) -# endif - -# include <boost/bind/bind.hpp> -# include <boost/bind/protect.hpp> - -namespace boost { namespace python { - -namespace detail -{ - // Adds an additional layer of binding to - // objects::make_iterator(...), which allows us to pass member - // function and member data pointers. - template <class Target, class Accessor1, class Accessor2, class NextPolicies> - inline object make_iterator( - Accessor1 get_start - , Accessor2 get_finish - , NextPolicies next_policies - , Target&(*)() - ) - { - using namespace boost::placeholders; - return objects::make_iterator_function<Target>( - boost::protect(boost::bind(get_start, _1)) - , boost::protect(boost::bind(get_finish, _1)) - , next_policies - ); - } - - // Guts of template class iterators<>, below. - template <bool const_ = false> - struct iterators_impl - { - template <class T> - struct apply - { - typedef typename T::iterator iterator; - static iterator begin(T& x) { return x.begin(); } - static iterator end(T& x) { return x.end(); } - }; - }; - - template <> - struct iterators_impl<true> - { - template <class T> - struct apply - { - typedef typename T::const_iterator iterator; - static iterator begin(T& x) { return x.begin(); } - static iterator end(T& x) { return x.end(); } - }; - }; -} - -// An "ordinary function generator" which contains static begin(x) and -// end(x) functions that invoke T::begin() and T::end(), respectively. -template <class T> -struct iterators - : detail::iterators_impl< - detail::is_const<T>::value - >::template apply<T> -{ -}; - -// Create an iterator-building function which uses the given -// accessors. Deduce the Target type from the accessors. The iterator -// returns copies of the inderlying elements. -template <class Accessor1, class Accessor2> -object range(Accessor1 start, Accessor2 finish) -{ - return detail::make_iterator( - start, finish - , objects::default_iterator_call_policies() - , detail::target(start) - ); -} - -// Create an iterator-building function which uses the given accessors -// and next() policies. Deduce the Target type. -template <class NextPolicies, class Accessor1, class Accessor2> -object range(Accessor1 start, Accessor2 finish, NextPolicies* = 0) -{ - return detail::make_iterator(start, finish, NextPolicies(), detail::target(start)); -} - -// Create an iterator-building function which uses the given accessors -// and next() policies, operating on the given Target type -template <class NextPolicies, class Target, class Accessor1, class Accessor2> -object range(Accessor1 start, Accessor2 finish, NextPolicies* = 0, boost::type<Target>* = 0) -{ - // typedef typename add_reference<Target>::type target; - return detail::make_iterator(start, finish, NextPolicies(), (Target&(*)())0); -} - -// A Python callable object which produces an iterator traversing -// [x.begin(), x.end()), where x is an instance of the Container -// type. NextPolicies are used as the CallPolicies for the iterator's -// next() function. -template <class Container - , class NextPolicies = objects::default_iterator_call_policies> -struct iterator : object -{ - iterator() - : object( - python::range<NextPolicies>( - &iterators<Container>::begin, &iterators<Container>::end - )) - { - } -}; - -}} // namespace boost::python - -#endif // ITERATOR_DWA2002512_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/lvalue_from_pytype.hpp b/contrib/restricted/boost/python/include/boost/python/lvalue_from_pytype.hpp deleted file mode 100644 index 59d31b89cf..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/lvalue_from_pytype.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef LVALUE_FROM_PYTYPE_DWA2002130_HPP -# define LVALUE_FROM_PYTYPE_DWA2002130_HPP - -# include <boost/python/detail/prefix.hpp> -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -# include <boost/python/converter/pytype_function.hpp> -#endif - -# include <boost/python/type_id.hpp> -# include <boost/python/converter/registry.hpp> -# include <boost/python/detail/void_ptr.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { - -namespace detail -{ - // Given a pointer-to-function of 1 parameter returning a reference - // type, return the type_id of the function's return type. - template <class T, class U> - inline type_info extractor_type_id(T&(*)(U)) - { - return type_id<T>(); - } - - // A function generator whose static execute() function is an lvalue - // from_python converter using the given Extractor. U is expected to - // be the actual type of the PyObject instance from which the result - // is being extracted. - template <class Extractor, class U> - struct normalized_extractor - { - static inline void* execute(PyObject* op) - { - typedef typename add_lvalue_reference<U>::type param; - return &Extractor::execute( - boost::python::detail::void_ptr_to_reference( - op, (param(*)())0 ) - ); - } - }; - - // Given an Extractor type and a pointer to its execute function, - // return a new object whose static execute function does the same - // job but is a conforming lvalue from_python conversion function. - // - // usage: normalize<Extractor>(&Extractor::execute) - template <class Extractor, class T, class U> - inline normalized_extractor<Extractor,U> - normalize(T(*)(U), Extractor* = 0) - { - return normalized_extractor<Extractor, U>(); - } -} - -// An Extractor which extracts the given member from a Python object -// whose instances are stored as InstanceType. -template <class InstanceType, class MemberType, MemberType (InstanceType::*member)> -struct extract_member -{ - static MemberType& execute(InstanceType& c) - { - (void)Py_TYPE(&c); // static assertion - return c.*member; - } -}; - -// An Extractor which simply extracts the entire python object -// instance of InstanceType. -template <class InstanceType> -struct extract_identity -{ - static InstanceType& execute(InstanceType& c) - { - (void)Py_TYPE(&c); // static assertion - return c; - } -}; - -// Registers a from_python conversion which extracts lvalues using -// Extractor's static execute function from Python objects whose type -// object is python_type. -template <class Extractor, PyTypeObject const* python_type> -struct lvalue_from_pytype -{ - lvalue_from_pytype() - { - converter::registry::insert - ( &extract - , detail::extractor_type_id(&Extractor::execute) -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - , &get_pytype -#endif - ); - } - private: - static void* extract(PyObject* op) - { - return PyObject_TypeCheck(op, const_cast<PyTypeObject*>(python_type)) - ? const_cast<void*>( - static_cast<void const volatile*>( - detail::normalize<Extractor>(&Extractor::execute).execute(op))) - : 0 - ; - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static PyTypeObject const*get_pytype() { return python_type; } -#endif -}; - -}} // namespace boost::python - -#endif // LVALUE_FROM_PYTYPE_DWA2002130_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/make_constructor.hpp b/contrib/restricted/boost/python/include/boost/python/make_constructor.hpp deleted file mode 100644 index 3ec9ad5f86..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/make_constructor.hpp +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef MAKE_CONSTRUCTOR_DWA20011221_HPP -# define MAKE_CONSTRUCTOR_DWA20011221_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/default_call_policies.hpp> -# include <boost/python/args.hpp> -# include <boost/python/object_fwd.hpp> - -# include <boost/python/object/function_object.hpp> -# include <boost/python/object/make_holder.hpp> -# include <boost/python/object/pointer_holder.hpp> -# include <boost/python/converter/context_result_converter.hpp> - -# include <boost/python/detail/caller.hpp> -# include <boost/python/detail/none.hpp> - -# include <boost/mpl/size.hpp> -# include <boost/mpl/int.hpp> -# include <boost/mpl/push_front.hpp> -# include <boost/mpl/pop_front.hpp> -# include <boost/mpl/assert.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <class T> - struct install_holder : converter::context_result_converter - { - install_holder(PyObject* args_) - : m_self(PyTuple_GetItem(args_, 0)) {} - - PyObject* operator()(T x) const - { - dispatch(x, is_pointer<T>()); - return none(); - } - - private: - template <class U> - void dispatch(U* x, detail::true_) const - { -#if defined(BOOST_NO_CXX11_SMART_PTR) - std::auto_ptr<U> owner(x); - dispatch(owner, detail::false_()); -#else - std::unique_ptr<U> owner(x); - dispatch(std::move(owner), detail::false_()); -#endif - } - - template <class Ptr> - void dispatch(Ptr x, detail::false_) const - { - typedef typename pointee<Ptr>::type value_type; - typedef objects::pointer_holder<Ptr,value_type> holder; - typedef objects::instance<holder> instance_t; - - void* memory = holder::allocate(this->m_self, offsetof(instance_t, storage), sizeof(holder)); - try { -#if defined(BOOST_NO_CXX11_SMART_PTR) - (new (memory) holder(x))->install(this->m_self); -#else - (new (memory) holder(std::move(x)))->install(this->m_self); -#endif - } - catch(...) { - holder::deallocate(this->m_self, memory); - throw; - } - } - - PyObject* m_self; - }; - - struct constructor_result_converter - { - template <class T> - struct apply - { - typedef install_holder<T> type; - }; - }; - - template <class BaseArgs, class Offset> - struct offset_args - { - offset_args(BaseArgs base_) : base(base_) {} - BaseArgs base; - }; - - template <int N, class BaseArgs, class Offset> - inline PyObject* get(mpl::int_<N>, offset_args<BaseArgs,Offset> const& args_) - { - return get(mpl::int_<(N+Offset::value)>(), args_.base); - } - - template <class BaseArgs, class Offset> - inline unsigned arity(offset_args<BaseArgs,Offset> const& args_) - { - return arity(args_.base) - Offset::value; - } - - template <class BasePolicy_ = default_call_policies> - struct constructor_policy : BasePolicy_ - { - constructor_policy(BasePolicy_ base) : BasePolicy_(base) {} - - // If the BasePolicy_ supplied a result converter it would be - // ignored; issue an error if it's not the default. - BOOST_MPL_ASSERT_MSG( - (is_same< - typename BasePolicy_::result_converter - , default_result_converter - >::value) - , MAKE_CONSTRUCTOR_SUPPLIES_ITS_OWN_RESULT_CONVERTER_THAT_WOULD_OVERRIDE_YOURS - , (typename BasePolicy_::result_converter) - ); - typedef constructor_result_converter result_converter; - typedef offset_args<typename BasePolicy_::argument_package, mpl::int_<1> > argument_package; - }; - - template <class InnerSignature> - struct outer_constructor_signature - { - typedef typename mpl::pop_front<InnerSignature>::type inner_args; - typedef typename mpl::push_front<inner_args,object>::type outer_args; - typedef typename mpl::push_front<outer_args,void>::type type; - }; - - // ETI workaround - template <> - struct outer_constructor_signature<int> - { - typedef int type; - }; - - // - // These helper functions for make_constructor (below) do the raw work - // of constructing a Python object from some invokable entity. See - // <boost/python/detail/caller.hpp> for more information about how - // the Sig arguments is used. - // - // @group make_constructor_aux { - template <class F, class CallPolicies, class Sig> - object make_constructor_aux( - F f // An object that can be invoked by detail::invoke() - , CallPolicies const& p // CallPolicies to use in the invocation - , Sig const& // An MPL sequence of argument types expected by F - ) - { - typedef typename outer_constructor_signature<Sig>::type outer_signature; - - typedef constructor_policy<CallPolicies> inner_policy; - - return objects::function_object( - objects::py_function( - detail::caller<F,inner_policy,Sig>(f, inner_policy(p)) - , outer_signature() - ) - ); - } - - // As above, except that it accepts argument keywords. NumKeywords - // is used only for a compile-time assertion to make sure the user - // doesn't pass more keywords than the function can accept. To - // disable all checking, pass mpl::int_<0> for NumKeywords. - template <class F, class CallPolicies, class Sig, class NumKeywords> - object make_constructor_aux( - F f - , CallPolicies const& p - , Sig const& - , detail::keyword_range const& kw // a [begin,end) pair of iterators over keyword names - , NumKeywords // An MPL integral type wrapper: the size of kw - ) - { - enum { arity = mpl::size<Sig>::value - 1 }; - - typedef typename detail::error::more_keywords_than_function_arguments< - NumKeywords::value, arity - >::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; - - typedef typename outer_constructor_signature<Sig>::type outer_signature; - - typedef constructor_policy<CallPolicies> inner_policy; - - return objects::function_object( - objects::py_function( - detail::caller<F,inner_policy,Sig>(f, inner_policy(p)) - , outer_signature() - ) - , kw - ); - } - // } - - // - // These dispatch functions are used to discriminate between the - // cases when the 3rd argument is keywords or when it is a - // signature. - // - // @group Helpers for make_constructor when called with 3 arguments. { - // - template <class F, class CallPolicies, class Keywords> - object make_constructor_dispatch(F f, CallPolicies const& policies, Keywords const& kw, mpl::true_) - { - return detail::make_constructor_aux( - f - , policies - , detail::get_signature(f) - , kw.range() - , mpl::int_<Keywords::size>() - ); - } - - template <class F, class CallPolicies, class Signature> - object make_constructor_dispatch(F f, CallPolicies const& policies, Signature const& sig, mpl::false_) - { - return detail::make_constructor_aux( - f - , policies - , sig - ); - } - // } -} - -// These overloaded functions wrap a function or member function -// pointer as a Python object, using optional CallPolicies, -// Keywords, and/or Signature. @group { -// -template <class F> -object make_constructor(F f) -{ - return detail::make_constructor_aux( - f,default_call_policies(), detail::get_signature(f)); -} - -template <class F, class CallPolicies> -object make_constructor(F f, CallPolicies const& policies) -{ - return detail::make_constructor_aux( - f, policies, detail::get_signature(f)); -} - -template <class F, class CallPolicies, class KeywordsOrSignature> -object make_constructor( - F f - , CallPolicies const& policies - , KeywordsOrSignature const& keywords_or_signature) -{ - typedef typename - detail::is_reference_to_keywords<KeywordsOrSignature&>::type - is_kw; - - return detail::make_constructor_dispatch( - f - , policies - , keywords_or_signature - , is_kw() - ); -} - -template <class F, class CallPolicies, class Keywords, class Signature> -object make_constructor( - F f - , CallPolicies const& policies - , Keywords const& kw - , Signature const& sig - ) -{ - return detail::make_constructor_aux( - f - , policies - , sig - , kw.range() - , mpl::int_<Keywords::size>() - ); -} -// } - -}} - - -#endif // MAKE_CONSTRUCTOR_DWA20011221_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/manage_new_object.hpp b/contrib/restricted/boost/python/include/boost/python/manage_new_object.hpp deleted file mode 100644 index 9ff341c1ac..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/manage_new_object.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef MANAGE_NEW_OBJECT_DWA200222_HPP -# define MANAGE_NEW_OBJECT_DWA200222_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/mpl/if.hpp> -# include <boost/python/to_python_indirect.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <class R> - struct manage_new_object_requires_a_pointer_return_type -# if defined(__GNUC__) || defined(__EDG__) - {} -# endif - ; -} - -struct manage_new_object -{ - template <class T> - struct apply - { - typedef typename mpl::if_c< - detail::is_pointer<T>::value - , to_python_indirect<T, detail::make_owning_holder> - , detail::manage_new_object_requires_a_pointer_return_type<T> - >::type type; - }; -}; - -}} // namespace boost::python - -#endif // MANAGE_NEW_OBJECT_DWA200222_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/module.hpp b/contrib/restricted/boost/python/include/boost/python/module.hpp deleted file mode 100644 index 8ad69f5a34..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/module.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef MODULE_DWA2001128_HPP -# define MODULE_DWA2001128_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/module_init.hpp> -# define BOOST_PYTHON_MODULE BOOST_PYTHON_MODULE_INIT - -#endif // MODULE_DWA20011221_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/module_init.hpp b/contrib/restricted/boost/python/include/boost/python/module_init.hpp deleted file mode 100644 index 7fe5a1c8a2..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/module_init.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef MODULE_INIT_DWA20020722_HPP -# define MODULE_INIT_DWA20020722_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/preprocessor/cat.hpp> -# include <boost/preprocessor/stringize.hpp> - -# ifndef BOOST_PYTHON_MODULE_INIT - -namespace boost { namespace python { namespace detail { - -# if PY_VERSION_HEX >= 0x03000000 - -BOOST_PYTHON_DECL PyObject* init_module(PyModuleDef&, void(*)()); - -#else - -BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*)()); - -#endif - -}}} - -# if PY_VERSION_HEX >= 0x03000000 - -# define _BOOST_PYTHON_MODULE_INIT(name) \ - PyObject* BOOST_PP_CAT(PyInit_, name)() \ - { \ - static PyModuleDef_Base initial_m_base = { \ - PyObject_HEAD_INIT(NULL) \ - 0, /* m_init */ \ - 0, /* m_index */ \ - 0 /* m_copy */ }; \ - static PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } }; \ - \ - static struct PyModuleDef moduledef = { \ - initial_m_base, \ - BOOST_PP_STRINGIZE(name), \ - 0, /* m_doc */ \ - -1, /* m_size */ \ - initial_methods, \ - 0, /* m_reload */ \ - 0, /* m_traverse */ \ - 0, /* m_clear */ \ - 0, /* m_free */ \ - }; \ - \ - return boost::python::detail::init_module( \ - moduledef, BOOST_PP_CAT(init_module_, name) ); \ - } \ - void BOOST_PP_CAT(init_module_, name)() - -# else - -# define _BOOST_PYTHON_MODULE_INIT(name) \ - void BOOST_PP_CAT(init,name)() \ -{ \ - boost::python::detail::init_module( \ - BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \ -} \ - void BOOST_PP_CAT(init_module_,name)() - -# endif - -# define BOOST_PYTHON_MODULE_INIT(name) \ - void BOOST_PP_CAT(init_module_,name)(); \ -extern "C" BOOST_SYMBOL_EXPORT _BOOST_PYTHON_MODULE_INIT(name) - -# endif - -#endif // MODULE_INIT_DWA20020722_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/class_metadata.hpp b/contrib/restricted/boost/python/include/boost/python/object/class_metadata.hpp deleted file mode 100644 index 06d3f8efa7..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/class_metadata.hpp +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright David Abrahams 2004. -// Copyright Stefan Seefeld 2016. -// Distributed under the 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_python_object_class_metadata_hpp_ -#define boost_python_object_class_metadata_hpp_ - -#include <boost/python/converter/shared_ptr_from_python.hpp> -#include <boost/python/object/inheritance.hpp> -#include <boost/python/object/class_wrapper.hpp> -#include <boost/python/object/make_instance.hpp> -#include <boost/python/object/value_holder.hpp> -#include <boost/python/object/pointer_holder.hpp> -#include <boost/python/object/make_ptr_instance.hpp> - -#include <boost/python/detail/force_instantiate.hpp> -#include <boost/python/detail/not_specified.hpp> -#include <boost/python/detail/type_traits.hpp> - -#include <boost/python/has_back_reference.hpp> -#include <boost/python/bases.hpp> - -#include <boost/mpl/if.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/or.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/mpl/for_each.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/mpl/single_view.hpp> - -#include <boost/mpl/assert.hpp> - -#include <boost/noncopyable.hpp> -#include <boost/detail/workaround.hpp> - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL -void copy_class_object(type_info const& src, type_info const& dst); - -// -// Support for registering base/derived relationships -// -template <class Derived> -struct register_base_of -{ - template <class Base> - inline void operator()(Base*) const - { - BOOST_MPL_ASSERT_NOT((boost::python::detail::is_same<Base,Derived>)); - - // Register the Base class - register_dynamic_id<Base>(); - - // Register the up-cast - register_conversion<Derived,Base>(false); - - // Register the down-cast, if appropriate. - this->register_downcast((Base*)0, boost::python::detail::is_polymorphic<Base>()); - } - - private: - static inline void register_downcast(void*, boost::python::detail::false_) {} - - template <class Base> - static inline void register_downcast(Base*, boost::python::detail::true_) - { - register_conversion<Base, Derived>(true); - } - -}; - -// -// Preamble of register_class. Also used for callback classes, which -// need some registration of their own. -// - -template <class T, class Bases> -inline void register_shared_ptr_from_python_and_casts(T*, Bases) -{ - // Constructor performs registration - python::detail::force_instantiate(converter::shared_ptr_from_python<T, boost::shared_ptr>()); -#if !defined(BOOST_NO_CXX11_SMART_PTR) - python::detail::force_instantiate(converter::shared_ptr_from_python<T, std::shared_ptr>()); -#endif - - // - // register all up/downcasts here. We're using the alternate - // interface to mpl::for_each to avoid an MSVC 6 bug. - // - register_dynamic_id<T>(); - mpl::for_each(register_base_of<T>(), (Bases*)0, (boost::python::detail::add_pointer<mpl::_>*)0); -} - -// -// Helper for choosing the unnamed held_type argument -// -template <class T, class Prev> -struct select_held_type - : mpl::if_< - mpl::or_< - python::detail::specifies_bases<T> - , boost::python::detail::is_same<T,noncopyable> - > - , Prev - , T - > -{ -}; - -template < - class T // class being wrapped - , class X1 // = detail::not_specified - , class X2 // = detail::not_specified - , class X3 // = detail::not_specified -> -struct class_metadata -{ - // - // Calculate the unnamed template arguments - // - - // held_type_arg -- not_specified, [a class derived from] T or a - // smart pointer to [a class derived from] T. Preserving - // not_specified allows us to give class_<T,T> a back-reference. - typedef typename select_held_type< - X1 - , typename select_held_type< - X2 - , typename select_held_type< - X3 - , python::detail::not_specified - >::type - >::type - >::type held_type_arg; - - // bases - typedef typename python::detail::select_bases< - X1 - , typename python::detail::select_bases< - X2 - , typename python::detail::select_bases< - X3 - , python::bases<> - >::type - >::type - >::type bases; - - typedef mpl::or_< - boost::python::detail::is_same<X1,noncopyable> - , boost::python::detail::is_same<X2,noncopyable> - , boost::python::detail::is_same<X3,noncopyable> - > is_noncopyable; - - // - // Holder computation. - // - - // Compute the actual type that will be held in the Holder. - typedef typename mpl::if_< - boost::python::detail::is_same<held_type_arg,python::detail::not_specified>, T, held_type_arg - >::type held_type; - - // Determine if the object will be held by value - typedef mpl::bool_<boost::python::detail::is_convertible<held_type*,T*>::value> use_value_holder; - - // Compute the "wrapped type", that is, if held_type is a smart - // pointer, we're talking about the pointee. - typedef typename mpl::eval_if< - use_value_holder - , mpl::identity<held_type> - , pointee<held_type> - >::type wrapped; - - // Determine whether to use a "back-reference holder" - typedef mpl::bool_< - mpl::or_< - has_back_reference<T> - , boost::python::detail::is_same<held_type_arg,T> - , is_base_and_derived<T,wrapped> - >::value - > use_back_reference; - - // Select the holder. - typedef typename mpl::eval_if< - use_back_reference - , mpl::if_< - use_value_holder - , value_holder_back_reference<T, wrapped> - , pointer_holder_back_reference<held_type,T> - > - , mpl::if_< - use_value_holder - , value_holder<T> - , pointer_holder<held_type,wrapped> - > - >::type holder; - - inline static void register_() // Register the runtime metadata. - { - class_metadata::register_aux((T*)0); - } - - private: - template <class T2> - inline static void register_aux(python::wrapper<T2>*) - { - typedef typename mpl::not_<boost::python::detail::is_same<T2,wrapped> >::type use_callback; - class_metadata::register_aux2((T2*)0, use_callback()); - } - - inline static void register_aux(void*) - { - typedef typename is_base_and_derived<T,wrapped>::type use_callback; - class_metadata::register_aux2((T*)0, use_callback()); - } - - template <class T2, class Callback> - inline static void register_aux2(T2*, Callback) - { - objects::register_shared_ptr_from_python_and_casts((T2*)0, bases()); - class_metadata::maybe_register_callback_class((T2*)0, Callback()); - - class_metadata::maybe_register_class_to_python((T2*)0, is_noncopyable()); - - class_metadata::maybe_register_pointer_to_python( - (T2*)0, (use_value_holder*)0, (use_back_reference*)0); - } - - - // - // Support for converting smart pointers to python - // - inline static void maybe_register_pointer_to_python(...) {} - -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - inline static void maybe_register_pointer_to_python(void*,void*,mpl::true_*) - { - objects::copy_class_object(python::type_id<T>(), python::type_id<back_reference<T const &> >()); - objects::copy_class_object(python::type_id<T>(), python::type_id<back_reference<T &> >()); - } -#endif - - template <class T2> - inline static void maybe_register_pointer_to_python(T2*, mpl::false_*, mpl::false_*) - { - python::detail::force_instantiate( - objects::class_value_wrapper< - held_type - , make_ptr_instance<T2, pointer_holder<held_type, T2> > - >() - ); -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - // explicit qualification of type_id makes msvc6 happy - objects::copy_class_object(python::type_id<T2>(), python::type_id<held_type>()); -#endif - } - // - // Support for registering to-python converters - // - inline static void maybe_register_class_to_python(void*, mpl::true_) {} - - - template <class T2> - inline static void maybe_register_class_to_python(T2*, mpl::false_) - { - python::detail::force_instantiate(class_cref_wrapper<T2, make_instance<T2, holder> >()); -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - // explicit qualification of type_id makes msvc6 happy - objects::copy_class_object(python::type_id<T2>(), python::type_id<held_type>()); -#endif - } - - // - // Support for registering callback classes - // - inline static void maybe_register_callback_class(void*, mpl::false_) {} - - template <class T2> - inline static void maybe_register_callback_class(T2*, mpl::true_) - { - objects::register_shared_ptr_from_python_and_casts( - (wrapped*)0, mpl::single_view<T2>()); - // explicit qualification of type_id makes msvc6 happy - objects::copy_class_object(python::type_id<T2>(), python::type_id<wrapped>()); - } -}; - -}}} // namespace boost::python::object - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/object/class_wrapper.hpp b/contrib/restricted/boost/python/include/boost/python/object/class_wrapper.hpp deleted file mode 100644 index ffee7457ab..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/class_wrapper.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef CLASS_WRAPPER_DWA20011221_HPP -# define CLASS_WRAPPER_DWA20011221_HPP - -# include <boost/python/to_python_converter.hpp> -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -# include <boost/python/converter/pytype_function.hpp> -#endif -# include <boost/ref.hpp> - -namespace boost { namespace python { namespace objects { - -// -// These two classes adapt the static execute function of a class -// MakeInstance execute() function returning a new PyObject* -// reference. The first one is used for class copy constructors, and -// the second one is used to handle smart pointers. -// - -template <class Src, class MakeInstance> -struct class_cref_wrapper - : to_python_converter<Src,class_cref_wrapper<Src,MakeInstance> ,true> -{ - static PyObject* convert(Src const& x) - { - return MakeInstance::execute(boost::ref(x)); - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static PyTypeObject const *get_pytype() { return converter::registered_pytype_direct<Src>::get_pytype(); } -#endif -}; - -template <class Src, class MakeInstance> -struct class_value_wrapper - : to_python_converter<Src,class_value_wrapper<Src,MakeInstance> ,true> -{ - static PyObject* convert(Src x) - { - return MakeInstance::execute(x); - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static PyTypeObject const *get_pytype() { return MakeInstance::get_pytype(); } -#endif -}; - -}}} // namespace boost::python::objects - -#endif // CLASS_WRAPPER_DWA20011221_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/iterator.hpp b/contrib/restricted/boost/python/include/boost/python/object/iterator.hpp deleted file mode 100644 index 874950365d..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/iterator.hpp +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef ITERATOR_DWA2002510_HPP -# define ITERATOR_DWA2002510_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/type_traits.hpp> - -# include <boost/python/class.hpp> -# include <boost/python/return_value_policy.hpp> -# include <boost/python/return_by_value.hpp> -# include <boost/python/handle.hpp> -# include <boost/python/make_function.hpp> - -# include <boost/python/object/iterator_core.hpp> -# include <boost/python/object/class_detail.hpp> -# include <boost/python/object/function_object.hpp> - -# include <boost/mpl/vector/vector10.hpp> -# include <boost/mpl/if.hpp> - -# include <boost/python/detail/raw_pyobject.hpp> - -# include <boost/type.hpp> - -# include <iterator> - -namespace boost { namespace python { namespace objects { - -// CallPolicies for the next() method of iterators. We don't want -// users to have to explicitly specify that the references returned by -// iterators are copied, so we just replace the result_converter from -// the default_iterator_call_policies with a permissive one which -// always copies the result. -typedef return_value_policy<return_by_value> default_iterator_call_policies; - -// Instantiations of these are wrapped to produce Python iterators. -template <class NextPolicies, class Iterator> -struct iterator_range -{ - iterator_range(object sequence, Iterator start, Iterator finish); - - typedef std::iterator_traits<Iterator> traits_t; - - struct next - { - typedef typename mpl::if_< - is_reference< - typename traits_t::reference - > - , typename traits_t::reference - , typename traits_t::value_type - >::type result_type; - - result_type - operator()(iterator_range<NextPolicies,Iterator>& self) - { - if (self.m_start == self.m_finish) - stop_iteration_error(); - return *self.m_start++; - } - -# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - // CWPro8 has a codegen problem when this is an empty class - int garbage; -# endif - }; - - typedef next next_fn; - - object m_sequence; // Keeps the sequence alive while iterating. - Iterator m_start; - Iterator m_finish; -}; - -namespace detail -{ - // Get a Python class which contains the given iterator and - // policies, creating it if necessary. Requires: NextPolicies is - // default-constructible. - template <class Iterator, class NextPolicies> - object demand_iterator_class(char const* name, Iterator* = 0, NextPolicies const& policies = NextPolicies()) - { - typedef iterator_range<NextPolicies,Iterator> range_; - - // Check the registry. If one is already registered, return it. - handle<> class_obj( - objects::registered_class_object(python::type_id<range_>())); - - if (class_obj.get() != 0) - return object(class_obj); - - typedef typename range_::next_fn next_fn; - typedef typename next_fn::result_type result_type; - - return class_<range_>(name, no_init) - .def("__iter__", identity_function()) - .def( -#if PY_VERSION_HEX >= 0x03000000 - "__next__" -#else - "next" -#endif - , make_function( - next_fn() - , policies - , mpl::vector2<result_type,range_&>() - )); - } - - // A function object which builds an iterator_range. - template < - class Target - , class Iterator - , class Accessor1 - , class Accessor2 - , class NextPolicies - > - struct py_iter_ - { - py_iter_(Accessor1 const& get_start, Accessor2 const& get_finish) - : m_get_start(get_start) - , m_get_finish(get_finish) - {} - - // Extract an object x of the Target type from the first Python - // argument, and invoke get_start(x)/get_finish(x) to produce - // iterators, which are used to construct a new iterator_range<> - // object that gets wrapped into a Python iterator. - iterator_range<NextPolicies,Iterator> - operator()(back_reference<Target&> x) const - { - // Make sure the Python class is instantiated. - detail::demand_iterator_class("iterator", (Iterator*)0, NextPolicies()); - - return iterator_range<NextPolicies,Iterator>( - x.source() - , m_get_start(x.get()) - , m_get_finish(x.get()) - ); - } - private: - Accessor1 m_get_start; - Accessor2 m_get_finish; - }; - - template <class Target, class Iterator, class NextPolicies, class Accessor1, class Accessor2> - inline object make_iterator_function( - Accessor1 const& get_start - , Accessor2 const& get_finish - , NextPolicies const& /*next_policies*/ - , Iterator const& (*)() - , boost::type<Target>* - , int - ) - { - return make_function( - py_iter_<Target,Iterator,Accessor1,Accessor2,NextPolicies>(get_start, get_finish) - , default_call_policies() - , mpl::vector2<iterator_range<NextPolicies,Iterator>, back_reference<Target&> >() - ); - } - - template <class Target, class Iterator, class NextPolicies, class Accessor1, class Accessor2> - inline object make_iterator_function( - Accessor1 const& get_start - , Accessor2 const& get_finish - , NextPolicies const& next_policies - , Iterator& (*)() - , boost::type<Target>* - , ...) - { - return make_iterator_function( - get_start - , get_finish - , next_policies - , (Iterator const&(*)())0 - , (boost::type<Target>*)0 - , 0 - ); - } - -} - -// Create a Python callable object which accepts a single argument -// convertible to the C++ Target type and returns a Python -// iterator. The Python iterator uses get_start(x) and get_finish(x) -// (where x is an instance of Target) to produce begin and end -// iterators for the range, and an instance of NextPolicies is used as -// CallPolicies for the Python iterator's next() function. -template <class Target, class NextPolicies, class Accessor1, class Accessor2> -inline object make_iterator_function( - Accessor1 const& get_start - , Accessor2 const& get_finish - , NextPolicies const& next_policies - , boost::type<Target>* = 0 -) -{ - typedef typename Accessor1::result_type iterator; - typedef typename boost::python::detail::add_const<iterator>::type iterator_const; - typedef typename boost::python::detail::add_lvalue_reference<iterator_const>::type iterator_cref; - - return detail::make_iterator_function( - get_start - , get_finish - , next_policies - , (iterator_cref(*)())0 - , (boost::type<Target>*)0 - , 0 - ); -} - -// -// implementation -// -template <class NextPolicies, class Iterator> -inline iterator_range<NextPolicies,Iterator>::iterator_range( - object sequence, Iterator start, Iterator finish) - : m_sequence(sequence), m_start(start), m_finish(finish) -{ -} - -}}} // namespace boost::python::objects - -#endif // ITERATOR_DWA2002510_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/make_holder.hpp b/contrib/restricted/boost/python/include/boost/python/object/make_holder.hpp deleted file mode 100644 index 735e5395ca..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/make_holder.hpp +++ /dev/null @@ -1,110 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 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) - -# ifndef MAKE_HOLDER_DWA20011215_HPP -# define MAKE_HOLDER_DWA20011215_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object/instance.hpp> -# include <boost/python/converter/registry.hpp> -#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE) -# include <boost/python/detail/python_type.hpp> -#endif - -# include <boost/python/object/forward.hpp> -# include <boost/python/detail/preprocessor.hpp> - -# include <boost/mpl/next.hpp> -# include <boost/mpl/begin_end.hpp> -# include <boost/mpl/deref.hpp> - -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/iteration/local.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/debug/line.hpp> -# include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> - -# include <cstddef> - -namespace boost { namespace python { namespace objects { - -template <int nargs> struct make_holder; - -# define BOOST_PYTHON_DO_FORWARD_ARG(z, index, _) , f##index(a##index) - -// specializations... -# define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/object/make_holder.hpp>)) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_DO_FORWARD_ARG - -}}} // namespace boost::python::objects - -# endif // MAKE_HOLDER_DWA20011215_HPP - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, make_holder.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -template <> -struct make_holder<N> -{ - template <class Holder, class ArgList> - struct apply - { -# if N - // Unrolled iteration through each argument type in ArgList, - // choosing the type that will be forwarded on to the holder's - // templated constructor. - typedef typename mpl::begin<ArgList>::type iter0; - -# define BOOST_PP_LOCAL_MACRO(n) \ - typedef typename mpl::deref<iter##n>::type t##n; \ - typedef typename forward<t##n>::type f##n; \ - typedef typename mpl::next<iter##n>::type \ - BOOST_PP_CAT(iter,BOOST_PP_INC(n)); // Next iterator type - -# define BOOST_PP_LOCAL_LIMITS (0, N-1) -# include BOOST_PP_LOCAL_ITERATE() -# endif - - static void execute( -#if !defined( BOOST_PYTHON_NO_PY_SIGNATURES) && defined( BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE) - boost::python::detail::python_class<BOOST_DEDUCED_TYPENAME Holder::value_type> *p -#else - PyObject *p -#endif - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, t, a)) - { - typedef instance<Holder> instance_t; - - void* memory = Holder::allocate(p, offsetof(instance_t, storage), sizeof(Holder), - boost::python::detail::alignment_of<Holder>::value); - try { - (new (memory) Holder( - p BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_DO_FORWARD_ARG, nil)))->install(p); - } - catch(...) { - Holder::deallocate(p, memory); - throw; - } - } - }; -}; - -# undef N - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/object/value_holder.hpp b/contrib/restricted/boost/python/include/boost/python/object/value_holder.hpp deleted file mode 100644 index a4e91786d1..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/value_holder.hpp +++ /dev/null @@ -1,166 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 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) - -# ifndef VALUE_HOLDER_DWA20011215_HPP -# define VALUE_HOLDER_DWA20011215_HPP - -# include <boost/python/object/value_holder_fwd.hpp> - -# include <boost/python/instance_holder.hpp> -# include <boost/python/type_id.hpp> -# include <boost/python/wrapper.hpp> - -# include <boost/python/object/inheritance_query.hpp> -# include <boost/python/object/forward.hpp> - -# include <boost/python/detail/force_instantiate.hpp> -# include <boost/python/detail/preprocessor.hpp> - -# include <boost/preprocessor/comma_if.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/debug/line.hpp> - -# include <boost/preprocessor/repetition/enum_params.hpp> -# include <boost/preprocessor/repetition/enum_binary_params.hpp> - -# include <boost/utility/addressof.hpp> - -namespace boost { namespace python { namespace objects { - -#define BOOST_PYTHON_UNFORWARD_LOCAL(z, n, _) BOOST_PP_COMMA_IF(n) objects::do_unforward(a##n,0) - -template <class Value> -struct value_holder : instance_holder -{ - typedef Value held_type; - typedef Value value_type; - - // Forward construction to the held object -# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/object/value_holder.hpp>, 1)) -# include BOOST_PP_ITERATE() - - private: // required holder implementation - void* holds(type_info, bool null_ptr_only); - - template <class T> - inline void* holds_wrapped(type_info dst_t, wrapper<T>*,T* p) - { - return python::type_id<T>() == dst_t ? p : 0; - } - - inline void* holds_wrapped(type_info, ...) - { - return 0; - } - private: // data members - Value m_held; -}; - -template <class Value, class Held> -struct value_holder_back_reference : instance_holder -{ - typedef Held held_type; - typedef Value value_type; - - // Forward construction to the held object -# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/object/value_holder.hpp>, 2)) -# include BOOST_PP_ITERATE() - -private: // required holder implementation - void* holds(type_info, bool null_ptr_only); - - private: // data members - Held m_held; -}; - -# undef BOOST_PYTHON_UNFORWARD_LOCAL - -template <class Value> -void* value_holder<Value>::holds(type_info dst_t, bool /*null_ptr_only*/) -{ - if (void* wrapped = holds_wrapped(dst_t, boost::addressof(m_held), boost::addressof(m_held))) - return wrapped; - - type_info src_t = python::type_id<Value>(); - return src_t == dst_t ? boost::addressof(m_held) - : find_static_type(boost::addressof(m_held), src_t, dst_t); -} - -template <class Value, class Held> -void* value_holder_back_reference<Value,Held>::holds( - type_info dst_t, bool /*null_ptr_only*/) -{ - type_info src_t = python::type_id<Value>(); - Value* x = &m_held; - - if (dst_t == src_t) - return x; - else if (dst_t == python::type_id<Held>()) - return &m_held; - else - return find_static_type(x, src_t, dst_t); -} - -}}} // namespace boost::python::objects - -# endif // VALUE_HOLDER_DWA20011215_HPP - -// --------------- value_holder --------------- - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder)) -# endif - -# define N BOOST_PP_ITERATION() - -# if (N != 0) - template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)> -# endif - value_holder( - PyObject* self BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) - : m_held( - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) - ) - { - python::detail::initialize_wrapper(self, boost::addressof(this->m_held)); - } - -# undef N - -// --------------- value_holder_back_reference --------------- - -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder_back_reference)) -# endif - -# define N BOOST_PP_ITERATION() - -# if (N != 0) - template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)> -# endif - value_holder_back_reference( - PyObject* p BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) - : m_held( - p BOOST_PP_COMMA_IF(N) - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) - ) - { - } - -# undef N - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/object/value_holder_fwd.hpp b/contrib/restricted/boost/python/include/boost/python/object/value_holder_fwd.hpp deleted file mode 100644 index 3454bac426..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/value_holder_fwd.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef VALUE_HOLDER_FWD_DWA2002311_HPP -# define VALUE_HOLDER_FWD_DWA2002311_HPP - -namespace boost { namespace python { namespace objects { - -struct no_back_reference; - -template <class CallbackType = no_back_reference> struct value_holder_generator; - -}}} // namespace boost::python::object - -#endif // VALUE_HOLDER_FWD_DWA2002311_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/opaque_pointer_converter.hpp b/contrib/restricted/boost/python/include/boost/python/opaque_pointer_converter.hpp deleted file mode 100644 index 701b13dc30..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/opaque_pointer_converter.hpp +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright Gottfried Ganßauge 2003..2006. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -/* - * Generic Conversion of opaque C++-pointers to a Python-Wrapper. - */ -# ifndef OPAQUE_POINTER_CONVERTER_HPP_ -# define OPAQUE_POINTER_CONVERTER_HPP_ - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/lvalue_from_pytype.hpp> -# include <boost/python/to_python_converter.hpp> -# include <boost/python/converter/registrations.hpp> -# include <boost/python/detail/dealloc.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/detail/none.hpp> -# include <boost/python/type_id.hpp> -# include <boost/python/errors.hpp> - -# include <boost/implicit_cast.hpp> - -# include <boost/mpl/eval_if.hpp> -# include <boost/mpl/identity.hpp> -# include <boost/mpl/assert.hpp> - -// opaque -- -// -// registers to- and from- python conversions for a type Pointee. -// -// Note: -// In addition you need to define specializations for type_id -// on the type pointed to by Pointer using -// BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee) -// -// For an example see libs/python/test/opaque.cpp -// -namespace boost { namespace python { - -template <class Pointee> -struct opaque -{ - opaque() - { - if (type_object.tp_name == 0) - { - type_object.tp_name = const_cast<char*>(type_id<Pointee*>().name()); - if (PyType_Ready (&type_object) < 0) - { - throw error_already_set(); - } - - this->register_self(); - } - } - - static opaque instance; -private: - - static void* extract(PyObject* op) - { - return PyObject_TypeCheck(op, &type_object) - ? static_cast<python_instance*>(implicit_cast<void*>(op))->x - : 0 - ; - } - - static PyObject* wrap(void const* px) - { - Pointee* x = *static_cast<Pointee*const*>(px); - - if (x == 0) - return detail::none(); - - if ( python_instance *o = PyObject_New(python_instance, &type_object) ) - { - o->x = x; - return static_cast<PyObject*>(implicit_cast<void*>(o)); - } - else - { - throw error_already_set(); - } - } - - void register_self() - { - converter::registration const *existing = - converter::registry::query (type_id<Pointee*>()); - - if ((existing == 0) || (existing->m_to_python == 0)) - { -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - converter::registry::insert(&extract, type_id<Pointee>(), &get_pytype); - converter::registry::insert(&wrap, type_id<Pointee*>(), &get_pytype); -#else - converter::registry::insert(&extract, type_id<Pointee>()); - converter::registry::insert(&wrap, type_id<Pointee*>()); -#endif - } - } - - struct python_instance - { - PyObject_HEAD - Pointee* x; - }; - - static PyTypeObject type_object; -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static PyTypeObject const *get_pytype(){return &type_object; } -#endif -}; - -template <class Pointee> -opaque<Pointee> opaque<Pointee>::instance; - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" - -template <class Pointee> -PyTypeObject opaque<Pointee>::type_object = -{ - PyVarObject_HEAD_INIT(NULL, 0) - 0, - sizeof( BOOST_DEDUCED_TYPENAME opaque<Pointee>::python_instance ), - 0, - ::boost::python::detail::dealloc, - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#if PYTHON_API_VERSION >= 1012 - 0 /* tp_del */ -#endif -}; - -#pragma GCC diagnostic pop - -}} // namespace boost::python - -// If you change the below, don't forget to alter the end of type_id.hpp -# define BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee) \ - namespace boost { namespace python { \ - template<> \ - inline type_info type_id<Pointee>() \ - { \ - return type_info (typeid (Pointee *)); \ - } \ - template<> \ - inline type_info type_id<const volatile Pointee&>() \ - { \ - return type_info (typeid (Pointee *)); \ - } \ - }} - -# endif // OPAQUE_POINTER_CONVERTER_HPP_ diff --git a/contrib/restricted/boost/python/include/boost/python/operators.hpp b/contrib/restricted/boost/python/include/boost/python/operators.hpp deleted file mode 100644 index ea2be7b98f..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/operators.hpp +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef OPERATORS_DWA2002530_HPP -# define OPERATORS_DWA2002530_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/def_visitor.hpp> -# include <boost/python/converter/arg_to_python.hpp> -# include <boost/python/detail/operator_id.hpp> -# include <boost/python/detail/not_specified.hpp> -# include <boost/python/back_reference.hpp> -# include <boost/mpl/if.hpp> -# include <boost/mpl/eval_if.hpp> -# include <boost/python/self.hpp> -# include <boost/python/other.hpp> -# include <boost/lexical_cast.hpp> -# include <boost/python/refcount.hpp> -# include <boost/python/detail/unwrap_wrapper.hpp> -# include <string> -# include <complex> - -namespace boost { namespace python { - -namespace detail -{ - // This is essentially the old v1 to_python(). It will be eliminated - // once the public interface for to_python is settled on. - template <class T> - PyObject* convert_result(T const& x) - { - return converter::arg_to_python<T>(x).release(); - } - - // Operator implementation template declarations. The nested apply - // declaration here keeps MSVC6 happy. - template <operator_id> struct operator_l - { - template <class L, class R> struct apply; - }; - - template <operator_id> struct operator_r - { - template <class L, class R> struct apply; - }; - - template <operator_id> struct operator_1 - { - template <class T> struct apply; - }; - - // MSVC6 doesn't want us to do this sort of inheritance on a nested - // class template, so we use this layer of indirection to avoid - // ::template<...> on the nested apply functions below - template <operator_id id, class L, class R> - struct operator_l_inner - : operator_l<id>::template apply<L,R> - {}; - - template <operator_id id, class L, class R> - struct operator_r_inner - : operator_r<id>::template apply<L,R> - {}; - - template <operator_id id, class T> - struct operator_1_inner - : operator_1<id>::template apply<T> - {}; - - // Define three different binary_op templates which take care of - // these cases: - // self op self - // self op R - // L op self - // - // The inner apply metafunction is used to adjust the operator to - // the class type being defined. Inheritance of the outer class is - // simply used to provide convenient access to the operation's - // name(). - - // self op self - template <operator_id id> - struct binary_op : operator_l<id> - { - template <class T> - struct apply : operator_l_inner<id,T,T> - { - }; - }; - - // self op R - template <operator_id id, class R> - struct binary_op_l : operator_l<id> - { - template <class T> - struct apply : operator_l_inner<id,T,R> - { - }; - }; - - // L op self - template <operator_id id, class L> - struct binary_op_r : operator_r<id> - { - template <class T> - struct apply : operator_r_inner<id,L,T> - { - }; - }; - - template <operator_id id> - struct unary_op : operator_1<id> - { - template <class T> - struct apply : operator_1_inner<id,T> - { - }; - }; - - // This type is what actually gets returned from operators used on - // self_t - template <operator_id id, class L = not_specified, class R = not_specified> - struct operator_ - : def_visitor<operator_<id,L,R> > - { - private: - template <class ClassT> - void visit(ClassT& cl) const - { - typedef typename mpl::eval_if< - is_same<L,self_t> - , mpl::if_< - is_same<R,self_t> - , binary_op<id> - , binary_op_l< - id - , BOOST_DEDUCED_TYPENAME unwrap_other<R>::type - > - > - , mpl::if_< - is_same<L,not_specified> - , unary_op<id> - , binary_op_r< - id - , BOOST_DEDUCED_TYPENAME unwrap_other<L>::type - > - > - >::type generator; - - cl.def( - generator::name() - , &generator::template apply< - BOOST_DEDUCED_TYPENAME ClassT::wrapped_type - >::execute - ); - } - - friend class python::def_visitor_access; - }; -} - -# define BOOST_PYTHON_BINARY_OPERATION(id, rid, expr) \ -namespace detail \ -{ \ - template <> \ - struct operator_l<op_##id> \ - { \ - template <class L, class R> \ - struct apply \ - { \ - typedef typename unwrap_wrapper_<L>::type lhs; \ - typedef typename unwrap_wrapper_<R>::type rhs; \ - static PyObject* execute(lhs& l, rhs const& r) \ - { \ - return detail::convert_result(expr); \ - } \ - }; \ - static char const* name() { return "__" #id "__"; } \ - }; \ - \ - template <> \ - struct operator_r<op_##id> \ - { \ - template <class L, class R> \ - struct apply \ - { \ - typedef typename unwrap_wrapper_<L>::type lhs; \ - typedef typename unwrap_wrapper_<R>::type rhs; \ - static PyObject* execute(rhs& r, lhs const& l) \ - { \ - return detail::convert_result(expr); \ - } \ - }; \ - static char const* name() { return "__" #rid "__"; } \ - }; \ -} - -# define BOOST_PYTHON_BINARY_OPERATOR(id, rid, op) \ -BOOST_PYTHON_BINARY_OPERATION(id, rid, l op r) \ -namespace self_ns \ -{ \ - template <class L, class R> \ - inline detail::operator_<detail::op_##id,L,R> \ - operator op(L const&, R const&) \ - { \ - return detail::operator_<detail::op_##id,L,R>(); \ - } \ -} - -BOOST_PYTHON_BINARY_OPERATOR(add, radd, +) -BOOST_PYTHON_BINARY_OPERATOR(sub, rsub, -) -BOOST_PYTHON_BINARY_OPERATOR(mul, rmul, *) -#if PY_VERSION_HEX >= 0x03000000 - BOOST_PYTHON_BINARY_OPERATOR(truediv, rtruediv, /) -#else - BOOST_PYTHON_BINARY_OPERATOR(div, rdiv, /) -#endif -BOOST_PYTHON_BINARY_OPERATOR(mod, rmod, %) -BOOST_PYTHON_BINARY_OPERATOR(lshift, rlshift, <<) -BOOST_PYTHON_BINARY_OPERATOR(rshift, rrshift, >>) -BOOST_PYTHON_BINARY_OPERATOR(and, rand, &) -BOOST_PYTHON_BINARY_OPERATOR(xor, rxor, ^) -BOOST_PYTHON_BINARY_OPERATOR(or, ror, |) -BOOST_PYTHON_BINARY_OPERATOR(gt, lt, >) -BOOST_PYTHON_BINARY_OPERATOR(ge, le, >=) -BOOST_PYTHON_BINARY_OPERATOR(lt, gt, <) -BOOST_PYTHON_BINARY_OPERATOR(le, ge, <=) -BOOST_PYTHON_BINARY_OPERATOR(eq, eq, ==) -BOOST_PYTHON_BINARY_OPERATOR(ne, ne, !=) -# undef BOOST_PYTHON_BINARY_OPERATOR - -// pow isn't an operator in C++; handle it specially. -BOOST_PYTHON_BINARY_OPERATION(pow, rpow, pow(l,r)) -# undef BOOST_PYTHON_BINARY_OPERATION - -namespace self_ns -{ -# ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - template <class L, class R> - inline detail::operator_<detail::op_pow,L,R> - pow(L const&, R const&) - { - return detail::operator_<detail::op_pow,L,R>(); - } -# else - // When there's no argument-dependent lookup, we need these - // overloads to handle the case when everything is imported into the - // global namespace. Note that the plain overload below does /not/ - // take const& arguments. This is needed by MSVC6 at least, or it - // complains of ambiguities, since there's no partial ordering. - inline detail::operator_<detail::op_pow,self_t,self_t> - pow(self_t, self_t) - { - return detail::operator_<detail::op_pow,self_t,self_t>(); - } - template <class R> - inline detail::operator_<detail::op_pow,self_t,R> - pow(self_t const&, R const&) - { - return detail::operator_<detail::op_pow,self_t,R>(); - } - template <class L> - inline detail::operator_<detail::op_pow,L,self_t> - pow(L const&, self_t const&) - { - return detail::operator_<detail::op_pow,L,self_t>(); - } -# endif -} - - -# define BOOST_PYTHON_INPLACE_OPERATOR(id, op) \ -namespace detail \ -{ \ - template <> \ - struct operator_l<op_##id> \ - { \ - template <class L, class R> \ - struct apply \ - { \ - typedef typename unwrap_wrapper_<L>::type lhs; \ - typedef typename unwrap_wrapper_<R>::type rhs; \ - static PyObject* \ - execute(back_reference<lhs&> l, rhs const& r) \ - { \ - l.get() op r; \ - return python::incref(l.source().ptr()); \ - } \ - }; \ - static char const* name() { return "__" #id "__"; } \ - }; \ -} \ -namespace self_ns \ -{ \ - template <class R> \ - inline detail::operator_<detail::op_##id,self_t,R> \ - operator op(self_t const&, R const&) \ - { \ - return detail::operator_<detail::op_##id,self_t,R>(); \ - } \ -} - -BOOST_PYTHON_INPLACE_OPERATOR(iadd,+=) -BOOST_PYTHON_INPLACE_OPERATOR(isub,-=) -BOOST_PYTHON_INPLACE_OPERATOR(imul,*=) -BOOST_PYTHON_INPLACE_OPERATOR(idiv,/=) -BOOST_PYTHON_INPLACE_OPERATOR(imod,%=) -BOOST_PYTHON_INPLACE_OPERATOR(ilshift,<<=) -BOOST_PYTHON_INPLACE_OPERATOR(irshift,>>=) -BOOST_PYTHON_INPLACE_OPERATOR(iand,&=) -BOOST_PYTHON_INPLACE_OPERATOR(ixor,^=) -BOOST_PYTHON_INPLACE_OPERATOR(ior,|=) - -# define BOOST_PYTHON_UNARY_OPERATOR(id, op, func_name) \ -namespace detail \ -{ \ - template <> \ - struct operator_1<op_##id> \ - { \ - template <class T> \ - struct apply \ - { \ - typedef typename unwrap_wrapper_<T>::type self_t; \ - static PyObject* execute(self_t& x) \ - { \ - return detail::convert_result(op(x)); \ - } \ - }; \ - static char const* name() { return "__" #id "__"; } \ - }; \ -} \ -namespace self_ns \ -{ \ - inline detail::operator_<detail::op_##id> \ - func_name(self_t const&) \ - { \ - return detail::operator_<detail::op_##id>(); \ - } \ -} -# undef BOOST_PYTHON_INPLACE_OPERATOR - -BOOST_PYTHON_UNARY_OPERATOR(neg, -, operator-) -BOOST_PYTHON_UNARY_OPERATOR(pos, +, operator+) -BOOST_PYTHON_UNARY_OPERATOR(abs, abs, abs) -BOOST_PYTHON_UNARY_OPERATOR(invert, ~, operator~) -#if PY_VERSION_HEX >= 0x03000000 -BOOST_PYTHON_UNARY_OPERATOR(bool, !!, operator!) -#else -BOOST_PYTHON_UNARY_OPERATOR(nonzero, !!, operator!) -#endif -BOOST_PYTHON_UNARY_OPERATOR(int, long, int_) -BOOST_PYTHON_UNARY_OPERATOR(long, PyLong_FromLong, long_) -BOOST_PYTHON_UNARY_OPERATOR(float, double, float_) -BOOST_PYTHON_UNARY_OPERATOR(complex, std::complex<double>, complex_) -BOOST_PYTHON_UNARY_OPERATOR(str, lexical_cast<std::string>, str) -BOOST_PYTHON_UNARY_OPERATOR(repr, lexical_cast<std::string>, repr) -# undef BOOST_PYTHON_UNARY_OPERATOR - -}} // namespace boost::python - -# ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -using boost::python::self_ns::abs; -using boost::python::self_ns::int_; -using boost::python::self_ns::long_; -using boost::python::self_ns::float_; -using boost::python::self_ns::complex_; -using boost::python::self_ns::str; -using boost::python::self_ns::repr; -using boost::python::self_ns::pow; -# endif - -#endif // OPERATORS_DWA2002530_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/other.hpp b/contrib/restricted/boost/python/include/boost/python/other.hpp deleted file mode 100644 index 26ebb426ba..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/other.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef BOOST_PYTHON_OTHER_HPP -# define BOOST_PYTHON_OTHER_HPP - -# include <boost/python/detail/prefix.hpp> -// Copyright David Abrahams 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) - -# include <boost/config.hpp> - -namespace boost { namespace python { - -template<class T> struct other -{ - typedef T type; -}; - -namespace detail -{ - template<typename T> - class is_other - { - public: - BOOST_STATIC_CONSTANT(bool, value = false); - }; - - template<typename T> - class is_other<other<T> > - { - public: - BOOST_STATIC_CONSTANT(bool, value = true); - }; - - template<typename T> - class unwrap_other - { - public: - typedef T type; - }; - - template<typename T> - class unwrap_other<other<T> > - { - public: - typedef T type; - }; -} - -}} // namespace boost::python - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/overloads.hpp b/contrib/restricted/boost/python/include/boost/python/overloads.hpp deleted file mode 100644 index e60dc1798e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/overloads.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef OVERLOADS_DWA2002101_HPP -# define OVERLOADS_DWA2002101_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/detail/overloads_fwd.hpp> -# include <boost/python/detail/defaults_def.hpp> - -#endif // OVERLOADS_DWA2002101_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/pure_virtual.hpp b/contrib/restricted/boost/python/include/boost/python/pure_virtual.hpp deleted file mode 100644 index 58e9aedef1..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/pure_virtual.hpp +++ /dev/null @@ -1,124 +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 PURE_VIRTUAL_DWA2003810_HPP -# define PURE_VIRTUAL_DWA2003810_HPP - -# include <boost/python/def_visitor.hpp> -# include <boost/python/default_call_policies.hpp> -# include <boost/mpl/push_front.hpp> -# include <boost/mpl/pop_front.hpp> - -# include <boost/python/detail/nullary_function_adaptor.hpp> - -namespace boost { namespace python { - -namespace detail -{ - // - // @group Helpers for pure_virtual_visitor. { - // - - // Raises a Python RuntimeError reporting that a pure virtual - // function was called. - void BOOST_PYTHON_DECL pure_virtual_called(); - - // Replace the two front elements of S with T1 and T2 - template <class S, class T1, class T2> - struct replace_front2 - { - // Metafunction forwarding seemed to confound vc6 - typedef typename mpl::push_front< - typename mpl::push_front< - typename mpl::pop_front< - typename mpl::pop_front< - S - >::type - >::type - , T2 - >::type - , T1 - >::type type; - }; - - // Given an MPL sequence representing a member function [object] - // signature, returns a new MPL sequence whose return type is - // replaced by void, and whose first argument is replaced by C&. - template <class C, class S> - typename replace_front2<S,void,C&>::type - error_signature(S) - { - typedef typename replace_front2<S,void,C&>::type r; - return r(); - } - - // - // } - // - - // - // A def_visitor which defines a method as usual, then adds a - // corresponding function which raises a "pure virtual called" - // exception unless it's been overridden. - // - template <class PointerToMemberFunction> - struct pure_virtual_visitor - : def_visitor<pure_virtual_visitor<PointerToMemberFunction> > - { - pure_virtual_visitor(PointerToMemberFunction pmf) - : m_pmf(pmf) - {} - - private: - friend class python::def_visitor_access; - - template <class C_, class Options> - void visit(C_& c, char const* name, Options& options) const - { - // This should probably be a nicer error message - BOOST_STATIC_ASSERT(!Options::has_default_implementation); - - // Add the virtual function dispatcher - c.def( - name - , m_pmf - , options.doc() - , options.keywords() - , options.policies() - ); - - typedef BOOST_DEDUCED_TYPENAME C_::metadata::held_type held_type; - - // Add the default implementation which raises the exception - c.def( - name - , make_function( - detail::nullary_function_adaptor<void(*)()>(pure_virtual_called) - , default_call_policies() - , detail::error_signature<held_type>(detail::get_signature(m_pmf)) - ) - ); - } - - private: // data members - PointerToMemberFunction m_pmf; - }; -} - -// -// Passed a pointer to member function, generates a def_visitor which -// creates a method that only dispatches to Python if the function has -// been overridden, either in C++ or in Python, raising a "pure -// virtual called" exception otherwise. -// -template <class PointerToMemberFunction> -detail::pure_virtual_visitor<PointerToMemberFunction> -pure_virtual(PointerToMemberFunction pmf) -{ - return detail::pure_virtual_visitor<PointerToMemberFunction>(pmf); -} - -}} // namespace boost::python - -#endif // PURE_VIRTUAL_DWA2003810_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/raw_function.hpp b/contrib/restricted/boost/python/include/boost/python/raw_function.hpp deleted file mode 100644 index 9d9f6b8b1b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/raw_function.hpp +++ /dev/null @@ -1,61 +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 RAW_FUNCTION_DWA200336_HPP -# define RAW_FUNCTION_DWA200336_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/tuple.hpp> -# include <boost/python/dict.hpp> -# include <boost/python/object/py_function.hpp> -# include <boost/mpl/vector/vector10.hpp> - -# include <boost/limits.hpp> -# include <cstddef> - -namespace boost { namespace python { - -namespace detail -{ - template <class F> - struct raw_dispatcher - { - raw_dispatcher(F f) : f(f) {} - - PyObject* operator()(PyObject* args, PyObject* keywords) - { - return incref( - object( - f( - tuple(borrowed_reference(args)) - , keywords ? dict(borrowed_reference(keywords)) : dict() - ) - ).ptr() - ); - } - - private: - F f; - }; - - object BOOST_PYTHON_DECL make_raw_function(objects::py_function); -} - -template <class F> -object raw_function(F f, std::size_t min_args = 0) -{ - return detail::make_raw_function( - objects::py_function( - detail::raw_dispatcher<F>(f) - , mpl::vector1<PyObject*>() - , min_args - , (std::numeric_limits<unsigned>::max)() - ) - ); -} - -}} // namespace boost::python - -#endif // RAW_FUNCTION_DWA200336_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/reference_existing_object.hpp b/contrib/restricted/boost/python/include/boost/python/reference_existing_object.hpp deleted file mode 100644 index 4c8344070b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/reference_existing_object.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef REFERENCE_EXISTING_OBJECT_DWA200222_HPP -# define REFERENCE_EXISTING_OBJECT_DWA200222_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/mpl/if.hpp> -# include <boost/python/to_python_indirect.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <class R> - struct reference_existing_object_requires_a_pointer_or_reference_return_type -# if defined(__GNUC__) || defined(__EDG__) - {} -# endif - ; -} - -template <class T> struct to_python_value; - -struct reference_existing_object -{ - template <class T> - struct apply - { - BOOST_STATIC_CONSTANT( - bool, ok = detail::is_pointer<T>::value || detail::is_reference<T>::value); - - typedef typename mpl::if_c< - ok - , to_python_indirect<T, detail::make_reference_holder> - , detail::reference_existing_object_requires_a_pointer_or_reference_return_type<T> - >::type type; - }; -}; - -}} // namespace boost::python - -#endif // REFERENCE_EXISTING_OBJECT_DWA200222_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/register_ptr_to_python.hpp b/contrib/restricted/boost/python/include/boost/python/register_ptr_to_python.hpp deleted file mode 100644 index d39bd0cf71..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/register_ptr_to_python.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef REGISTER_PTR_TO_PYTHON_HPP -#define REGISTER_PTR_TO_PYTHON_HPP - -#include <boost/python/pointee.hpp> -#include <boost/python/object.hpp> -#include <boost/python/object/class_wrapper.hpp> - -namespace boost { namespace python { - -template <class P> -void register_ptr_to_python() -{ - typedef typename boost::python::pointee<P>::type X; - objects::class_value_wrapper< - P - , objects::make_ptr_instance< - X - , objects::pointer_holder<P,X> - > - >(); -} - -}} // namespace boost::python - -#endif // REGISTER_PTR_TO_PYTHON_HPP - - diff --git a/contrib/restricted/boost/python/include/boost/python/return_arg.hpp b/contrib/restricted/boost/python/include/boost/python/return_arg.hpp deleted file mode 100644 index de23993987..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/return_arg.hpp +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright David Abrahams and Nikolay Mladenov 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 RETURN_ARG_DWA2003719_HPP -# define RETURN_ARG_DWA2003719_HPP -# include <boost/python/default_call_policies.hpp> -# include <boost/python/detail/none.hpp> -# include <boost/python/detail/value_arg.hpp> - -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -# include <boost/python/converter/pytype_function.hpp> -#endif - -# include <boost/python/detail/type_traits.hpp> - -# include <boost/mpl/int.hpp> -# include <boost/mpl/at.hpp> - -# include <boost/static_assert.hpp> -# include <boost/python/refcount.hpp> - -# include <cstddef> - -namespace boost { namespace python { - -namespace detail -{ - template <std::size_t> - struct return_arg_pos_argument_must_be_positive -# if defined(__GNUC__) || defined(__EDG__) - {} -# endif - ; - - struct return_none - { - template <class T> struct apply - { - struct type - { - static bool convertible() - { - return true; - } - - PyObject *operator()( typename value_arg<T>::type ) const - { - return none(); - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - PyTypeObject const *get_pytype() const { return converter::expected_pytype_for_arg<T>::get_pytype() ; } -#endif - }; - }; - }; -} - -template < - std::size_t arg_pos=1 - , class Base = default_call_policies -> -struct return_arg : Base -{ - private: - BOOST_STATIC_CONSTANT(bool, legal = arg_pos > 0); - - public: - typedef typename mpl::if_c< - legal - , detail::return_none - , detail::return_arg_pos_argument_must_be_positive<arg_pos> - // we could default to the base result_converter in case or - // arg_pos==0 since return arg 0 means return result, but I - // think it is better to issue an error instead, cause it can - // lead to confusions - >::type result_converter; - - template <class ArgumentPackage> - static PyObject* postcall(ArgumentPackage const& args, PyObject* result) - { - // In case of arg_pos == 0 we could simply return Base::postcall, - // but this is redundant - BOOST_STATIC_ASSERT(arg_pos > 0); - - result = Base::postcall(args,result); - if (!result) - return 0; - Py_DECREF(result); - return incref( detail::get(mpl::int_<arg_pos-1>(),args) ); - } - - template <class Sig> - struct extract_return_type : mpl::at_c<Sig, arg_pos> - { - }; - -}; - -template < - class Base = default_call_policies - > -struct return_self - : return_arg<1,Base> -{}; - -}} // namespace boost::python - -#endif // RETURN_ARG_DWA2003719_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/return_by_value.hpp b/contrib/restricted/boost/python/include/boost/python/return_by_value.hpp deleted file mode 100644 index 42d7076d17..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/return_by_value.hpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef BY_VALUE_DWA20021015_HPP -# define BY_VALUE_DWA20021015_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/to_python_value.hpp> -# include <boost/python/detail/type_traits.hpp> - -# include <boost/python/detail/value_arg.hpp> - -namespace boost { namespace python { - -struct return_by_value -{ - template <class R> - struct apply - { - typedef to_python_value< - typename detail::value_arg<R>::type - > type; - }; -}; - -}} // namespace boost::python - -#endif // BY_VALUE_DWA20021015_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/return_internal_reference.hpp b/contrib/restricted/boost/python/include/boost/python/return_internal_reference.hpp deleted file mode 100644 index cc60f4422a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/return_internal_reference.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef RETURN_INTERNAL_REFERENCE_DWA2002131_HPP -# define RETURN_INTERNAL_REFERENCE_DWA2002131_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/default_call_policies.hpp> -# include <boost/python/reference_existing_object.hpp> -# include <boost/python/with_custodian_and_ward.hpp> -# include <boost/mpl/if.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <std::size_t> - struct return_internal_reference_owner_arg_must_be_greater_than_zero -# if defined(__GNUC__) || defined(__EDG__) - {} -# endif - ; -} - -template <std::size_t owner_arg = 1, class BasePolicy_ = default_call_policies> -struct return_internal_reference - : with_custodian_and_ward_postcall<0, owner_arg, BasePolicy_> -{ - private: - BOOST_STATIC_CONSTANT(bool, legal = owner_arg > 0); - public: - typedef typename mpl::if_c< - legal - , reference_existing_object - , detail::return_internal_reference_owner_arg_must_be_greater_than_zero<owner_arg> - >::type result_converter; -}; - -}} // namespace boost::python - -#endif // RETURN_INTERNAL_REFERENCE_DWA2002131_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/return_opaque_pointer.hpp b/contrib/restricted/boost/python/include/boost/python/return_opaque_pointer.hpp deleted file mode 100644 index 4654e3bd51..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/return_opaque_pointer.hpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright Gottfried Ganßauge 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) -/* - * Generic Return value converter generator for opaque C++-pointers - */ -# ifndef RETURN_OPAQUE_POINTER_HPP_ -# define RETURN_OPAQUE_POINTER_HPP_ - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/opaque_pointer_converter.hpp> -# include <boost/python/detail/force_instantiate.hpp> -# include <boost/python/to_python_value.hpp> -# include <boost/python/detail/value_arg.hpp> -# include <boost/mpl/assert.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <class Pointee> - static void opaque_pointee(Pointee const volatile*) - { - force_instantiate(opaque<Pointee>::instance); - } -} - -struct return_opaque_pointer -{ - template <class R> - struct apply - { - BOOST_MPL_ASSERT_MSG( is_pointer<R>::value, RETURN_OPAQUE_POINTER_EXPECTS_A_POINTER_TYPE, (R)); - - struct type : - boost::python::to_python_value< - typename detail::value_arg<R>::type - > - { - type() { detail::opaque_pointee(R()); } - }; - }; -}; - -}} // namespace boost::python -# endif // RETURN_OPAQUE_POINTER_HPP_ diff --git a/contrib/restricted/boost/python/include/boost/python/return_value_policy.hpp b/contrib/restricted/boost/python/include/boost/python/return_value_policy.hpp deleted file mode 100644 index 9a5fba380b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/return_value_policy.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef RETURN_VALUE_POLICY_DWA2002131_HPP -# define RETURN_VALUE_POLICY_DWA2002131_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/default_call_policies.hpp> - -namespace boost { namespace python { - -template <class ResultConverterGenerator, class BasePolicy_ = default_call_policies> -struct return_value_policy : BasePolicy_ -{ - typedef ResultConverterGenerator result_converter; -}; - -}} // namespace boost::python - -#endif // RETURN_VALUE_POLICY_DWA2002131_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/stl_iterator.hpp b/contrib/restricted/boost/python/include/boost/python/stl_iterator.hpp deleted file mode 100644 index 838954879a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/stl_iterator.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Eric Niebler 2005. -// Distributed under the 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 STL_ITERATOR_EAN20051028_HPP -# define STL_ITERATOR_EAN20051028_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object/stl_iterator_core.hpp> - -# include <boost/iterator/iterator_facade.hpp> - -namespace boost { namespace python -{ - -// An STL input iterator over a python sequence -template<typename ValueT> -struct stl_input_iterator - : boost::iterator_facade< - stl_input_iterator<ValueT> - , ValueT - , std::input_iterator_tag - , ValueT - > -{ - stl_input_iterator() - : impl_() - { - } - - // ob is the python sequence - stl_input_iterator(boost::python::object const &ob) - : impl_(ob) - { - } - -private: - friend class boost::iterator_core_access; - - void increment() - { - this->impl_.increment(); - } - - ValueT dereference() const - { - return extract<ValueT>(this->impl_.current().get())(); - } - - bool equal(stl_input_iterator<ValueT> const &that) const - { - return this->impl_.equal(that.impl_); - } - - objects::stl_input_iterator_impl impl_; -}; - -}} // namespace boost::python - -#endif // STL_ITERATOR_EAN20051028_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/to_python_converter.hpp b/contrib/restricted/boost/python/include/boost/python/to_python_converter.hpp deleted file mode 100644 index 4391b6dce9..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/to_python_converter.hpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef TO_PYTHON_CONVERTER_DWA200221_HPP -# define TO_PYTHON_CONVERTER_DWA200221_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/converter/registry.hpp> -# include <boost/python/converter/as_to_python_function.hpp> -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -# include <boost/python/converter/pytype_function.hpp> -#endif -# include <boost/python/type_id.hpp> - -namespace boost { namespace python { - -#if 0 //get_pytype member detection -namespace detail -{ - typedef char yes_type; - typedef struct {char a[2]; } no_type; - template<PyTypeObject const * (*f)()> struct test_get_pytype1 { }; - template<PyTypeObject * (*f)()> struct test_get_pytype2 { }; - - template<class T> yes_type tester(test_get_pytype1<&T::get_pytype>*); - - template<class T> yes_type tester(test_get_pytype2<&T::get_pytype>*); - - template<class T> no_type tester(...); - - template<class T> - struct test_get_pytype_base - { - BOOST_STATIC_CONSTANT(bool, value= (sizeof(detail::tester<T>(0)) == sizeof(yes_type))); - }; - - template<class T> - struct test_get_pytype : boost::mpl::bool_<test_get_pytype_base<T>::value> - { - }; - -} -#endif - -template < class T, class Conversion, bool has_get_pytype=false > -struct to_python_converter -{ -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - typedef boost::mpl::bool_<has_get_pytype> HasGetPytype; - - static PyTypeObject const* get_pytype_1(boost::mpl::true_ *) - { - return Conversion::get_pytype(); - } - - static PyTypeObject const* get_pytype_1(boost::mpl::false_ *) - { - return 0; - } - static PyTypeObject const* get_pytype_impl() - { - return get_pytype_1((HasGetPytype*)0); - } -#endif - - to_python_converter(); -}; - -// -// implementation -// - -template <class T, class Conversion ,bool has_get_pytype> -to_python_converter<T,Conversion, has_get_pytype>::to_python_converter() -{ - typedef converter::as_to_python_function< - T, Conversion - > normalized; - - converter::registry::insert( - &normalized::convert - , type_id<T>() -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - , &get_pytype_impl -#endif - ); -} - -}} // namespace boost::python - -#endif // TO_PYTHON_CONVERTER_DWA200221_HPP - diff --git a/contrib/restricted/boost/python/include/boost/python/with_custodian_and_ward.hpp b/contrib/restricted/boost/python/include/boost/python/with_custodian_and_ward.hpp deleted file mode 100644 index 3431c6f22c..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/with_custodian_and_ward.hpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef WITH_CUSTODIAN_AND_WARD_DWA2002131_HPP -# define WITH_CUSTODIAN_AND_WARD_DWA2002131_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/default_call_policies.hpp> -# include <boost/python/object/life_support.hpp> -# include <algorithm> - -namespace boost { namespace python { - -namespace detail -{ - template <std::size_t N> - struct get_prev - { - template <class ArgumentPackage> - static PyObject* execute(ArgumentPackage const& args, PyObject* = 0) - { - int const pre_n = static_cast<int>(N) - 1; // separate line is gcc-2.96 workaround - return detail::get(mpl::int_<pre_n>(), args); - } - }; - template <> - struct get_prev<0> - { - template <class ArgumentPackage> - static PyObject* execute(ArgumentPackage const&, PyObject* zeroth) - { - return zeroth; - } - }; -} -template < - std::size_t custodian - , std::size_t ward - , class BasePolicy_ = default_call_policies -> -struct with_custodian_and_ward : BasePolicy_ -{ - BOOST_STATIC_ASSERT(custodian != ward); - BOOST_STATIC_ASSERT(custodian > 0); - BOOST_STATIC_ASSERT(ward > 0); - - template <class ArgumentPackage> - static bool precall(ArgumentPackage const& args_) - { - unsigned arity_ = detail::arity(args_); - if (custodian > arity_ || ward > arity_) - { - PyErr_SetString( - PyExc_IndexError - , "boost::python::with_custodian_and_ward: argument index out of range" - ); - return false; - } - - PyObject* patient = detail::get_prev<ward>::execute(args_); - PyObject* nurse = detail::get_prev<custodian>::execute(args_); - - PyObject* life_support = python::objects::make_nurse_and_patient(nurse, patient); - if (life_support == 0) - return false; - - bool result = BasePolicy_::precall(args_); - - if (!result) { - Py_DECREF(life_support); - } - - return result; - } -}; - -template <std::size_t custodian, std::size_t ward, class BasePolicy_ = default_call_policies> -struct with_custodian_and_ward_postcall : BasePolicy_ -{ - BOOST_STATIC_ASSERT(custodian != ward); - - template <class ArgumentPackage> - static PyObject* postcall(ArgumentPackage const& args_, PyObject* result) - { - std::size_t arity_ = detail::arity(args_); - // check if either custodian or ward exceeds the arity - // (this weird formulation avoids "always false" warnings - // for arity_ = 0) - if ( (std::max)(custodian, ward) > arity_ ) - { - PyErr_SetString( - PyExc_IndexError - , "boost::python::with_custodian_and_ward_postcall: argument index out of range" - ); - return 0; - } - - PyObject* patient = detail::get_prev<ward>::execute(args_, result); - PyObject* nurse = detail::get_prev<custodian>::execute(args_, result); - - if (nurse == 0) return 0; - - result = BasePolicy_::postcall(args_, result); - if (result == 0) - return 0; - - if (python::objects::make_nurse_and_patient(nurse, patient) == 0) - { - Py_XDECREF(result); - return 0; - } - return result; - } -}; - - -}} // namespace boost::python - -#endif // WITH_CUSTODIAN_AND_WARD_DWA2002131_HPP diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/directory_management.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/directory_management.hpp deleted file mode 100644 index b219010d6d..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/directory_management.hpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2010 Vicente J. Botet Escriba - * Copyright 2015 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_DIRECTORY_MANAGEMENT_HPP_INCLUDED_ -#define BOOST_WINAPI_DIRECTORY_MANAGEMENT_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> -#include <boost/winapi/get_system_directory.hpp> -#include <boost/winapi/detail/header.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#if !defined( BOOST_USE_WINDOWS_H ) -extern "C" { -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC - CreateDirectoryA(boost::winapi::LPCSTR_, ::_SECURITY_ATTRIBUTES*); -#if BOOST_WINAPI_PARTITION_APP_SYSTEM -BOOST_WINAPI_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC - GetTempPathA(boost::winapi::DWORD_ length, boost::winapi::LPSTR_ buffer); -#endif -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC - RemoveDirectoryA(boost::winapi::LPCSTR_); -#endif -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC - CreateDirectoryW(boost::winapi::LPCWSTR_, ::_SECURITY_ATTRIBUTES*); -#if BOOST_WINAPI_PARTITION_APP_SYSTEM -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC - GetTempPathW(boost::winapi::DWORD_ length, boost::winapi::LPWSTR_ buffer); -#endif -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC - RemoveDirectoryW(boost::winapi::LPCWSTR_); -} // extern "C" -#endif - -namespace boost { -namespace winapi { - -#if !defined( BOOST_NO_ANSI_APIS ) -#if BOOST_WINAPI_PARTITION_APP_SYSTEM -using ::GetTempPathA; -#endif -using ::RemoveDirectoryA; -#endif -#if BOOST_WINAPI_PARTITION_APP_SYSTEM -using ::GetTempPathW; -#endif -using ::RemoveDirectoryW; - -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_FORCEINLINE BOOL_ CreateDirectoryA(LPCSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes) -{ - return ::CreateDirectoryA(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes)); -} -#endif - -BOOST_FORCEINLINE BOOL_ CreateDirectoryW(LPCWSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes) -{ - return ::CreateDirectoryW(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes)); -} - -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_FORCEINLINE BOOL_ create_directory(LPCSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes) -{ - return ::CreateDirectoryA(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes)); -} -#if BOOST_WINAPI_PARTITION_APP_SYSTEM -BOOST_FORCEINLINE DWORD_ get_temp_path(DWORD_ length, LPSTR_ buffer) -{ - return ::GetTempPathA(length, buffer); -} -#endif -BOOST_FORCEINLINE BOOL_ remove_directory(LPCSTR_ pPathName) -{ - return ::RemoveDirectoryA(pPathName); -} -#endif - -BOOST_FORCEINLINE BOOL_ create_directory(LPCWSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes) -{ - return ::CreateDirectoryW(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes)); -} -#if BOOST_WINAPI_PARTITION_APP_SYSTEM -BOOST_FORCEINLINE DWORD_ get_temp_path(DWORD_ length, LPWSTR_ buffer) -{ - return ::GetTempPathW(length, buffer); -} -#endif -BOOST_FORCEINLINE BOOL_ remove_directory(LPCWSTR_ pPathName) -{ - return ::RemoveDirectoryW(pPathName); -} - -} // namespace winapi -} // namespace boost - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_DIRECTORY_MANAGEMENT_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/file_mapping.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/file_mapping.hpp deleted file mode 100644 index 9a5e23803a..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/file_mapping.hpp +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright 2010 Vicente J. Botet Escriba - * Copyright 2015 Andrey Semashev - * Copyright 2016 Jorge Lodos - * Copyright 2017 James E. King, III - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_FILE_MAPPING_HPP_INCLUDED_ -#define BOOST_WINAPI_FILE_MAPPING_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> -#include <boost/winapi/detail/header.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -/* - * UWP: - * API SDK 8 SDK 10 - * CreateFileMapping DESKTOP - DESKTOP | SYSTEM - * FlushViewOfFile APP - APP | SYSTEM - * MapViewOfFile DESKTOP - DESKTOP | SYSTEM - * MapViewOfFileEx DESKTOP - DESKTOP | SYSTEM - * OpenFileMapping DESKTOP - DESKTOP | SYSTEM - * UnmapViewOfFile APP - APP | SYSTEM - */ - -#if !defined( BOOST_USE_WINDOWS_H ) -extern "C" { - -#if BOOST_WINAPI_PARTITION_DESKTOP -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -CreateFileMappingA( - boost::winapi::HANDLE_ hFile, - ::_SECURITY_ATTRIBUTES* lpFileMappingAttributes, - boost::winapi::DWORD_ flProtect, - boost::winapi::DWORD_ dwMaximumSizeHigh, - boost::winapi::DWORD_ dwMaximumSizeLow, - boost::winapi::LPCSTR_ lpName); - -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -OpenFileMappingA( - boost::winapi::DWORD_ dwDesiredAccess, - boost::winapi::BOOL_ bInheritHandle, - boost::winapi::LPCSTR_ lpName); -#endif // !defined( BOOST_NO_ANSI_APIS ) -#endif // BOOST_WINAPI_PARTITION_DESKTOP - -#if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -CreateFileMappingW( - boost::winapi::HANDLE_ hFile, - ::_SECURITY_ATTRIBUTES* lpFileMappingAttributes, - boost::winapi::DWORD_ flProtect, - boost::winapi::DWORD_ dwMaximumSizeHigh, - boost::winapi::DWORD_ dwMaximumSizeLow, - boost::winapi::LPCWSTR_ lpName); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::LPVOID_ BOOST_WINAPI_WINAPI_CC -MapViewOfFile( - boost::winapi::HANDLE_ hFileMappingObject, - boost::winapi::DWORD_ dwDesiredAccess, - boost::winapi::DWORD_ dwFileOffsetHigh, - boost::winapi::DWORD_ dwFileOffsetLow, - boost::winapi::SIZE_T_ dwNumberOfBytesToMap); - -BOOST_WINAPI_IMPORT boost::winapi::LPVOID_ BOOST_WINAPI_WINAPI_CC -MapViewOfFileEx( - boost::winapi::HANDLE_ hFileMappingObject, - boost::winapi::DWORD_ dwDesiredAccess, - boost::winapi::DWORD_ dwFileOffsetHigh, - boost::winapi::DWORD_ dwFileOffsetLow, - boost::winapi::SIZE_T_ dwNumberOfBytesToMap, - boost::winapi::LPVOID_ lpBaseAddress); - -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -OpenFileMappingW( - boost::winapi::DWORD_ dwDesiredAccess, - boost::winapi::BOOL_ bInheritHandle, - boost::winapi::LPCWSTR_ lpName); -#endif // BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM - -#if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -FlushViewOfFile( - boost::winapi::LPCVOID_ lpBaseAddress, - boost::winapi::SIZE_T_ dwNumberOfBytesToFlush); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -UnmapViewOfFile(boost::winapi::LPCVOID_ lpBaseAddress); -#endif // BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM - -} // extern "C" -#endif // !defined( BOOST_USE_WINDOWS_H ) - -namespace boost { -namespace winapi { - -#if defined( BOOST_USE_WINDOWS_H ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_FILE_ = SEC_FILE; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_IMAGE_ = SEC_IMAGE; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_RESERVE_ = SEC_RESERVE; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_COMMIT_ = SEC_COMMIT; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_NOCACHE_ = SEC_NOCACHE; - -// These permission flags are undocumented and some of them are equivalent to the FILE_MAP_* flags. -// SECTION_QUERY enables NtQuerySection. -// http://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FNT%20Objects%2FSection%2FNtQuerySection.html -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_QUERY_ = SECTION_QUERY; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_WRITE_ = SECTION_MAP_WRITE; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_READ_ = SECTION_MAP_READ; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_EXECUTE_ = SECTION_MAP_EXECUTE; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_EXTEND_SIZE_ = SECTION_EXTEND_SIZE; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_ALL_ACCESS_ = SECTION_ALL_ACCESS; - -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_COPY_ = FILE_MAP_COPY; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_WRITE_ = FILE_MAP_WRITE; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_READ_ = FILE_MAP_READ; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_ALL_ACCESS_ = FILE_MAP_ALL_ACCESS; - -#else // defined( BOOST_USE_WINDOWS_H ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_FILE_ = 0x800000; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_IMAGE_ = 0x1000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_RESERVE_ = 0x4000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_COMMIT_ = 0x8000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_NOCACHE_ = 0x10000000; - -// These permission flags are undocumented and some of them are equivalent to the FILE_MAP_* flags. -// SECTION_QUERY enables NtQuerySection. -// http://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FNT%20Objects%2FSection%2FNtQuerySection.html -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_QUERY_ = 0x00000001; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_WRITE_ = 0x00000002; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_READ_ = 0x00000004; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_EXECUTE_ = 0x00000008; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_EXTEND_SIZE_ = 0x00000010; -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_ALL_ACCESS_ = 0x000F001F; // STANDARD_RIGHTS_REQUIRED | SECTION_* - -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_COPY_ = SECTION_QUERY_; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_WRITE_ = SECTION_MAP_WRITE_; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_READ_ = SECTION_MAP_READ_; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_ALL_ACCESS_ = SECTION_ALL_ACCESS_; - -#endif // defined( BOOST_USE_WINDOWS_H ) - -// These constants are not defined in Windows SDK up until the one shipped with MSVC 8 and MinGW (as of 2016-02-14) -BOOST_CONSTEXPR_OR_CONST DWORD_ SECTION_MAP_EXECUTE_EXPLICIT_ = 0x00000020; // not included in SECTION_ALL_ACCESS -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_MAP_EXECUTE_ = SECTION_MAP_EXECUTE_EXPLICIT_; // not included in FILE_MAP_ALL_ACCESS - -// These constants are not defined in Windows SDK up until 6.0A and MinGW (as of 2016-02-14) -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_PROTECTED_IMAGE_ = 0x2000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_WRITECOMBINE_ = 0x40000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_LARGE_PAGES_ = 0x80000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ SEC_IMAGE_NO_EXECUTE_ = (SEC_IMAGE_ | SEC_NOCACHE_); - -#if BOOST_WINAPI_PARTITION_DESKTOP -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_FORCEINLINE HANDLE_ CreateFileMappingA( - HANDLE_ hFile, - SECURITY_ATTRIBUTES_* lpFileMappingAttributes, - DWORD_ flProtect, - DWORD_ dwMaximumSizeHigh, - DWORD_ dwMaximumSizeLow, - LPCSTR_ lpName) -{ - return ::CreateFileMappingA( - hFile, - reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpFileMappingAttributes), - flProtect, - dwMaximumSizeHigh, - dwMaximumSizeLow, - lpName); -} - -BOOST_FORCEINLINE HANDLE_ create_file_mapping( - HANDLE_ hFile, - SECURITY_ATTRIBUTES_* lpFileMappingAttributes, - DWORD_ flProtect, - DWORD_ dwMaximumSizeHigh, - DWORD_ dwMaximumSizeLow, - LPCSTR_ lpName) -{ - return ::CreateFileMappingA( - hFile, - reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpFileMappingAttributes), - flProtect, - dwMaximumSizeHigh, - dwMaximumSizeLow, - lpName); -} - -using ::OpenFileMappingA; - -BOOST_FORCEINLINE HANDLE_ open_file_mapping(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName) -{ - return ::OpenFileMappingA(dwDesiredAccess, bInheritHandle, lpName); -} -#endif -#endif // BOOST_WINAPI_PARTITION_DESKTOP - -#if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM -BOOST_FORCEINLINE HANDLE_ CreateFileMappingW( - HANDLE_ hFile, - SECURITY_ATTRIBUTES_* lpFileMappingAttributes, - DWORD_ flProtect, - DWORD_ dwMaximumSizeHigh, - DWORD_ dwMaximumSizeLow, - LPCWSTR_ lpName) -{ - return ::CreateFileMappingW( - hFile, - reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpFileMappingAttributes), - flProtect, - dwMaximumSizeHigh, - dwMaximumSizeLow, - lpName); -} - -BOOST_FORCEINLINE HANDLE_ create_file_mapping( - HANDLE_ hFile, - SECURITY_ATTRIBUTES_* lpFileMappingAttributes, - DWORD_ flProtect, - DWORD_ dwMaximumSizeHigh, - DWORD_ dwMaximumSizeLow, - LPCWSTR_ lpName) -{ - return ::CreateFileMappingW( - hFile, - reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpFileMappingAttributes), - flProtect, - dwMaximumSizeHigh, - dwMaximumSizeLow, - lpName); -} - -using ::MapViewOfFile; -using ::MapViewOfFileEx; -using ::OpenFileMappingW; - -BOOST_FORCEINLINE HANDLE_ open_file_mapping(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName) -{ - return ::OpenFileMappingW(dwDesiredAccess, bInheritHandle, lpName); -} -#endif // BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM - -#if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM -using ::FlushViewOfFile; -using ::UnmapViewOfFile; -#endif // BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM - -} -} - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_FILE_MAPPING_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/get_system_directory.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/get_system_directory.hpp deleted file mode 100644 index 636808a915..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/get_system_directory.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2016 Klemens D. Morgenstern - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_GET_SYSTEM_DIRECTORY_HPP_INCLUDED_ -#define BOOST_WINAPI_GET_SYSTEM_DIRECTORY_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#if BOOST_WINAPI_PARTITION_DESKTOP - -#include <boost/winapi/detail/header.hpp> - -#if !defined( BOOST_USE_WINDOWS_H ) -extern "C" { -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_WINAPI_IMPORT boost::winapi::UINT_ BOOST_WINAPI_WINAPI_CC -GetSystemDirectoryA( - boost::winapi::LPSTR_ lpBuffer, - boost::winapi::UINT_ uSize); -#endif - -BOOST_WINAPI_IMPORT boost::winapi::UINT_ BOOST_WINAPI_WINAPI_CC -GetSystemDirectoryW( - boost::winapi::LPWSTR_ lpBuffer, - boost::winapi::UINT_ uSize); -} // extern "C" -#endif - -namespace boost { -namespace winapi { - -#if !defined( BOOST_NO_ANSI_APIS ) -using ::GetSystemDirectoryA; -#endif -using ::GetSystemDirectoryW; - -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_FORCEINLINE UINT_ get_system_directory(LPSTR_ lpBuffer, UINT_ uSize) -{ - return ::GetSystemDirectoryA(lpBuffer, uSize); -} -#endif - -BOOST_FORCEINLINE UINT_ get_system_directory(LPWSTR_ lpBuffer, UINT_ uSize) -{ - return ::GetSystemDirectoryW(lpBuffer, uSize); -} - -} -} - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_PARTITION_DESKTOP - -#endif // BOOST_WINAPI_GET_SYSTEM_DIRECTORY_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/mutex.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/mutex.hpp deleted file mode 100644 index c708c54376..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/mutex.hpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2010 Vicente J. Botet Escriba - * Copyright 2015, 2017 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_MUTEX_HPP_INCLUDED_ -#define BOOST_WINAPI_MUTEX_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> -#include <boost/winapi/detail/header.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#if !defined( BOOST_USE_WINDOWS_H ) && BOOST_WINAPI_PARTITION_APP_SYSTEM -extern "C" { -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -CreateMutexA( - ::_SECURITY_ATTRIBUTES* lpMutexAttributes, - boost::winapi::BOOL_ bInitialOwner, - boost::winapi::LPCSTR_ lpName); -#endif - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -CreateMutexW( - ::_SECURITY_ATTRIBUTES* lpMutexAttributes, - boost::winapi::BOOL_ bInitialOwner, - boost::winapi::LPCWSTR_ lpName); -} // extern "C" -#endif // !defined( BOOST_USE_WINDOWS_H ) && BOOST_WINAPI_PARTITION_APP_SYSTEM - -#if !defined( BOOST_USE_WINDOWS_H ) -extern "C" { -#if !defined( BOOST_NO_ANSI_APIS ) -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -CreateMutexExA( - ::_SECURITY_ATTRIBUTES* lpMutexAttributes, - boost::winapi::LPCSTR_ lpName, - boost::winapi::DWORD_ dwFlags, - boost::winapi::DWORD_ dwDesiredAccess); -#endif - -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -OpenMutexA( - boost::winapi::DWORD_ dwDesiredAccess, - boost::winapi::BOOL_ bInheritHandle, - boost::winapi::LPCSTR_ lpName); -#endif // !defined( BOOST_NO_ANSI_APIS ) - -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -CreateMutexExW( - ::_SECURITY_ATTRIBUTES* lpMutexAttributes, - boost::winapi::LPCWSTR_ lpName, - boost::winapi::DWORD_ dwFlags, - boost::winapi::DWORD_ dwDesiredAccess); -#endif - -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -OpenMutexW( - boost::winapi::DWORD_ dwDesiredAccess, - boost::winapi::BOOL_ bInheritHandle, - boost::winapi::LPCWSTR_ lpName); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -ReleaseMutex(boost::winapi::HANDLE_ hMutex); -} // extern "C" -#endif - -namespace boost { -namespace winapi { - -#if !defined( BOOST_NO_ANSI_APIS ) -using ::OpenMutexA; -#endif -using ::OpenMutexW; -using ::ReleaseMutex; - -#if defined( BOOST_USE_WINDOWS_H ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ MUTEX_ALL_ACCESS_ = MUTEX_ALL_ACCESS; -BOOST_CONSTEXPR_OR_CONST DWORD_ MUTEX_MODIFY_STATE_ = MUTEX_MODIFY_STATE; -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 -BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_MUTEX_INITIAL_OWNER_ = CREATE_MUTEX_INITIAL_OWNER; -#endif - -#else // defined( BOOST_USE_WINDOWS_H ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ MUTEX_ALL_ACCESS_ = 0x001F0001; -BOOST_CONSTEXPR_OR_CONST DWORD_ MUTEX_MODIFY_STATE_ = 0x00000001; -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 -BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_MUTEX_INITIAL_OWNER_ = 0x00000001; -#endif - -#endif // defined( BOOST_USE_WINDOWS_H ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ mutex_all_access = MUTEX_ALL_ACCESS_; -BOOST_CONSTEXPR_OR_CONST DWORD_ mutex_modify_state = MUTEX_MODIFY_STATE_; -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 -BOOST_CONSTEXPR_OR_CONST DWORD_ create_mutex_initial_owner = CREATE_MUTEX_INITIAL_OWNER_; -#endif - -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_FORCEINLINE HANDLE_ CreateMutexA(SECURITY_ATTRIBUTES_* lpMutexAttributes, BOOL_ bInitialOwner, LPCSTR_ lpName) -{ -#if !BOOST_WINAPI_PARTITION_APP_SYSTEM && BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 - const DWORD_ flags = bInitialOwner ? create_mutex_initial_owner : 0u; - return ::CreateMutexExA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpMutexAttributes), lpName, flags, mutex_all_access); -#else - return ::CreateMutexA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpMutexAttributes), bInitialOwner, lpName); -#endif -} - -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 -BOOST_FORCEINLINE HANDLE_ CreateMutexExA( - SECURITY_ATTRIBUTES_* lpMutexAttributes, - LPCSTR_ lpName, - DWORD_ dwFlags, - DWORD_ dwDesiredAccess) -{ - return ::CreateMutexExA(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpMutexAttributes), lpName, dwFlags, dwDesiredAccess); -} -#endif -#endif - -BOOST_FORCEINLINE HANDLE_ CreateMutexW(SECURITY_ATTRIBUTES_* lpMutexAttributes, BOOL_ bInitialOwner, LPCWSTR_ lpName) -{ -#if !BOOST_WINAPI_PARTITION_APP_SYSTEM && BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 - const DWORD_ flags = bInitialOwner ? create_mutex_initial_owner : 0u; - return ::CreateMutexExW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpMutexAttributes), lpName, flags, mutex_all_access); -#else - return ::CreateMutexW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpMutexAttributes), bInitialOwner, lpName); -#endif -} - -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 -BOOST_FORCEINLINE HANDLE_ CreateMutexExW( - SECURITY_ATTRIBUTES_* lpMutexAttributes, - LPCWSTR_ lpName, - DWORD_ dwFlags, - DWORD_ dwDesiredAccess) -{ - return ::CreateMutexExW(reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpMutexAttributes), lpName, dwFlags, dwDesiredAccess); -} -#endif - -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_FORCEINLINE HANDLE_ create_mutex(SECURITY_ATTRIBUTES_* lpAttributes, BOOL_ bInitialOwner, LPCSTR_ lpName) -{ - return winapi::CreateMutexA(lpAttributes, bInitialOwner, lpName); -} - -BOOST_FORCEINLINE HANDLE_ open_mutex(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName) -{ - return ::OpenMutexA(dwDesiredAccess, bInheritHandle, lpName); -} -#endif - -BOOST_FORCEINLINE HANDLE_ create_mutex(SECURITY_ATTRIBUTES_* lpAttributes, BOOL_ bInitialOwner, LPCWSTR_ lpName) -{ - return winapi::CreateMutexW(lpAttributes, bInitialOwner, lpName); -} - -BOOST_FORCEINLINE HANDLE_ open_mutex(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName) -{ - return ::OpenMutexW(dwDesiredAccess, bInheritHandle, lpName); -} - -BOOST_FORCEINLINE HANDLE_ create_anonymous_mutex(SECURITY_ATTRIBUTES_* lpAttributes, BOOL_ bInitialOwner) -{ - return winapi::CreateMutexW(lpAttributes, bInitialOwner, 0); -} - -} -} - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_MUTEX_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/security.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/security.hpp deleted file mode 100644 index 80a2d952e3..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/security.hpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2010 Vicente J. Botet Escriba - * Copyright 2015 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_SECURITY_HPP_INCLUDED_ -#define BOOST_WINAPI_SECURITY_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#if BOOST_WINAPI_PARTITION_APP_SYSTEM - -#include <boost/winapi/detail/header.hpp> - -#if !defined( BOOST_USE_WINDOWS_H ) -extern "C" { -struct _ACL; -struct _SECURITY_DESCRIPTOR; -#if defined( BOOST_WINAPI_IS_MINGW ) -typedef _SECURITY_DESCRIPTOR *PSECURITY_DESCRIPTOR; -#else -typedef boost::winapi::PVOID_ PSECURITY_DESCRIPTOR; -#endif - -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -InitializeSecurityDescriptor( - PSECURITY_DESCRIPTOR pSecurityDescriptor, - boost::winapi::DWORD_ dwRevision); -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -SetSecurityDescriptorDacl( - PSECURITY_DESCRIPTOR pSecurityDescriptor, - boost::winapi::BOOL_ bDaclPresent, - ::_ACL* pDacl, - boost::winapi::BOOL_ bDaclDefaulted); -} -#endif - -namespace boost { -namespace winapi { - -typedef PVOID_ PSID_; -typedef WORD_ SECURITY_DESCRIPTOR_CONTROL_, *PSECURITY_DESCRIPTOR_CONTROL_; - -typedef struct BOOST_MAY_ALIAS _ACL { - BYTE_ AclRevision; - BYTE_ Sbz1; - WORD_ AclSize; - WORD_ AceCount; - WORD_ Sbz2; -} ACL_, *PACL_; - -typedef struct BOOST_MAY_ALIAS _SECURITY_DESCRIPTOR { - BYTE_ Revision; - BYTE_ Sbz1; - SECURITY_DESCRIPTOR_CONTROL_ Control; - PSID_ Owner; - PSID_ Group; - PACL_ Sacl; - PACL_ Dacl; -} SECURITY_DESCRIPTOR_, *PISECURITY_DESCRIPTOR_; - -// To abstract away the different ::PSECURITY_DESCRIPTOR on MinGW, we use PVOID_ universally here -// and cast the pointers to ::PSECURITY_DESCRIPTOR in wrapper functions. -typedef PVOID_ PSECURITY_DESCRIPTOR_; - -BOOST_FORCEINLINE BOOL_ InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR_ pSecurityDescriptor, DWORD_ dwRevision) -{ - return ::InitializeSecurityDescriptor(reinterpret_cast< ::PSECURITY_DESCRIPTOR >(pSecurityDescriptor), dwRevision); -} - -BOOST_FORCEINLINE BOOL_ SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR_ pSecurityDescriptor, BOOL_ bDaclPresent, PACL_ pDacl, BOOL_ bDaclDefaulted) -{ - return ::SetSecurityDescriptorDacl(reinterpret_cast< ::PSECURITY_DESCRIPTOR >(pSecurityDescriptor), bDaclPresent, reinterpret_cast< ::_ACL* >(pDacl), bDaclDefaulted); -} - -} -} - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_PARTITION_APP_SYSTEM -#endif // BOOST_WINAPI_SECURITY_HPP_INCLUDED_ diff --git a/ydb/public/lib/ydb_cli/commands/ydb_profile.cpp b/ydb/public/lib/ydb_cli/commands/ydb_profile.cpp index a6f344b4c2..6c93933081 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_profile.cpp +++ b/ydb/public/lib/ydb_cli/commands/ydb_profile.cpp @@ -47,6 +47,8 @@ TCommandProfile::TCommandProfile() AddCommand(std::make_unique<TCommandDeactivateProfile>()); AddCommand(std::make_unique<TCommandListProfiles>()); AddCommand(std::make_unique<TCommandGetProfile>()); + AddCommand(std::make_unique<TCommandUpdateProfile>()); + AddCommand(std::make_unique<TCommandReplaceProfile>()); } namespace { @@ -152,7 +154,7 @@ namespace { if (config.ParseResult->Has(name)) { profile->SetValue(name, config.ParseResult->Get(name)); return; - }; + } } if (!interactive) { return; @@ -444,54 +446,18 @@ int TCommandInit::Run(TConfig& config) { return EXIT_SUCCESS; } -TCommandCreateProfile::TCommandCreateProfile() - : TClientCommand("create", {}, "Create new configuration profile or re-configure existing one") +TCommandProfileCommon::TCommandProfileCommon(const TString& name, const std::initializer_list<TString>& aliases, const TString& description) + : TClientCommand(name, aliases, description) {} -void TCommandCreateProfile::Config(TConfig& config) { - TClientCommand::Config(config); - - config.SetFreeArgsMax(1); - SetFreeArgTitle(0, "<name>", "Profile name"); - NLastGetopt::TOpts& opts = *config.Opts; - - opts.AddLongOption('e', "endpoint", "Endpoint to save in the profile").RequiredArgument("STRING"); - opts.AddLongOption('d', "database", "Database to save in the profile").RequiredArgument("PATH"); - - opts.AddLongOption("token-file", "Access token file").RequiredArgument("PATH"); - opts.AddLongOption("iam-token-file", "Access token file").RequiredArgument("PATH").Hidden(); - if (config.UseIamAuth) { - opts.AddLongOption("yc-token-file", "YC OAuth refresh token file").RequiredArgument("PATH"); - opts.AddLongOption("use-metadata-credentials", "Metadata service authentication").Optional().StoreTrue(&UseMetadataCredentials); - opts.AddLongOption("sa-key-file", "YC Service account key file").RequiredArgument("PATH"); - } - - if (config.UseStaticCredentials) { - opts.AddLongOption("user", "User name").RequiredArgument("STR"); - opts.AddLongOption("password-file", "Password file").RequiredArgument("PATH"); - } - if (config.UseIamAuth) { - opts.AddLongOption("iam-endpoint", "Endpoint of IAM service to refresh token in YC OAuth or YC Service account authentication modes").RequiredArgument("STR"); - } - -} - -bool TCommandCreateProfile::AnyProfileOptionInCommandLine(TConfig& config) { - return (config.ParseResult->Has("endpoint") || config.ParseResult->Has("database") || - config.ParseResult->Has("token-file") || config.ParseResult->Has("iam-token-file") || config.ParseResult->Has("yc-token-file") || - config.ParseResult->Has("sa-key-file") || config.ParseResult->Has("use-metadata-credentials") || - config.ParseResult->Has("user") || config.ParseResult->Has("password-file") || - config.ParseResult->Has("iam-endpoint")); -} - -void TCommandCreateProfile::ValidateAuth(TConfig& config) { - size_t authMethodCount = - (size_t)(config.ParseResult->Has("token-file")) + - (size_t)(config.ParseResult->Has("iam-token-file")) + - (size_t)(config.ParseResult->Has("yc-token-file")) + - (size_t)UseMetadataCredentials + - (size_t)(config.ParseResult->Has("sa-key-file")) + - (size_t)(config.ParseResult->Has("user") || config.ParseResult->Has("password-file")); +void TCommandProfileCommon::ValidateAuth(TConfig& config) { + size_t authMethodCount = + (size_t)(config.ParseResult->Has("token-file")) + + (size_t)(config.ParseResult->Has("iam-token-file")) + + (size_t)(config.ParseResult->Has("yc-token-file")) + + (size_t)UseMetadataCredentials + + (size_t)(config.ParseResult->Has("sa-key-file")) + + (size_t)(config.ParseResult->Has("user") || config.ParseResult->Has("password-file")); if (authMethodCount > 1) { TStringBuilder str; @@ -518,10 +484,52 @@ void TCommandCreateProfile::ValidateAuth(TConfig& config) { str << " Password file (" << config.ParseResult->Get("password-file") << ")"; } - throw TMisuseException() << str << ". Choose exactly one of them"; + throw TMisuseException() << str << ". Choose exactly one of them"; } +} +bool TCommandProfileCommon::AnyProfileOptionInCommandLine(TConfig& config) { + return (config.ParseResult->Has("endpoint") || config.ParseResult->Has("database") || + config.ParseResult->Has("token-file") || config.ParseResult->Has("iam-token-file") || config.ParseResult->Has("yc-token-file") || + config.ParseResult->Has("sa-key-file") || config.ParseResult->Has("use-metadata-credentials") || + config.ParseResult->Has("user") || config.ParseResult->Has("password-file") || + config.ParseResult->Has("iam-endpoint")); +} + + +TCommandCreateProfile::TCommandCreateProfile() + : TCommandProfileCommon("create", {}, "Create new configuration profile or re-configure existing one") +{} + +void TCommandProfileCommon::Config(TConfig& config) { + TClientCommand::Config(config); + + config.SetFreeArgsMax(1); + SetFreeArgTitle(0, "<name>", "Profile name"); + NLastGetopt::TOpts& opts = *config.Opts; + + opts.AddLongOption('e', "endpoint", "Endpoint to save in the profile").RequiredArgument("STRING"); + opts.AddLongOption('d', "database", "Database to save in the profile").RequiredArgument("PATH"); + + opts.AddLongOption("token-file", "Access token file").RequiredArgument("PATH"); + opts.AddLongOption("iam-token-file", "Access token file").RequiredArgument("PATH").Hidden(); + if (config.UseIamAuth) { + opts.AddLongOption("yc-token-file", "YC OAuth refresh token file").RequiredArgument("PATH"); + opts.AddLongOption("use-metadata-credentials", "Metadata service authentication").Optional().StoreTrue(&UseMetadataCredentials); + opts.AddLongOption("sa-key-file", "YC Service account key file").RequiredArgument("PATH"); + } + + if (config.UseStaticCredentials) { + opts.AddLongOption("user", "User name").RequiredArgument("STR"); + opts.AddLongOption("password-file", "Password file").RequiredArgument("PATH"); + } + if (config.UseIamAuth) { + opts.AddLongOption("iam-endpoint", "Endpoint of IAM service to refresh token in YC OAuth or YC Service account authentication modes").RequiredArgument("STR"); + } +} +void TCommandCreateProfile::Config(TConfig& config) { + TCommandProfileCommon::Config(config); } void TCommandCreateProfile::Parse(TConfig& config) { @@ -536,14 +544,20 @@ int TCommandCreateProfile::Run(TConfig& config) { // Y_UNUSED(config); TString profileName = ProfileName; Interactive = !AnyProfileOptionInCommandLine(config) || !profileName; + auto profileManager = CreateYdbProfileManager(config.YdbDir); if (Interactive) { Cout << "Welcome! This command will take you through configuration profile creation process." << Endl; } + else { + if (profileManager->HasProfile(ProfileName)) { + Cerr << "Profile \"" << ProfileName << "\" already exists. Consider using update, replace or delete command." << Endl; + return EXIT_FAILURE; + } + } if (!profileName) { Cout << "Please enter configuration profile name to create or re-configure: "; Cin >> profileName; } - auto profileManager = CreateYdbProfileManager(config.YdbDir); ConfigureProfile(profileName, profileManager, config, Interactive, true); return EXIT_SUCCESS; } @@ -835,4 +849,111 @@ int TCommandGetProfile::Run(TConfig& config) { return EXIT_SUCCESS; } +TCommandUpdateProfile::TCommandUpdateProfile() + : TCommandProfileCommon("update", {}, "Update existing configuration profile") +{} + +void TCommandUpdateProfile::Config(TConfig& config) { + TCommandProfileCommon::Config(config); + + config.SetFreeArgsMin(1); + NLastGetopt::TOpts& opts = *config.Opts; + opts.AddLongOption("no-endpoint", "Delete endpoint from the profile").StoreTrue(&NoEndpoint); + opts.AddLongOption("no-database", "Delete database from the profile").StoreTrue(&NoDatabase); + opts.AddLongOption("no-auth", "Delete authentication data from the profile").StoreTrue(&NoAuth); + + if (config.UseIamAuth) { + opts.AddLongOption("no-iam-endpoint", "Delete endpoint of IAM service from the profile").StoreTrue(&NoIamEndpoint); + } +} + +void TCommandUpdateProfile::ValidateNoOptions(TConfig& config) { + size_t authMethodCount = + (size_t)(config.ParseResult->Has("token-file")) + + (size_t)(config.ParseResult->Has("iam-token-file")) + + (size_t)(config.ParseResult->Has("yc-token-file")) + + (size_t)UseMetadataCredentials + + (size_t)(config.ParseResult->Has("sa-key-file")) + + (size_t)(config.ParseResult->Has("user") || config.ParseResult->Has("password-file")); + if (authMethodCount > 0 && ParseResult->Has("no-auth")) { + throw TMisuseException() << "You cannot enter authentication options and the \"--no-auth\" option at the same time"; + } + TStringBuilder str; + if (config.ParseResult->Has("endpoint") && config.ParseResult->Has("no-endpoint")) { + str << "\"--endpoint\" and \"--no-endpoint\""; + } else { + if (config.ParseResult->Has("database") && config.ParseResult->Has("no-database")) { + str << "\"--database and \"--no-database\""; + } else { + if (config.ParseResult->Has("iam-endpoint") && config.ParseResult->Has("no-iam-endpoint")) { + str << "\"--iam-endpoint\" and \"--no-iam-endpoint\""; + } + } + } + if (!str.empty()) { + throw TMisuseException() << "Options " << str << " are mutually exclusive"; + } +} + +void TCommandUpdateProfile::DropNoOptions(std::shared_ptr<IProfile> profile) { + if (NoEndpoint) { + profile->RemoveValue("endpoint"); + } + if (NoDatabase) { + profile->RemoveValue("database"); + } + if (NoIamEndpoint) { + profile->RemoveValue("iam-endpoint"); + } + if (NoAuth) { + profile->RemoveValue("authentication"); + } +} + +void TCommandUpdateProfile::Parse(TConfig& config) { + TClientCommand::Parse(config); + ProfileName = config.ParseResult->GetFreeArgs()[0]; + ValidateAuth(config); + ValidateNoOptions(config); +} + +int TCommandUpdateProfile::Run(TConfig& config) { + auto profileManager = CreateYdbProfileManager(config.YdbDir); + if (!profileManager->HasProfile(ProfileName)) { + Cerr << "No existing profile \"" << ProfileName << "\". " + << "Run \"ydb config profile list\" without arguments to see existing profiles" << Endl; + return EXIT_FAILURE; + } + DropNoOptions(profileManager->GetProfile(ProfileName)); + if (profileManager->GetProfile(ProfileName)->IsEmpty()) { + profileManager->RemoveProfile(ProfileName); + profileManager->CreateProfile(ProfileName); + } + ConfigureProfile(ProfileName, profileManager, config, false, true); + return EXIT_SUCCESS; +} + +TCommandReplaceProfile::TCommandReplaceProfile() + : TCommandProfileCommon("replace", {}, "Create new configuration profile or delete and re-configure existing one") +{} + +void TCommandReplaceProfile::Config(TConfig& config) { + TCommandProfileCommon::Config(config); + config.SetFreeArgsMin(1); +} + +void TCommandReplaceProfile::Parse(TConfig& config) { + TClientCommand::Parse(config); + ProfileName = config.ParseResult->GetFreeArgs()[0]; + ValidateAuth(config); +} + +int TCommandReplaceProfile::Run(TConfig& config) { + auto profileManager = CreateYdbProfileManager(config.YdbDir); + profileManager->RemoveProfile(ProfileName); + profileManager->CreateProfile(ProfileName); + ConfigureProfile(ProfileName, profileManager, config, false, true); + return EXIT_SUCCESS; +} + } // NYdb::NConsoleClient diff --git a/ydb/public/lib/ydb_cli/commands/ydb_profile.h b/ydb/public/lib/ydb_cli/commands/ydb_profile.h index 877e7129c7..55cad46039 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_profile.h +++ b/ydb/public/lib/ydb_cli/commands/ydb_profile.h @@ -26,21 +26,27 @@ public: virtual int Run(TConfig& config) override; }; -class TCommandCreateProfile : public TClientCommand { +class TCommandProfileCommon : public TClientCommand { public: - TCommandCreateProfile(); + TCommandProfileCommon(const TString& name, const std::initializer_list<TString>& aliases = + std::initializer_list<TString>(), const TString& description = TString()); virtual void Config(TConfig& config) override; - virtual void Parse(TConfig& config) override; - virtual int Run(TConfig& config) override; -private: +protected: void ValidateAuth(TConfig& config); - void PutAuthMethod(std::shared_ptr<IProfile> profile, const TString& id, const TString& value); - void PutAuthStatic(std::shared_ptr<IProfile> profile, const TString& user, const TString& pass); - void PutAuthMethodWithoutPars(std::shared_ptr<IProfile> profile, const TString& id); bool AnyProfileOptionInCommandLine(TConfig& config); TString ProfileName; bool UseMetadataCredentials = false; +}; + +class TCommandCreateProfile : public TCommandProfileCommon { +public: + TCommandCreateProfile(); + virtual void Config(TConfig& config) override; + virtual void Parse(TConfig& config) override; + virtual int Run(TConfig& config) override; + +private: bool Interactive; }; @@ -95,5 +101,28 @@ private: TString ProfileName; }; +class TCommandUpdateProfile : public TCommandProfileCommon { +public: + TCommandUpdateProfile(); + virtual void Config(TConfig& config) override; + virtual void Parse(TConfig& config) override; + virtual int Run(TConfig& config) override; +private: + void ValidateNoOptions(TConfig& config); + void DropNoOptions(std::shared_ptr<IProfile> profile); + bool NoEndpoint = false; + bool NoDatabase = false; + bool NoAuth = false; + bool NoIamEndpoint = false; +}; + +class TCommandReplaceProfile : public TCommandProfileCommon { +public: + TCommandReplaceProfile(); + virtual void Config(TConfig& config) override; + virtual void Parse(TConfig& config) override; + virtual int Run(TConfig& config) override; +}; + } } diff --git a/ydb/public/lib/ydb_cli/common/profile_manager.cpp b/ydb/public/lib/ydb_cli/common/profile_manager.cpp index cbb21ba307..6156df75ed 100644 --- a/ydb/public/lib/ydb_cli/common/profile_manager.cpp +++ b/ydb/public/lib/ydb_cli/common/profile_manager.cpp @@ -22,6 +22,10 @@ public: return Name; } + bool IsEmpty() const override { + return YamlProfile.size() == 0; + } + bool Has(const TString& key) const noexcept override { return YamlProfile[key]; } @@ -70,6 +74,11 @@ public: return Config["profiles"] && Config["profiles"][profileName]; } + std::shared_ptr<IProfile> CreateProfile(const TString& profileName) override { + Config["profiles"][profileName] = YAML::Node(); + return GetProfile(profileName); + } + std::shared_ptr<IProfile> GetProfile(const TString& profileName) override { return std::make_shared<TProfile>(profileName, Config["profiles"][profileName], ProfilesChanged, shared_from_this()); } diff --git a/ydb/public/lib/ydb_cli/common/profile_manager.h b/ydb/public/lib/ydb_cli/common/profile_manager.h index 44bf9aa79b..c96df527d9 100644 --- a/ydb/public/lib/ydb_cli/common/profile_manager.h +++ b/ydb/public/lib/ydb_cli/common/profile_manager.h @@ -11,6 +11,7 @@ public: virtual ~IProfile() = default; virtual TString GetName() const = 0; + virtual bool IsEmpty() const = 0; virtual bool Has(const TString& key) const noexcept = 0; virtual void SetValue(const TString& key, const YAML::Node& value) = 0; virtual void SetValue(const TString& key, const TString& value) = 0; @@ -24,6 +25,7 @@ public: virtual bool HasProfile(const TString& profileName) const = 0; // Get existing profile or create new + virtual std::shared_ptr<IProfile> CreateProfile(const TString& profileName) = 0; virtual std::shared_ptr<IProfile> GetProfile(const TString& profileName) = 0; virtual TVector<TString> ListProfiles() const = 0; virtual bool RemoveProfile(const TString& profileName) = 0; |