diff options
author | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-09-11 22:40:27 +0300 |
---|---|---|
committer | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-09-11 22:40:27 +0300 |
commit | 8ee3a632d2efcea08c59920dab8aa7b5c29c5e25 (patch) | |
tree | d3111e79a74f9a04dd866032536666241b374802 | |
parent | 7b5901f98468efe49b044b6ef344c5d6aa2116f2 (diff) | |
download | ydb-8ee3a632d2efcea08c59920dab8aa7b5c29c5e25.tar.gz |
Reimport boost/property_tree as a separate project
181 files changed, 34 insertions, 28427 deletions
diff --git a/contrib/restricted/boost/CMakeLists.txt b/contrib/restricted/boost/CMakeLists.txt index fb7f4bd673..146e6959b0 100644 --- a/contrib/restricted/boost/CMakeLists.txt +++ b/contrib/restricted/boost/CMakeLists.txt @@ -61,6 +61,7 @@ add_subdirectory(pool) add_subdirectory(predef) add_subdirectory(preprocessor) add_subdirectory(program_options) +add_subdirectory(property_tree) add_subdirectory(proto) add_subdirectory(ptr_container) add_subdirectory(random) @@ -133,6 +134,7 @@ target_link_libraries(contrib-restricted-boost INTERFACE restricted-boost-phoenix restricted-boost-predef restricted-boost-preprocessor + restricted-boost-property_tree restricted-boost-proto restricted-boost-ptr_container restricted-boost-random diff --git a/contrib/restricted/boost/boost/accumulators/accumulators.hpp b/contrib/restricted/boost/boost/accumulators/accumulators.hpp deleted file mode 100644 index 55ee2f9184..0000000000 --- a/contrib/restricted/boost/boost/accumulators/accumulators.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// \file accumulators.hpp -/// Includes all of the Accumulators Framework -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_ACCUMULATORS_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_ACCUMULATORS_HPP_EAN_28_10_2005 - -#include <boost/accumulators/framework/accumulator_set.hpp> -#include <boost/accumulators/framework/accumulator_concept.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/external.hpp> -#include <boost/accumulators/framework/features.hpp> -#include <boost/accumulators/framework/parameters/accumulator.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/parameters/weight.hpp> -#include <boost/accumulators/framework/parameters/weights.hpp> -#include <boost/accumulators/framework/accumulators/external_accumulator.hpp> -#include <boost/accumulators/framework/accumulators/droppable_accumulator.hpp> -#include <boost/accumulators/framework/accumulators/reference_accumulator.hpp> -#include <boost/accumulators/framework/accumulators/value_accumulator.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/accumulators_fwd.hpp b/contrib/restricted/boost/boost/accumulators/accumulators_fwd.hpp deleted file mode 100644 index 4c0370e21e..0000000000 --- a/contrib/restricted/boost/boost/accumulators/accumulators_fwd.hpp +++ /dev/null @@ -1,230 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// accumulators_fwd.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005 - -#include <boost/config.hpp> -#include <boost/mpl/apply_fwd.hpp> // for mpl::na -#include <boost/mpl/limits/vector.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> -#include <boost/accumulators/numeric/functional_fwd.hpp> - -#ifndef BOOST_ACCUMULATORS_MAX_FEATURES - /// The maximum number of accumulators that may be put in an accumulator_set. - /// Defaults to BOOST_MPL_LIMIT_VECTOR_SIZE (which defaults to 20). -# define BOOST_ACCUMULATORS_MAX_FEATURES BOOST_MPL_LIMIT_VECTOR_SIZE -#endif - -#if BOOST_ACCUMULATORS_MAX_FEATURES > BOOST_MPL_LIMIT_VECTOR_SIZE -# error BOOST_ACCUMULATORS_MAX_FEATURES cannot be larger than BOOST_MPL_LIMIT_VECTOR_SIZE -#endif - -#ifndef BOOST_ACCUMULATORS_MAX_ARGS - /// The maximum number of arguments that may be specified to an accumulator_set's - /// accumulation function. Defaults to 15. -# define BOOST_ACCUMULATORS_MAX_ARGS 15 -#endif - -#if BOOST_WORKAROUND(__GNUC__, == 3) \ - || BOOST_WORKAROUND(__EDG_VERSION__, BOOST_TESTED_AT(306)) -# define BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS -#endif - -#ifdef BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS -# include <boost/utility/enable_if.hpp> -# include <boost/type_traits/is_const.hpp> -# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)\ - , typename boost::disable_if<boost::is_const<T> >::type * = 0 -#else -# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T) -#endif - -#define BOOST_ACCUMULATORS_GCC_VERSION \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - -namespace boost { namespace accumulators -{ - -/////////////////////////////////////////////////////////////////////////////// -// Named parameters tags -// -namespace tag -{ - struct sample; - struct weight; - struct accumulator; - struct weights; -} - -/////////////////////////////////////////////////////////////////////////////// -// User-level features -// -namespace tag -{ - template<typename ValueType, typename Tag> - struct value; - - template<typename Tag> - struct value_tag; - - template<typename Referent, typename Tag> - struct reference; - - template<typename Tag> - struct reference_tag; - - template<typename Type, typename Tag = void, typename AccumulatorSet = void> - struct external; - - template<typename Feature> - struct droppable; -} - -template<typename Accumulator> -struct droppable_accumulator_base; - -template<typename Accumulator> -struct droppable_accumulator; - -template<typename Accumulator> -struct with_cached_result; - -template<typename Sample, typename Features, typename Weight = void> -struct accumulator_set; - -template<typename Feature> -struct extractor; - -template<typename Feature> -struct feature_of; - -template<typename Feature> -struct as_feature; - -template<typename Feature> -struct as_weighted_feature; - -template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)> -struct depends_on; - -template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)> -struct features; - -template<typename Feature, typename AccumulatorSet> -typename mpl::apply<AccumulatorSet, Feature>::type const & -find_accumulator(AccumulatorSet const &acc); - -template<typename Feature, typename AccumulatorSet> -typename mpl::apply<AccumulatorSet, Feature>::type::result_type -extract_result(AccumulatorSet const &acc); - -template<typename Feature, typename AccumulatorSet, typename A1> -typename mpl::apply<AccumulatorSet, Feature>::type::result_type -extract_result(AccumulatorSet const &acc, A1 const &a1); - -// ... other overloads generated by Boost.Preprocessor: - -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD(z, n, _) \ - template< \ - typename Feature \ - , typename AccumulatorSet \ - BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \ - > \ - typename mpl::apply<AccumulatorSet, Feature>::type::result_type \ - extract_result( \ - AccumulatorSet const &acc \ - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ - ); - -/// INTERNAL ONLY -/// -BOOST_PP_REPEAT_FROM_TO( - 2 - , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) - , BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD - , _ -) - -#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED -template<typename Feature, typename AccumulatorSet, typename A1, typename A2 ...> -typename mpl::apply<AccumulatorSet, Feature>::type::result_type -extract_result(AccumulatorSet const &acc, A1 const &a1, A2 const &a2 ...); -#endif - -namespace impl -{ - using namespace numeric::operators; - - template<typename Accumulator, typename Tag> - struct external_impl; -} - -namespace detail -{ - template<typename Accumulator> - struct feature_tag; - - template<typename Feature, typename Sample, typename Weight> - struct to_accumulator; - - struct accumulator_set_base; - - template<typename T> - struct is_accumulator_set; - - inline void ignore_variable(void const *) {} - -#define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X) \ - namespace detail \ - { \ - struct BOOST_PP_CAT(ignore_, X) \ - { \ - void ignore() \ - { \ - boost::accumulators::detail::ignore_variable(&X); \ - } \ - }; \ - } \ - /**/ -} - -}} // namespace boost::accumulators - -// For defining boost::parameter keywords that can be inherited from to -// get a nested, class-scoped keyword with the requested alias -#define BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias) \ - namespace tag_namespace \ - { \ - template<int Dummy = 0> \ - struct name ## _ \ - { \ - static char const* keyword_name() \ - { \ - return #name; \ - } \ - static ::boost::parameter::keyword<name ## _<Dummy> > &alias; \ - }; \ - template<int Dummy> \ - ::boost::parameter::keyword<name ## _<Dummy> > &name ## _<Dummy>::alias = \ - ::boost::parameter::keyword<name ## _<Dummy> >::get(); \ - typedef name ## _ <> name; \ - } \ - namespace \ - { \ - ::boost::parameter::keyword<tag_namespace::name> &name = \ - ::boost::parameter::keyword<tag_namespace::name>::get(); \ - } - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/accumulator_base.hpp b/contrib/restricted/boost/boost/accumulators/framework/accumulator_base.hpp deleted file mode 100644 index 52c520d107..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/accumulator_base.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// accumulator_base.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_BASE_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_BASE_HPP_EAN_28_10_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/mpl/joint_view.hpp> -#include <boost/mpl/single_view.hpp> -#include <boost/mpl/fold.hpp> -#include <boost/mpl/contains.hpp> -#include <boost/mpl/empty_sequence.hpp> -#include <boost/accumulators/framework/accumulator_concept.hpp> - -namespace boost { namespace accumulators -{ - -namespace detail -{ - typedef void void_; -} - -/////////////////////////////////////////////////////////////////////////////// -// dont_care -// -struct dont_care -{ - template<typename Args> - dont_care(Args const &) - { - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// accumulator_base -// -struct accumulator_base -{ - // hidden if defined in derived classes - detail::void_ operator ()(dont_care) - { - } - - typedef mpl::false_ is_droppable; - - detail::void_ add_ref(dont_care) - { - } - - detail::void_ drop(dont_care) - { - } - - detail::void_ on_drop(dont_care) - { - } -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/accumulator_concept.hpp b/contrib/restricted/boost/boost/accumulators/framework/accumulator_concept.hpp deleted file mode 100644 index 492357efba..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/accumulator_concept.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// accumulator_concept.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_CONCEPT_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_CONCEPT_HPP_EAN_28_10_2005 - -#include <boost/concept_check.hpp> - -namespace boost { namespace accumulators -{ - -template<typename Stat> -struct accumulator_concept -{ - void constraints() - { - // TODO: define the stat concept - } - - Stat stat; -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/accumulator_set.hpp b/contrib/restricted/boost/boost/accumulators/framework/accumulator_set.hpp deleted file mode 100644 index ed1ceb1afa..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/accumulator_set.hpp +++ /dev/null @@ -1,401 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// accumulator_set.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005 - -#include <boost/version.hpp> -#include <boost/mpl/apply.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/mpl/protect.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/mpl/is_sequence.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/is_base_and_derived.hpp> -#include <boost/parameter/parameters.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/framework/accumulator_concept.hpp> -#include <boost/accumulators/framework/parameters/accumulator.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/accumulators/external_accumulator.hpp> -#include <boost/accumulators/framework/accumulators/droppable_accumulator.hpp> -#include <boost/fusion/include/any.hpp> -#include <boost/fusion/include/find_if.hpp> -#include <boost/fusion/include/for_each.hpp> -#include <boost/fusion/include/filter_view.hpp> - -namespace boost { namespace accumulators -{ - -namespace detail -{ - /////////////////////////////////////////////////////////////////////////////// - // accumulator_visitor - // wrap a boost::parameter argument pack in a Fusion extractor object - template<typename Args> - struct accumulator_visitor - { - explicit accumulator_visitor(Args const &a) - : args(a) - { - } - - template<typename Accumulator> - void operator ()(Accumulator &accumulator) const - { - accumulator(this->args); - } - - private: - accumulator_visitor &operator =(accumulator_visitor const &); - Args const &args; - }; - - template<typename Args> - inline accumulator_visitor<Args> const make_accumulator_visitor(Args const &args) - { - return accumulator_visitor<Args>(args); - } - - typedef - parameter::parameters< - parameter::required<tag::accumulator> - , parameter::optional<tag::sample> - // ... and others which are not specified here... - > - accumulator_params; - - /////////////////////////////////////////////////////////////////////////////// - // accumulator_set_base - struct accumulator_set_base - { - }; - - /////////////////////////////////////////////////////////////////////////////// - // is_accumulator_set - template<typename T> - struct is_accumulator_set - : is_base_and_derived<accumulator_set_base, T> - { - }; - -} // namespace detail - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4355) // warning C4355: 'this' : used in base member initializer list -#endif - -/////////////////////////////////////////////////////////////////////////////// -/// \brief A set of accumulators. -/// -/// accumulator_set resolves the dependencies between features and ensures that -/// the accumulators in the set are updated in the proper order. -/// -/// acccumulator_set provides a general mechanism to visit the accumulators -/// in the set in order, with or without a filter. You can also fetch a reference -/// to an accumulator that corresponds to a feature. -/// -template<typename Sample, typename Features, typename Weight> -struct accumulator_set - : detail::accumulator_set_base -{ - typedef Sample sample_type; ///< The type of the samples that will be accumulated - typedef Features features_type; ///< An MPL sequence of the features that should be accumulated. - typedef Weight weight_type; ///< The type of the weight parameter. Must be a scalar. Defaults to void. - - /// INTERNAL ONLY - /// - typedef - typename detail::make_accumulator_tuple< - Features - , Sample - , Weight - >::type - accumulators_mpl_vector; - - // generate a fusion::list of accumulators - /// INTERNAL ONLY - /// - typedef - typename detail::meta::make_acc_list< - accumulators_mpl_vector - >::type - accumulators_type; - - /// INTERNAL ONLY - /// - //BOOST_MPL_ASSERT((mpl::is_sequence<accumulators_type>)); - - /////////////////////////////////////////////////////////////////////////////// - /// default-construct all contained accumulators - accumulator_set() - : accumulators( - detail::make_acc_list( - accumulators_mpl_vector() - , detail::accumulator_params()(*this) - ) - ) - { - // Add-ref the Features that the user has specified - this->template visit_if<detail::contains_feature_of_<Features> >( - detail::make_add_ref_visitor(detail::accumulator_params()(*this)) - ); - } - - /// \overload - /// - /// \param a1 Optional named parameter to be passed to all the accumulators - template<typename A1> - explicit accumulator_set(A1 const &a1) - : accumulators( - detail::make_acc_list( - accumulators_mpl_vector() - , detail::accumulator_params()(*this, a1) - ) - ) - { - // Add-ref the Features that the user has specified - this->template visit_if<detail::contains_feature_of_<Features> >( - detail::make_add_ref_visitor(detail::accumulator_params()(*this)) - ); - } - - // ... other overloads generated by Boost.Preprocessor: - - /// INTERNAL ONLY - /// -#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR(z, n, _) \ - template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ - accumulator_set(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a)) \ - : accumulators( \ - detail::make_acc_list( \ - accumulators_mpl_vector() \ - , detail::accumulator_params()( \ - *this BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ - ) \ - ) \ - ) \ - { \ - /* Add-ref the Features that the user has specified */ \ - this->template visit_if<detail::contains_feature_of_<Features> >( \ - detail::make_add_ref_visitor(detail::accumulator_params()(*this)) \ - ); \ - } - - /// INTERNAL ONLY - /// - BOOST_PP_REPEAT_FROM_TO( - 2 - , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) - , BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR - , _ - ) - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// \overload - /// - template<typename A1, typename A2, ...> - accumulator_set(A1 const &a1, A2 const &a2, ...); - #endif - - // ... other overloads generated by Boost.Preprocessor below ... - - /////////////////////////////////////////////////////////////////////////////// - /// Visitation - /// \param func UnaryFunction which is invoked with each accumulator in turn. - template<typename UnaryFunction> - void visit(UnaryFunction const &func) - { - fusion::for_each(this->accumulators, func); - } - - /////////////////////////////////////////////////////////////////////////////// - /// Conditional visitation - /// \param func UnaryFunction which is invoked with each accumulator in turn, - /// provided the accumulator satisfies the MPL predicate FilterPred. - template<typename FilterPred, typename UnaryFunction> - void visit_if(UnaryFunction const &func) - { - fusion::filter_view<accumulators_type, FilterPred> filtered_accs(this->accumulators); - fusion::for_each(filtered_accs, func); - } - - /////////////////////////////////////////////////////////////////////////////// - /// The return type of the operator() overloads is void. - typedef void result_type; - - /////////////////////////////////////////////////////////////////////////////// - /// Accumulation - /// \param a1 Optional named parameter to be passed to all the accumulators - void operator ()() - { - this->visit( - detail::make_accumulator_visitor( - detail::accumulator_params()(*this) - ) - ); - } - - template<typename A1> - void operator ()(A1 const &a1) - { - this->visit( - detail::make_accumulator_visitor( - detail::accumulator_params()(*this, a1) - ) - ); - } - - // ... other overloads generated by Boost.Preprocessor: - - /// INTERNAL ONLY - /// -#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP(z, n, _) \ - template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ - void operator ()(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a)) \ - { \ - this->visit( \ - detail::make_accumulator_visitor( \ - detail::accumulator_params()( \ - *this BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ - ) \ - ) \ - ); \ - } - - /// INTERNAL ONLY - /// - BOOST_PP_REPEAT_FROM_TO( - 2 - , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) - , BOOST_ACCUMULATORS_ACCUMULATOR_SET_FUN_OP - , _ - ) - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// \overload - /// - template<typename A1, typename A2, ...> - void operator ()(A1 const &a1, A2 const &a2, ...); - #endif - - /////////////////////////////////////////////////////////////////////////////// - /// Extraction - template<typename Feature> - struct apply - : fusion::result_of::value_of< - typename fusion::result_of::find_if< - accumulators_type - , detail::matches_feature<Feature> - >::type - > - { - }; - - /////////////////////////////////////////////////////////////////////////////// - /// Extraction - template<typename Feature> - typename apply<Feature>::type &extract() - { - return *fusion::find_if<detail::matches_feature<Feature> >(this->accumulators); - } - - /// \overload - template<typename Feature> - typename apply<Feature>::type const &extract() const - { - return *fusion::find_if<detail::matches_feature<Feature> >(this->accumulators); - } - - /////////////////////////////////////////////////////////////////////////////// - /// Drop - template<typename Feature> - void drop() - { - // You can only drop the features that you have specified explicitly - typedef typename apply<Feature>::type the_accumulator; - BOOST_MPL_ASSERT((detail::contains_feature_of<Features, the_accumulator>)); - - typedef - typename feature_of<typename as_feature<Feature>::type>::type - the_feature; - - (*fusion::find_if<detail::matches_feature<Feature> >(this->accumulators)) - .drop(detail::accumulator_params()(*this)); - - // Also drop accumulators that this feature depends on - typedef typename the_feature::dependencies dependencies; - this->template visit_if<detail::contains_feature_of_<dependencies> >( - detail::make_drop_visitor(detail::accumulator_params()(*this)) - ); - } - -private: - - accumulators_type accumulators; -}; - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -/////////////////////////////////////////////////////////////////////////////// -// find_accumulator -// find an accumulator in an accumulator_set corresponding to a feature -template<typename Feature, typename AccumulatorSet> -typename mpl::apply<AccumulatorSet, Feature>::type & -find_accumulator(AccumulatorSet &acc BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(AccumulatorSet)) -{ - return acc.template extract<Feature>(); -} - -/// \overload -template<typename Feature, typename AccumulatorSet> -typename mpl::apply<AccumulatorSet, Feature>::type const & -find_accumulator(AccumulatorSet const &acc) -{ - return acc.template extract<Feature>(); -} - -/////////////////////////////////////////////////////////////////////////////// -// extract_result -// extract a result from an accumulator set -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_EXTRACT_RESULT_FUN(z, n, _) \ - template< \ - typename Feature \ - , typename AccumulatorSet \ - BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \ - > \ - typename mpl::apply<AccumulatorSet, Feature>::type::result_type \ - extract_result( \ - AccumulatorSet const &acc \ - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ - ) \ - { \ - return find_accumulator<Feature>(acc).result( \ - detail::accumulator_params()( \ - acc \ - BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \ - ) \ - ); \ - } - -BOOST_PP_REPEAT( - BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) - , BOOST_ACCUMULATORS_EXTRACT_RESULT_FUN - , _ -) - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp b/contrib/restricted/boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp deleted file mode 100644 index 0e882b5c35..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp +++ /dev/null @@ -1,328 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// droppable_accumulator.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_DROPPABLE_ACCUMULATOR_HPP_EAN_13_12_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_DROPPABLE_ACCUMULATOR_HPP_EAN_13_12_2005 - -#include <new> -#include <boost/assert.hpp> -#include <boost/mpl/apply.hpp> -#include <boost/aligned_storage.hpp> -#include <boost/accumulators/framework/depends_on.hpp> // for feature_of -#include <boost/accumulators/framework/parameters/accumulator.hpp> // for accumulator - -namespace boost { namespace accumulators -{ - - template<typename Accumulator> - struct droppable_accumulator; - - namespace detail - { - /////////////////////////////////////////////////////////////////////////////// - // add_ref_visitor - // a fusion function object for add_ref'ing accumulators - template<typename Args> - struct add_ref_visitor - { - explicit add_ref_visitor(Args const &args) - : args_(args) - { - } - - template<typename Accumulator> - void operator ()(Accumulator &acc) const - { - typedef typename Accumulator::feature_tag::dependencies dependencies; - - acc.add_ref(this->args_); - - // Also add_ref accumulators that this feature depends on - this->args_[accumulator].template - visit_if<detail::contains_feature_of_<dependencies> >( - *this - ); - } - - private: - add_ref_visitor &operator =(add_ref_visitor const &); - Args const &args_; - }; - - template<typename Args> - add_ref_visitor<Args> make_add_ref_visitor(Args const &args) - { - return add_ref_visitor<Args>(args); - } - - /////////////////////////////////////////////////////////////////////////////// - // drop_visitor - // a fusion function object for dropping accumulators - template<typename Args> - struct drop_visitor - { - explicit drop_visitor(Args const &args) - : args_(args) - { - } - - template<typename Accumulator> - void operator ()(Accumulator &acc) const - { - if(typename Accumulator::is_droppable()) - { - typedef typename Accumulator::feature_tag::dependencies dependencies; - - acc.drop(this->args_); - // Also drop accumulators that this feature depends on - this->args_[accumulator].template - visit_if<detail::contains_feature_of_<dependencies> >( - *this - ); - } - } - - private: - drop_visitor &operator =(drop_visitor const &); - Args const &args_; - }; - - template<typename Args> - drop_visitor<Args> make_drop_visitor(Args const &args) - { - return drop_visitor<Args>(args); - } - } - - ////////////////////////////////////////////////////////////////////////// - // droppable_accumulator_base - template<typename Accumulator> - struct droppable_accumulator_base - : Accumulator - { - typedef droppable_accumulator_base base; - typedef mpl::true_ is_droppable; - typedef typename Accumulator::result_type result_type; - - template<typename Args> - droppable_accumulator_base(Args const &args) - : Accumulator(args) - , ref_count_(0) - { - } - - droppable_accumulator_base(droppable_accumulator_base const &that) - : Accumulator(*static_cast<Accumulator const *>(&that)) - , ref_count_(that.ref_count_) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - if(!this->is_dropped()) - { - this->Accumulator::operator ()(args); - } - } - - template<typename Args> - void add_ref(Args const &) - { - ++this->ref_count_; - } - - template<typename Args> - void drop(Args const &args) - { - BOOST_ASSERT(0 < this->ref_count_); - if(1 == this->ref_count_) - { - static_cast<droppable_accumulator<Accumulator> *>(this)->on_drop(args); - } - --this->ref_count_; - } - - bool is_dropped() const - { - return 0 == this->ref_count_; - } - - private: - int ref_count_; - }; - - ////////////////////////////////////////////////////////////////////////// - // droppable_accumulator - // this can be specialized for any type that needs special handling - template<typename Accumulator> - struct droppable_accumulator - : droppable_accumulator_base<Accumulator> - { - template<typename Args> - droppable_accumulator(Args const &args) - : droppable_accumulator::base(args) - { - } - - droppable_accumulator(droppable_accumulator const &that) - : droppable_accumulator::base(*static_cast<typename droppable_accumulator::base const *>(&that)) - { - } - }; - - ////////////////////////////////////////////////////////////////////////// - // with_cached_result - template<typename Accumulator> - struct with_cached_result - : Accumulator - { - typedef typename Accumulator::result_type result_type; - - template<typename Args> - with_cached_result(Args const &args) - : Accumulator(args) - , cache() - { - } - - with_cached_result(with_cached_result const &that) - : Accumulator(*static_cast<Accumulator const *>(&that)) - , cache() - { - if(that.has_result()) - { - this->set(that.get()); - } - } - - ~with_cached_result() - { - // Since this is a base class of droppable_accumulator_base, - // this destructor is called before any of droppable_accumulator_base's - // members get cleaned up, including is_dropped, so the following - // call to has_result() is valid. - if(this->has_result()) - { - this->get().~result_type(); - } - } - - template<typename Args> - void on_drop(Args const &args) - { - // cache the result at the point this calculation was dropped - BOOST_ASSERT(!this->has_result()); - this->set(this->Accumulator::result(args)); - } - - template<typename Args> - result_type result(Args const &args) const - { - return this->has_result() ? this->get() : this->Accumulator::result(args); - } - - private: - with_cached_result &operator =(with_cached_result const &); - - void set(result_type const &r) - { - ::new(this->cache.address()) result_type(r); - } - - result_type const &get() const - { - return *static_cast<result_type const *>(this->cache.address()); - } - - bool has_result() const - { - typedef with_cached_result<Accumulator> this_type; - typedef droppable_accumulator_base<this_type> derived_type; - return static_cast<derived_type const *>(this)->is_dropped(); - } - - aligned_storage<sizeof(result_type)> cache; - }; - - namespace tag - { - template<typename Feature> - struct as_droppable - { - typedef droppable<Feature> type; - }; - - template<typename Feature> - struct as_droppable<droppable<Feature> > - { - typedef droppable<Feature> type; - }; - - ////////////////////////////////////////////////////////////////////////// - // droppable - template<typename Feature> - struct droppable - : as_feature<Feature>::type - { - typedef typename as_feature<Feature>::type feature_type; - typedef typename feature_type::dependencies tmp_dependencies_; - - typedef - typename mpl::transform< - typename feature_type::dependencies - , as_droppable<mpl::_1> - >::type - dependencies; - - struct impl - { - template<typename Sample, typename Weight> - struct apply - { - typedef - droppable_accumulator< - typename mpl::apply2<typename feature_type::impl, Sample, Weight>::type - > - type; - }; - }; - }; - } - - // make droppable<tag::feature(modifier)> work - template<typename Feature> - struct as_feature<tag::droppable<Feature> > - { - typedef tag::droppable<typename as_feature<Feature>::type> type; - }; - - // make droppable<tag::mean> work with non-void weights (should become - // droppable<tag::weighted_mean> - template<typename Feature> - struct as_weighted_feature<tag::droppable<Feature> > - { - typedef tag::droppable<typename as_weighted_feature<Feature>::type> type; - }; - - // for the purposes of feature-based dependency resolution, - // droppable<Foo> provides the same feature as Foo - template<typename Feature> - struct feature_of<tag::droppable<Feature> > - : feature_of<Feature> - { - }; - - // Note: Usually, the extractor is pulled into the accumulators namespace with - // a using directive, not the tag. But the droppable<> feature doesn't have an - // extractor, so we can put the droppable tag in the accumulators namespace - // without fear of a name conflict. - using tag::droppable; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/accumulators/external_accumulator.hpp b/contrib/restricted/boost/boost/accumulators/framework/accumulators/external_accumulator.hpp deleted file mode 100644 index 71dce42e51..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/accumulators/external_accumulator.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// external_accumulator.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_EXTERNAL_ACCUMULATOR_HPP_EAN_01_12_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_EXTERNAL_ACCUMULATOR_HPP_EAN_01_12_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/depends_on.hpp> // for feature_tag -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/accumulators/reference_accumulator.hpp> - -namespace boost { namespace accumulators { namespace impl -{ - - ////////////////////////////////////////////////////////////////////////// - // external_impl - /// INTERNAL ONLY - /// - template<typename Accumulator, typename Tag> - struct external_impl - : accumulator_base - { - typedef typename Accumulator::result_type result_type; - typedef typename detail::feature_tag<Accumulator>::type feature_tag; - - external_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - return this->extract_(args, args[parameter::keyword<Tag>::get() | 0]); - } - - private: - - template<typename Args> - static result_type extract_(Args const &args, int) - { - // No named parameter passed to the extractor. Maybe the external - // feature is held by reference<>. - extractor<feature_tag> extract; - return extract(accumulators::reference_tag<Tag>(args)); - } - - template<typename Args, typename AccumulatorSet> - static result_type extract_(Args const &, AccumulatorSet const &acc) - { - // OK, a named parameter for this external feature was passed to the - // extractor, so use that. - extractor<feature_tag> extract; - return extract(acc); - } - }; - -} // namespace impl - -namespace tag -{ - ////////////////////////////////////////////////////////////////////////// - // external - template<typename Feature, typename Tag, typename AccumulatorSet> - struct external - : depends_on<reference<AccumulatorSet, Tag> > - { - typedef - accumulators::impl::external_impl< - detail::to_accumulator<Feature, mpl::_1, mpl::_2> - , Tag - > - impl; - }; - - template<typename Feature, typename Tag> - struct external<Feature, Tag, void> - : depends_on<> - { - typedef - accumulators::impl::external_impl< - detail::to_accumulator<Feature, mpl::_1, mpl::_2> - , Tag - > - impl; - }; -} - -// for the purposes of feature-based dependency resolution, -// external_accumulator<Feature, Tag> provides the same feature as Feature -template<typename Feature, typename Tag, typename AccumulatorSet> -struct feature_of<tag::external<Feature, Tag, AccumulatorSet> > - : feature_of<Feature> -{ -}; - -// Note: Usually, the extractor is pulled into the accumulators namespace with -// a using directive, not the tag. But the external<> feature doesn't have an -// extractor, so we can put the external tag in the accumulators namespace -// without fear of a name conflict. -using tag::external; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/accumulators/reference_accumulator.hpp b/contrib/restricted/boost/boost/accumulators/framework/accumulators/reference_accumulator.hpp deleted file mode 100644 index bf4252ca6a..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/accumulators/reference_accumulator.hpp +++ /dev/null @@ -1,89 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// reference_accumulator.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_REFERENCE_ACCUMULATOR_HPP_EAN_03_23_2006 -#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_REFERENCE_ACCUMULATOR_HPP_EAN_03_23_2006 - -#include <boost/ref.hpp> -#include <boost/mpl/always.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/framework/depends_on.hpp> // for feature_tag -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - ////////////////////////////////////////////////////////////////////////// - // reference_accumulator_impl - // - template<typename Referent, typename Tag> - struct reference_accumulator_impl - : accumulator_base - { - typedef Referent &result_type; - - template<typename Args> - reference_accumulator_impl(Args const &args) - : ref(args[parameter::keyword<Tag>::get()]) - { - } - - result_type result(dont_care) const - { - return this->ref; - } - - private: - reference_wrapper<Referent> ref; - }; -} // namespace impl - -namespace tag -{ - ////////////////////////////////////////////////////////////////////////// - // reference_tag - template<typename Tag> - struct reference_tag - { - }; - - ////////////////////////////////////////////////////////////////////////// - // reference - template<typename Referent, typename Tag> - struct reference - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef mpl::always<accumulators::impl::reference_accumulator_impl<Referent, Tag> > impl; - }; -} - -namespace extract -{ - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, reference, (typename)(typename)) - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, reference_tag, (typename)) -} - -using extract::reference; -using extract::reference_tag; - -// Map all reference<V,T> features to reference_tag<T> so -// that references can be extracted using reference_tag<T> -// without specifying the referent type. -template<typename ValueType, typename Tag> -struct feature_of<tag::reference<ValueType, Tag> > - : feature_of<tag::reference_tag<Tag> > -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/accumulators/value_accumulator.hpp b/contrib/restricted/boost/boost/accumulators/framework/accumulators/value_accumulator.hpp deleted file mode 100644 index 02bf7f3499..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/accumulators/value_accumulator.hpp +++ /dev/null @@ -1,89 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// value_accumulator.hpp -// -// Copyright 2005 Eric Niebler, Daniel Egloff. Distributed under the 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_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_VALUE_ACCUMULATOR_HPP_EAN_03_23_2006 -#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_VALUE_ACCUMULATOR_HPP_EAN_03_23_2006 - -#include <boost/mpl/always.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/framework/depends_on.hpp> // for feature_tag -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - - ////////////////////////////////////////////////////////////////////////// - // value_accumulator_impl - template<typename ValueType, typename Tag> - struct value_accumulator_impl - : accumulator_base - { - typedef ValueType result_type; - - template<typename Args> - value_accumulator_impl(Args const &args) - : val(args[parameter::keyword<Tag>::get()]) - { - } - - result_type result(dont_care) const - { - return this->val; - } - - private: - ValueType val; - }; - -} // namespace impl - -namespace tag -{ - ////////////////////////////////////////////////////////////////////////// - // value_tag - template<typename Tag> - struct value_tag - { - }; - - ////////////////////////////////////////////////////////////////////////// - // value - template<typename ValueType, typename Tag> - struct value - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef mpl::always<accumulators::impl::value_accumulator_impl<ValueType, Tag> > impl; - }; -} - -namespace extract -{ - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, value, (typename)(typename)) - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, value_tag, (typename)) -} - -using extract::value; -using extract::value_tag; - -// Map all value<V,T> features to value_tag<T> so -// that values can be extracted using value_tag<T> -// without specifying the value type. -template<typename ValueType, typename Tag> -struct feature_of<tag::value<ValueType, Tag> > - : feature_of<tag::value_tag<Tag> > -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/depends_on.hpp b/contrib/restricted/boost/boost/accumulators/framework/depends_on.hpp deleted file mode 100644 index 008f1217da..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/depends_on.hpp +++ /dev/null @@ -1,448 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// depends_on.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_DEPENDS_ON_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_DEPENDS_ON_HPP_EAN_28_10_2005 - -#include <boost/version.hpp> -#include <boost/mpl/end.hpp> -#include <boost/mpl/map.hpp> -#include <boost/mpl/set.hpp> -#include <boost/mpl/copy.hpp> -#include <boost/mpl/fold.hpp> -#include <boost/mpl/size.hpp> -#include <boost/mpl/sort.hpp> -#include <boost/mpl/insert.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/mpl/remove.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/mpl/inherit.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/mpl/equal_to.hpp> -#include <boost/mpl/contains.hpp> -#include <boost/mpl/transform.hpp> -#include <boost/mpl/is_sequence.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/mpl/insert_range.hpp> -#include <boost/mpl/back_inserter.hpp> -#include <boost/mpl/transform_view.hpp> -#include <boost/mpl/inherit_linearly.hpp> -#include <boost/type_traits/is_base_and_derived.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/facilities/intercept.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/fusion/include/next.hpp> -#include <boost/fusion/include/equal_to.hpp> -#include <boost/fusion/include/value_of.hpp> -#include <boost/fusion/include/mpl.hpp> -#include <boost/fusion/include/end.hpp> -#include <boost/fusion/include/begin.hpp> -#include <boost/fusion/include/cons.hpp> - -namespace boost { namespace accumulators -{ - /////////////////////////////////////////////////////////////////////////// - // as_feature - template<typename Feature> - struct as_feature - { - typedef Feature type; - }; - - /////////////////////////////////////////////////////////////////////////// - // weighted_feature - template<typename Feature> - struct as_weighted_feature - { - typedef Feature type; - }; - - /////////////////////////////////////////////////////////////////////////// - // feature_of - template<typename Feature> - struct feature_of - { - typedef Feature type; - }; - - namespace detail - { - /////////////////////////////////////////////////////////////////////////// - // feature_tag - template<typename Accumulator> - struct feature_tag - { - typedef typename Accumulator::feature_tag type; - }; - - template<typename Feature> - struct undroppable - { - typedef Feature type; - }; - - template<typename Feature> - struct undroppable<tag::droppable<Feature> > - { - typedef Feature type; - }; - - // For the purpose of determining whether one feature depends on another, - // disregard whether the feature is droppable or not. - template<typename A, typename B> - struct is_dependent_on - : is_base_and_derived< - typename feature_of<typename undroppable<B>::type>::type - , typename undroppable<A>::type - > - {}; - - template<typename Feature> - struct dependencies_of - { - typedef typename Feature::dependencies type; - }; - - // Should use mpl::insert_range, but doesn't seem to work with mpl sets - template<typename Set, typename Range> - struct set_insert_range - : mpl::fold< - Range - , Set - , mpl::insert<mpl::_1, mpl::_2> - > - {}; - - template<typename Features> - struct collect_abstract_features - : mpl::fold< - Features - , mpl::set0<> - , set_insert_range< - mpl::insert<mpl::_1, feature_of<mpl::_2> > - , collect_abstract_features<dependencies_of<mpl::_2> > - > - > - {}; - - template<typename Features> - struct depends_on_base - : mpl::inherit_linearly< - typename mpl::sort< - typename mpl::copy< - typename collect_abstract_features<Features>::type - , mpl::back_inserter<mpl::vector0<> > - >::type - , is_dependent_on<mpl::_1, mpl::_2> - >::type - // Don't inherit multiply from a feature - , mpl::if_< - is_dependent_on<mpl::_1, mpl::_2> - , mpl::_1 - , mpl::inherit<mpl::_1, mpl::_2> - > - >::type - { - }; - } - - /////////////////////////////////////////////////////////////////////////// - /// depends_on - template<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature)> - struct depends_on - : detail::depends_on_base< - typename mpl::transform< - mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, Feature)> - , as_feature<mpl::_1> - >::type - > - { - typedef mpl::false_ is_weight_accumulator; - typedef - typename mpl::transform< - mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, Feature)> - , as_feature<mpl::_1> - >::type - dependencies; - }; - - namespace detail - { - template<typename Feature> - struct matches_feature - { - template<typename Accumulator> - struct apply - : is_same< - typename feature_of<typename as_feature<Feature>::type>::type - , typename feature_of<typename as_feature<typename feature_tag<Accumulator>::type>::type>::type - > - {}; - }; - - template<typename Features, typename Accumulator> - struct contains_feature_of - { - typedef - mpl::transform_view<Features, feature_of<as_feature<mpl::_> > > - features_list; - - typedef - typename feature_of<typename feature_tag<Accumulator>::type>::type - the_feature; - - typedef - typename mpl::contains<features_list, the_feature>::type - type; - }; - - // This is to work around a bug in early versions of Fusion which caused - // a compile error if contains_feature_of<List, mpl::_> is used as a - // predicate to fusion::find_if - template<typename Features> - struct contains_feature_of_ - { - template<typename Accumulator> - struct apply - : contains_feature_of<Features, Accumulator> - {}; - }; - - template< - typename First - , typename Last - , bool is_empty = fusion::result_of::equal_to<First, Last>::value - > - struct build_acc_list; - - template<typename First, typename Last> - struct build_acc_list<First, Last, true> - { - typedef fusion::nil_ type; - - template<typename Args> - static fusion::nil_ - call(Args const &, First const&, Last const&) - { - return fusion::nil_(); - } - }; - - template<typename First, typename Last> - struct build_acc_list<First, Last, false> - { - typedef - build_acc_list<typename fusion::result_of::next<First>::type, Last> - next_build_acc_list; - - typedef fusion::cons< - typename fusion::result_of::value_of<First>::type - , typename next_build_acc_list::type> - type; - - template<typename Args> - static type - call(Args const &args, First const& f, Last const& l) - { - return type(args, next_build_acc_list::call(args, fusion::next(f), l)); - } - }; - - namespace meta - { - template<typename Sequence> - struct make_acc_list - : build_acc_list< - typename fusion::result_of::begin<Sequence>::type - , typename fusion::result_of::end<Sequence>::type - > - {}; - } - - template<typename Sequence, typename Args> - typename meta::make_acc_list<Sequence>::type - make_acc_list(Sequence const &seq, Args const &args) - { - return meta::make_acc_list<Sequence>::call(args, fusion::begin(seq), fusion::end(seq)); - } - - /////////////////////////////////////////////////////////////////////////// - // checked_as_weighted_feature - template<typename Feature> - struct checked_as_weighted_feature - { - typedef typename as_feature<Feature>::type feature_type; - typedef typename as_weighted_feature<feature_type>::type type; - // weighted and non-weighted flavors should provide the same feature. - BOOST_MPL_ASSERT(( - is_same< - typename feature_of<feature_type>::type - , typename feature_of<type>::type - > - )); - }; - - /////////////////////////////////////////////////////////////////////////// - // as_feature_list - template<typename Features, typename Weight> - struct as_feature_list - : mpl::transform_view<Features, checked_as_weighted_feature<mpl::_1> > - { - }; - - template<typename Features> - struct as_feature_list<Features, void> - : mpl::transform_view<Features, as_feature<mpl::_1> > - { - }; - - /////////////////////////////////////////////////////////////////////////// - // accumulator_wrapper - template<typename Accumulator, typename Feature> - struct accumulator_wrapper - : Accumulator - { - typedef Feature feature_tag; - - accumulator_wrapper(accumulator_wrapper const &that) - : Accumulator(*static_cast<Accumulator const *>(&that)) - { - } - - template<typename Args> - accumulator_wrapper(Args const &args) - : Accumulator(args) - { - } - }; - - /////////////////////////////////////////////////////////////////////////// - // to_accumulator - template<typename Feature, typename Sample, typename Weight> - struct to_accumulator - { - typedef - accumulator_wrapper< - typename mpl::apply2<typename Feature::impl, Sample, Weight>::type - , Feature - > - type; - }; - - template<typename Feature, typename Sample, typename Weight, typename Tag, typename AccumulatorSet> - struct to_accumulator<Feature, Sample, tag::external<Weight, Tag, AccumulatorSet> > - { - BOOST_MPL_ASSERT((is_same<Tag, void>)); - BOOST_MPL_ASSERT((is_same<AccumulatorSet, void>)); - - typedef - accumulator_wrapper< - typename mpl::apply2<typename Feature::impl, Sample, Weight>::type - , Feature - > - accumulator_type; - - typedef - typename mpl::if_< - typename Feature::is_weight_accumulator - , accumulator_wrapper<impl::external_impl<accumulator_type, tag::weights>, Feature> - , accumulator_type - >::type - type; - }; - - // BUGBUG work around an MPL bug wrt map insertion - template<typename FeatureMap, typename Feature> - struct insert_feature - : mpl::eval_if< - mpl::has_key<FeatureMap, typename feature_of<Feature>::type> - , mpl::identity<FeatureMap> - , mpl::insert<FeatureMap, mpl::pair<typename feature_of<Feature>::type, Feature> > - > - { - }; - - template<typename FeatureMap, typename Feature, typename Weight> - struct insert_dependencies - : mpl::fold< - as_feature_list<typename Feature::dependencies, Weight> - , FeatureMap - , insert_dependencies< - insert_feature<mpl::_1, mpl::_2> - , mpl::_2 - , Weight - > - > - { - }; - - template<typename FeatureMap, typename Features, typename Weight> - struct insert_sequence - : mpl::fold< // BUGBUG should use insert_range, but doesn't seem to work for maps - as_feature_list<Features, Weight> - , FeatureMap - , insert_feature<mpl::_1, mpl::_2> - > - { - }; - - template<typename Features, typename Sample, typename Weight> - struct make_accumulator_tuple - { - typedef - typename mpl::fold< - as_feature_list<Features, Weight> - , mpl::map0<> - , mpl::if_< - mpl::is_sequence<mpl::_2> - , insert_sequence<mpl::_1, mpl::_2, Weight> - , insert_feature<mpl::_1, mpl::_2> - > - >::type - feature_map; - - // for each element in the map, add its dependencies also - typedef - typename mpl::fold< - feature_map - , feature_map - , insert_dependencies<mpl::_1, mpl::second<mpl::_2>, Weight> - >::type - feature_map_with_dependencies; - - // turn the map into a vector so we can sort it - typedef - typename mpl::insert_range< - mpl::vector<> - , mpl::end<mpl::vector<> >::type - , mpl::transform_view<feature_map_with_dependencies, mpl::second<mpl::_1> > - >::type - feature_vector_with_dependencies; - - // sort the features according to which is derived from which - typedef - typename mpl::sort< - feature_vector_with_dependencies - , is_dependent_on<mpl::_2, mpl::_1> - >::type - sorted_feature_vector; - - // From the vector of features, construct a vector of accumulators - typedef - typename mpl::transform< - sorted_feature_vector - , to_accumulator<mpl::_1, Sample, Weight> - >::type - type; - }; - - } // namespace detail - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/external.hpp b/contrib/restricted/boost/boost/accumulators/framework/external.hpp deleted file mode 100644 index dbd5d91693..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/external.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// external.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_EXTERNAL_HPP_EAN_01_12_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_EXTERNAL_HPP_EAN_01_12_2005 - -#include <boost/mpl/apply.hpp> -#include <boost/accumulators/framework/accumulators/external_accumulator.hpp> - -//namespace boost { namespace accumulators -//{ -// -///////////////////////////////////////////////////////////////////////////////// -//// external -//// -//template<typename Type> -//struct external -//{ -//}; -// -//}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/extractor.hpp b/contrib/restricted/boost/boost/accumulators/framework/extractor.hpp deleted file mode 100644 index 98281cecb9..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/extractor.hpp +++ /dev/null @@ -1,229 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// extractor.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_EXTRACTOR_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_EXTRACTOR_HPP_EAN_28_10_2005 - -#include <boost/preprocessor/tuple/rem.hpp> -#include <boost/preprocessor/array/size.hpp> -#include <boost/preprocessor/array/data.hpp> -#include <boost/preprocessor/array/elem.hpp> -#include <boost/preprocessor/seq/to_array.hpp> -#include <boost/preprocessor/seq/transform.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> -#include <boost/parameter/binding.hpp> -#include <boost/mpl/apply.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/parameters/accumulator.hpp> - -namespace boost { namespace accumulators -{ - -namespace detail -{ - template<typename AccumulatorSet, typename Feature> - struct accumulator_set_result - { - typedef typename as_feature<Feature>::type feature_type; - typedef typename mpl::apply<AccumulatorSet, feature_type>::type::result_type type; - }; - - template<typename Args, typename Feature> - struct argument_pack_result - : accumulator_set_result< - typename remove_reference< - typename parameter::binding<Args, tag::accumulator>::type - >::type - , Feature - > - { - }; - - template<typename A, typename Feature> - struct extractor_result - : mpl::eval_if< - detail::is_accumulator_set<A> - , accumulator_set_result<A, Feature> - , argument_pack_result<A, Feature> - > - { - }; - - template<typename Feature, typename AccumulatorSet> - typename extractor_result<AccumulatorSet, Feature>::type - do_extract(AccumulatorSet const &acc, mpl::true_) - { - typedef typename as_feature<Feature>::type feature_type; - return extract_result<feature_type>(acc); - } - - template<typename Feature, typename Args> - typename extractor_result<Args, Feature>::type - do_extract(Args const &args, mpl::false_) - { - typedef typename as_feature<Feature>::type feature_type; - return find_accumulator<feature_type>(args[accumulator]).result(args); - } - -} // namespace detail - - -/////////////////////////////////////////////////////////////////////////////// -/// Extracts the result associated with Feature from the specified accumulator_set. -template<typename Feature> -struct extractor -{ - typedef extractor<Feature> this_type; - - /// The result meta-function for determining the return type of the extractor - template<typename F> - struct result; - - template<typename A1> - struct result<this_type(A1)> - : detail::extractor_result<A1, Feature> - { - }; - - /// Extract the result associated with Feature from the accumulator set - /// \param acc The accumulator set object from which to extract the result - template<typename Arg1> - typename detail::extractor_result<Arg1, Feature>::type - operator ()(Arg1 const &arg1) const - { - // Arg1 could be an accumulator_set or an argument pack containing - // an accumulator_set. Dispatch accordingly. - return detail::do_extract<Feature>(arg1, detail::is_accumulator_set<Arg1>()); - } - - /// \overload - /// - /// \param a1 Optional named parameter to be passed to the accumulator's result() function. - template<typename AccumulatorSet, typename A1> - typename detail::extractor_result<AccumulatorSet, Feature>::type - operator ()(AccumulatorSet const &acc, A1 const &a1) const - { - BOOST_MPL_ASSERT((detail::is_accumulator_set<AccumulatorSet>)); - typedef typename as_feature<Feature>::type feature_type; - return extract_result<feature_type>(acc, a1); - } - - // ... other overloads generated by Boost.Preprocessor: - - /// INTERNAL ONLY - /// -#define BOOST_ACCUMULATORS_EXTRACTOR_FUN_OP(z, n, _) \ - template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ - struct result<this_type(BOOST_PP_ENUM_PARAMS_Z(z, n, A))> \ - : detail::extractor_result<A1, Feature> \ - {}; \ - template< \ - typename AccumulatorSet \ - BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \ - > \ - typename detail::extractor_result<AccumulatorSet, Feature>::type \ - operator ()( \ - AccumulatorSet const &acc \ - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \ - ) const \ - { \ - BOOST_MPL_ASSERT((detail::is_accumulator_set<AccumulatorSet>)); \ - typedef typename as_feature<Feature>::type feature_type; \ - return extract_result<feature_type>(acc BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a));\ - } - - BOOST_PP_REPEAT_FROM_TO( - 2 - , BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) - , BOOST_ACCUMULATORS_EXTRACTOR_FUN_OP - , _ - ) - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// \overload - /// - template<typename AccumulatorSet, typename A1, typename A2, ...> - typename detail::extractor_result<AccumulatorSet, Feature>::type - operator ()(AccumulatorSet const &acc, A1 const &a1, A2 const &a2, ...); - #endif -}; - -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_ARRAY_REM(Array) \ - BOOST_PP_TUPLE_REM_CTOR(BOOST_PP_ARRAY_SIZE(Array), BOOST_PP_ARRAY_DATA(Array)) - -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_SEQ_REM(Seq) \ - BOOST_ACCUMULATORS_ARRAY_REM(BOOST_PP_SEQ_TO_ARRAY(Seq)) - -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_ARGS_OP(s, data, elem) \ - T ## s - -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_PARAMS_OP(s, data, elem) \ - elem T ## s - -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_MAKE_FEATURE(Tag, Feature, ParamsSeq) \ - Tag::Feature< \ - BOOST_ACCUMULATORS_SEQ_REM( \ - BOOST_PP_SEQ_TRANSFORM(BOOST_ACCUMULATORS_ARGS_OP, ~, ParamsSeq) \ - ) \ - > - -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN_IMPL(z, n, Tag, Feature, ParamsSeq) \ - template< \ - BOOST_ACCUMULATORS_SEQ_REM( \ - BOOST_PP_SEQ_TRANSFORM(BOOST_ACCUMULATORS_PARAMS_OP, ~, ParamsSeq) \ - ) \ - , typename Arg1 \ - BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \ - > \ - typename boost::accumulators::detail::extractor_result< \ - Arg1 \ - , BOOST_ACCUMULATORS_MAKE_FEATURE(Tag, Feature, ParamsSeq) \ - >::type \ - Feature(Arg1 const &arg1 BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) ) \ - { \ - typedef BOOST_ACCUMULATORS_MAKE_FEATURE(Tag, Feature, ParamsSeq) feature_type; \ - return boost::accumulators::extractor<feature_type>()( \ - arg1 BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a)); \ - } - -/// INTERNAL ONLY -/// -#define BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN(z, n, _) \ - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN_IMPL( \ - z \ - , n \ - , BOOST_PP_ARRAY_ELEM(0, _) \ - , BOOST_PP_ARRAY_ELEM(1, _) \ - , BOOST_PP_ARRAY_ELEM(2, _) \ - ) - -#define BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(Tag, Feature, ParamSeq) \ - BOOST_PP_REPEAT( \ - BOOST_PP_INC(BOOST_ACCUMULATORS_MAX_ARGS) \ - , BOOST_ACCUMULATORS_DEFINE_EXTRACTOR_FUN \ - , (3, (Tag, Feature, ParamSeq)) \ - ) - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/features.hpp b/contrib/restricted/boost/boost/accumulators/framework/features.hpp deleted file mode 100644 index 21cae004da..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/features.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// features.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_STATS_HPP_EAN_08_12_2005 -#define BOOST_ACCUMULATORS_STATISTICS_STATS_HPP_EAN_08_12_2005 - -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> - -namespace boost { namespace accumulators -{ - -/////////////////////////////////////////////////////////////////////////////// -// features -// -template<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature)> -struct features - : mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, Feature)> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/parameters/accumulator.hpp b/contrib/restricted/boost/boost/accumulators/framework/parameters/accumulator.hpp deleted file mode 100644 index 525ebb30ba..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/parameters/accumulator.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// accumulator.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_ACCUMULATOR_HPP_EAN_31_10_2005 - -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> - -namespace boost { namespace accumulators -{ - -BOOST_PARAMETER_KEYWORD(tag, accumulator) -BOOST_ACCUMULATORS_IGNORE_GLOBAL(accumulator) - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/parameters/sample.hpp b/contrib/restricted/boost/boost/accumulators/framework/parameters/sample.hpp deleted file mode 100644 index 8b227eb334..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/parameters/sample.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// sample.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_SAMPLE_HPP_EAN_31_10_2005 - -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> - -namespace boost { namespace accumulators -{ - -BOOST_PARAMETER_KEYWORD(tag, sample) -BOOST_ACCUMULATORS_IGNORE_GLOBAL(sample) - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/parameters/weight.hpp b/contrib/restricted/boost/boost/accumulators/framework/parameters/weight.hpp deleted file mode 100644 index f36016f372..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/parameters/weight.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weight.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHT_HPP_EAN_31_10_2005 - -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> - -namespace boost { namespace accumulators -{ - -// The weight of a single sample -BOOST_PARAMETER_KEYWORD(tag, weight) -BOOST_ACCUMULATORS_IGNORE_GLOBAL(weight) - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/framework/parameters/weights.hpp b/contrib/restricted/boost/boost/accumulators/framework/parameters/weights.hpp deleted file mode 100644 index 6beae61386..0000000000 --- a/contrib/restricted/boost/boost/accumulators/framework/parameters/weights.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weights.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_FRAMEWORK_PARAMETERS_WEIGHTS_HPP_EAN_28_10_2005 - -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> - -namespace boost { namespace accumulators -{ - -// The weight accumulator -BOOST_PARAMETER_KEYWORD(tag, weights) -BOOST_ACCUMULATORS_IGNORE_GLOBAL(weights) - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/numeric/detail/function1.hpp b/contrib/restricted/boost/boost/accumulators/numeric/detail/function1.hpp deleted file mode 100644 index 282eb1ef3e..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/detail/function1.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef BOOST_DETAIL_FUNCTION1_DWA200655_HPP -# define BOOST_DETAIL_FUNCTION1_DWA200655_HPP - -# include <boost/concept_check.hpp> -# include <boost/type_traits/remove_reference.hpp> -# include <boost/type_traits/add_const.hpp> -# include <boost/mpl/apply.hpp> - -namespace boost { namespace detail { - -// A utility for creating unary function objects that play nicely with -// boost::result_of and that handle the forwarding problem. -// -// mpl::apply<F, A0>::type is expected to be a stateless function -// object that accepts an argument of type A0&. It is also expected -// to have a nested ::result_type identical to its return type. -template<typename F> -struct function1 -{ - template<typename Signature> - struct result - {}; - - template<typename This, typename A0> - struct result<This(A0)> - { - // How adding const to arguments handles rvalues. - // - // if A0 is arg0 is represents actual argument - // -------- ------- -------------------------- - // T const & T const const T lvalue - // T & T non-const T lvalue - // T const T const const T rvalue - // T T const non-const T rvalue - typedef typename remove_reference< - typename add_const< A0 >::type - >::type arg0; - - typedef typename mpl::apply1<F, arg0>::type impl; - typedef typename impl::result_type type; - }; - - // Handles mutable lvalues - template<typename A0> - typename result<function1(A0 &)>::type - operator ()(A0 &a0) const - { - typedef typename result<function1(A0 &)>::impl impl; - typedef typename result<function1(A0 &)>::type type; - typedef A0 &arg0; - BOOST_CONCEPT_ASSERT((UnaryFunction<impl, type, arg0>)); - //boost::function_requires<UnaryFunctionConcept<impl, type, arg0> >(); - return impl()(a0); - } - - // Handles const lvalues and all rvalues - template<typename A0> - typename result<function1(A0 const &)>::type - operator ()(A0 const &a0) const - { - typedef typename result<function1(A0 const &)>::impl impl; - typedef typename result<function1(A0 const &)>::type type; - typedef A0 const &arg0; - BOOST_CONCEPT_ASSERT((UnaryFunction<impl, type, arg0>)); - //boost::function_requires<UnaryFunctionConcept<impl, type, arg0> >(); - return impl()(a0); - } -}; - -}} // namespace boost::detail - -#endif // BOOST_DETAIL_FUNCTION1_DWA200655_HPP diff --git a/contrib/restricted/boost/boost/accumulators/numeric/detail/function2.hpp b/contrib/restricted/boost/boost/accumulators/numeric/detail/function2.hpp deleted file mode 100644 index daf3c4d4e7..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/detail/function2.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef BOOST_DETAIL_FUNCTION2_DWA200655_HPP -# define BOOST_DETAIL_FUNCTION2_DWA200655_HPP - -# define args (2) -# include <boost/accumulators/numeric/detail/function_n.hpp> - -#endif // BOOST_DETAIL_FUNCTION2_DWA200655_HPP diff --git a/contrib/restricted/boost/boost/accumulators/numeric/detail/function3.hpp b/contrib/restricted/boost/boost/accumulators/numeric/detail/function3.hpp deleted file mode 100644 index 175e4d5b3a..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/detail/function3.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef BOOST_DETAIL_FUNCTION3_DWA2006514_HPP -# define BOOST_DETAIL_FUNCTION3_DWA2006514_HPP - -# define args (3) -# include <boost/accumulators/numeric/detail/function_n.hpp> - -#endif // BOOST_DETAIL_FUNCTION3_DWA2006514_HPP diff --git a/contrib/restricted/boost/boost/accumulators/numeric/detail/function4.hpp b/contrib/restricted/boost/boost/accumulators/numeric/detail/function4.hpp deleted file mode 100644 index a0d710837e..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/detail/function4.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef BOOST_DETAIL_FUNCTION4_DWA2006514_HPP -# define BOOST_DETAIL_FUNCTION4_DWA2006514_HPP - -# define args (4) -# include <boost/accumulators/numeric/detail/function_n.hpp> - -#endif // BOOST_DETAIL_FUNCTION4_DWA2006514_HPP diff --git a/contrib/restricted/boost/boost/accumulators/numeric/detail/function_n.hpp b/contrib/restricted/boost/boost/accumulators/numeric/detail/function_n.hpp deleted file mode 100644 index 47c42ed05b..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/detail/function_n.hpp +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright David Abrahams 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) -// -// #include guards intentionally disabled. -// #ifndef BOOST_DETAIL_FUNCTION_N_DWA2006514_HPP -// # define BOOST_DETAIL_FUNCTION_N_DWA2006514_HPP - -#include <boost/mpl/void.hpp> -#include <boost/mpl/apply.hpp> - -#include <boost/preprocessor/control/if.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/punctuation/comma_if.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/seq/fold_left.hpp> -#include <boost/preprocessor/seq/seq.hpp> -#include <boost/preprocessor/seq/for_each.hpp> -#include <boost/preprocessor/seq/for_each_i.hpp> -#include <boost/preprocessor/seq/for_each_product.hpp> -#include <boost/preprocessor/seq/size.hpp> -#include <boost/type_traits/add_const.hpp> -#include <boost/type_traits/remove_reference.hpp> - -namespace boost { namespace detail { - -# define BOOST_DETAIL_default_arg(z, n, _) \ - typedef mpl::void_ BOOST_PP_CAT(arg, n); - -# define BOOST_DETAIL_function_arg(z, n, _) \ - typedef typename remove_reference< \ - typename add_const< BOOST_PP_CAT(A, n) >::type \ - >::type BOOST_PP_CAT(arg, n); - -#define BOOST_DETAIL_cat_arg_counts(s, state, n) \ - BOOST_PP_IF( \ - n \ - , BOOST_PP_CAT(state, BOOST_PP_CAT(_, n)) \ - , state \ - ) \ - /**/ - -#define function_name \ - BOOST_PP_SEQ_FOLD_LEFT( \ - BOOST_DETAIL_cat_arg_counts \ - , BOOST_PP_CAT(function, BOOST_PP_SEQ_HEAD(args)) \ - , BOOST_PP_SEQ_TAIL(args)(0) \ - ) \ - /**/ - -template<typename F> -struct function_name -{ - BOOST_PP_REPEAT( - BOOST_MPL_LIMIT_METAFUNCTION_ARITY - , BOOST_DETAIL_default_arg - , ~ - ) - - template<typename Signature> - struct result {}; - -#define BOOST_DETAIL_function_result(r, _, n) \ - template<typename This BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A)> \ - struct result<This(BOOST_PP_ENUM_PARAMS(n, A))> \ - { \ - BOOST_PP_REPEAT(n, BOOST_DETAIL_function_arg, ~) \ - typedef \ - typename BOOST_PP_CAT(mpl::apply, BOOST_MPL_LIMIT_METAFUNCTION_ARITY)<\ - F \ - BOOST_PP_ENUM_TRAILING_PARAMS( \ - BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ - , arg \ - ) \ - >::type \ - impl; \ - typedef typename impl::result_type type; \ - }; \ - /**/ - - BOOST_PP_SEQ_FOR_EACH(BOOST_DETAIL_function_result, _, args) - -# define arg_type(r, _, i, is_const) \ - BOOST_PP_COMMA_IF(i) BOOST_PP_CAT(A, i) BOOST_PP_CAT(const_if, is_const) & - -# define result_(r, n, constness) \ - typename result< \ - function_name( \ - BOOST_PP_SEQ_FOR_EACH_I_R(r, arg_type, ~, constness) \ - ) \ - > \ - /**/ - -# define param(r, _, i, is_const) BOOST_PP_COMMA_IF(i) \ - BOOST_PP_CAT(A, i) BOOST_PP_CAT(const_if, is_const) & BOOST_PP_CAT(x, i) - -# define param_list(r, n, constness) \ - BOOST_PP_SEQ_FOR_EACH_I_R(r, param, ~, constness) - -# define call_operator(r, constness) \ - template<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(constness), typename A)> \ - result_(r, BOOST_PP_SEQ_SIZE(constness), constness)::type \ - operator ()( param_list(r, BOOST_PP_SEQ_SIZE(constness), constness) ) const \ - { \ - typedef result_(r, BOOST_PP_SEQ_SIZE(constness), constness)::impl impl; \ - return impl()(BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(constness), x)); \ - } \ - /**/ - -# define const_if0 -# define const_if1 const - -# define bits(z, n, _) ((0)(1)) - -# define gen_operator(r, _, n) \ - BOOST_PP_SEQ_FOR_EACH_PRODUCT_R( \ - r \ - , call_operator \ - , BOOST_PP_REPEAT(n, bits, ~) \ - ) \ - /**/ - - BOOST_PP_SEQ_FOR_EACH( - gen_operator - , ~ - , args - ) - -# undef bits -# undef const_if1 -# undef const_if0 -# undef call_operator -# undef param_list -# undef param -# undef result_ -# undef default_ -# undef arg_type -# undef gen_operator -# undef function_name - -# undef args -}; - -}} // namespace boost::detail - -//#endif // BOOST_DETAIL_FUNCTION_N_DWA2006514_HPP diff --git a/contrib/restricted/boost/boost/accumulators/numeric/detail/pod_singleton.hpp b/contrib/restricted/boost/boost/accumulators/numeric/detail/pod_singleton.hpp deleted file mode 100644 index 317d85fb24..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/detail/pod_singleton.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef BOOST_DETAIL_POD_SINGLETON_DWA200655_HPP -# define BOOST_DETAIL_POD_SINGLETON_DWA200655_HPP - -namespace boost { namespace detail { - -template<typename T> -struct pod_singleton -{ - static T instance; -}; - -template<typename T> -T pod_singleton<T>::instance; - -}} // namespace boost::detail - -#endif // BOOST_DETAIL_POD_SINGLETON_DWA200655_HPP diff --git a/contrib/restricted/boost/boost/accumulators/numeric/functional.hpp b/contrib/restricted/boost/boost/accumulators/numeric/functional.hpp deleted file mode 100644 index 858decc199..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/functional.hpp +++ /dev/null @@ -1,537 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// \file functional.hpp -/// -// Copyright 2005 Eric Niebler. Distributed under the 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_NUMERIC_FUNCTIONAL_HPP_EAN_08_12_2005 -#define BOOST_NUMERIC_FUNCTIONAL_HPP_EAN_08_12_2005 - -#include <limits> -#include <functional> -#include <boost/static_assert.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/and.hpp> -#include <boost/type_traits/remove_const.hpp> -#include <boost/type_traits/add_reference.hpp> -#include <boost/type_traits/is_empty.hpp> -#include <boost/type_traits/is_integral.hpp> -#include <boost/type_traits/is_floating_point.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/typeof/typeof.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/numeric/functional_fwd.hpp> -#include <boost/accumulators/numeric/detail/function1.hpp> -#include <boost/accumulators/numeric/detail/function2.hpp> -#include <boost/accumulators/numeric/detail/pod_singleton.hpp> - -#ifdef BOOST_NUMERIC_FUNCTIONAL_STD_VECTOR_SUPPORT -# include <boost/accumulators/numeric/functional/vector.hpp> -#endif - -#ifdef BOOST_NUMERIC_FUNCTIONAL_STD_VALARRAY_SUPPORT -# include <boost/accumulators/numeric/functional/valarray.hpp> -#endif - -#ifdef BOOST_NUMERIC_FUNCTIONAL_STD_COMPLEX_SUPPORT -# include <boost/accumulators/numeric/functional/complex.hpp> -#endif - -/// INTERNAL ONLY -/// -#define BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED - -#ifdef BOOST_NUMERIC_FUNCTIONAL_DOXYGEN_INVOKED -// Hack to make Doxygen show the inheritance relationships -/// INTERNAL ONLY -/// -namespace std -{ - /// INTERNAL ONLY - /// - template<class Arg, class Ret> struct unary_function {}; - /// INTERNAL ONLY - /// - template<class Left, class Right, class Ret> struct binary_function {}; -} -#endif - -namespace boost { namespace numeric -{ - namespace functional - { - /// INTERNAL ONLY - /// - template<typename A0, typename A1> - struct are_integral - : mpl::and_<is_integral<A0>, is_integral<A1> > - {}; - - template<typename Left, typename Right> - struct left_ref - { - typedef Left &type; - }; - - namespace detail - { - template<typename T> - T &lvalue_of(); - } - } - - // TODO: handle complex weight, valarray, MTL vectors - - /// INTERNAL ONLY - /// -#define BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(Name, Op) \ - namespace functional \ - { \ - template<typename Arg> \ - struct result_of_ ## Name \ - { \ - BOOST_TYPEOF_NESTED_TYPEDEF_TPL( \ - nested \ - , Op boost::numeric::functional::detail::lvalue_of<Arg>() \ - ) \ - typedef typename nested::type type; \ - }; \ - template<typename Arg, typename EnableIf> \ - struct Name ## _base \ - { \ - typedef typename remove_const<Arg>::type argument_type; \ - typedef typename result_of_ ## Name<Arg>::type result_type; \ - typename result_of_ ## Name<Arg>::type operator ()(Arg &arg) const \ - { \ - return Op arg; \ - } \ - }; \ - template<typename Arg, typename ArgTag> \ - struct Name \ - : Name ## _base<Arg, void> \ - {}; \ - } \ - namespace op \ - { \ - struct Name \ - : boost::detail::function1<functional::Name<_, functional::tag<_> > > \ - {}; \ - } \ - namespace \ - { \ - op::Name const &Name = boost::detail::pod_singleton<op::Name>::instance; \ - } \ - /**/ - - /// INTERNAL ONLY - /// -#define BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(Name, Op, RetType) \ - namespace functional \ - { \ - template<typename Left, typename Right, typename EnableIf> \ - struct result_of_ ## Name \ - { \ - RetType(Left, Op, Right) \ - }; \ - template<typename Left, typename Right, typename EnableIf> \ - struct Name ## _base \ - { \ - typedef typename remove_const<Left>::type first_argument_type; \ - typedef typename remove_const<Right>::type second_argument_type; \ - typedef typename result_of_ ## Name<Left, Right>::type result_type; \ - typename result_of_ ## Name<Left, Right>::type \ - operator ()(Left &left, Right &right) const \ - { \ - return left Op right; \ - } \ - }; \ - template<typename Left, typename Right, typename LeftTag, typename RightTag> \ - struct Name \ - : Name ## _base<Left, Right, void> \ - {}; \ - } \ - namespace op \ - { \ - struct Name \ - : boost::detail::function2< \ - functional::Name<_1, _2, functional::tag<_1>, functional::tag<_2> > \ - > \ - {}; \ - } \ - namespace \ - { \ - op::Name const &Name = boost::detail::pod_singleton<op::Name>::instance; \ - } \ - BOOST_ACCUMULATORS_IGNORE_GLOBAL(Name) \ - /**/ - - /// INTERNAL ONLY - /// -#define BOOST_NUMERIC_FUNCTIONAL_DEDUCED(Left, Op, Right) \ - BOOST_TYPEOF_NESTED_TYPEDEF_TPL( \ - nested \ - , boost::numeric::functional::detail::lvalue_of<Left>() Op \ - boost::numeric::functional::detail::lvalue_of<Right>() \ - ) \ - typedef typename nested::type type; \ - /**/ - - /// INTERNAL ONLY - /// -#define BOOST_NUMERIC_FUNCTIONAL_LEFT(Left, Op, Right) \ - typedef Left &type; \ - /**/ - - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(plus, +, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(minus, -, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(multiplies, *, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(divides, /, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(modulus, %, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(greater, >, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(greater_equal, >=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(less, <, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(less_equal, <=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(equal_to, ==, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(not_equal_to, !=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) - - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(assign, =, BOOST_NUMERIC_FUNCTIONAL_LEFT) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(plus_assign, +=, BOOST_NUMERIC_FUNCTIONAL_LEFT) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(minus_assign, -=, BOOST_NUMERIC_FUNCTIONAL_LEFT) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(multiplies_assign, *=, BOOST_NUMERIC_FUNCTIONAL_LEFT) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(divides_assign, /=, BOOST_NUMERIC_FUNCTIONAL_LEFT) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(modulus_assign, %=, BOOST_NUMERIC_FUNCTIONAL_LEFT) - - BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(unary_plus, +) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(unary_minus, -) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(complement, ~) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(logical_not, !) - -#undef BOOST_NUMERIC_FUNCTIONAL_LEFT -#undef BOOST_NUMERIC_FUNCTIONAL_DEDUCED -#undef BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP -#undef BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP - - namespace functional - { - template<typename Left, typename Right, typename EnableIf> - struct min_assign_base - { - typedef Left first_argument_type; - typedef Right second_argument_type; - typedef void result_type; - - void operator ()(Left &left, Right &right) const - { - if(numeric::less(right, left)) - { - left = right; - } - } - }; - - template<typename Left, typename Right, typename EnableIf> - struct max_assign_base - { - typedef Left first_argument_type; - typedef Right second_argument_type; - typedef void result_type; - - void operator ()(Left &left, Right &right) const - { - if(numeric::greater(right, left)) - { - left = right; - } - } - }; - - template<typename Left, typename Right, typename EnableIf> - struct fdiv_base - : functional::divides<Left, Right> - {}; - - // partial specialization that promotes the arguments to double for - // integral division. - template<typename Left, typename Right> - struct fdiv_base<Left, Right, typename enable_if<are_integral<Left, Right> >::type> - : functional::divides<double const, double const> - {}; - - template<typename To, typename From, typename EnableIf> - struct promote_base - { - typedef From argument_type; - typedef To result_type; - - To operator ()(From &from) const - { - return from; - } - }; - - template<typename ToFrom> - struct promote_base<ToFrom, ToFrom, void> - { - typedef ToFrom argument_type; - typedef ToFrom result_type; - - ToFrom &operator ()(ToFrom &tofrom) - { - return tofrom; - } - }; - - template<typename Arg, typename EnableIf> - struct as_min_base - { - BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized); - - typedef Arg argument_type; - typedef typename remove_const<Arg>::type result_type; - - typename remove_const<Arg>::type operator ()(Arg &) const - { - return (std::numeric_limits<typename remove_const<Arg>::type>::min)(); - } - }; - - template<typename Arg> - struct as_min_base<Arg, typename enable_if<is_floating_point<Arg> >::type> - { - BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized); - - typedef Arg argument_type; - typedef typename remove_const<Arg>::type result_type; - - typename remove_const<Arg>::type operator ()(Arg &) const - { - return -(std::numeric_limits<typename remove_const<Arg>::type>::max)(); - } - }; - - template<typename Arg, typename EnableIf> - struct as_max_base - { - BOOST_STATIC_ASSERT(std::numeric_limits<typename remove_const<Arg>::type>::is_specialized); - - typedef Arg argument_type; - typedef typename remove_const<Arg>::type result_type; - - typename remove_const<Arg>::type operator ()(Arg &) const - { - return (std::numeric_limits<typename remove_const<Arg>::type>::max)(); - } - }; - - template<typename Arg, typename EnableIf> - struct as_zero_base - { - typedef Arg argument_type; - typedef typename remove_const<Arg>::type result_type; - - typename remove_const<Arg>::type operator ()(Arg &) const - { - return numeric::zero<typename remove_const<Arg>::type>::value; - } - }; - - template<typename Arg, typename EnableIf> - struct as_one_base - { - typedef Arg argument_type; - typedef typename remove_const<Arg>::type result_type; - - typename remove_const<Arg>::type operator ()(Arg &) const - { - return numeric::one<typename remove_const<Arg>::type>::value; - } - }; - - template<typename To, typename From, typename ToTag, typename FromTag> - struct promote - : promote_base<To, From, void> - {}; - - template<typename Left, typename Right, typename LeftTag, typename RightTag> - struct min_assign - : min_assign_base<Left, Right, void> - {}; - - template<typename Left, typename Right, typename LeftTag, typename RightTag> - struct max_assign - : max_assign_base<Left, Right, void> - {}; - - template<typename Left, typename Right, typename LeftTag, typename RightTag> - struct fdiv - : fdiv_base<Left, Right, void> - {}; - - /// INTERNAL ONLY - /// For back-compat only. Use fdiv. - template<typename Left, typename Right, typename LeftTag, typename RightTag> - struct average - : fdiv<Left, Right, LeftTag, RightTag> - {}; - - template<typename Arg, typename Tag> - struct as_min - : as_min_base<Arg, void> - {}; - - template<typename Arg, typename Tag> - struct as_max - : as_max_base<Arg, void> - {}; - - template<typename Arg, typename Tag> - struct as_zero - : as_zero_base<Arg, void> - {}; - - template<typename Arg, typename Tag> - struct as_one - : as_one_base<Arg, void> - {}; - } - - namespace op - { - template<typename To> - struct promote - : boost::detail::function1<functional::promote<To, _, typename functional::tag<To>::type, functional::tag<_> > > - {}; - - struct min_assign - : boost::detail::function2<functional::min_assign<_1, _2, functional::tag<_1>, functional::tag<_2> > > - {}; - - struct max_assign - : boost::detail::function2<functional::max_assign<_1, _2, functional::tag<_1>, functional::tag<_2> > > - {}; - - struct fdiv - : boost::detail::function2<functional::fdiv<_1, _2, functional::tag<_1>, functional::tag<_2> > > - {}; - - /// INTERNAL ONLY - struct average - : boost::detail::function2<functional::fdiv<_1, _2, functional::tag<_1>, functional::tag<_2> > > - {}; - - struct as_min - : boost::detail::function1<functional::as_min<_, functional::tag<_> > > - {}; - - struct as_max - : boost::detail::function1<functional::as_max<_, functional::tag<_> > > - {}; - - struct as_zero - : boost::detail::function1<functional::as_zero<_, functional::tag<_> > > - {}; - - struct as_one - : boost::detail::function1<functional::as_one<_, functional::tag<_> > > - {}; - } - - namespace - { - op::min_assign const &min_assign = boost::detail::pod_singleton<op::min_assign>::instance; - op::max_assign const &max_assign = boost::detail::pod_singleton<op::max_assign>::instance; - op::fdiv const &fdiv = boost::detail::pod_singleton<op::fdiv>::instance; - op::fdiv const &average = boost::detail::pod_singleton<op::fdiv>::instance; ///< INTERNAL ONLY - op::as_min const &as_min = boost::detail::pod_singleton<op::as_min>::instance; - op::as_max const &as_max = boost::detail::pod_singleton<op::as_max>::instance; - op::as_zero const &as_zero = boost::detail::pod_singleton<op::as_zero>::instance; - op::as_one const &as_one = boost::detail::pod_singleton<op::as_one>::instance; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(min_assign) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(max_assign) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(fdiv) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(average) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(as_min) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(as_max) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(as_zero) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(as_one) - } - - /////////////////////////////////////////////////////////////////////////////// - // promote - template<typename To, typename From> - typename lazy_disable_if<is_const<From>, mpl::if_<is_same<To, From>, To &, To> >::type - promote(From &from) - { - return functional::promote<To, From>()(from); - } - - template<typename To, typename From> - typename mpl::if_<is_same<To const, From const>, To const &, To const>::type - promote(From const &from) - { - return functional::promote<To const, From const>()(from); - } - - template<typename T> - struct default_ - { - typedef default_ type; - typedef T value_type; - static T const value; - - operator T const & () const - { - return default_::value; - } - }; - - template<typename T> - T const default_<T>::value = T(); - - template<typename T> - struct one - { - typedef one type; - typedef T value_type; - static T const value; - - operator T const & () const - { - return one::value; - } - }; - - template<typename T> - T const one<T>::value = T(1); - - template<typename T> - struct zero - { - typedef zero type; - typedef T value_type; - static T const value; - - operator T const & () const - { - return zero::value; - } - }; - - template<typename T> - T const zero<T>::value = T(); - - template<typename T> - struct one_or_default - : mpl::if_<is_empty<T>, default_<T>, one<T> >::type - {}; - - template<typename T> - struct zero_or_default - : mpl::if_<is_empty<T>, default_<T>, zero<T> >::type - {}; - -}} // namespace boost::numeric - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/numeric/functional/complex.hpp b/contrib/restricted/boost/boost/accumulators/numeric/functional/complex.hpp deleted file mode 100644 index ea8c033240..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/functional/complex.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// \file complex.hpp -/// -// Copyright 2005 Eric Niebler. Distributed under the 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_NUMERIC_FUNCTIONAL_COMPLEX_HPP_EAN_01_17_2006 -#define BOOST_NUMERIC_FUNCTIONAL_COMPLEX_HPP_EAN_01_17_2006 - -#ifdef BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED -# error Include this file before boost/accumulators/numeric/functional.hpp -#endif - -#include <complex> -#include <boost/mpl/or.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/typeof/std/complex.hpp> -#include <boost/accumulators/numeric/functional_fwd.hpp> - -namespace boost { namespace numeric { namespace operators -{ - // So that the stats compile when Sample type is std::complex - template<typename T, typename U> - typename - disable_if< - mpl::or_<is_same<T, U>, is_same<std::complex<T>, U> > - , std::complex<T> - >::type - operator *(std::complex<T> ri, U const &u) - { - // BUGBUG promote result to typeof(T()*u) ? - return ri *= static_cast<T>(u); - } - - template<typename T, typename U> - typename - disable_if< - mpl::or_<is_same<T, U>, is_same<std::complex<T>, U> > - , std::complex<T> - >::type - operator /(std::complex<T> ri, U const &u) - { - // BUGBUG promote result to typeof(T()*u) ? - return ri /= static_cast<T>(u); - } - -}}} // namespace boost::numeric::operators - -namespace boost { namespace numeric -{ - namespace detail - { - template<typename T> - struct one_complex - { - static std::complex<T> const value; - }; - - template<typename T> - std::complex<T> const one_complex<T>::value - = std::complex<T>(numeric::one<T>::value, numeric::one<T>::value); - } - - /// INTERNAL ONLY - /// - template<typename T> - struct one<std::complex<T> > - : detail::one_complex<T> - { - typedef one type; - typedef std::complex<T> value_type; - operator value_type const & () const - { - return detail::one_complex<T>::value; - } - }; - -}} // namespace boost::numeric - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/numeric/functional/valarray.hpp b/contrib/restricted/boost/boost/accumulators/numeric/functional/valarray.hpp deleted file mode 100644 index 1996c75845..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/functional/valarray.hpp +++ /dev/null @@ -1,362 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// \file valarray.hpp -/// -// Copyright 2005 Eric Niebler. Distributed under the 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_NUMERIC_FUNCTIONAL_VALARRAY_HPP_EAN_12_12_2005 -#define BOOST_NUMERIC_FUNCTIONAL_VALARRAY_HPP_EAN_12_12_2005 - -#ifdef BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED -# error Include this file before boost/accumulators/numeric/functional.hpp -#endif - -#include <valarray> -#include <functional> -#include <boost/assert.hpp> -#include <boost/mpl/and.hpp> -#include <boost/mpl/not.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/is_scalar.hpp> -#include <boost/type_traits/remove_const.hpp> -#include <boost/typeof/std/valarray.hpp> -#include <boost/accumulators/numeric/functional_fwd.hpp> - -namespace boost { namespace numeric -{ - namespace operators - { - namespace acc_detail - { - template<typename Fun> - struct make_valarray - { - typedef std::valarray<typename Fun::result_type> type; - }; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle valarray<Left> / Right where Right is a scalar and Right != Left. - template<typename Left, typename Right> - typename lazy_enable_if< - mpl::and_<is_scalar<Right>, mpl::not_<is_same<Left, Right> > > - , acc_detail::make_valarray<functional::divides<Left, Right> > - >::type - operator /(std::valarray<Left> const &left, Right const &right) - { - typedef typename functional::divides<Left, Right>::result_type value_type; - std::valarray<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::divides(left[i], right); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle valarray<Left> * Right where Right is a scalar and Right != Left. - template<typename Left, typename Right> - typename lazy_enable_if< - mpl::and_<is_scalar<Right>, mpl::not_<is_same<Left, Right> > > - , acc_detail::make_valarray<functional::multiplies<Left, Right> > - >::type - operator *(std::valarray<Left> const &left, Right const &right) - { - typedef typename functional::multiplies<Left, Right>::result_type value_type; - std::valarray<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::multiplies(left[i], right); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle valarray<Left> + valarray<Right> where Right != Left. - template<typename Left, typename Right> - typename lazy_disable_if< - is_same<Left, Right> - , acc_detail::make_valarray<functional::plus<Left, Right> > - >::type - operator +(std::valarray<Left> const &left, std::valarray<Right> const &right) - { - typedef typename functional::plus<Left, Right>::result_type value_type; - std::valarray<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::plus(left[i], right[i]); - } - return result; - } - } - - namespace functional - { - struct std_valarray_tag; - - template<typename T> - struct tag<std::valarray<T> > - { - typedef std_valarray_tag type; - }; - - #ifdef __GLIBCXX__ - template<typename T, typename U> - struct tag<std::_Expr<T, U> > - { - typedef std_valarray_tag type; - }; - #endif - - /// INTERNAL ONLY - /// - // This is necessary because the GCC stdlib uses expression templates, and - // typeof(som-valarray-expression) is not an instance of std::valarray - #define BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(Name, Op) \ - template<typename Left, typename Right> \ - struct Name<Left, Right, std_valarray_tag, std_valarray_tag> \ - { \ - typedef Left first_argument_type; \ - typedef Right second_argument_type; \ - typedef typename Left::value_type left_value_type; \ - typedef typename Right::value_type right_value_type; \ - typedef \ - std::valarray< \ - typename Name<left_value_type, right_value_type>::result_type \ - > \ - result_type; \ - result_type \ - operator ()(Left &left, Right &right) const \ - { \ - return numeric::promote<std::valarray<left_value_type> >(left) \ - Op numeric::promote<std::valarray<right_value_type> >(right); \ - } \ - }; \ - template<typename Left, typename Right> \ - struct Name<Left, Right, std_valarray_tag, void> \ - { \ - typedef Left first_argument_type; \ - typedef Right second_argument_type; \ - typedef typename Left::value_type left_value_type; \ - typedef \ - std::valarray< \ - typename Name<left_value_type, Right>::result_type \ - > \ - result_type; \ - result_type \ - operator ()(Left &left, Right &right) const \ - { \ - return numeric::promote<std::valarray<left_value_type> >(left) Op right;\ - } \ - }; \ - template<typename Left, typename Right> \ - struct Name<Left, Right, void, std_valarray_tag> \ - { \ - typedef Left first_argument_type; \ - typedef Right second_argument_type; \ - typedef typename Right::value_type right_value_type; \ - typedef \ - std::valarray< \ - typename Name<Left, right_value_type>::result_type \ - > \ - result_type; \ - result_type \ - operator ()(Left &left, Right &right) const \ - { \ - return left Op numeric::promote<std::valarray<right_value_type> >(right);\ - } \ - }; - - BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(plus, +) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(minus, -) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(multiplies, *) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(divides, /) - BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP(modulus, %) - - #undef BOOST_NUMERIC_FUNCTIONAL_DEFINE_VALARRAY_BIN_OP - - /////////////////////////////////////////////////////////////////////////////// - // element-wise min of std::valarray - template<typename Left, typename Right> - struct min_assign<Left, Right, std_valarray_tag, std_valarray_tag> - { - typedef Left first_argument_type; - typedef Right second_argument_type; - typedef void result_type; - - void operator ()(Left &left, Right &right) const - { - BOOST_ASSERT(left.size() == right.size()); - for(std::size_t i = 0, size = left.size(); i != size; ++i) - { - if(numeric::less(right[i], left[i])) - { - left[i] = right[i]; - } - } - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // element-wise max of std::valarray - template<typename Left, typename Right> - struct max_assign<Left, Right, std_valarray_tag, std_valarray_tag> - { - typedef Left first_argument_type; - typedef Right second_argument_type; - typedef void result_type; - - void operator ()(Left &left, Right &right) const - { - BOOST_ASSERT(left.size() == right.size()); - for(std::size_t i = 0, size = left.size(); i != size; ++i) - { - if(numeric::greater(right[i], left[i])) - { - left[i] = right[i]; - } - } - } - }; - - // partial specialization of numeric::fdiv<> for std::valarray. - template<typename Left, typename Right, typename RightTag> - struct fdiv<Left, Right, std_valarray_tag, RightTag> - : mpl::if_< - are_integral<typename Left::value_type, Right> - , divides<Left, double const> - , divides<Left, Right> - >::type - {}; - - // promote - template<typename To, typename From> - struct promote<To, From, std_valarray_tag, std_valarray_tag> - { - typedef From argument_type; - typedef To result_type; - - To operator ()(From &arr) const - { - typename remove_const<To>::type res(arr.size()); - for(std::size_t i = 0, size = arr.size(); i != size; ++i) - { - res[i] = numeric::promote<typename To::value_type>(arr[i]); - } - return res; - } - }; - - template<typename ToFrom> - struct promote<ToFrom, ToFrom, std_valarray_tag, std_valarray_tag> - { - typedef ToFrom argument_type; - typedef ToFrom result_type; - - ToFrom &operator ()(ToFrom &tofrom) const - { - return tofrom; - } - }; - - // for "promoting" a std::valarray<bool> to a bool, useful for - // comparing 2 valarrays for equality: - // if(numeric::promote<bool>(a == b)) - template<typename From> - struct promote<bool, From, void, std_valarray_tag> - { - typedef From argument_type; - typedef bool result_type; - - bool operator ()(From &arr) const - { - BOOST_MPL_ASSERT((is_same<bool, typename From::value_type>)); - for(std::size_t i = 0, size = arr.size(); i != size; ++i) - { - if(!arr[i]) - { - return false; - } - } - return true; - } - }; - - template<typename From> - struct promote<bool const, From, void, std_valarray_tag> - : promote<bool, From, void, std_valarray_tag> - {}; - - /////////////////////////////////////////////////////////////////////////////// - // functional::as_min - template<typename T> - struct as_min<T, std_valarray_tag> - { - typedef T argument_type; - typedef typename remove_const<T>::type result_type; - - typename remove_const<T>::type operator ()(T &arr) const - { - return 0 == arr.size() - ? T() - : T(numeric::as_min(arr[0]), arr.size()); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // functional::as_max - template<typename T> - struct as_max<T, std_valarray_tag> - { - typedef T argument_type; - typedef typename remove_const<T>::type result_type; - - typename remove_const<T>::type operator ()(T &arr) const - { - return 0 == arr.size() - ? T() - : T(numeric::as_max(arr[0]), arr.size()); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // functional::as_zero - template<typename T> - struct as_zero<T, std_valarray_tag> - { - typedef T argument_type; - typedef typename remove_const<T>::type result_type; - - typename remove_const<T>::type operator ()(T &arr) const - { - return 0 == arr.size() - ? T() - : T(numeric::as_zero(arr[0]), arr.size()); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // functional::as_one - template<typename T> - struct as_one<T, std_valarray_tag> - { - typedef T argument_type; - typedef typename remove_const<T>::type result_type; - - typename remove_const<T>::type operator ()(T &arr) const - { - return 0 == arr.size() - ? T() - : T(numeric::as_one(arr[0]), arr.size()); - } - }; - - } // namespace functional - -}} // namespace boost::numeric - -#endif - diff --git a/contrib/restricted/boost/boost/accumulators/numeric/functional/vector.hpp b/contrib/restricted/boost/boost/accumulators/numeric/functional/vector.hpp deleted file mode 100644 index 4c2fbd8ada..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/functional/vector.hpp +++ /dev/null @@ -1,347 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// \file vector.hpp -/// -// Copyright 2005 Eric Niebler. Distributed under the 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_NUMERIC_FUNCTIONAL_VECTOR_HPP_EAN_12_12_2005 -#define BOOST_NUMERIC_FUNCTIONAL_VECTOR_HPP_EAN_12_12_2005 - -#ifdef BOOST_NUMERIC_FUNCTIONAL_HPP_INCLUDED -# error Include this file before boost/accumulators/numeric/functional.hpp -#endif - -#include <vector> -#include <functional> -#include <boost/assert.hpp> -#include <boost/mpl/and.hpp> -#include <boost/mpl/not.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/is_scalar.hpp> -#include <boost/type_traits/remove_const.hpp> -#include <boost/typeof/std/vector.hpp> -#include <boost/accumulators/numeric/functional_fwd.hpp> - -namespace boost { namespace numeric -{ - namespace operators - { - namespace acc_detail - { - template<typename Fun> - struct make_vector - { - typedef std::vector<typename Fun::result_type> type; - }; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle vector<Left> / Right where Right is a scalar. - template<typename Left, typename Right> - typename lazy_enable_if< - is_scalar<Right> - , acc_detail::make_vector<functional::divides<Left, Right> > - >::type - operator /(std::vector<Left> const &left, Right const &right) - { - typedef typename functional::divides<Left, Right>::result_type value_type; - std::vector<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::divides(left[i], right); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle vector<Left> / vector<Right>. - template<typename Left, typename Right> - std::vector<typename functional::divides<Left, Right>::result_type> - operator /(std::vector<Left> const &left, std::vector<Right> const &right) - { - typedef typename functional::divides<Left, Right>::result_type value_type; - std::vector<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::divides(left[i], right[i]); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle vector<Left> * Right where Right is a scalar. - template<typename Left, typename Right> - typename lazy_enable_if< - is_scalar<Right> - , acc_detail::make_vector<functional::multiplies<Left, Right> > - >::type - operator *(std::vector<Left> const &left, Right const &right) - { - typedef typename functional::multiplies<Left, Right>::result_type value_type; - std::vector<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::multiplies(left[i], right); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle Left * vector<Right> where Left is a scalar. - template<typename Left, typename Right> - typename lazy_enable_if< - is_scalar<Left> - , acc_detail::make_vector<functional::multiplies<Left, Right> > - >::type - operator *(Left const &left, std::vector<Right> const &right) - { - typedef typename functional::multiplies<Left, Right>::result_type value_type; - std::vector<value_type> result(right.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::multiplies(left, right[i]); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle vector<Left> * vector<Right> - template<typename Left, typename Right> - std::vector<typename functional::multiplies<Left, Right>::result_type> - operator *(std::vector<Left> const &left, std::vector<Right> const &right) - { - typedef typename functional::multiplies<Left, Right>::result_type value_type; - std::vector<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::multiplies(left[i], right[i]); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle vector<Left> + vector<Right> - template<typename Left, typename Right> - std::vector<typename functional::plus<Left, Right>::result_type> - operator +(std::vector<Left> const &left, std::vector<Right> const &right) - { - typedef typename functional::plus<Left, Right>::result_type value_type; - std::vector<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::plus(left[i], right[i]); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle vector<Left> - vector<Right> - template<typename Left, typename Right> - std::vector<typename functional::minus<Left, Right>::result_type> - operator -(std::vector<Left> const &left, std::vector<Right> const &right) - { - typedef typename functional::minus<Left, Right>::result_type value_type; - std::vector<value_type> result(left.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::minus(left[i], right[i]); - } - return result; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle vector<Left> += vector<Left> - template<typename Left> - std::vector<Left> & - operator +=(std::vector<Left> &left, std::vector<Left> const &right) - { - BOOST_ASSERT(left.size() == right.size()); - for(std::size_t i = 0, size = left.size(); i != size; ++i) - { - numeric::plus_assign(left[i], right[i]); - } - return left; - } - - /////////////////////////////////////////////////////////////////////////////// - // Handle -vector<Arg> - template<typename Arg> - std::vector<typename functional::unary_minus<Arg>::result_type> - operator -(std::vector<Arg> const &arg) - { - typedef typename functional::unary_minus<Arg>::result_type value_type; - std::vector<value_type> result(arg.size()); - for(std::size_t i = 0, size = result.size(); i != size; ++i) - { - result[i] = numeric::unary_minus(arg[i]); - } - return result; - } - } - - namespace functional - { - struct std_vector_tag; - - template<typename T, typename Al> - struct tag<std::vector<T, Al> > - { - typedef std_vector_tag type; - }; - - /////////////////////////////////////////////////////////////////////////////// - // element-wise min of std::vector - template<typename Left, typename Right> - struct min_assign<Left, Right, std_vector_tag, std_vector_tag> - { - typedef Left first_argument_type; - typedef Right second_argument_type; - typedef void result_type; - - void operator ()(Left &left, Right &right) const - { - BOOST_ASSERT(left.size() == right.size()); - for(std::size_t i = 0, size = left.size(); i != size; ++i) - { - if(numeric::less(right[i], left[i])) - { - left[i] = right[i]; - } - } - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // element-wise max of std::vector - template<typename Left, typename Right> - struct max_assign<Left, Right, std_vector_tag, std_vector_tag> - { - typedef Left first_argument_type; - typedef Right second_argument_type; - typedef void result_type; - - void operator ()(Left &left, Right &right) const - { - BOOST_ASSERT(left.size() == right.size()); - for(std::size_t i = 0, size = left.size(); i != size; ++i) - { - if(numeric::greater(right[i], left[i])) - { - left[i] = right[i]; - } - } - } - }; - - // partial specialization for std::vector. - template<typename Left, typename Right> - struct fdiv<Left, Right, std_vector_tag, void> - : mpl::if_< - are_integral<typename Left::value_type, Right> - , divides<Left, double const> - , divides<Left, Right> - >::type - {}; - - // promote - template<typename To, typename From> - struct promote<To, From, std_vector_tag, std_vector_tag> - { - typedef From argument_type; - typedef To result_type; - - To operator ()(From &arr) const - { - typename remove_const<To>::type res(arr.size()); - for(std::size_t i = 0, size = arr.size(); i != size; ++i) - { - res[i] = numeric::promote<typename To::value_type>(arr[i]); - } - return res; - } - }; - - template<typename ToFrom> - struct promote<ToFrom, ToFrom, std_vector_tag, std_vector_tag> - { - typedef ToFrom argument_type; - typedef ToFrom result_type; - - ToFrom &operator ()(ToFrom &tofrom) const - { - return tofrom; - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // functional::as_min - template<typename T> - struct as_min<T, std_vector_tag> - { - typedef T argument_type; - typedef typename remove_const<T>::type result_type; - - typename remove_const<T>::type operator ()(T &arr) const - { - return 0 == arr.size() - ? T() - : T(arr.size(), numeric::as_min(arr[0])); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // functional::as_max - template<typename T> - struct as_max<T, std_vector_tag> - { - typedef T argument_type; - typedef typename remove_const<T>::type result_type; - - typename remove_const<T>::type operator ()(T &arr) const - { - return 0 == arr.size() - ? T() - : T(arr.size(), numeric::as_max(arr[0])); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // functional::as_zero - template<typename T> - struct as_zero<T, std_vector_tag> - { - typedef T argument_type; - typedef typename remove_const<T>::type result_type; - - typename remove_const<T>::type operator ()(T &arr) const - { - return 0 == arr.size() - ? T() - : T(arr.size(), numeric::as_zero(arr[0])); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // functional::as_one - template<typename T> - struct as_one<T, std_vector_tag> - { - typedef T argument_type; - typedef typename remove_const<T>::type result_type; - - typename remove_const<T>::type operator ()(T &arr) const - { - return 0 == arr.size() - ? T() - : T(arr.size(), numeric::as_one(arr[0])); - } - }; - - } // namespace functional - -}} // namespace boost::numeric - -#endif - diff --git a/contrib/restricted/boost/boost/accumulators/numeric/functional_fwd.hpp b/contrib/restricted/boost/boost/accumulators/numeric/functional_fwd.hpp deleted file mode 100644 index 501f654b29..0000000000 --- a/contrib/restricted/boost/boost/accumulators/numeric/functional_fwd.hpp +++ /dev/null @@ -1,221 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// \file functional_fwd.hpp -/// -// Copyright 2005 Eric Niebler. Distributed under the 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_NUMERIC_FUNCTIONAL_FWD_HPP_EAN_08_12_2005 -#define BOOST_NUMERIC_FUNCTIONAL_FWD_HPP_EAN_08_12_2005 - -#include <boost/mpl/if.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/is_const.hpp> - -namespace boost { namespace numeric -{ - // For using directives -- this namespace may be re-opened elsewhere - namespace operators - {} - - namespace op - { - using mpl::_; - using mpl::_1; - using mpl::_2; - } - - namespace functional - { - using namespace operators; - - template<typename T> - struct tag - { - typedef void type; - }; - - template<typename T> - struct tag<T const> - : tag<T> - {}; - - template<typename T> - struct tag<T volatile> - : tag<T> - {}; - - template<typename T> - struct tag<T const volatile> - : tag<T> - {}; - - template<typename T> - struct static_; - - template<typename A0, typename A1> - struct are_integral; - } - - /// INTERNAL ONLY - /// -#define BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(Name, Op) \ - namespace functional \ - { \ - template<typename Arg, typename EnableIf = void> \ - struct Name ## _base; \ - template<typename Arg, typename ArgTag = typename tag<Arg>::type> \ - struct Name; \ - } \ - namespace op \ - { \ - struct Name; \ - } \ - namespace \ - { \ - extern op::Name const &Name; \ - } - - /// INTERNAL ONLY - /// -#define BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(Name) \ - namespace functional \ - { \ - template<typename Left, typename Right, typename EnableIf = void> \ - struct result_of_ ## Name; \ - template<typename Left, typename Right, typename EnableIf = void> \ - struct Name ## _base; \ - template< \ - typename Left \ - , typename Right \ - , typename LeftTag = typename tag<Left>::type \ - , typename RightTag = typename tag<Right>::type \ - > \ - struct Name; \ - } \ - namespace op \ - { \ - struct Name; \ - } \ - namespace \ - { \ - extern op::Name const &Name; \ - } - - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(plus) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(minus) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(multiplies) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(divides) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(modulus) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(greater) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(greater_equal) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(less) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(less_equal) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(equal_to) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(not_equal_to) - - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(assign) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(plus_assign) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(minus_assign) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(multiplies_assign) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(divides_assign) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP(modulus_assign) - - BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(unary_plus, +) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(unary_minus, -) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(complement, ~) - BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP(logical_not, !) - -#undef BOOST_NUMERIC_FUNCTIONAL_DECLARE_UNARY_OP -#undef BOOST_NUMERIC_FUNCTIONAL_DECLARE_BINARY_OP - - - namespace functional - { - template<typename To, typename From, typename EnableIf = void> - struct promote_base; - template<typename Left, typename Right, typename EnableIf = void> - struct min_assign_base; - template<typename Left, typename Right, typename EnableIf = void> - struct max_assign_base; - template<typename Left, typename Right, typename EnableIf = void> - struct fdiv_base; - template<typename Arg, typename EnableIf = void> - struct as_min_base; - template<typename Arg, typename EnableIf = void> - struct as_max_base; - template<typename Arg, typename EnableIf = void> - struct as_zero_base; - template<typename Arg, typename EnableIf = void> - struct as_one_base; - - template<typename To, typename From, typename ToTag = typename tag<To>::type, typename FromTag = typename tag<From>::type> - struct promote; - template<typename Left, typename Right, typename LeftTag = typename tag<Left>::type, typename RightTag = typename tag<Right>::type> - struct min_assign; - template<typename Left, typename Right, typename LeftTag = typename tag<Left>::type, typename RightTag = typename tag<Right>::type> - struct max_assign; - template<typename Left, typename Right, typename LeftTag = typename tag<Left>::type, typename RightTag = typename tag<Right>::type> - struct fdiv; - template<typename Arg, typename Tag = typename tag<Arg>::type> - struct as_min; - template<typename Arg, typename Tag = typename tag<Arg>::type> - struct as_max; - template<typename Arg, typename Tag = typename tag<Arg>::type> - struct as_zero; - template<typename Arg, typename Tag = typename tag<Arg>::type> - struct as_one; - } - - namespace op - { - template<typename To> - struct promote; - struct min_assign; - struct max_assign; - struct fdiv; - struct as_min; - struct as_max; - struct as_zero; - struct as_one; - } - - namespace - { - extern op::min_assign const &min_assign; - extern op::max_assign const &max_assign; - extern op::fdiv const &fdiv; - extern op::as_min const &as_min; - extern op::as_max const &as_max; - extern op::as_zero const &as_zero; - extern op::as_one const &as_one; - } - - template<typename To, typename From> - typename lazy_disable_if<is_const<From>, mpl::if_<is_same<To, From>, To &, To> >::type - promote(From &from); - - template<typename To, typename From> - typename mpl::if_<is_same<To const, From const>, To const &, To const>::type - promote(From const &from); - - template<typename T> - struct default_; - - template<typename T> - struct one; - - template<typename T> - struct zero; - - template<typename T> - struct one_or_default; - - template<typename T> - struct zero_or_default; - -}} // namespace boost::numeric - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics.hpp b/contrib/restricted/boost/boost/accumulators/statistics.hpp deleted file mode 100644 index 01786079a8..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// \file statistics.hpp -/// Includes all of the Statistical Accumulators Library -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_HPP_EAN_01_17_2006 -#define BOOST_ACCUMULATORS_STATISTICS_HPP_EAN_01_17_2006 - -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/covariance.hpp> -#include <boost/accumulators/statistics/density.hpp> -#include <boost/accumulators/statistics/error_of.hpp> -#include <boost/accumulators/statistics/error_of_mean.hpp> -#include <boost/accumulators/statistics/extended_p_square.hpp> -#include <boost/accumulators/statistics/extended_p_square_quantile.hpp> -#include <boost/accumulators/statistics/kurtosis.hpp> -#include <boost/accumulators/statistics/max.hpp> -#include <boost/accumulators/statistics/mean.hpp> -#include <boost/accumulators/statistics/median.hpp> -#include <boost/accumulators/statistics/min.hpp> -#include <boost/accumulators/statistics/moment.hpp> -#include <boost/accumulators/statistics/peaks_over_threshold.hpp> -#include <boost/accumulators/statistics/pot_tail_mean.hpp> -#include <boost/accumulators/statistics/pot_quantile.hpp> -#include <boost/accumulators/statistics/p_square_cumul_dist.hpp> -#include <boost/accumulators/statistics/p_square_quantile.hpp> -#include <boost/accumulators/statistics/skewness.hpp> -#include <boost/accumulators/statistics/stats.hpp> -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/sum_kahan.hpp> -#include <boost/accumulators/statistics/tail.hpp> -#include <boost/accumulators/statistics/tail_quantile.hpp> -#include <boost/accumulators/statistics/tail_mean.hpp> -#include <boost/accumulators/statistics/tail_variate.hpp> -#include <boost/accumulators/statistics/tail_variate_means.hpp> -#include <boost/accumulators/statistics/variance.hpp> -#include <boost/accumulators/statistics/weighted_covariance.hpp> -#include <boost/accumulators/statistics/weighted_density.hpp> -#include <boost/accumulators/statistics/weighted_kurtosis.hpp> -#include <boost/accumulators/statistics/weighted_extended_p_square.hpp> -#include <boost/accumulators/statistics/weighted_mean.hpp> -#include <boost/accumulators/statistics/weighted_median.hpp> -#include <boost/accumulators/statistics/weighted_moment.hpp> -#include <boost/accumulators/statistics/weighted_peaks_over_threshold.hpp> -#include <boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp> -#include <boost/accumulators/statistics/weighted_p_square_quantile.hpp> -#include <boost/accumulators/statistics/weighted_skewness.hpp> -#include <boost/accumulators/statistics/weighted_sum.hpp> -#include <boost/accumulators/statistics/weighted_sum_kahan.hpp> -#include <boost/accumulators/statistics/weighted_tail_quantile.hpp> -#include <boost/accumulators/statistics/weighted_tail_mean.hpp> -#include <boost/accumulators/statistics/weighted_tail_variate_means.hpp> -#include <boost/accumulators/statistics/weighted_variance.hpp> -#include <boost/accumulators/statistics/with_error.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> -#include <boost/accumulators/statistics/variates/covariate.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/count.hpp b/contrib/restricted/boost/boost/accumulators/statistics/count.hpp deleted file mode 100644 index 6d30b41e26..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/count.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// count.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_COUNT_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_COUNT_HPP_EAN_28_10_2005 - -#include <boost/mpl/always.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - - /////////////////////////////////////////////////////////////////////////////// - // count_impl - struct count_impl - : accumulator_base - { - // for boost::result_of - typedef std::size_t result_type; - - count_impl(dont_care) - : cnt(0) - { - } - - void operator ()(dont_care) - { - ++this->cnt; - } - - result_type result(dont_care) const - { - return this->cnt; - } - - private: - std::size_t cnt; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::count -// -namespace tag -{ - struct count - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef mpl::always<accumulators::impl::count_impl> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::count -// -namespace extract -{ - extractor<tag::count> const count = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(count) -} - -using extract::count; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/covariance.hpp b/contrib/restricted/boost/boost/accumulators/statistics/covariance.hpp deleted file mode 100644 index b3030b9676..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/covariance.hpp +++ /dev/null @@ -1,212 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// covariance.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_COVARIANCE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_COVARIANCE_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <numeric> -#include <functional> -#include <complex> -#include <boost/mpl/assert.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/range.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/numeric/ublas/io.hpp> -#include <boost/numeric/ublas/matrix.hpp> -#include <boost/type_traits/is_scalar.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/mean.hpp> - -namespace boost { namespace numeric -{ - namespace functional - { - struct std_vector_tag; - - /////////////////////////////////////////////////////////////////////////////// - // functional::outer_product - template<typename Left, typename Right, typename EnableIf = void> - struct outer_product_base - : functional::multiplies<Left, Right> - {}; - - template<typename Left, typename Right, typename LeftTag = typename tag<Left>::type, typename RightTag = typename tag<Right>::type> - struct outer_product - : outer_product_base<Left, Right, void> - {}; - - template<typename Left, typename Right> - struct outer_product<Left, Right, std_vector_tag, std_vector_tag> - { - typedef Left first_argument_type; - typedef Right second_argument_type; - typedef - ublas::matrix< - typename functional::multiplies< - typename Left::value_type - , typename Right::value_type - >::result_type - > - result_type; - - result_type - operator ()(Left & left, Right & right) const - { - std::size_t left_size = left.size(); - std::size_t right_size = right.size(); - result_type result(left_size, right_size); - for (std::size_t i = 0; i < left_size; ++i) - for (std::size_t j = 0; j < right_size; ++j) - result(i,j) = numeric::multiplies(left[i], right[j]); - return result; - } - }; - } - - namespace op - { - struct outer_product - : boost::detail::function2<functional::outer_product<_1, _2, functional::tag<_1>, functional::tag<_2> > > - {}; - } - - namespace - { - op::outer_product const &outer_product = boost::detail::pod_singleton<op::outer_product>::instance; - } - -}} - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // covariance_impl - // - /** - @brief Covariance Estimator - - An iterative Monte Carlo estimator for the covariance \f$\mathrm{Cov}(X,X')\f$, where \f$X\f$ is a sample - and \f$X'\f$ is a variate, is given by: - - \f[ - \hat{c}_n = \frac{n-1}{n} \hat{c}_{n-1} + \frac{1}{n-1}(X_n - \hat{\mu}_n)(X_n' - \hat{\mu}_n'),\quad n\ge2,\quad\hat{c}_1 = 0, - \f] - - \f$\hat{\mu}_n\f$ and \f$\hat{\mu}_n'\f$ being the means of the samples and variates. - */ - template<typename Sample, typename VariateType, typename VariateTag> - struct covariance_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type sample_type; - typedef typename numeric::functional::fdiv<VariateType, std::size_t>::result_type variate_type; - // for boost::result_of - typedef typename numeric::functional::outer_product<sample_type, variate_type>::result_type result_type; - - template<typename Args> - covariance_impl(Args const &args) - : cov_( - numeric::outer_product( - numeric::fdiv(args[sample | Sample()], (std::size_t)1) - , numeric::fdiv(args[parameter::keyword<VariateTag>::get() | VariateType()], (std::size_t)1) - ) - ) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - - if (cnt > 1) - { - extractor<tag::mean_of_variates<VariateType, VariateTag> > const some_mean_of_variates = {}; - - this->cov_ = this->cov_*(cnt-1.)/cnt - + numeric::outer_product( - some_mean_of_variates(args) - args[parameter::keyword<VariateTag>::get()] - , mean(args) - args[sample] - ) / (cnt-1.); - } - } - - result_type result(dont_care) const - { - return this->cov_; - } - - private: - result_type cov_; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::covariance -// -namespace tag -{ - template<typename VariateType, typename VariateTag> - struct covariance - : depends_on<count, mean, mean_of_variates<VariateType, VariateTag> > - { - typedef accumulators::impl::covariance_impl<mpl::_1, VariateType, VariateTag> impl; - }; - - struct abstract_covariance - : depends_on<> - { - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::covariance -// -namespace extract -{ - extractor<tag::abstract_covariance> const covariance = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(covariance) -} - -using extract::covariance; - -template<typename VariateType, typename VariateTag> -struct feature_of<tag::covariance<VariateType, VariateTag> > - : feature_of<tag::abstract_covariance> -{ -}; - -// So that covariance can be automatically substituted with -// weighted_covariance when the weight parameter is non-void. -template<typename VariateType, typename VariateTag> -struct as_weighted_feature<tag::covariance<VariateType, VariateTag> > -{ - typedef tag::weighted_covariance<VariateType, VariateTag> type; -}; - -template<typename VariateType, typename VariateTag> -struct feature_of<tag::weighted_covariance<VariateType, VariateTag> > - : feature_of<tag::covariance<VariateType, VariateTag> > -{}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/density.hpp b/contrib/restricted/boost/boost/accumulators/statistics/density.hpp deleted file mode 100644 index 88ca17df79..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/density.hpp +++ /dev/null @@ -1,250 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////// -// density.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_DENSITY_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_DENSITY_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <functional> -#include <boost/range.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/max.hpp> -#include <boost/accumulators/statistics/min.hpp> - -namespace boost { namespace accumulators -{ - -/////////////////////////////////////////////////////////////////////////////// -// cache_size and num_bins named parameters -// -BOOST_PARAMETER_NESTED_KEYWORD(tag, density_cache_size, cache_size) -BOOST_PARAMETER_NESTED_KEYWORD(tag, density_num_bins, num_bins) - -BOOST_ACCUMULATORS_IGNORE_GLOBAL(density_cache_size) -BOOST_ACCUMULATORS_IGNORE_GLOBAL(density_num_bins) - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // density_impl - // density histogram - /** - @brief Histogram density estimator - - The histogram density estimator returns a histogram of the sample distribution. The positions and sizes of the bins - are determined using a specifiable number of cached samples (cache_size). The range between the minimum and the - maximum of the cached samples is subdivided into a specifiable number of bins (num_bins) of same size. Additionally, - an under- and an overflow bin is added to capture future under- and overflow samples. Once the bins are determined, - the cached samples and all subsequent samples are added to the correct bins. At the end, a range of std::pair is - return, where each pair contains the position of the bin (lower bound) and the samples count (normalized with the - total number of samples). - - @param density_cache_size Number of first samples used to determine min and max. - @param density_num_bins Number of bins (two additional bins collect under- and overflow samples). - */ - template<typename Sample> - struct density_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef std::vector<std::pair<float_type, float_type> > histogram_type; - typedef std::vector<float_type> array_type; - // for boost::result_of - typedef iterator_range<typename histogram_type::iterator> result_type; - - template<typename Args> - density_impl(Args const &args) - : cache_size(args[density_cache_size]) - , cache(cache_size) - , num_bins(args[density_num_bins]) - , samples_in_bin(num_bins + 2, 0.) - , bin_positions(num_bins + 2) - , histogram( - num_bins + 2 - , std::make_pair( - numeric::fdiv(args[sample | Sample()],(std::size_t)1) - , numeric::fdiv(args[sample | Sample()],(std::size_t)1) - ) - ) - , is_dirty(true) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - this->is_dirty = true; - - std::size_t cnt = count(args); - - // Fill up cache with cache_size first samples - if (cnt <= this->cache_size) - { - this->cache[cnt - 1] = args[sample]; - } - - // Once cache_size samples have been accumulated, create num_bins bins of same size between - // the minimum and maximum of the cached samples as well as under and overflow bins. - // Store their lower bounds (bin_positions) and fill the bins with the cached samples (samples_in_bin). - if (cnt == this->cache_size) - { - float_type minimum = numeric::fdiv((min)(args), (std::size_t)1); - float_type maximum = numeric::fdiv((max)(args), (std::size_t)1); - float_type bin_size = numeric::fdiv(maximum - minimum, this->num_bins ); - - // determine bin positions (their lower bounds) - for (std::size_t i = 0; i < this->num_bins + 2; ++i) - { - this->bin_positions[i] = minimum + (i - 1.) * bin_size; - } - - for (typename array_type::const_iterator iter = this->cache.begin(); iter != this->cache.end(); ++iter) - { - if (*iter < this->bin_positions[1]) - { - ++(this->samples_in_bin[0]); - } - else if (*iter >= this->bin_positions[this->num_bins + 1]) - { - ++(this->samples_in_bin[this->num_bins + 1]); - } - else - { - typename array_type::iterator it = std::upper_bound( - this->bin_positions.begin() - , this->bin_positions.end() - , *iter - ); - - std::size_t d = std::distance(this->bin_positions.begin(), it); - ++(this->samples_in_bin[d - 1]); - } - } - } - // Add each subsequent sample to the correct bin - else if (cnt > this->cache_size) - { - if (args[sample] < this->bin_positions[1]) - { - ++(this->samples_in_bin[0]); - } - else if (args[sample] >= this->bin_positions[this->num_bins + 1]) - { - ++(this->samples_in_bin[this->num_bins + 1]); - } - else - { - typename array_type::iterator it = std::upper_bound( - this->bin_positions.begin() - , this->bin_positions.end() - , args[sample] - ); - - std::size_t d = std::distance(this->bin_positions.begin(), it); - ++(this->samples_in_bin[d - 1]); - } - } - } - - /** - @pre The number of samples must meet or exceed the cache size - */ - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - // creates a vector of std::pair where each pair i holds - // the values bin_positions[i] (x-axis of histogram) and - // samples_in_bin[i] / cnt (y-axis of histogram). - - for (std::size_t i = 0; i < this->num_bins + 2; ++i) - { - this->histogram[i] = std::make_pair(this->bin_positions[i], numeric::fdiv(this->samples_in_bin[i], count(args))); - } - } - // returns a range of pairs - return make_iterator_range(this->histogram); - } - - private: - std::size_t cache_size; // number of cached samples - array_type cache; // cache to store the first cache_size samples - std::size_t num_bins; // number of bins - array_type samples_in_bin; // number of samples in each bin - array_type bin_positions; // lower bounds of bins - mutable histogram_type histogram; // histogram - mutable bool is_dirty; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::density -// -namespace tag -{ - struct density - : depends_on<count, min, max> - , density_cache_size - , density_num_bins - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::density_impl<mpl::_1> impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::density::cache_size named parameter - /// tag::density::num_bins named parameter - static boost::parameter::keyword<density_cache_size> const cache_size; - static boost::parameter::keyword<density_num_bins> const num_bins; - #endif - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::density -// -namespace extract -{ - extractor<tag::density> const density = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(density) -} - -using extract::density; - -// So that density can be automatically substituted -// with weighted_density when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::density> -{ - typedef tag::weighted_density type; -}; - -template<> -struct feature_of<tag::weighted_density> - : feature_of<tag::density> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/error_of.hpp b/contrib/restricted/boost/boost/accumulators/statistics/error_of.hpp deleted file mode 100644 index a29da02f57..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/error_of.hpp +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// error_of.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /// INTERNAL ONLY - /// - template<typename Feature> - struct this_feature_has_no_error_calculation - : mpl::false_ - { - }; - - /////////////////////////////////////////////////////////////////////////////// - // error_of_impl - /// INTERNAL ONLY - /// - template<typename Sample, typename Feature> - struct error_of_impl - : accumulator_base - { - // TODO: specialize this on the specific features that have errors we're - // interested in. - BOOST_MPL_ASSERT((this_feature_has_no_error_calculation<Feature>)); - - // for boost::result_of - typedef int result_type; - - error_of_impl(dont_care) - { - } - - result_type result(dont_care) const - { - return 0; - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::error_of -// -namespace tag -{ - template<typename Feature> - struct error_of - : depends_on<Feature> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::error_of_impl<mpl::_1, Feature> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::error_of -// -namespace extract -{ - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, error_of, (typename)) -} - -using extract::error_of; - -// make tag::error_of<tag::feature(modifier)> work -template<typename Feature> -struct as_feature<tag::error_of<Feature> > -{ - typedef tag::error_of<typename as_feature<Feature>::type> type; -}; - -// make error_of<tag::mean> work with non-void weights (should become -// error_of<tag::weighted_mean> -template<typename Feature> -struct as_weighted_feature<tag::error_of<Feature> > -{ - typedef tag::error_of<typename as_weighted_feature<Feature>::type> type; -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/error_of_mean.hpp b/contrib/restricted/boost/boost/accumulators/statistics/error_of_mean.hpp deleted file mode 100644 index 7cd923d5f4..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/error_of_mean.hpp +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// error_of.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_ERROR_OF_MEAN_HPP_EAN_27_03_2006 -#define BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_MEAN_HPP_EAN_27_03_2006 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/error_of.hpp> -#include <boost/accumulators/statistics/variance.hpp> -#include <boost/accumulators/statistics/count.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // error_of_mean_impl - template<typename Sample, typename Variance> - struct error_of_mean_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - error_of_mean_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - using namespace std; - extractor<Variance> const variance = {}; - return sqrt(numeric::fdiv(variance(args), count(args) - 1)); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::error_of -// -namespace tag -{ - template<> - struct error_of<mean> - : depends_on<lazy_variance, count> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::error_of_mean_impl<mpl::_1, lazy_variance> impl; - }; - - template<> - struct error_of<immediate_mean> - : depends_on<variance, count> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::error_of_mean_impl<mpl::_1, variance> impl; - }; -} - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/extended_p_square.hpp b/contrib/restricted/boost/boost/accumulators/statistics/extended_p_square.hpp deleted file mode 100644 index e6cc8dc9a1..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/extended_p_square.hpp +++ /dev/null @@ -1,295 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// extended_p_square.hpp -// -// Copyright 2005 Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_EXTENDED_SINGLE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_EXTENDED_SINGLE_HPP_DE_01_01_2006 - -#include <vector> -#include <functional> -#include <boost/range/begin.hpp> -#include <boost/range/end.hpp> -#include <boost/range/iterator_range.hpp> -#include <boost/iterator/transform_iterator.hpp> -#include <boost/iterator/counting_iterator.hpp> -#include <boost/iterator/permutation_iterator.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/times2_iterator.hpp> - -namespace boost { namespace accumulators -{ -/////////////////////////////////////////////////////////////////////////////// -// probabilities named parameter -// -BOOST_PARAMETER_NESTED_KEYWORD(tag, extended_p_square_probabilities, probabilities) - -BOOST_ACCUMULATORS_IGNORE_GLOBAL(extended_p_square_probabilities) - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // extended_p_square_impl - // multiple quantile estimation - /** - @brief Multiple quantile estimation with the extended \f$P^2\f$ algorithm - - Extended \f$P^2\f$ algorithm for estimation of several quantiles without storing samples. - Assume that \f$m\f$ quantiles \f$\xi_{p_1}, \ldots, \xi_{p_m}\f$ are to be estimated. - Instead of storing the whole sample cumulative distribution, the algorithm maintains only - \f$m+2\f$ principal markers and \f$m+1\f$ middle markers, whose positions are updated - with each sample and whose heights are adjusted (if necessary) using a piecewise-parablic - formula. The heights of these central markers are the current estimates of the quantiles - and returned as an iterator range. - - For further details, see - - K. E. E. Raatikainen, Simultaneous estimation of several quantiles, Simulation, Volume 49, - Number 4 (October), 1986, p. 159-164. - - The extended \f$ P^2 \f$ algorithm generalizes the \f$ P^2 \f$ algorithm of - - R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param extended_p_square_probabilities A vector of quantile probabilities. - */ - template<typename Sample> - struct extended_p_square_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef std::vector<float_type> array_type; - // for boost::result_of - typedef iterator_range< - detail::lvalue_index_iterator< - permutation_iterator< - typename array_type::const_iterator - , detail::times2_iterator - > - > - > result_type; - - template<typename Args> - extended_p_square_impl(Args const &args) - : probabilities( - boost::begin(args[extended_p_square_probabilities]) - , boost::end(args[extended_p_square_probabilities]) - ) - , heights(2 * probabilities.size() + 3) - , actual_positions(heights.size()) - , desired_positions(heights.size()) - , positions_increments(heights.size()) - { - std::size_t num_quantiles = this->probabilities.size(); - std::size_t num_markers = this->heights.size(); - - for(std::size_t i = 0; i < num_markers; ++i) - { - this->actual_positions[i] = i + 1; - } - - this->positions_increments[0] = 0.; - this->positions_increments[num_markers - 1] = 1.; - - for(std::size_t i = 0; i < num_quantiles; ++i) - { - this->positions_increments[2 * i + 2] = probabilities[i]; - } - - for(std::size_t i = 0; i <= num_quantiles; ++i) - { - this->positions_increments[2 * i + 1] = - 0.5 * (this->positions_increments[2 * i] + this->positions_increments[2 * i + 2]); - } - - for(std::size_t i = 0; i < num_markers; ++i) - { - this->desired_positions[i] = 1. + 2. * (num_quantiles + 1.) * this->positions_increments[i]; - } - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - - // m+2 principal markers and m+1 middle markers - std::size_t num_markers = 2 * this->probabilities.size() + 3; - - // first accumulate num_markers samples - if(cnt <= num_markers) - { - this->heights[cnt - 1] = args[sample]; - - // complete the initialization of heights by sorting - if(cnt == num_markers) - { - std::sort(this->heights.begin(), this->heights.end()); - } - } - else - { - std::size_t sample_cell = 1; - - // find cell k = sample_cell such that heights[k-1] <= sample < heights[k] - if(args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - sample_cell = 1; - } - else if(args[sample] >= this->heights[num_markers - 1]) - { - this->heights[num_markers - 1] = args[sample]; - sample_cell = num_markers - 1; - } - else - { - typedef typename array_type::iterator iterator; - iterator it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // update actual positions of all markers above sample_cell index - for(std::size_t i = sample_cell; i < num_markers; ++i) - { - ++this->actual_positions[i]; - } - - // update desired positions of all markers - for(std::size_t i = 0; i < num_markers; ++i) - { - this->desired_positions[i] += this->positions_increments[i]; - } - - // adjust heights and actual positions of markers 1 to num_markers-2 if necessary - for(std::size_t i = 1; i <= num_markers - 2; ++i) - { - // offset to desired position - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i+1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i-1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i+1] - this->heights[i]) / dp; - float_type hm = (this->heights[i-1] - this->heights[i]) / dm; - - if((d >= 1 && dp > 1) || (d <= -1 && dm < -1)) - { - short sign_d = static_cast<short>(d / std::abs(d)); - - float_type h = this->heights[i] + sign_d / (dp - dm) * ((sign_d - dm)*hp - + (dp - sign_d) * hm); - - // try adjusting heights[i] using p-squared formula - if(this->heights[i - 1] < h && h < this->heights[i + 1]) - { - this->heights[i] = h; - } - else - { - // use linear formula - if(d > 0) - { - this->heights[i] += hp; - } - if(d < 0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - result_type result(dont_care) const - { - // for i in [1,probabilities.size()], return heights[i * 2] - detail::times2_iterator idx_begin = detail::make_times2_iterator(1); - detail::times2_iterator idx_end = detail::make_times2_iterator(this->probabilities.size() + 1); - - return result_type( - make_permutation_iterator(this->heights.begin(), idx_begin) - , make_permutation_iterator(this->heights.begin(), idx_end) - ); - } - - private: - array_type probabilities; // the quantile probabilities - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // d_i - array_type positions_increments; // f_i - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::extended_p_square -// -namespace tag -{ - struct extended_p_square - : depends_on<count> - , extended_p_square_probabilities - { - typedef accumulators::impl::extended_p_square_impl<mpl::_1> impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::extended_p_square::probabilities named parameter - static boost::parameter::keyword<tag::probabilities> const probabilities; - #endif - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::extended_p_square -// -namespace extract -{ - extractor<tag::extended_p_square> const extended_p_square = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(extended_p_square) -} - -using extract::extended_p_square; - -// So that extended_p_square can be automatically substituted with -// weighted_extended_p_square when the weight parameter is non-void -template<> -struct as_weighted_feature<tag::extended_p_square> -{ - typedef tag::weighted_extended_p_square type; -}; - -template<> -struct feature_of<tag::weighted_extended_p_square> - : feature_of<tag::extended_p_square> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/extended_p_square_quantile.hpp b/contrib/restricted/boost/boost/accumulators/statistics/extended_p_square_quantile.hpp deleted file mode 100644 index a17843d774..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/extended_p_square_quantile.hpp +++ /dev/null @@ -1,320 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// extended_p_square_quantile.hpp -// -// Copyright 2005 Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_EXTENDED_SINGLE_QUANTILE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_EXTENDED_SINGLE_QUANTILE_HPP_DE_01_01_2006 - -#include <vector> -#include <functional> -#include <boost/throw_exception.hpp> -#include <boost/range/begin.hpp> -#include <boost/range/end.hpp> -#include <boost/range/iterator_range.hpp> -#include <boost/iterator/transform_iterator.hpp> -#include <boost/iterator/counting_iterator.hpp> -#include <boost/iterator/permutation_iterator.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> -#include <boost/accumulators/statistics/extended_p_square.hpp> -#include <boost/accumulators/statistics/weighted_extended_p_square.hpp> -#include <boost/accumulators/statistics/times2_iterator.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // extended_p_square_quantile_impl - // single quantile estimation - /** - @brief Quantile estimation using the extended \f$P^2\f$ algorithm for weighted and unweighted samples - - Uses the quantile estimates calculated by the extended \f$P^2\f$ algorithm to compute - intermediate quantile estimates by means of quadratic interpolation. - - @param quantile_probability The probability of the quantile to be estimated. - */ - template<typename Sample, typename Impl1, typename Impl2> // Impl1: weighted/unweighted // Impl2: linear/quadratic - struct extended_p_square_quantile_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef std::vector<float_type> array_type; - typedef iterator_range< - detail::lvalue_index_iterator< - permutation_iterator< - typename array_type::const_iterator - , detail::times2_iterator - > - > - > range_type; - // for boost::result_of - typedef float_type result_type; - - template<typename Args> - extended_p_square_quantile_impl(Args const &args) - : probabilities( - boost::begin(args[extended_p_square_probabilities]) - , boost::end(args[extended_p_square_probabilities]) - ) - { - } - - template<typename Args> - result_type result(Args const &args) const - { - typedef - typename mpl::if_< - is_same<Impl1, weighted> - , tag::weighted_extended_p_square - , tag::extended_p_square - >::type - extended_p_square_tag; - - extractor<extended_p_square_tag> const some_extended_p_square = {}; - - array_type heights(some_extended_p_square(args).size()); - std::copy(some_extended_p_square(args).begin(), some_extended_p_square(args).end(), heights.begin()); - - this->probability = args[quantile_probability]; - - typename array_type::const_iterator iter_probs = std::lower_bound(this->probabilities.begin(), this->probabilities.end(), this->probability); - std::size_t dist = std::distance(this->probabilities.begin(), iter_probs); - typename array_type::const_iterator iter_heights = heights.begin() + dist; - - // If this->probability is not in a valid range return NaN or throw exception - if (this->probability < *this->probabilities.begin() || this->probability > *(this->probabilities.end() - 1)) - { - if (std::numeric_limits<result_type>::has_quiet_NaN) - { - return std::numeric_limits<result_type>::quiet_NaN(); - } - else - { - std::ostringstream msg; - msg << "probability = " << this->probability << " is not in valid range ("; - msg << *this->probabilities.begin() << ", " << *(this->probabilities.end() - 1) << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - return Sample(0); - } - - } - - if (*iter_probs == this->probability) - { - return heights[dist]; - } - else - { - result_type res; - - if (is_same<Impl2, linear>::value) - { - ///////////////////////////////////////////////////////////////////////////////// - // LINEAR INTERPOLATION - // - float_type p1 = *iter_probs; - float_type p0 = *(iter_probs - 1); - float_type h1 = *iter_heights; - float_type h0 = *(iter_heights - 1); - - float_type a = numeric::fdiv(h1 - h0, p1 - p0); - float_type b = h1 - p1 * a; - - res = a * this->probability + b; - } - else - { - ///////////////////////////////////////////////////////////////////////////////// - // QUADRATIC INTERPOLATION - // - float_type p0, p1, p2; - float_type h0, h1, h2; - - if ( (dist == 1 || *iter_probs - this->probability <= this->probability - *(iter_probs - 1) ) && dist != this->probabilities.size() - 1 ) - { - p0 = *(iter_probs - 1); - p1 = *iter_probs; - p2 = *(iter_probs + 1); - h0 = *(iter_heights - 1); - h1 = *iter_heights; - h2 = *(iter_heights + 1); - } - else - { - p0 = *(iter_probs - 2); - p1 = *(iter_probs - 1); - p2 = *iter_probs; - h0 = *(iter_heights - 2); - h1 = *(iter_heights - 1); - h2 = *iter_heights; - } - - float_type hp21 = numeric::fdiv(h2 - h1, p2 - p1); - float_type hp10 = numeric::fdiv(h1 - h0, p1 - p0); - float_type p21 = numeric::fdiv(p2 * p2 - p1 * p1, p2 - p1); - float_type p10 = numeric::fdiv(p1 * p1 - p0 * p0, p1 - p0); - - float_type a = numeric::fdiv(hp21 - hp10, p21 - p10); - float_type b = hp21 - a * p21; - float_type c = h2 - a * p2 * p2 - b * p2; - - res = a * this->probability * this-> probability + b * this->probability + c; - } - - return res; - } - - } - private: - - array_type probabilities; - mutable float_type probability; - - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::extended_p_square_quantile -// -namespace tag -{ - struct extended_p_square_quantile - : depends_on<extended_p_square> - { - typedef accumulators::impl::extended_p_square_quantile_impl<mpl::_1, unweighted, linear> impl; - }; - struct extended_p_square_quantile_quadratic - : depends_on<extended_p_square> - { - typedef accumulators::impl::extended_p_square_quantile_impl<mpl::_1, unweighted, quadratic> impl; - }; - struct weighted_extended_p_square_quantile - : depends_on<weighted_extended_p_square> - { - typedef accumulators::impl::extended_p_square_quantile_impl<mpl::_1, weighted, linear> impl; - }; - struct weighted_extended_p_square_quantile_quadratic - : depends_on<weighted_extended_p_square> - { - typedef accumulators::impl::extended_p_square_quantile_impl<mpl::_1, weighted, quadratic> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::extended_p_square_quantile -// extract::weighted_extended_p_square_quantile -// -namespace extract -{ - extractor<tag::extended_p_square_quantile> const extended_p_square_quantile = {}; - extractor<tag::extended_p_square_quantile_quadratic> const extended_p_square_quantile_quadratic = {}; - extractor<tag::weighted_extended_p_square_quantile> const weighted_extended_p_square_quantile = {}; - extractor<tag::weighted_extended_p_square_quantile_quadratic> const weighted_extended_p_square_quantile_quadratic = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(extended_p_square_quantile) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(extended_p_square_quantile_quadratic) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_extended_p_square_quantile) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_extended_p_square_quantile_quadratic) -} - -using extract::extended_p_square_quantile; -using extract::extended_p_square_quantile_quadratic; -using extract::weighted_extended_p_square_quantile; -using extract::weighted_extended_p_square_quantile_quadratic; - -// extended_p_square_quantile(linear) -> extended_p_square_quantile -template<> -struct as_feature<tag::extended_p_square_quantile(linear)> -{ - typedef tag::extended_p_square_quantile type; -}; - -// extended_p_square_quantile(quadratic) -> extended_p_square_quantile_quadratic -template<> -struct as_feature<tag::extended_p_square_quantile(quadratic)> -{ - typedef tag::extended_p_square_quantile_quadratic type; -}; - -// weighted_extended_p_square_quantile(linear) -> weighted_extended_p_square_quantile -template<> -struct as_feature<tag::weighted_extended_p_square_quantile(linear)> -{ - typedef tag::weighted_extended_p_square_quantile type; -}; - -// weighted_extended_p_square_quantile(quadratic) -> weighted_extended_p_square_quantile_quadratic -template<> -struct as_feature<tag::weighted_extended_p_square_quantile(quadratic)> -{ - typedef tag::weighted_extended_p_square_quantile_quadratic type; -}; - -// for the purposes of feature-based dependency resolution, -// extended_p_square_quantile and weighted_extended_p_square_quantile -// provide the same feature as quantile -template<> -struct feature_of<tag::extended_p_square_quantile> - : feature_of<tag::quantile> -{ -}; -template<> -struct feature_of<tag::extended_p_square_quantile_quadratic> - : feature_of<tag::quantile> -{ -}; -// So that extended_p_square_quantile can be automatically substituted with -// weighted_extended_p_square_quantile when the weight parameter is non-void -template<> -struct as_weighted_feature<tag::extended_p_square_quantile> -{ - typedef tag::weighted_extended_p_square_quantile type; -}; - -template<> -struct feature_of<tag::weighted_extended_p_square_quantile> - : feature_of<tag::extended_p_square_quantile> -{ -}; - -// So that extended_p_square_quantile_quadratic can be automatically substituted with -// weighted_extended_p_square_quantile_quadratic when the weight parameter is non-void -template<> -struct as_weighted_feature<tag::extended_p_square_quantile_quadratic> -{ - typedef tag::weighted_extended_p_square_quantile_quadratic type; -}; -template<> -struct feature_of<tag::weighted_extended_p_square_quantile_quadratic> - : feature_of<tag::extended_p_square_quantile_quadratic> -{ -}; - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/kurtosis.hpp b/contrib/restricted/boost/boost/accumulators/statistics/kurtosis.hpp deleted file mode 100644 index 76c93d3850..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/kurtosis.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// kurtosis.hpp -// -// Copyright 2006 Olivier Gygi, Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_KURTOSIS_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_KURTOSIS_HPP_EAN_28_10_2005 - -#include <limits> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics/mean.hpp> -#include <boost/accumulators/statistics/moment.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // kurtosis_impl - /** - @brief Kurtosis estimation - - The kurtosis of a sample distribution is defined as the ratio of the 4th central moment and the square of the 2nd central - moment (the variance) of the samples, minus 3. The term \f$ -3 \f$ is added in order to ensure that the normal distribution - has zero kurtosis. The kurtosis can also be expressed by the simple moments: - - \f[ - \hat{g}_2 = - \frac - {\widehat{m}_n^{(4)}-4\widehat{m}_n^{(3)}\hat{\mu}_n+6\widehat{m}_n^{(2)}\hat{\mu}_n^2-3\hat{\mu}_n^4} - {\left(\widehat{m}_n^{(2)} - \hat{\mu}_n^{2}\right)^2} - 3, - \f] - - where \f$ \widehat{m}_n^{(i)} \f$ are the \f$ i \f$-th moment and \f$ \hat{\mu}_n \f$ the mean (first moment) of the - \f$ n \f$ samples. - */ - template<typename Sample> - struct kurtosis_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, Sample>::result_type result_type; - - kurtosis_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - return numeric::fdiv( - accumulators::moment<4>(args) - - 4. * accumulators::moment<3>(args) * mean(args) - + 6. * accumulators::moment<2>(args) * mean(args) * mean(args) - - 3. * mean(args) * mean(args) * mean(args) * mean(args) - , ( accumulators::moment<2>(args) - mean(args) * mean(args) ) - * ( accumulators::moment<2>(args) - mean(args) * mean(args) ) - ) - 3.; - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::kurtosis -// -namespace tag -{ - struct kurtosis - : depends_on<mean, moment<2>, moment<3>, moment<4> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::kurtosis_impl<mpl::_1> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::kurtosis -// -namespace extract -{ - extractor<tag::kurtosis> const kurtosis = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(kurtosis) -} - -using extract::kurtosis; - -// So that kurtosis can be automatically substituted with -// weighted_kurtosis when the weight parameter is non-void -template<> -struct as_weighted_feature<tag::kurtosis> -{ - typedef tag::weighted_kurtosis type; -}; - -template<> -struct feature_of<tag::weighted_kurtosis> - : feature_of<tag::kurtosis> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/max.hpp b/contrib/restricted/boost/boost/accumulators/statistics/max.hpp deleted file mode 100644 index 820f6593f0..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/max.hpp +++ /dev/null @@ -1,85 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// max.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_MAX_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_MAX_HPP_EAN_28_10_2005 - -#include <limits> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // max_impl - template<typename Sample> - struct max_impl - : accumulator_base - { - // for boost::result_of - typedef Sample result_type; - - template<typename Args> - max_impl(Args const &args) - : max_(numeric::as_min(args[sample | Sample()])) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - numeric::max_assign(this->max_, args[sample]); - } - - result_type result(dont_care) const - { - return this->max_; - } - - private: - Sample max_; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::max -// -namespace tag -{ - struct max - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::max_impl<mpl::_1> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::max -// -namespace extract -{ - extractor<tag::max> const max = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(max) -} - -using extract::max; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/mean.hpp b/contrib/restricted/boost/boost/accumulators/statistics/mean.hpp deleted file mode 100644 index 4788837184..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/mean.hpp +++ /dev/null @@ -1,298 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// mean.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_MEAN_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_MEAN_HPP_EAN_28_10_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/sum.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // mean_impl - // lazy, by default - template<typename Sample, typename SumFeature> - struct mean_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - mean_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - extractor<SumFeature> sum; - return numeric::fdiv(sum(args), count(args)); - } - }; - - template<typename Sample, typename Tag> - struct immediate_mean_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - template<typename Args> - immediate_mean_impl(Args const &args) - : mean(numeric::fdiv(args[sample | Sample()], numeric::one<std::size_t>::value)) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - this->mean = numeric::fdiv( - (this->mean * (cnt - 1)) + args[parameter::keyword<Tag>::get()] - , cnt - ); - } - - result_type result(dont_care) const - { - return this->mean; - } - - private: - result_type mean; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::mean -// tag::immediate_mean -// tag::mean_of_weights -// tag::immediate_mean_of_weights -// tag::mean_of_variates -// tag::immediate_mean_of_variates -// -namespace tag -{ - struct mean - : depends_on<count, sum> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::mean_impl<mpl::_1, sum> impl; - }; - struct immediate_mean - : depends_on<count> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::immediate_mean_impl<mpl::_1, tag::sample> impl; - }; - struct mean_of_weights - : depends_on<count, sum_of_weights> - { - typedef mpl::true_ is_weight_accumulator; - /// INTERNAL ONLY - /// - typedef accumulators::impl::mean_impl<mpl::_2, sum_of_weights> impl; - }; - struct immediate_mean_of_weights - : depends_on<count> - { - typedef mpl::true_ is_weight_accumulator; - /// INTERNAL ONLY - /// - typedef accumulators::impl::immediate_mean_impl<mpl::_2, tag::weight> impl; - }; - template<typename VariateType, typename VariateTag> - struct mean_of_variates - : depends_on<count, sum_of_variates<VariateType, VariateTag> > - { - /// INTERNAL ONLY - /// - typedef mpl::always<accumulators::impl::mean_impl<VariateType, sum_of_variates<VariateType, VariateTag> > > impl; - }; - template<typename VariateType, typename VariateTag> - struct immediate_mean_of_variates - : depends_on<count> - { - /// INTERNAL ONLY - /// - typedef mpl::always<accumulators::impl::immediate_mean_impl<VariateType, VariateTag> > impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::mean -// extract::mean_of_weights -// extract::mean_of_variates -// -namespace extract -{ - extractor<tag::mean> const mean = {}; - extractor<tag::mean_of_weights> const mean_of_weights = {}; - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, mean_of_variates, (typename)(typename)) - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(mean) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(mean_of_weights) -} - -using extract::mean; -using extract::mean_of_weights; -using extract::mean_of_variates; - -// mean(lazy) -> mean -template<> -struct as_feature<tag::mean(lazy)> -{ - typedef tag::mean type; -}; - -// mean(immediate) -> immediate_mean -template<> -struct as_feature<tag::mean(immediate)> -{ - typedef tag::immediate_mean type; -}; - -// mean_of_weights(lazy) -> mean_of_weights -template<> -struct as_feature<tag::mean_of_weights(lazy)> -{ - typedef tag::mean_of_weights type; -}; - -// mean_of_weights(immediate) -> immediate_mean_of_weights -template<> -struct as_feature<tag::mean_of_weights(immediate)> -{ - typedef tag::immediate_mean_of_weights type; -}; - -// mean_of_variates<VariateType, VariateTag>(lazy) -> mean_of_variates<VariateType, VariateTag> -template<typename VariateType, typename VariateTag> -struct as_feature<tag::mean_of_variates<VariateType, VariateTag>(lazy)> -{ - typedef tag::mean_of_variates<VariateType, VariateTag> type; -}; - -// mean_of_variates<VariateType, VariateTag>(immediate) -> immediate_mean_of_variates<VariateType, VariateTag> -template<typename VariateType, typename VariateTag> -struct as_feature<tag::mean_of_variates<VariateType, VariateTag>(immediate)> -{ - typedef tag::immediate_mean_of_variates<VariateType, VariateTag> type; -}; - -// for the purposes of feature-based dependency resolution, -// immediate_mean provides the same feature as mean -template<> -struct feature_of<tag::immediate_mean> - : feature_of<tag::mean> -{ -}; - -// for the purposes of feature-based dependency resolution, -// immediate_mean provides the same feature as mean -template<> -struct feature_of<tag::immediate_mean_of_weights> - : feature_of<tag::mean_of_weights> -{ -}; - -// for the purposes of feature-based dependency resolution, -// immediate_mean provides the same feature as mean -template<typename VariateType, typename VariateTag> -struct feature_of<tag::immediate_mean_of_variates<VariateType, VariateTag> > - : feature_of<tag::mean_of_variates<VariateType, VariateTag> > -{ -}; - -// So that mean can be automatically substituted with -// weighted_mean when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::mean> -{ - typedef tag::weighted_mean type; -}; - -template<> -struct feature_of<tag::weighted_mean> - : feature_of<tag::mean> -{}; - -// So that immediate_mean can be automatically substituted with -// immediate_weighted_mean when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::immediate_mean> -{ - typedef tag::immediate_weighted_mean type; -}; - -template<> -struct feature_of<tag::immediate_weighted_mean> - : feature_of<tag::immediate_mean> -{}; - -// So that mean_of_weights<> can be automatically substituted with -// weighted_mean_of_variates<> when the weight parameter is non-void. -template<typename VariateType, typename VariateTag> -struct as_weighted_feature<tag::mean_of_variates<VariateType, VariateTag> > -{ - typedef tag::weighted_mean_of_variates<VariateType, VariateTag> type; -}; - -template<typename VariateType, typename VariateTag> -struct feature_of<tag::weighted_mean_of_variates<VariateType, VariateTag> > - : feature_of<tag::mean_of_variates<VariateType, VariateTag> > -{ -}; - -// So that immediate_mean_of_weights<> can be automatically substituted with -// immediate_weighted_mean_of_variates<> when the weight parameter is non-void. -template<typename VariateType, typename VariateTag> -struct as_weighted_feature<tag::immediate_mean_of_variates<VariateType, VariateTag> > -{ - typedef tag::immediate_weighted_mean_of_variates<VariateType, VariateTag> type; -}; - -template<typename VariateType, typename VariateTag> -struct feature_of<tag::immediate_weighted_mean_of_variates<VariateType, VariateTag> > - : feature_of<tag::immediate_mean_of_variates<VariateType, VariateTag> > -{ -}; - -//////////////////////////////////////////////////////////////////////////// -//// droppable_accumulator<mean_impl> -//// need to specialize droppable lazy mean to cache the result at the -//// point the accumulator is dropped. -///// INTERNAL ONLY -///// -//template<typename Sample, typename SumFeature> -//struct droppable_accumulator<impl::mean_impl<Sample, SumFeature> > -// : droppable_accumulator_base< -// with_cached_result<impl::mean_impl<Sample, SumFeature> > -// > -//{ -// template<typename Args> -// droppable_accumulator(Args const &args) -// : droppable_accumulator::base(args) -// { -// } -//}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/median.hpp b/contrib/restricted/boost/boost/accumulators/statistics/median.hpp deleted file mode 100644 index d361c6dda4..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/median.hpp +++ /dev/null @@ -1,301 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// median.hpp -// -// Copyright 2006 Eric Niebler, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_MEDIAN_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_MEDIAN_HPP_EAN_28_10_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/range/iterator_range.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/p_square_quantile.hpp> -#include <boost/accumulators/statistics/density.hpp> -#include <boost/accumulators/statistics/p_square_cumul_dist.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // median_impl - // - /** - @brief Median estimation based on the \f$P^2\f$ quantile estimator - - The \f$P^2\f$ algorithm is invoked with a quantile probability of 0.5. - */ - template<typename Sample> - struct median_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - median_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - return p_square_quantile_for_median(args); - } - }; - /////////////////////////////////////////////////////////////////////////////// - // with_density_median_impl - // - /** - @brief Median estimation based on the density estimator - - The algorithm determines the bin in which the \f$0.5*cnt\f$-th sample lies, \f$cnt\f$ being - the total number of samples. It returns the approximate horizontal position of this sample, - based on a linear interpolation inside the bin. - */ - template<typename Sample> - struct with_density_median_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef std::vector<std::pair<float_type, float_type> > histogram_type; - typedef iterator_range<typename histogram_type::iterator> range_type; - // for boost::result_of - typedef float_type result_type; - - template<typename Args> - with_density_median_impl(Args const &args) - : sum(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , is_dirty(true) - { - } - - void operator ()(dont_care) - { - this->is_dirty = true; - } - - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - std::size_t cnt = count(args); - range_type histogram = density(args); - typename range_type::iterator it = histogram.begin(); - while (this->sum < 0.5 * cnt) - { - this->sum += it->second * cnt; - ++it; - } - --it; - float_type over = numeric::fdiv(this->sum - 0.5 * cnt, it->second * cnt); - this->median = it->first * over + (it + 1)->first * (1. - over); - } - - return this->median; - } - - private: - mutable float_type sum; - mutable bool is_dirty; - mutable float_type median; - }; - - /////////////////////////////////////////////////////////////////////////////// - // with_p_square_cumulative_distribution_median_impl - // - /** - @brief Median estimation based on the \f$P^2\f$ cumulative distribution estimator - - The algorithm determines the first (leftmost) bin with a height exceeding 0.5. It - returns the approximate horizontal position of where the cumulative distribution - equals 0.5, based on a linear interpolation inside the bin. - */ - template<typename Sample> - struct with_p_square_cumulative_distribution_median_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef std::vector<std::pair<float_type, float_type> > histogram_type; - typedef iterator_range<typename histogram_type::iterator> range_type; - // for boost::result_of - typedef float_type result_type; - - with_p_square_cumulative_distribution_median_impl(dont_care) - : is_dirty(true) - { - } - - void operator ()(dont_care) - { - this->is_dirty = true; - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - range_type histogram = p_square_cumulative_distribution(args); - typename range_type::iterator it = histogram.begin(); - while (it->second < 0.5) - { - ++it; - } - float_type over = numeric::fdiv(it->second - 0.5, it->second - (it - 1)->second); - this->median = it->first * over + (it + 1)->first * ( 1. - over ); - } - - return this->median; - } - private: - - mutable bool is_dirty; - mutable float_type median; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::median -// tag::with_densisty_median -// tag::with_p_square_cumulative_distribution_median -// -namespace tag -{ - struct median - : depends_on<p_square_quantile_for_median> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::median_impl<mpl::_1> impl; - }; - struct with_density_median - : depends_on<count, density> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::with_density_median_impl<mpl::_1> impl; - }; - struct with_p_square_cumulative_distribution_median - : depends_on<p_square_cumulative_distribution> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::with_p_square_cumulative_distribution_median_impl<mpl::_1> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::median -// extract::with_density_median -// extract::with_p_square_cumulative_distribution_median -// -namespace extract -{ - extractor<tag::median> const median = {}; - extractor<tag::with_density_median> const with_density_median = {}; - extractor<tag::with_p_square_cumulative_distribution_median> const with_p_square_cumulative_distribution_median = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(median) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(with_density_median) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(with_p_square_cumulative_distribution_median) -} - -using extract::median; -using extract::with_density_median; -using extract::with_p_square_cumulative_distribution_median; - -// median(with_p_square_quantile) -> median -template<> -struct as_feature<tag::median(with_p_square_quantile)> -{ - typedef tag::median type; -}; - -// median(with_density) -> with_density_median -template<> -struct as_feature<tag::median(with_density)> -{ - typedef tag::with_density_median type; -}; - -// median(with_p_square_cumulative_distribution) -> with_p_square_cumulative_distribution_median -template<> -struct as_feature<tag::median(with_p_square_cumulative_distribution)> -{ - typedef tag::with_p_square_cumulative_distribution_median type; -}; - -// for the purposes of feature-based dependency resolution, -// with_density_median and with_p_square_cumulative_distribution_median -// provide the same feature as median -template<> -struct feature_of<tag::with_density_median> - : feature_of<tag::median> -{ -}; - -template<> -struct feature_of<tag::with_p_square_cumulative_distribution_median> - : feature_of<tag::median> -{ -}; - -// So that median can be automatically substituted with -// weighted_median when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::median> -{ - typedef tag::weighted_median type; -}; - -template<> -struct feature_of<tag::weighted_median> - : feature_of<tag::median> -{ -}; - -// So that with_density_median can be automatically substituted with -// with_density_weighted_median when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::with_density_median> -{ - typedef tag::with_density_weighted_median type; -}; - -template<> -struct feature_of<tag::with_density_weighted_median> - : feature_of<tag::with_density_median> -{ -}; - -// So that with_p_square_cumulative_distribution_median can be automatically substituted with -// with_p_square_cumulative_distribution_weighted_median when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::with_p_square_cumulative_distribution_median> -{ - typedef tag::with_p_square_cumulative_distribution_weighted_median type; -}; - -template<> -struct feature_of<tag::with_p_square_cumulative_distribution_weighted_median> - : feature_of<tag::with_p_square_cumulative_distribution_median> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/min.hpp b/contrib/restricted/boost/boost/accumulators/statistics/min.hpp deleted file mode 100644 index 83943bdb3c..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/min.hpp +++ /dev/null @@ -1,85 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// min.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_MIN_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_MIN_HPP_EAN_28_10_2005 - -#include <limits> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // min_impl - template<typename Sample> - struct min_impl - : accumulator_base - { - // for boost::result_of - typedef Sample result_type; - - template<typename Args> - min_impl(Args const &args) - : min_(numeric::as_max(args[sample | Sample()])) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - numeric::min_assign(this->min_, args[sample]); - } - - result_type result(dont_care) const - { - return this->min_; - } - - private: - Sample min_; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::min -// -namespace tag -{ - struct min - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::min_impl<mpl::_1> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::min -// -namespace extract -{ - extractor<tag::min> const min = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(min) -} - -using extract::min; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/moment.hpp b/contrib/restricted/boost/boost/accumulators/statistics/moment.hpp deleted file mode 100644 index 3dabd47ecf..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/moment.hpp +++ /dev/null @@ -1,125 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// moment.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_MOMENT_HPP_EAN_15_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_MOMENT_HPP_EAN_15_11_2005 - -#include <boost/config/no_tr1/cmath.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> - -namespace boost { namespace numeric -{ - /// INTERNAL ONLY - /// - template<typename T> - T const &pow(T const &x, mpl::int_<1>) - { - return x; - } - - /// INTERNAL ONLY - /// - template<typename T, int N> - T pow(T const &x, mpl::int_<N>) - { - using namespace operators; - T y = numeric::pow(x, mpl::int_<N/2>()); - T z = y * y; - return (N % 2) ? (z * x) : z; - } -}} - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // moment_impl - template<typename N, typename Sample> - struct moment_impl - : accumulator_base // TODO: also depends_on sum of powers - { - BOOST_MPL_ASSERT_RELATION(N::value, >, 0); - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - template<typename Args> - moment_impl(Args const &args) - : sum(args[sample | Sample()]) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - this->sum += numeric::pow(args[sample], N()); - } - - template<typename Args> - result_type result(Args const &args) const - { - return numeric::fdiv(this->sum, count(args)); - } - - private: - Sample sum; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::moment -// -namespace tag -{ - template<int N> - struct moment - : depends_on<count> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::moment_impl<mpl::int_<N>, mpl::_1> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::moment -// -namespace extract -{ - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, moment, (int)) -} - -using extract::moment; - -// So that moment<N> can be automatically substituted with -// weighted_moment<N> when the weight parameter is non-void -template<int N> -struct as_weighted_feature<tag::moment<N> > -{ - typedef tag::weighted_moment<N> type; -}; - -template<int N> -struct feature_of<tag::weighted_moment<N> > - : feature_of<tag::moment<N> > -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/p_square_cumul_dist.hpp b/contrib/restricted/boost/boost/accumulators/statistics/p_square_cumul_dist.hpp deleted file mode 100644 index 50692838c7..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/p_square_cumul_dist.hpp +++ /dev/null @@ -1,263 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// p_square_cumulative_distribution.hpp -// -// Copyright 2005 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 - -#include <vector> -#include <functional> -#include <boost/parameter/keyword.hpp> -#include <boost/range.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> - -namespace boost { namespace accumulators -{ -/////////////////////////////////////////////////////////////////////////////// -// num_cells named parameter -// -BOOST_PARAMETER_NESTED_KEYWORD(tag, p_square_cumulative_distribution_num_cells, num_cells) - -BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_cumulative_distribution_num_cells) - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // p_square_cumulative_distribution_impl - // cumulative_distribution calculation (as histogram) - /** - @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm - - A histogram of the sample cumulative distribution is computed dynamically without storing samples - based on the \f$ P^2 \f$ algorithm. The returned histogram has a specifiable amount (num_cells) - equiprobable (and not equal-sized) cells. - - For further details, see - - R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param p_square_cumulative_distribution_num_cells. - */ - template<typename Sample> - struct p_square_cumulative_distribution_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef std::vector<float_type> array_type; - typedef std::vector<std::pair<float_type, float_type> > histogram_type; - // for boost::result_of - typedef iterator_range<typename histogram_type::iterator> result_type; - - template<typename Args> - p_square_cumulative_distribution_impl(Args const &args) - : num_cells(args[p_square_cumulative_distribution_num_cells]) - , heights(num_cells + 1) - , actual_positions(num_cells + 1) - , desired_positions(num_cells + 1) - , positions_increments(num_cells + 1) - , histogram(num_cells + 1) - , is_dirty(true) - { - std::size_t b = this->num_cells; - - for (std::size_t i = 0; i < b + 1; ++i) - { - this->actual_positions[i] = i + 1.; - this->desired_positions[i] = i + 1.; - this->positions_increments[i] = numeric::fdiv(i, b); - } - } - - template<typename Args> - void operator ()(Args const &args) - { - this->is_dirty = true; - - std::size_t cnt = count(args); - std::size_t sample_cell = 1; // k - std::size_t b = this->num_cells; - - // accumulate num_cells + 1 first samples - if (cnt <= b + 1) - { - this->heights[cnt - 1] = args[sample]; - - // complete the initialization of heights by sorting - if (cnt == b + 1) - { - std::sort(this->heights.begin(), this->heights.end()); - } - } - else - { - // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values - if (args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - sample_cell = 1; - } - else if (this->heights[b] <= args[sample]) - { - this->heights[b] = args[sample]; - sample_cell = b; - } - else - { - typename array_type::iterator it; - it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // increment positions of markers above sample_cell - for (std::size_t i = sample_cell; i < b + 1; ++i) - { - ++this->actual_positions[i]; - } - - // update desired position of markers 2 to num_cells + 1 - // (desired position of first marker is always 1) - for (std::size_t i = 1; i < b + 1; ++i) - { - this->desired_positions[i] += this->positions_increments[i]; - } - - // adjust heights of markers 2 to num_cells if necessary - for (std::size_t i = 1; i < b; ++i) - { - // offset to desire position - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) - { - short sign_d = static_cast<short>(d / std::abs(d)); - - // try adjusting heights[i] using p-squared formula - float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); - - if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) - { - this->heights[i] = h; - } - else - { - // use linear formula - if (d>0) - { - this->heights[i] += hp; - } - if (d<0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - // creates a vector of std::pair where each pair i holds - // the values heights[i] (x-axis of histogram) and - // actual_positions[i] / cnt (y-axis of histogram) - - std::size_t cnt = count(args); - - for (std::size_t i = 0; i < this->histogram.size(); ++i) - { - this->histogram[i] = std::make_pair(this->heights[i], numeric::fdiv(this->actual_positions[i], cnt)); - } - } - //return histogram; - return make_iterator_range(this->histogram); - } - - private: - std::size_t num_cells; // number of cells b - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // n'_i - array_type positions_increments; // dn'_i - mutable histogram_type histogram; // histogram - mutable bool is_dirty; - }; - -} // namespace detail - -/////////////////////////////////////////////////////////////////////////////// -// tag::p_square_cumulative_distribution -// -namespace tag -{ - struct p_square_cumulative_distribution - : depends_on<count> - , p_square_cumulative_distribution_num_cells - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::p_square_cumulative_distribution_impl<mpl::_1> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::p_square_cumulative_distribution -// -namespace extract -{ - extractor<tag::p_square_cumulative_distribution> const p_square_cumulative_distribution = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_cumulative_distribution) -} - -using extract::p_square_cumulative_distribution; - -// So that p_square_cumulative_distribution can be automatically substituted with -// weighted_p_square_cumulative_distribution when the weight parameter is non-void -template<> -struct as_weighted_feature<tag::p_square_cumulative_distribution> -{ - typedef tag::weighted_p_square_cumulative_distribution type; -}; - -template<> -struct feature_of<tag::weighted_p_square_cumulative_distribution> - : feature_of<tag::p_square_cumulative_distribution> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/p_square_cumulative_distribution.hpp b/contrib/restricted/boost/boost/accumulators/statistics/p_square_cumulative_distribution.hpp deleted file mode 100644 index 5e08b51293..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/p_square_cumulative_distribution.hpp +++ /dev/null @@ -1,19 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// p_square_cumulative_distribution.hpp -// -// Copyright 2012 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 -#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 - -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) -# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp") -#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) -# warning "This header is deprecated. Please use: boost/accumulators/statistics/p_square_cumul_dist.hpp" -#endif - -#include <boost/accumulators/statistics/p_square_cumul_dist.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/p_square_quantile.hpp b/contrib/restricted/boost/boost/accumulators/statistics/p_square_quantile.hpp deleted file mode 100644 index 636fea7f23..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/p_square_quantile.hpp +++ /dev/null @@ -1,257 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// p_square_quantile.hpp -// -// Copyright 2005 Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_P_SQUARE_QUANTILE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_P_SQUARE_QUANTILE_HPP_DE_01_01_2006 - -#include <cmath> -#include <functional> -#include <boost/array.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // p_square_quantile_impl - // single quantile estimation - /** - @brief Single quantile estimation with the \f$P^2\f$ algorithm - - The \f$P^2\f$ algorithm estimates a quantile dynamically without storing samples. Instead of - storing the whole sample cumulative distribution, only five points (markers) are stored. The heights - of these markers are the minimum and the maximum of the samples and the current estimates of the - \f$(p/2)\f$-, \f$p\f$- and \f$(1+p)/2\f$-quantiles. Their positions are equal to the number - of samples that are smaller or equal to the markers. Each time a new samples is recorded, the - positions of the markers are updated and if necessary their heights are adjusted using a piecewise- - parabolic formula. - - For further details, see - - R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param quantile_probability - */ - template<typename Sample, typename Impl> - struct p_square_quantile_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef array<float_type, 5> array_type; - // for boost::result_of - typedef float_type result_type; - - template<typename Args> - p_square_quantile_impl(Args const &args) - : p(is_same<Impl, for_median>::value ? 0.5 : args[quantile_probability | 0.5]) - , heights() - , actual_positions() - , desired_positions() - , positions_increments() - { - for(std::size_t i = 0; i < 5; ++i) - { - this->actual_positions[i] = i + 1.; - } - - this->desired_positions[0] = 1.; - this->desired_positions[1] = 1. + 2. * this->p; - this->desired_positions[2] = 1. + 4. * this->p; - this->desired_positions[3] = 3. + 2. * this->p; - this->desired_positions[4] = 5.; - - this->positions_increments[0] = 0.; - this->positions_increments[1] = this->p / 2.; - this->positions_increments[2] = this->p; - this->positions_increments[3] = (1. + this->p) / 2.; - this->positions_increments[4] = 1.; - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - - // accumulate 5 first samples - if(cnt <= 5) - { - this->heights[cnt - 1] = args[sample]; - - // complete the initialization of heights by sorting - if(cnt == 5) - { - std::sort(this->heights.begin(), this->heights.end()); - } - } - else - { - std::size_t sample_cell = 1; // k - - // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values - if (args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - sample_cell = 1; - } - else if (this->heights[4] <= args[sample]) - { - this->heights[4] = args[sample]; - sample_cell = 4; - } - else - { - typedef typename array_type::iterator iterator; - iterator it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // update positions of markers above sample_cell - for(std::size_t i = sample_cell; i < 5; ++i) - { - ++this->actual_positions[i]; - } - - // update desired positions of all markers - for(std::size_t i = 0; i < 5; ++i) - { - this->desired_positions[i] += this->positions_increments[i]; - } - - // adjust heights and actual positions of markers 1 to 3 if necessary - for(std::size_t i = 1; i <= 3; ++i) - { - // offset to desired positions - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if((d >= 1. && dp > 1.) || (d <= -1. && dm < -1.)) - { - short sign_d = static_cast<short>(d / std::abs(d)); - - // try adjusting heights[i] using p-squared formula - float_type h = this->heights[i] + sign_d / (dp - dm) * ((sign_d - dm) * hp - + (dp - sign_d) * hm); - - if(this->heights[i - 1] < h && h < this->heights[i + 1]) - { - this->heights[i] = h; - } - else - { - // use linear formula - if(d > 0) - { - this->heights[i] += hp; - } - if(d < 0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - result_type result(dont_care) const - { - return this->heights[2]; - } - - private: - float_type p; // the quantile probability p - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // n'_i - array_type positions_increments; // dn'_i - }; - -} // namespace detail - -/////////////////////////////////////////////////////////////////////////////// -// tag::p_square_quantile -// -namespace tag -{ - struct p_square_quantile - : depends_on<count> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::p_square_quantile_impl<mpl::_1, regular> impl; - }; - struct p_square_quantile_for_median - : depends_on<count> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::p_square_quantile_impl<mpl::_1, for_median> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::p_square_quantile -// extract::p_square_quantile_for_median -// -namespace extract -{ - extractor<tag::p_square_quantile> const p_square_quantile = {}; - extractor<tag::p_square_quantile_for_median> const p_square_quantile_for_median = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_quantile) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(p_square_quantile_for_median) -} - -using extract::p_square_quantile; -using extract::p_square_quantile_for_median; - -// So that p_square_quantile can be automatically substituted with -// weighted_p_square_quantile when the weight parameter is non-void -template<> -struct as_weighted_feature<tag::p_square_quantile> -{ - typedef tag::weighted_p_square_quantile type; -}; - -template<> -struct feature_of<tag::weighted_p_square_quantile> - : feature_of<tag::p_square_quantile> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/parameters/quantile_probability.hpp b/contrib/restricted/boost/boost/accumulators/statistics/parameters/quantile_probability.hpp deleted file mode 100644 index e8792642ec..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/parameters/quantile_probability.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// quantile_probability.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_PARAMETERS_QUANTILE_PROBABILITY_HPP_EAN_03_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_PARAMETERS_QUANTILE_PROBABILITY_HPP_EAN_03_11_2005 - -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> - -namespace boost { namespace accumulators -{ - -BOOST_PARAMETER_KEYWORD(tag, quantile_probability) - -BOOST_ACCUMULATORS_IGNORE_GLOBAL(quantile_probability) - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/peaks_over_threshold.hpp b/contrib/restricted/boost/boost/accumulators/statistics/peaks_over_threshold.hpp deleted file mode 100644 index f04f743a0c..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/peaks_over_threshold.hpp +++ /dev/null @@ -1,405 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// peaks_over_threshold.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_PEAKS_OVER_THRESHOLD_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_PEAKS_OVER_THRESHOLD_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <numeric> -#include <functional> -#include <boost/config/no_tr1/cmath.hpp> // pow -#include <sstream> // stringstream -#include <stdexcept> // runtime_error -#include <boost/throw_exception.hpp> -#include <boost/range.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/tail.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost { namespace accumulators -{ - -/////////////////////////////////////////////////////////////////////////////// -// threshold_probability and threshold named parameters -// -BOOST_PARAMETER_NESTED_KEYWORD(tag, pot_threshold_value, threshold_value) -BOOST_PARAMETER_NESTED_KEYWORD(tag, pot_threshold_probability, threshold_probability) - -BOOST_ACCUMULATORS_IGNORE_GLOBAL(pot_threshold_value) -BOOST_ACCUMULATORS_IGNORE_GLOBAL(pot_threshold_probability) - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // peaks_over_threshold_impl - // works with an explicit threshold value and does not depend on order statistics - /** - @brief Peaks over Threshold Method for Quantile and Tail Mean Estimation - - According to the theorem of Pickands-Balkema-de Haan, the distribution function \f$F_u(x)\f$ of - the excesses \f$x\f$ over some sufficiently high threshold \f$u\f$ of a distribution function \f$F(x)\f$ - may be approximated by a generalized Pareto distribution - \f[ - G_{\xi,\beta}(x) = - \left\{ - \begin{array}{ll} - \beta^{-1}\left(1+\frac{\xi x}{\beta}\right)^{-1/\xi-1} & \textrm{if }\xi\neq0\\ - \beta^{-1}\exp\left(-\frac{x}{\beta}\right) & \textrm{if }\xi=0, - \end{array} - \right. - \f] - with suitable parameters \f$\xi\f$ and \f$\beta\f$ that can be estimated, e.g., with the method of moments, cf. - Hosking and Wallis (1987), - \f[ - \begin{array}{lll} - \hat{\xi} & = & \frac{1}{2}\left[1-\frac{(\hat{\mu}-u)^2}{\hat{\sigma}^2}\right]\\ - \hat{\beta} & = & \frac{\hat{\mu}-u}{2}\left[\frac{(\hat{\mu}-u)^2}{\hat{\sigma}^2}+1\right], - \end{array} - \f] - \f$\hat{\mu}\f$ and \f$\hat{\sigma}^2\f$ being the empirical mean and variance of the samples over - the threshold \f$u\f$. Equivalently, the distribution function - \f$F_u(x-u)\f$ of the exceedances \f$x-u\f$ can be approximated by - \f$G_{\xi,\beta}(x-u)=G_{\xi,\beta,u}(x)\f$. Since for \f$x\geq u\f$ the distribution function \f$F(x)\f$ - can be written as - \f[ - F(x) = [1 - \P(X \leq u)]F_u(x - u) + \P(X \leq u) - \f] - and the probability \f$\P(X \leq u)\f$ can be approximated by the empirical distribution function - \f$F_n(u)\f$ evaluated at \f$u\f$, an estimator of \f$F(x)\f$ is given by - \f[ - \widehat{F}(x) = [1 - F_n(u)]G_{\xi,\beta,u}(x) + F_n(u). - \f] - It can be shown that \f$\widehat{F}(x)\f$ is a generalized - Pareto distribution \f$G_{\xi,\bar{\beta},\bar{u}}(x)\f$ with \f$\bar{\beta}=\beta[1-F_n(u)]^{\xi}\f$ - and \f$\bar{u}=u-\bar{\beta}\left\{[1-F_n(u)]^{-\xi}-1\right\}/\xi\f$. By inverting \f$\widehat{F}(x)\f$, - one obtains an estimator for the \f$\alpha\f$-quantile, - \f[ - \hat{q}_{\alpha} = \bar{u} + \frac{\bar{\beta}}{\xi}\left[(1-\alpha)^{-\xi}-1\right], - \f] - and similarly an estimator for the (coherent) tail mean, - \f[ - \widehat{CTM}_{\alpha} = \hat{q}_{\alpha} - \frac{\bar{\beta}}{\xi-1}(1-\alpha)^{-\xi}, - \f] - cf. McNeil and Frey (2000). - - Note that in case extreme values of the left tail are fitted, the distribution is mirrored with respect to the - \f$y\f$ axis such that the left tail can be treated as a right tail. The computed fit parameters thus define - the Pareto distribution that fits the mirrored left tail. When quantities like a quantile or a tail mean are - computed using the fit parameters obtained from the mirrored data, the result is mirrored back, yielding the - correct result. - - For further details, see - - J. R. M. Hosking and J. R. Wallis, Parameter and quantile estimation for the generalized Pareto distribution, - Technometrics, Volume 29, 1987, p. 339-349 - - A. J. McNeil and R. Frey, Estimation of Tail-Related Risk Measures for Heteroscedastic Financial Time Series: - an Extreme Value Approach, Journal of Empirical Finance, Volume 7, 2000, p. 271-300 - - @param quantile_probability - @param pot_threshold_value - */ - template<typename Sample, typename LeftRight> - struct peaks_over_threshold_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - // for boost::result_of - typedef boost::tuple<float_type, float_type, float_type> result_type; - // for left tail fitting, mirror the extreme values - typedef mpl::int_<is_same<LeftRight, left>::value ? -1 : 1> sign; - - template<typename Args> - peaks_over_threshold_impl(Args const &args) - : Nu_(0) - , mu_(sign::value * numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , sigma2_(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , threshold_(sign::value * args[pot_threshold_value]) - , fit_parameters_(boost::make_tuple(0., 0., 0.)) - , is_dirty_(true) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - this->is_dirty_ = true; - - if (sign::value * args[sample] > this->threshold_) - { - this->mu_ += args[sample]; - this->sigma2_ += args[sample] * args[sample]; - ++this->Nu_; - } - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty_) - { - this->is_dirty_ = false; - - std::size_t cnt = count(args); - - this->mu_ = sign::value * numeric::fdiv(this->mu_, this->Nu_); - this->sigma2_ = numeric::fdiv(this->sigma2_, this->Nu_); - this->sigma2_ -= this->mu_ * this->mu_; - - float_type threshold_probability = numeric::fdiv(cnt - this->Nu_, cnt); - - float_type tmp = numeric::fdiv(( this->mu_ - this->threshold_ )*( this->mu_ - this->threshold_ ), this->sigma2_); - float_type xi_hat = 0.5 * ( 1. - tmp ); - float_type beta_hat = 0.5 * ( this->mu_ - this->threshold_ ) * ( 1. + tmp ); - float_type beta_bar = beta_hat * std::pow(1. - threshold_probability, xi_hat); - float_type u_bar = this->threshold_ - beta_bar * ( std::pow(1. - threshold_probability, -xi_hat) - 1.)/xi_hat; - this->fit_parameters_ = boost::make_tuple(u_bar, beta_bar, xi_hat); - } - - return this->fit_parameters_; - } - - private: - std::size_t Nu_; // number of samples larger than threshold - mutable float_type mu_; // mean of Nu_ largest samples - mutable float_type sigma2_; // variance of Nu_ largest samples - float_type threshold_; - mutable result_type fit_parameters_; // boost::tuple that stores fit parameters - mutable bool is_dirty_; - }; - - /////////////////////////////////////////////////////////////////////////////// - // peaks_over_threshold_prob_impl - // determines threshold from a given threshold probability using order statistics - /** - @brief Peaks over Threshold Method for Quantile and Tail Mean Estimation - - @sa peaks_over_threshold_impl - - @param quantile_probability - @param pot_threshold_probability - */ - template<typename Sample, typename LeftRight> - struct peaks_over_threshold_prob_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - // for boost::result_of - typedef boost::tuple<float_type, float_type, float_type> result_type; - // for left tail fitting, mirror the extreme values - typedef mpl::int_<is_same<LeftRight, left>::value ? -1 : 1> sign; - - template<typename Args> - peaks_over_threshold_prob_impl(Args const &args) - : mu_(sign::value * numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , sigma2_(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , threshold_probability_(args[pot_threshold_probability]) - , fit_parameters_(boost::make_tuple(0., 0., 0.)) - , is_dirty_(true) - { - } - - void operator ()(dont_care) - { - this->is_dirty_ = true; - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty_) - { - this->is_dirty_ = false; - - std::size_t cnt = count(args); - - // the n'th cached sample provides an approximate threshold value u - std::size_t n = static_cast<std::size_t>( - std::ceil( - cnt * ( ( is_same<LeftRight, left>::value ) ? this->threshold_probability_ : 1. - this->threshold_probability_ ) - ) - ); - - // If n is in a valid range, return result, otherwise return NaN or throw exception - if ( n >= static_cast<std::size_t>(tail(args).size())) - { - if (std::numeric_limits<float_type>::has_quiet_NaN) - { - return boost::make_tuple( - std::numeric_limits<float_type>::quiet_NaN() - , std::numeric_limits<float_type>::quiet_NaN() - , std::numeric_limits<float_type>::quiet_NaN() - ); - } - else - { - std::ostringstream msg; - msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - return boost::make_tuple(Sample(0), Sample(0), Sample(0)); - } - } - else - { - float_type u = *(tail(args).begin() + n - 1) * sign::value; - - // compute mean and variance of samples above/under threshold value u - for (std::size_t i = 0; i < n; ++i) - { - mu_ += *(tail(args).begin() + i); - sigma2_ += *(tail(args).begin() + i) * (*(tail(args).begin() + i)); - } - - this->mu_ = sign::value * numeric::fdiv(this->mu_, n); - this->sigma2_ = numeric::fdiv(this->sigma2_, n); - this->sigma2_ -= this->mu_ * this->mu_; - - if (is_same<LeftRight, left>::value) - this->threshold_probability_ = 1. - this->threshold_probability_; - - float_type tmp = numeric::fdiv(( this->mu_ - u )*( this->mu_ - u ), this->sigma2_); - float_type xi_hat = 0.5 * ( 1. - tmp ); - float_type beta_hat = 0.5 * ( this->mu_ - u ) * ( 1. + tmp ); - float_type beta_bar = beta_hat * std::pow(1. - threshold_probability_, xi_hat); - float_type u_bar = u - beta_bar * ( std::pow(1. - threshold_probability_, -xi_hat) - 1.)/xi_hat; - this->fit_parameters_ = boost::make_tuple(u_bar, beta_bar, xi_hat); - } - } - - return this->fit_parameters_; - } - - private: - mutable float_type mu_; // mean of samples above threshold u - mutable float_type sigma2_; // variance of samples above threshold u - mutable float_type threshold_probability_; - mutable result_type fit_parameters_; // boost::tuple that stores fit parameters - mutable bool is_dirty_; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::peaks_over_threshold -// -namespace tag -{ - template<typename LeftRight> - struct peaks_over_threshold - : depends_on<count> - , pot_threshold_value - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::peaks_over_threshold_impl<mpl::_1, LeftRight> impl; - }; - - template<typename LeftRight> - struct peaks_over_threshold_prob - : depends_on<count, tail<LeftRight> > - , pot_threshold_probability - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::peaks_over_threshold_prob_impl<mpl::_1, LeftRight> impl; - }; - - struct abstract_peaks_over_threshold - : depends_on<> - { - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::peaks_over_threshold -// -namespace extract -{ - extractor<tag::abstract_peaks_over_threshold> const peaks_over_threshold = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(peaks_over_threshold) -} - -using extract::peaks_over_threshold; - -// peaks_over_threshold<LeftRight>(with_threshold_value) -> peaks_over_threshold<LeftRight> -template<typename LeftRight> -struct as_feature<tag::peaks_over_threshold<LeftRight>(with_threshold_value)> -{ - typedef tag::peaks_over_threshold<LeftRight> type; -}; - -// peaks_over_threshold<LeftRight>(with_threshold_probability) -> peaks_over_threshold_prob<LeftRight> -template<typename LeftRight> -struct as_feature<tag::peaks_over_threshold<LeftRight>(with_threshold_probability)> -{ - typedef tag::peaks_over_threshold_prob<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::peaks_over_threshold<LeftRight> > - : feature_of<tag::abstract_peaks_over_threshold> -{ -}; - -template<typename LeftRight> -struct feature_of<tag::peaks_over_threshold_prob<LeftRight> > - : feature_of<tag::abstract_peaks_over_threshold> -{ -}; - -// So that peaks_over_threshold can be automatically substituted -// with weighted_peaks_over_threshold when the weight parameter is non-void. -template<typename LeftRight> -struct as_weighted_feature<tag::peaks_over_threshold<LeftRight> > -{ - typedef tag::weighted_peaks_over_threshold<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::weighted_peaks_over_threshold<LeftRight> > - : feature_of<tag::peaks_over_threshold<LeftRight> > -{}; - -// So that peaks_over_threshold_prob can be automatically substituted -// with weighted_peaks_over_threshold_prob when the weight parameter is non-void. -template<typename LeftRight> -struct as_weighted_feature<tag::peaks_over_threshold_prob<LeftRight> > -{ - typedef tag::weighted_peaks_over_threshold_prob<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::weighted_peaks_over_threshold_prob<LeftRight> > - : feature_of<tag::peaks_over_threshold_prob<LeftRight> > -{}; - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/pot_quantile.hpp b/contrib/restricted/boost/boost/accumulators/statistics/pot_quantile.hpp deleted file mode 100644 index 470bdbace3..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/pot_quantile.hpp +++ /dev/null @@ -1,205 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// pot_quantile.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_POT_QUANTILE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_POT_QUANTILE_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <numeric> -#include <functional> -#include <boost/parameter/keyword.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/tail.hpp> -#include <boost/accumulators/statistics/peaks_over_threshold.hpp> -#include <boost/accumulators/statistics/weighted_peaks_over_threshold.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // pot_quantile_impl - // - /** - @brief Quantile Estimation based on Peaks over Threshold Method (for both left and right tails) - - Computes an estimate - \f[ - \hat{q}_{\alpha} = \bar{u} + \frac{\bar{\beta}}{\xi}\left[(1-\alpha)^{-\xi}-1\right] - \f] - for a right or left extreme quantile, \f$\bar[u]\f$, \f$\bar{\beta}\f$ and \f$\xi\f$ being the parameters of the - generalized Pareto distribution that approximates the right tail of the distribution (or the mirrored left tail, - in case the left tail is used). In the latter case, the result is mirrored back, yielding the correct result. - */ - template<typename Sample, typename Impl, typename LeftRight> - struct pot_quantile_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - // for boost::result_of - typedef float_type result_type; - - pot_quantile_impl(dont_care) - : sign_((is_same<LeftRight, left>::value) ? -1 : 1) - { - } - - template<typename Args> - result_type result(Args const &args) const - { - typedef - typename mpl::if_< - is_same<Impl, weighted> - , tag::weighted_peaks_over_threshold<LeftRight> - , tag::peaks_over_threshold<LeftRight> - >::type - peaks_over_threshold_tag; - - extractor<peaks_over_threshold_tag> const some_peaks_over_threshold = {}; - - float_type u_bar = some_peaks_over_threshold(args).template get<0>(); - float_type beta_bar = some_peaks_over_threshold(args).template get<1>(); - float_type xi_hat = some_peaks_over_threshold(args).template get<2>(); - - return this->sign_ * (u_bar + beta_bar/xi_hat * ( std::pow( - is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability] - , -xi_hat - ) - 1.)); - } - - private: - short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::pot_quantile<> -// tag::pot_quantile_prob<> -// tag::weighted_pot_quantile<> -// tag::weighted_pot_quantile_prob<> -// -namespace tag -{ - template<typename LeftRight> - struct pot_quantile - : depends_on<peaks_over_threshold<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::pot_quantile_impl<mpl::_1, unweighted, LeftRight> impl; - }; - template<typename LeftRight> - struct pot_quantile_prob - : depends_on<peaks_over_threshold_prob<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::pot_quantile_impl<mpl::_1, unweighted, LeftRight> impl; - }; - template<typename LeftRight> - struct weighted_pot_quantile - : depends_on<weighted_peaks_over_threshold<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::pot_quantile_impl<mpl::_1, weighted, LeftRight> impl; - }; - template<typename LeftRight> - struct weighted_pot_quantile_prob - : depends_on<weighted_peaks_over_threshold_prob<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::pot_quantile_impl<mpl::_1, weighted, LeftRight> impl; - }; -} - -// pot_quantile<LeftRight>(with_threshold_value) -> pot_quantile<LeftRight> -template<typename LeftRight> -struct as_feature<tag::pot_quantile<LeftRight>(with_threshold_value)> -{ - typedef tag::pot_quantile<LeftRight> type; -}; - -// pot_quantile<LeftRight>(with_threshold_probability) -> pot_quantile_prob<LeftRight> -template<typename LeftRight> -struct as_feature<tag::pot_quantile<LeftRight>(with_threshold_probability)> -{ - typedef tag::pot_quantile_prob<LeftRight> type; -}; - -// weighted_pot_quantile<LeftRight>(with_threshold_value) -> weighted_pot_quantile<LeftRight> -template<typename LeftRight> -struct as_feature<tag::weighted_pot_quantile<LeftRight>(with_threshold_value)> -{ - typedef tag::weighted_pot_quantile<LeftRight> type; -}; - -// weighted_pot_quantile<LeftRight>(with_threshold_probability) -> weighted_pot_quantile_prob<LeftRight> -template<typename LeftRight> -struct as_feature<tag::weighted_pot_quantile<LeftRight>(with_threshold_probability)> -{ - typedef tag::weighted_pot_quantile_prob<LeftRight> type; -}; - -// for the purposes of feature-based dependency resolution, -// pot_quantile<LeftRight> and pot_quantile_prob<LeftRight> provide -// the same feature as quantile -template<typename LeftRight> -struct feature_of<tag::pot_quantile<LeftRight> > - : feature_of<tag::quantile> -{ -}; - -template<typename LeftRight> -struct feature_of<tag::pot_quantile_prob<LeftRight> > - : feature_of<tag::quantile> -{ -}; - -// So that pot_quantile can be automatically substituted -// with weighted_pot_quantile when the weight parameter is non-void. -template<typename LeftRight> -struct as_weighted_feature<tag::pot_quantile<LeftRight> > -{ - typedef tag::weighted_pot_quantile<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::weighted_pot_quantile<LeftRight> > - : feature_of<tag::pot_quantile<LeftRight> > -{ -}; - -// So that pot_quantile_prob can be automatically substituted -// with weighted_pot_quantile_prob when the weight parameter is non-void. -template<typename LeftRight> -struct as_weighted_feature<tag::pot_quantile_prob<LeftRight> > -{ - typedef tag::weighted_pot_quantile_prob<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::weighted_pot_quantile_prob<LeftRight> > - : feature_of<tag::pot_quantile_prob<LeftRight> > -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/pot_tail_mean.hpp b/contrib/restricted/boost/boost/accumulators/statistics/pot_tail_mean.hpp deleted file mode 100644 index a78043fce2..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/pot_tail_mean.hpp +++ /dev/null @@ -1,211 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// pot_tail_mean.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_POT_TAIL_MEAN_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_POT_TAIL_MEAN_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <numeric> -#include <functional> -#include <boost/range.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/peaks_over_threshold.hpp> -#include <boost/accumulators/statistics/weighted_peaks_over_threshold.hpp> -#include <boost/accumulators/statistics/pot_quantile.hpp> -#include <boost/accumulators/statistics/tail_mean.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // pot_tail_mean_impl - // - /** - @brief Estimation of the (coherent) tail mean based on the peaks over threshold method (for both left and right tails) - - Computes an estimate for the (coherent) tail mean - \f[ - \widehat{CTM}_{\alpha} = \hat{q}_{\alpha} - \frac{\bar{\beta}}{\xi-1}(1-\alpha)^{-\xi}, - \f] - where \f$\bar[u]\f$, \f$\bar{\beta}\f$ and \f$\xi\f$ are the parameters of the - generalized Pareto distribution that approximates the right tail of the distribution (or the - mirrored left tail, in case the left tail is used). In the latter case, the result is mirrored - back, yielding the correct result. - */ - template<typename Sample, typename Impl, typename LeftRight> - struct pot_tail_mean_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - // for boost::result_of - typedef float_type result_type; - - pot_tail_mean_impl(dont_care) - : sign_((is_same<LeftRight, left>::value) ? -1 : 1) - { - } - - template<typename Args> - result_type result(Args const &args) const - { - typedef - typename mpl::if_< - is_same<Impl, weighted> - , tag::weighted_peaks_over_threshold<LeftRight> - , tag::peaks_over_threshold<LeftRight> - >::type - peaks_over_threshold_tag; - - typedef - typename mpl::if_< - is_same<Impl, weighted> - , tag::weighted_pot_quantile<LeftRight> - , tag::pot_quantile<LeftRight> - >::type - pot_quantile_tag; - - extractor<peaks_over_threshold_tag> const some_peaks_over_threshold = {}; - extractor<pot_quantile_tag> const some_pot_quantile = {}; - - float_type beta_bar = some_peaks_over_threshold(args).template get<1>(); - float_type xi_hat = some_peaks_over_threshold(args).template get<2>(); - - return some_pot_quantile(args) - this->sign_ * beta_bar/( xi_hat - 1. ) * std::pow( - is_same<LeftRight, left>::value ? args[quantile_probability] : 1. - args[quantile_probability] - , -xi_hat); - } - private: - short sign_; // if the fit parameters from the mirrored left tail extreme values are used, mirror back the result - }; -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::pot_tail_mean -// tag::pot_tail_mean_prob -// -namespace tag -{ - template<typename LeftRight> - struct pot_tail_mean - : depends_on<peaks_over_threshold<LeftRight>, pot_quantile<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::pot_tail_mean_impl<mpl::_1, unweighted, LeftRight> impl; - }; - template<typename LeftRight> - struct pot_tail_mean_prob - : depends_on<peaks_over_threshold_prob<LeftRight>, pot_quantile_prob<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::pot_tail_mean_impl<mpl::_1, unweighted, LeftRight> impl; - }; - template<typename LeftRight> - struct weighted_pot_tail_mean - : depends_on<weighted_peaks_over_threshold<LeftRight>, weighted_pot_quantile<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::pot_tail_mean_impl<mpl::_1, weighted, LeftRight> impl; - }; - template<typename LeftRight> - struct weighted_pot_tail_mean_prob - : depends_on<weighted_peaks_over_threshold_prob<LeftRight>, weighted_pot_quantile_prob<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::pot_tail_mean_impl<mpl::_1, weighted, LeftRight> impl; - }; -} - -// pot_tail_mean<LeftRight>(with_threshold_value) -> pot_tail_mean<LeftRight> -template<typename LeftRight> -struct as_feature<tag::pot_tail_mean<LeftRight>(with_threshold_value)> -{ - typedef tag::pot_tail_mean<LeftRight> type; -}; - -// pot_tail_mean<LeftRight>(with_threshold_probability) -> pot_tail_mean_prob<LeftRight> -template<typename LeftRight> -struct as_feature<tag::pot_tail_mean<LeftRight>(with_threshold_probability)> -{ - typedef tag::pot_tail_mean_prob<LeftRight> type; -}; - -// weighted_pot_tail_mean<LeftRight>(with_threshold_value) -> weighted_pot_tail_mean<LeftRight> -template<typename LeftRight> -struct as_feature<tag::weighted_pot_tail_mean<LeftRight>(with_threshold_value)> -{ - typedef tag::weighted_pot_tail_mean<LeftRight> type; -}; - -// weighted_pot_tail_mean<LeftRight>(with_threshold_probability) -> weighted_pot_tail_mean_prob<LeftRight> -template<typename LeftRight> -struct as_feature<tag::weighted_pot_tail_mean<LeftRight>(with_threshold_probability)> -{ - typedef tag::weighted_pot_tail_mean_prob<LeftRight> type; -}; - -// for the purposes of feature-based dependency resolution, -// pot_tail_mean<LeftRight> and pot_tail_mean_prob<LeftRight> provide -// the same feature as tail_mean -template<typename LeftRight> -struct feature_of<tag::pot_tail_mean<LeftRight> > - : feature_of<tag::tail_mean> -{ -}; - -template<typename LeftRight> -struct feature_of<tag::pot_tail_mean_prob<LeftRight> > - : feature_of<tag::tail_mean> -{ -}; - -// So that pot_tail_mean can be automatically substituted -// with weighted_pot_tail_mean when the weight parameter is non-void. -template<typename LeftRight> -struct as_weighted_feature<tag::pot_tail_mean<LeftRight> > -{ - typedef tag::weighted_pot_tail_mean<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::weighted_pot_tail_mean<LeftRight> > - : feature_of<tag::pot_tail_mean<LeftRight> > -{ -}; - -// So that pot_tail_mean_prob can be automatically substituted -// with weighted_pot_tail_mean_prob when the weight parameter is non-void. -template<typename LeftRight> -struct as_weighted_feature<tag::pot_tail_mean_prob<LeftRight> > -{ - typedef tag::weighted_pot_tail_mean_prob<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::weighted_pot_tail_mean_prob<LeftRight> > - : feature_of<tag::pot_tail_mean_prob<LeftRight> > -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/rolling_count.hpp b/contrib/restricted/boost/boost/accumulators/statistics/rolling_count.hpp deleted file mode 100644 index 1e34f76354..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/rolling_count.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// rolling_count.hpp -// -// Copyright 2008 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_ROLLING_COUNT_HPP_EAN_26_12_2008 -#define BOOST_ACCUMULATORS_STATISTICS_ROLLING_COUNT_HPP_EAN_26_12_2008 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/rolling_window.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - - /////////////////////////////////////////////////////////////////////////////// - // rolling_count_impl - // returns the count of elements in the rolling window - template<typename Sample> - struct rolling_count_impl - : accumulator_base - { - typedef std::size_t result_type; - - rolling_count_impl(dont_care) - {} - - template<typename Args> - result_type result(Args const &args) const - { - return static_cast<std::size_t>(rolling_window_plus1(args).size()) - is_rolling_window_plus1_full(args); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::rolling_count -// -namespace tag -{ - struct rolling_count - : depends_on< rolling_window_plus1 > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::rolling_count_impl< mpl::_1 > impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::window_size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; - #endif - }; -} // namespace tag - -/////////////////////////////////////////////////////////////////////////////// -// extract::rolling_count -// -namespace extract -{ - extractor<tag::rolling_count> const rolling_count = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_count) -} - -using extract::rolling_count; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/rolling_mean.hpp b/contrib/restricted/boost/boost/accumulators/statistics/rolling_mean.hpp deleted file mode 100644 index 1439da1e2c..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/rolling_mean.hpp +++ /dev/null @@ -1,179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// rolling_mean.hpp -// Copyright (C) 2008 Eric Niebler. -// Copyright (C) 2012 Pieter Bastiaan Ober (Integricom). -// Distributed under the 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_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008 -#define BOOST_ACCUMULATORS_STATISTICS_ROLLING_MEAN_HPP_EAN_26_12_2008 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/rolling_sum.hpp> -#include <boost/accumulators/statistics/rolling_count.hpp> - -namespace boost { namespace accumulators -{ - namespace impl - { - /////////////////////////////////////////////////////////////////////////////// - // lazy_rolling_mean_impl - // returns the mean over the rolling window and is calculated only - // when the result is requested - template<typename Sample> - struct lazy_rolling_mean_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t, void, void>::result_type result_type; - - lazy_rolling_mean_impl(dont_care) - { - } - - template<typename Args> - result_type result(Args const &args) const - { - return numeric::fdiv(rolling_sum(args), rolling_count(args)); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // immediate_rolling_mean_impl - // The non-lazy version computes the rolling mean recursively when a new - // sample is added - template<typename Sample> - struct immediate_rolling_mean_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - template<typename Args> - immediate_rolling_mean_impl(Args const &args) - : mean_(numeric::fdiv(args[sample | Sample()],numeric::one<std::size_t>::value)) - { - } - - template<typename Args> - void operator()(Args const &args) - { - if(is_rolling_window_plus1_full(args)) - { - mean_ += numeric::fdiv(args[sample]-rolling_window_plus1(args).front(),rolling_count(args)); - } - else - { - result_type prev_mean = mean_; - mean_ += numeric::fdiv(args[sample]-prev_mean,rolling_count(args)); - } - } - - template<typename Args> - result_type result(Args const &) const - { - return mean_; - } - - private: - - result_type mean_; - }; - } // namespace impl - - /////////////////////////////////////////////////////////////////////////////// - // tag::lazy_rolling_mean - // tag::immediate_rolling_mean - // tag::rolling_mean - // - namespace tag - { - struct lazy_rolling_mean - : depends_on< rolling_sum, rolling_count > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::lazy_rolling_mean_impl< mpl::_1 > impl; - -#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::window_size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; -#endif - }; - - struct immediate_rolling_mean - : depends_on< rolling_window_plus1, rolling_count> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::immediate_rolling_mean_impl< mpl::_1> impl; - -#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::window_size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; -#endif - }; - - // make immediate_rolling_mean the default implementation - struct rolling_mean : immediate_rolling_mean {}; - } // namespace tag - - /////////////////////////////////////////////////////////////////////////////// - // extract::lazy_rolling_mean - // extract::immediate_rolling_mean - // extract::rolling_mean - // - namespace extract - { - extractor<tag::lazy_rolling_mean> const lazy_rolling_mean = {}; - extractor<tag::immediate_rolling_mean> const immediate_rolling_mean = {}; - extractor<tag::rolling_mean> const rolling_mean = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(lazy_rolling_mean) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(immediate_rolling_mean) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_mean) - } - - using extract::lazy_rolling_mean; - using extract::immediate_rolling_mean; - using extract::rolling_mean; - - // rolling_mean(lazy) -> lazy_rolling_mean - template<> - struct as_feature<tag::rolling_mean(lazy)> - { - typedef tag::lazy_rolling_mean type; - }; - - // rolling_mean(immediate) -> immediate_rolling_mean - template<> - struct as_feature<tag::rolling_mean(immediate)> - { - typedef tag::immediate_rolling_mean type; - }; - - // for the purposes of feature-based dependency resolution, - // immediate_rolling_mean provides the same feature as rolling_mean - template<> - struct feature_of<tag::immediate_rolling_mean> - : feature_of<tag::rolling_mean> - { - }; - - // for the purposes of feature-based dependency resolution, - // lazy_rolling_mean provides the same feature as rolling_mean - template<> - struct feature_of<tag::lazy_rolling_mean> - : feature_of<tag::rolling_mean> - { - }; -}} // namespace boost::accumulators - -#endif
\ No newline at end of file diff --git a/contrib/restricted/boost/boost/accumulators/statistics/rolling_moment.hpp b/contrib/restricted/boost/boost/accumulators/statistics/rolling_moment.hpp deleted file mode 100644 index f172cee34f..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/rolling_moment.hpp +++ /dev/null @@ -1,113 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// rolling_moment.hpp -// Copyright 2005 Eric Niebler. -// Copyright (C) 2014 Pieter Bastiaan Ober (Integricom). -// Distributed under the 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_ACCUMULATORS_STATISTICS_ROLLING_MOMENT_HPP_EAN_27_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_ROLLING_MOMENT_HPP_EAN_27_11_2005 - -#include <boost/config/no_tr1/cmath.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/moment.hpp> -#include <boost/accumulators/statistics/rolling_count.hpp> - -namespace boost { namespace accumulators -{ -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // rolling_moment_impl - template<typename N, typename Sample> - struct rolling_moment_impl - : accumulator_base - { - BOOST_MPL_ASSERT_RELATION(N::value, >, 0); - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t,void,void>::result_type result_type; - - template<typename Args> - rolling_moment_impl(Args const &args) - : sum_(args[sample | Sample()]) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - if(is_rolling_window_plus1_full(args)) - { - this->sum_ -= numeric::pow(rolling_window_plus1(args).front(), N()); - } - this->sum_ += numeric::pow(args[sample], N()); - } - - template<typename Args> - result_type result(Args const &args) const - { - return numeric::fdiv(this->sum_, rolling_count(args)); - } - - private: - result_type sum_; - }; -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::rolling_moment -// -namespace tag -{ - template<int N> - struct rolling_moment - : depends_on< rolling_window_plus1, rolling_count> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::rolling_moment_impl<mpl::int_<N>, mpl::_1> impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::window_size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; - #endif - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::rolling_moment -// -namespace extract -{ - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, rolling_moment, (int)) -} - -using extract::rolling_moment; - -// There is no weighted_rolling_moment (yet)... -// -//// So that rolling_moment<N> can be automatically substituted with -//// weighted_rolling_moment<N> when the weight parameter is non-void -//template<int N> -//struct as_weighted_feature<tag::rolling_moment<N> > -//{ -// typedef tag::weighted_rolling_moment<N> type; -//}; -// -//template<int N> -//struct feature_of<tag::weighted_rolling_moment<N> > -// : feature_of<tag::rolling_moment<N> > -//{ -//}; -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/rolling_sum.hpp b/contrib/restricted/boost/boost/accumulators/statistics/rolling_sum.hpp deleted file mode 100644 index bbb7a8e9a0..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/rolling_sum.hpp +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// rolling_sum.hpp -// -// Copyright 2008 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_ROLLING_SUM_HPP_EAN_26_12_2008 -#define BOOST_ACCUMULATORS_STATISTICS_ROLLING_SUM_HPP_EAN_26_12_2008 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/rolling_window.hpp> - -namespace boost { namespace accumulators -{ -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // rolling_sum_impl - // returns the sum of the samples in the rolling window - template<typename Sample> - struct rolling_sum_impl - : accumulator_base - { - typedef Sample result_type; - - template<typename Args> - rolling_sum_impl(Args const &args) - : sum_(args[sample | Sample()]) - {} - - template<typename Args> - void operator ()(Args const &args) - { - if(is_rolling_window_plus1_full(args)) - { - this->sum_ -= rolling_window_plus1(args).front(); - } - this->sum_ += args[sample]; - } - - template<typename Args> - result_type result(Args const & /*args*/) const - { - return this->sum_; - } - - private: - Sample sum_; - }; -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::rolling_sum -// -namespace tag -{ - struct rolling_sum - : depends_on< rolling_window_plus1 > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::rolling_sum_impl< mpl::_1 > impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::window_size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; - #endif - }; -} // namespace tag - -/////////////////////////////////////////////////////////////////////////////// -// extract::rolling_sum -// -namespace extract -{ - extractor<tag::rolling_sum> const rolling_sum = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_sum) -} - -using extract::rolling_sum; -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/rolling_variance.hpp b/contrib/restricted/boost/boost/accumulators/statistics/rolling_variance.hpp deleted file mode 100644 index 33b3922a50..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/rolling_variance.hpp +++ /dev/null @@ -1,247 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// rolling_variance.hpp -// Copyright (C) 2005 Eric Niebler -// Copyright (C) 2014 Pieter Bastiaan Ober (Integricom). -// Distributed under the 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_ACCUMULATORS_STATISTICS_ROLLING_VARIANCE_HPP_EAN_15_11_2011 -#define BOOST_ACCUMULATORS_STATISTICS_ROLLING_VARIANCE_HPP_EAN_15_11_2011 - -#include <boost/accumulators/accumulators.hpp> -#include <boost/accumulators/statistics/stats.hpp> - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/rolling_mean.hpp> -#include <boost/accumulators/statistics/rolling_moment.hpp> - -#include <boost/type_traits/is_arithmetic.hpp> -#include <boost/utility/enable_if.hpp> - -namespace boost { namespace accumulators -{ -namespace impl -{ - //! Immediate (lazy) calculation of the rolling variance. - /*! - Calculation of sample variance \f$\sigma_n^2\f$ is done as follows, see also - http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance. - For a rolling window of size \f$N\f$, when \f$n <= N\f$, the variance is computed according to the formula - \f[ - \sigma_n^2 = \frac{1}{n-1} \sum_{i = 1}^n (x_i - \mu_n)^2. - \f] - When \f$n > N\f$, the sample variance over the window becomes: - \f[ - \sigma_n^2 = \frac{1}{N-1} \sum_{i = n-N+1}^n (x_i - \mu_n)^2. - \f] - */ - /////////////////////////////////////////////////////////////////////////////// - // lazy_rolling_variance_impl - // - template<typename Sample> - struct lazy_rolling_variance_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t,void,void>::result_type result_type; - - lazy_rolling_variance_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - result_type mean = rolling_mean(args); - size_t nr_samples = rolling_count(args); - if (nr_samples < 2) return result_type(); - return nr_samples*(rolling_moment<2>(args) - mean*mean)/(nr_samples-1); - } - }; - - //! Iterative calculation of the rolling variance. - /*! - Iterative calculation of sample variance \f$\sigma_n^2\f$ is done as follows, see also - http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance. - For a rolling window of size \f$N\f$, for the first \f$N\f$ samples, the variance is computed according to the formula - \f[ - \sigma_n^2 = \frac{1}{n-1} \sum_{i = 1}^n (x_i - \mu_n)^2 = \frac{1}{n-1}M_{2,n}, - \f] - where the sum of squares \f$M_{2,n}\f$ can be recursively computed as: - \f[ - M_{2,n} = \sum_{i = 1}^n (x_i - \mu_n)^2 = M_{2,n-1} + (x_n - \mu_n)(x_n - \mu_{n-1}), - \f] - and the estimate of the sample mean as: - \f[ - \mu_n = \frac{1}{n} \sum_{i = 1}^n x_i = \mu_{n-1} + \frac{1}{n}(x_n - \mu_{n-1}). - \f] - For further samples, when the rolling window is fully filled with data, one has to take into account that the oldest - sample \f$x_{n-N}\f$ is dropped from the window. The sample variance over the window now becomes: - \f[ - \sigma_n^2 = \frac{1}{N-1} \sum_{i = n-N+1}^n (x_i - \mu_n)^2 = \frac{1}{n-1}M_{2,n}, - \f] - where the sum of squares \f$M_{2,n}\f$ now equals: - \f[ - M_{2,n} = \sum_{i = n-N+1}^n (x_i - \mu_n)^2 = M_{2,n-1} + (x_n - \mu_n)(x_n - \mu_{n-1}) - (x_{n-N} - \mu_n)(x_{n-N} - \mu_{n-1}), - \f] - and the estimated mean is: - \f[ - \mu_n = \frac{1}{N} \sum_{i = n-N+1}^n x_i = \mu_{n-1} + \frac{1}{n}(x_n - x_{n-N}). - \f] - - Note that the sample variance is not defined for \f$n <= 1\f$. - - */ - /////////////////////////////////////////////////////////////////////////////// - // immediate_rolling_variance_impl - // - template<typename Sample> - struct immediate_rolling_variance_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - template<typename Args> - immediate_rolling_variance_impl(Args const &args) - : previous_mean_(numeric::fdiv(args[sample | Sample()], numeric::one<std::size_t>::value)) - , sum_of_squares_(numeric::fdiv(args[sample | Sample()], numeric::one<std::size_t>::value)) - { - } - - template<typename Args> - void operator()(Args const &args) - { - Sample added_sample = args[sample]; - - result_type mean = immediate_rolling_mean(args); - sum_of_squares_ += (added_sample-mean)*(added_sample-previous_mean_); - - if(is_rolling_window_plus1_full(args)) - { - Sample removed_sample = rolling_window_plus1(args).front(); - sum_of_squares_ -= (removed_sample-mean)*(removed_sample-previous_mean_); - prevent_underflow(sum_of_squares_); - } - previous_mean_ = mean; - } - - template<typename Args> - result_type result(Args const &args) const - { - size_t nr_samples = rolling_count(args); - if (nr_samples < 2) return result_type(); - return numeric::fdiv(sum_of_squares_,(nr_samples-1)); - } - - private: - - result_type previous_mean_; - result_type sum_of_squares_; - - template<typename T> - void prevent_underflow(T &non_negative_number,typename boost::enable_if<boost::is_arithmetic<T>,T>::type* = 0) - { - if (non_negative_number < T(0)) non_negative_number = T(0); - } - template<typename T> - void prevent_underflow(T &non_arithmetic_quantity,typename boost::disable_if<boost::is_arithmetic<T>,T>::type* = 0) - { - } - }; -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag:: lazy_rolling_variance -// tag:: immediate_rolling_variance -// tag:: rolling_variance -// -namespace tag -{ - struct lazy_rolling_variance - : depends_on< rolling_count, rolling_mean, rolling_moment<2> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::lazy_rolling_variance_impl< mpl::_1 > impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::window_size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; - #endif - }; - - struct immediate_rolling_variance - : depends_on< rolling_window_plus1, rolling_count, immediate_rolling_mean> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::immediate_rolling_variance_impl< mpl::_1> impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::window_size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; - #endif - }; - - // make immediate_rolling_variance the default implementation - struct rolling_variance : immediate_rolling_variance {}; -} // namespace tag - -/////////////////////////////////////////////////////////////////////////////// -// extract::lazy_rolling_variance -// extract::immediate_rolling_variance -// extract::rolling_variance -// -namespace extract -{ - extractor<tag::lazy_rolling_variance> const lazy_rolling_variance = {}; - extractor<tag::immediate_rolling_variance> const immediate_rolling_variance = {}; - extractor<tag::rolling_variance> const rolling_variance = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(lazy_rolling_variance) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(immediate_rolling_variance) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_variance) -} - -using extract::lazy_rolling_variance; -using extract::immediate_rolling_variance; -using extract::rolling_variance; - -// rolling_variance(lazy) -> lazy_rolling_variance -template<> -struct as_feature<tag::rolling_variance(lazy)> -{ - typedef tag::lazy_rolling_variance type; -}; - -// rolling_variance(immediate) -> immediate_rolling_variance -template<> -struct as_feature<tag::rolling_variance(immediate)> -{ - typedef tag::immediate_rolling_variance type; -}; - -// for the purposes of feature-based dependency resolution, -// lazy_rolling_variance provides the same feature as rolling_variance -template<> -struct feature_of<tag::lazy_rolling_variance> - : feature_of<tag::rolling_variance> -{ -}; - -// for the purposes of feature-based dependency resolution, -// immediate_rolling_variance provides the same feature as rolling_variance -template<> -struct feature_of<tag::immediate_rolling_variance> - : feature_of<tag::rolling_variance> -{ -}; -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/rolling_window.hpp b/contrib/restricted/boost/boost/accumulators/statistics/rolling_window.hpp deleted file mode 100644 index 2e0a33420a..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/rolling_window.hpp +++ /dev/null @@ -1,172 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// rolling_window.hpp -// -// Copyright 2008 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_ROLLING_WINDOW_HPP_EAN_26_12_2008 -#define BOOST_ACCUMULATORS_STATISTICS_ROLLING_WINDOW_HPP_EAN_26_12_2008 - -#include <cstddef> -#include <boost/version.hpp> -#include <boost/assert.hpp> -#include <boost/circular_buffer.hpp> -#include <boost/range/iterator_range.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/parameters/accumulator.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/statistics_fwd.hpp> - -namespace boost { namespace accumulators -{ - -/////////////////////////////////////////////////////////////////////////////// -// tag::rolling_window::size named parameter -BOOST_PARAMETER_NESTED_KEYWORD(tag, rolling_window_size, window_size) - -BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_window_size) - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // rolling_window_plus1_impl - // stores the latest N+1 samples, where N is specified at construction time - // with the rolling_window_size named parameter - template<typename Sample> - struct rolling_window_plus1_impl - : accumulator_base - { - typedef typename circular_buffer<Sample>::const_iterator const_iterator; - typedef iterator_range<const_iterator> result_type; - - template<typename Args> - rolling_window_plus1_impl(Args const & args) - : buffer_(args[rolling_window_size] + 1) - {} - - #if BOOST_VERSION < 103600 - // Before Boost 1.36, copying a circular buffer didn't copy - // it's capacity, and we need that behavior. - rolling_window_plus1_impl(rolling_window_plus1_impl const &that) - : buffer_(that.buffer_) - { - this->buffer_.set_capacity(that.buffer_.capacity()); - } - - rolling_window_plus1_impl &operator =(rolling_window_plus1_impl const &that) - { - this->buffer_ = that.buffer_; - this->buffer_.set_capacity(that.buffer_.capacity()); - } - #endif - - template<typename Args> - void operator ()(Args const &args) - { - this->buffer_.push_back(args[sample]); - } - - bool full() const - { - return this->buffer_.full(); - } - - // The result of a shifted rolling window is the range including - // everything except the most recently added element. - result_type result(dont_care) const - { - return result_type(this->buffer_.begin(), this->buffer_.end()); - } - - private: - circular_buffer<Sample> buffer_; - }; - - template<typename Args> - bool is_rolling_window_plus1_full(Args const &args) - { - return find_accumulator<tag::rolling_window_plus1>(args[accumulator]).full(); - } - - /////////////////////////////////////////////////////////////////////////////// - // rolling_window_impl - // stores the latest N samples, where N is specified at construction type - // with the rolling_window_size named parameter - template<typename Sample> - struct rolling_window_impl - : accumulator_base - { - typedef typename circular_buffer<Sample>::const_iterator const_iterator; - typedef iterator_range<const_iterator> result_type; - - rolling_window_impl(dont_care) - {} - - template<typename Args> - result_type result(Args const &args) const - { - return rolling_window_plus1(args).advance_begin(is_rolling_window_plus1_full(args)); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::rolling_window_plus1 -// tag::rolling_window -// -namespace tag -{ - struct rolling_window_plus1 - : depends_on<> - , tag::rolling_window_size - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::rolling_window_plus1_impl< mpl::_1 > impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; - #endif - }; - - struct rolling_window - : depends_on< rolling_window_plus1 > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::rolling_window_impl< mpl::_1 > impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::rolling_window::size named parameter - static boost::parameter::keyword<tag::rolling_window_size> const window_size; - #endif - }; - -} // namespace tag - -/////////////////////////////////////////////////////////////////////////////// -// extract::rolling_window_plus1 -// extract::rolling_window -// -namespace extract -{ - extractor<tag::rolling_window_plus1> const rolling_window_plus1 = {}; - extractor<tag::rolling_window> const rolling_window = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_window_plus1) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(rolling_window) -} - -using extract::rolling_window_plus1; -using extract::rolling_window; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/skewness.hpp b/contrib/restricted/boost/boost/accumulators/statistics/skewness.hpp deleted file mode 100644 index c383ec4a6c..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/skewness.hpp +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// skewness.hpp -// -// Copyright 2006 Olivier Gygi, Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_SKEWNESS_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_SKEWNESS_HPP_EAN_28_10_2005 - -#include <limits> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/moment.hpp> -#include <boost/accumulators/statistics/mean.hpp> - - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // skewness_impl - /** - @brief Skewness estimation - - The skewness of a sample distribution is defined as the ratio of the 3rd central moment and the \f$ 3/2 \f$-th power - of the 2nd central moment (the variance) of the samples 3. The skewness can also be expressed by the simple moments: - - \f[ - \hat{g}_1 = - \frac - {\widehat{m}_n^{(3)}-3\widehat{m}_n^{(2)}\hat{\mu}_n+2\hat{\mu}_n^3} - {\left(\widehat{m}_n^{(2)} - \hat{\mu}_n^{2}\right)^{3/2}} - \f] - - where \f$ \widehat{m}_n^{(i)} \f$ are the \f$ i \f$-th moment and \f$ \hat{\mu}_n \f$ the mean (first moment) of the - \f$ n \f$ samples. - */ - template<typename Sample> - struct skewness_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, Sample>::result_type result_type; - - skewness_impl(dont_care) - { - } - - template<typename Args> - result_type result(Args const &args) const - { - return numeric::fdiv( - accumulators::moment<3>(args) - - 3. * accumulators::moment<2>(args) * mean(args) - + 2. * mean(args) * mean(args) * mean(args) - , ( accumulators::moment<2>(args) - mean(args) * mean(args) ) - * std::sqrt( accumulators::moment<2>(args) - mean(args) * mean(args) ) - ); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::skewness -// -namespace tag -{ - struct skewness - : depends_on<mean, moment<2>, moment<3> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::skewness_impl<mpl::_1> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::skewness -// -namespace extract -{ - extractor<tag::skewness> const skewness = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(skewness) -} - -using extract::skewness; - -// So that skewness can be automatically substituted with -// weighted_skewness when the weight parameter is non-void -template<> -struct as_weighted_feature<tag::skewness> -{ - typedef tag::weighted_skewness type; -}; - -template<> -struct feature_of<tag::weighted_skewness> - : feature_of<tag::skewness> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/stats.hpp b/contrib/restricted/boost/boost/accumulators/statistics/stats.hpp deleted file mode 100644 index 22c4ede027..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/stats.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// \file stats.hpp -/// Contains the stats<> template. -/// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_STATS_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_STATS_HPP_EAN_28_10_2005 - -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/accumulators/statistics_fwd.hpp> - -namespace boost { namespace accumulators -{ - -/////////////////////////////////////////////////////////////////////////////// -/// An MPL sequence of statistics. -template<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, typename Stat)> -struct stats - : mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, Stat)> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/sum.hpp b/contrib/restricted/boost/boost/accumulators/statistics/sum.hpp deleted file mode 100644 index 126ce244fd..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/sum.hpp +++ /dev/null @@ -1,141 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// sum.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_SUM_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_SUM_HPP_EAN_28_10_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/parameters/weight.hpp> -#include <boost/accumulators/framework/accumulators/external_accumulator.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // sum_impl - template<typename Sample, typename Tag> - struct sum_impl - : accumulator_base - { - // for boost::result_of - typedef Sample result_type; - - template<typename Args> - sum_impl(Args const &args) - : sum(args[parameter::keyword<Tag>::get() | Sample()]) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - // what about overflow? - this->sum += args[parameter::keyword<Tag>::get()]; - } - - result_type result(dont_care) const - { - return this->sum; - } - - private: - - Sample sum; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::sum -// tag::sum_of_weights -// tag::sum_of_variates -// -namespace tag -{ - struct sum - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::sum_impl<mpl::_1, tag::sample> impl; - }; - - struct sum_of_weights - : depends_on<> - { - typedef mpl::true_ is_weight_accumulator; - /// INTERNAL ONLY - /// - typedef accumulators::impl::sum_impl<mpl::_2, tag::weight> impl; - }; - - template<typename VariateType, typename VariateTag> - struct sum_of_variates - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef mpl::always<accumulators::impl::sum_impl<VariateType, VariateTag> > impl; - }; - - struct abstract_sum_of_variates - : depends_on<> - { - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::sum -// extract::sum_of_weights -// extract::sum_of_variates -// -namespace extract -{ - extractor<tag::sum> const sum = {}; - extractor<tag::sum_of_weights> const sum_of_weights = {}; - extractor<tag::abstract_sum_of_variates> const sum_of_variates = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_of_weights) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_of_variates) -} - -using extract::sum; -using extract::sum_of_weights; -using extract::sum_of_variates; - -// So that mean can be automatically substituted with -// weighted_mean when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::sum> -{ - typedef tag::weighted_sum type; -}; - -template<> -struct feature_of<tag::weighted_sum> - : feature_of<tag::sum> -{}; - -template<typename VariateType, typename VariateTag> -struct feature_of<tag::sum_of_variates<VariateType, VariateTag> > - : feature_of<tag::abstract_sum_of_variates> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/sum_kahan.hpp b/contrib/restricted/boost/boost/accumulators/statistics/sum_kahan.hpp deleted file mode 100644 index 97ade18da8..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/sum_kahan.hpp +++ /dev/null @@ -1,188 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// sum_kahan.hpp -// -// Copyright 2010 Gaetano Mendola, 2011 Simon West. Distributed under the 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_ACCUMULATORS_STATISTICS_SUM_KAHAN_HPP_EAN_26_07_2010 -#define BOOST_ACCUMULATORS_STATISTICS_SUM_KAHAN_HPP_EAN_26_07_2010 - -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/weighted_sum_kahan.hpp> -#include <boost/numeric/conversion/cast.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - -#if _MSC_VER > 1400 -# pragma float_control(push) -# pragma float_control(precise, on) -#endif - -template<typename Sample, typename Tag> -struct sum_kahan_impl - : accumulator_base -{ - typedef Sample result_type; - - //////////////////////////////////////////////////////////////////////////// - // sum_kahan_impl - /** - @brief Kahan summation algorithm - - The Kahan summation algorithm reduces the numerical error obtained with standard - sequential sum. - - */ - template<typename Args> - sum_kahan_impl(Args const & args) - : sum(args[parameter::keyword<Tag>::get() | Sample()]), - compensation(boost::numeric_cast<Sample>(0.0)) - { - } - - template<typename Args> - void -#if BOOST_ACCUMULATORS_GCC_VERSION > 40305 - __attribute__((__optimize__("no-associative-math"))) -#endif - operator ()(Args const & args) - { - const Sample myTmp1 = args[parameter::keyword<Tag>::get()] - this->compensation; - const Sample myTmp2 = this->sum + myTmp1; - this->compensation = (myTmp2 - this->sum) - myTmp1; - this->sum = myTmp2; - } - - result_type result(dont_care) const - { - return this->sum; - } - -private: - Sample sum; - Sample compensation; -}; - -#if _MSC_VER > 1400 -# pragma float_control(pop) -#endif - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::sum_kahan -// tag::sum_of_weights_kahan -// tag::sum_of_variates_kahan -// -namespace tag -{ - - struct sum_kahan - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef impl::sum_kahan_impl< mpl::_1, tag::sample > impl; - }; - - struct sum_of_weights_kahan - : depends_on<> - { - typedef mpl::true_ is_weight_accumulator; - /// INTERNAL ONLY - /// - typedef accumulators::impl::sum_kahan_impl<mpl::_2, tag::weight> impl; - }; - - template<typename VariateType, typename VariateTag> - struct sum_of_variates_kahan - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef mpl::always<accumulators::impl::sum_kahan_impl<VariateType, VariateTag> > impl; - }; - -} // namespace tag - -/////////////////////////////////////////////////////////////////////////////// -// extract::sum_kahan -// extract::sum_of_weights_kahan -// extract::sum_of_variates_kahan -// -namespace extract -{ - extractor<tag::sum_kahan> const sum_kahan = {}; - extractor<tag::sum_of_weights_kahan> const sum_of_weights_kahan = {}; - extractor<tag::abstract_sum_of_variates> const sum_of_variates_kahan = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_kahan) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_of_weights_kahan) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(sum_of_variates_kahan) -} // namespace extract - -using extract::sum_kahan; -using extract::sum_of_weights_kahan; -using extract::sum_of_variates_kahan; - -// sum(kahan) -> sum_kahan -template<> -struct as_feature<tag::sum(kahan)> -{ - typedef tag::sum_kahan type; -}; - -// sum_of_weights(kahan) -> sum_of_weights_kahan -template<> -struct as_feature<tag::sum_of_weights(kahan)> -{ - typedef tag::sum_of_weights_kahan type; -}; - -// So that sum_kahan can be automatically substituted with -// weighted_sum_kahan when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::sum_kahan> -{ - typedef tag::weighted_sum_kahan type; -}; - -template<> -struct feature_of<tag::weighted_sum_kahan> - : feature_of<tag::sum> -{}; - -// for the purposes of feature-based dependency resolution, -// sum_kahan provides the same feature as sum -template<> -struct feature_of<tag::sum_kahan> - : feature_of<tag::sum> -{ -}; - -// for the purposes of feature-based dependency resolution, -// sum_of_weights_kahan provides the same feature as sum_of_weights -template<> -struct feature_of<tag::sum_of_weights_kahan> - : feature_of<tag::sum_of_weights> -{ -}; - -template<typename VariateType, typename VariateTag> -struct feature_of<tag::sum_of_variates_kahan<VariateType, VariateTag> > - : feature_of<tag::abstract_sum_of_variates> -{ -}; - -}} // namespace boost::accumulators - -#endif - diff --git a/contrib/restricted/boost/boost/accumulators/statistics/tail.hpp b/contrib/restricted/boost/boost/accumulators/statistics/tail.hpp deleted file mode 100644 index be6cdee392..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/tail.hpp +++ /dev/null @@ -1,341 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// tail.hpp -// -// Copyright 2005 Eric Niebler, Michael Gauckler. Distributed under the 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_ACCUMULATORS_STATISTICS_TAIL_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_TAIL_HPP_EAN_28_10_2005 - -#include <vector> -#include <functional> -#include <boost/assert.hpp> -#include <boost/range.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/or.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/iterator/reverse_iterator.hpp> -#include <boost/iterator/permutation_iterator.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> - -namespace boost { namespace accumulators -{ -/////////////////////////////////////////////////////////////////////////////// -// cache_size named parameters -BOOST_PARAMETER_NESTED_KEYWORD(tag, right_tail_cache_size, cache_size) -BOOST_PARAMETER_NESTED_KEYWORD(tag, left_tail_cache_size, cache_size) - -BOOST_ACCUMULATORS_IGNORE_GLOBAL(right_tail_cache_size) -BOOST_ACCUMULATORS_IGNORE_GLOBAL(left_tail_cache_size) - -namespace detail -{ - /////////////////////////////////////////////////////////////////////////////// - // tail_range - /// INTERNAL ONLY - /// - template<typename ElementIterator, typename IndexIterator> - struct tail_range - { - typedef boost::iterator_range< - boost::reverse_iterator<boost::permutation_iterator<ElementIterator, IndexIterator> > - > type; - }; - - /////////////////////////////////////////////////////////////////////////////// - // make_tail_range - /// INTERNAL ONLY - /// - template<typename ElementIterator, typename IndexIterator> - typename tail_range<ElementIterator, IndexIterator>::type - make_tail_range(ElementIterator elem_begin, IndexIterator index_begin, IndexIterator index_end) - { - return boost::make_iterator_range( - boost::make_reverse_iterator( - boost::make_permutation_iterator(elem_begin, index_end) - ) - , boost::make_reverse_iterator( - boost::make_permutation_iterator(elem_begin, index_begin) - ) - ); - } - - /////////////////////////////////////////////////////////////////////////////// - // stat_assign_visitor - /// INTERNAL ONLY - /// - template<typename Args> - struct stat_assign_visitor - { - stat_assign_visitor(Args const &a, std::size_t i) - : args(a) - , index(i) - { - } - - template<typename Stat> - void operator ()(Stat &stat) const - { - stat.assign(this->args, this->index); - } - - private: - stat_assign_visitor &operator =(stat_assign_visitor const &); - Args const &args; - std::size_t index; - }; - - /////////////////////////////////////////////////////////////////////////////// - // stat_assign - /// INTERNAL ONLY - /// - template<typename Args> - inline stat_assign_visitor<Args> const stat_assign(Args const &args, std::size_t index) - { - return stat_assign_visitor<Args>(args, index); - } - - /////////////////////////////////////////////////////////////////////////////// - // is_tail_variate_feature - /// INTERNAL ONLY - /// - template<typename Stat, typename LeftRight> - struct is_tail_variate_feature - : mpl::false_ - { - }; - - /// INTERNAL ONLY - /// - template<typename VariateType, typename VariateTag, typename LeftRight> - struct is_tail_variate_feature<tag::tail_variate<VariateType, VariateTag, LeftRight>, LeftRight> - : mpl::true_ - { - }; - - /// INTERNAL ONLY - /// - template<typename LeftRight> - struct is_tail_variate_feature<tag::tail_weights<LeftRight>, LeftRight> - : mpl::true_ - { - }; - -} // namespace detail - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // tail_impl - template<typename Sample, typename LeftRight> - struct tail_impl - : accumulator_base - { - // LeftRight must be either right or left - BOOST_MPL_ASSERT(( - mpl::or_<is_same<LeftRight, right>, is_same<LeftRight, left> > - )); - - typedef - typename mpl::if_< - is_same<LeftRight, right> - , numeric::functional::greater<Sample const, Sample const> - , numeric::functional::less<Sample const, Sample const> - >::type - predicate_type; - - // for boost::result_of - typedef typename detail::tail_range< - typename std::vector<Sample>::const_iterator - , std::vector<std::size_t>::iterator - >::type result_type; - - template<typename Args> - tail_impl(Args const &args) - : is_sorted(false) - , indices() - , samples(args[tag::tail<LeftRight>::cache_size], args[sample | Sample()]) - { - this->indices.reserve(this->samples.size()); - } - - tail_impl(tail_impl const &that) - : is_sorted(that.is_sorted) - , indices(that.indices) - , samples(that.samples) - { - this->indices.reserve(this->samples.size()); - } - - // This just stores the heap and the samples. - // In operator()() below, if we are adding a new sample - // to the sample cache, we force all the - // tail_variates to update also. (It's not - // good enough to wait for the accumulator_set to do it - // for us because then information about whether a sample - // was stored and where is lost, and would need to be - // queried at runtime, which would be slow.) This is - // implemented as a filtered visitation over the stats, - // which we can access because args[accumulator] gives us - // all the stats. - - template<typename Args> - void operator ()(Args const &args) - { - if(this->indices.size() < this->samples.size()) - { - this->indices.push_back(this->indices.size()); - this->assign(args, this->indices.back()); - } - else if(predicate_type()(args[sample], this->samples[this->indices[0]])) - { - std::pop_heap(this->indices.begin(), this->indices.end(), indirect_cmp(this->samples)); - this->assign(args, this->indices.back()); - } - } - - result_type result(dont_care) const - { - if(!this->is_sorted) - { - // Must use the same predicate here as in push_heap/pop_heap above. - std::sort_heap(this->indices.begin(), this->indices.end(), indirect_cmp(this->samples)); - // sort_heap puts elements in reverse order. Calling std::reverse - // turns the sorted sequence back into a valid heap. - std::reverse(this->indices.begin(), this->indices.end()); - this->is_sorted = true; - } - - return detail::make_tail_range( - this->samples.begin() - , this->indices.begin() - , this->indices.end() - ); - } - - private: - - struct is_tail_variate - { - template<typename T> - struct apply - : detail::is_tail_variate_feature< - typename detail::feature_tag<T>::type - , LeftRight - > - {}; - }; - - template<typename Args> - void assign(Args const &args, std::size_t index) - { - BOOST_ASSERT(index < this->samples.size()); - this->samples[index] = args[sample]; - std::push_heap(this->indices.begin(), this->indices.end(), indirect_cmp(this->samples)); - this->is_sorted = false; - // Tell the tail variates to store their values also - args[accumulator].template visit_if<is_tail_variate>(detail::stat_assign(args, index)); - } - - /////////////////////////////////////////////////////////////////////////////// - // - struct indirect_cmp - { - typedef std::size_t first_argument_type; - typedef std::size_t second_argument_type; - typedef bool result_type; - - indirect_cmp(std::vector<Sample> const &s) - : samples(s) - { - } - - bool operator ()(std::size_t left, std::size_t right) const - { - return predicate_type()(this->samples[left], this->samples[right]); - } - - private: - indirect_cmp &operator =(indirect_cmp const &); - std::vector<Sample> const &samples; - }; - - mutable bool is_sorted; - mutable std::vector<std::size_t> indices; - std::vector<Sample> samples; - }; - -} // namespace impl - -// TODO The templatized tag::tail below should inherit from the correct named parameter. -// The following lines provide a workaround, but there must be a better way of doing this. -template<typename T> -struct tail_cache_size_named_arg -{ -}; -template<> -struct tail_cache_size_named_arg<left> - : tag::left_tail_cache_size -{ -}; -template<> -struct tail_cache_size_named_arg<right> - : tag::right_tail_cache_size -{ -}; - -/////////////////////////////////////////////////////////////////////////////// -// tag::tail<> -// -namespace tag -{ - template<typename LeftRight> - struct tail - : depends_on<> - , tail_cache_size_named_arg<LeftRight> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::tail_impl<mpl::_1, LeftRight> impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - /// tag::tail<LeftRight>::cache_size named parameter - static boost::parameter::keyword<tail_cache_size_named_arg<LeftRight> > const cache_size; - #endif - }; - - struct abstract_tail - : depends_on<> - { - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::tail -// -namespace extract -{ - extractor<tag::abstract_tail> const tail = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(tail) -} - -using extract::tail; - -template<typename LeftRight> -struct feature_of<tag::tail<LeftRight> > - : feature_of<tag::abstract_tail> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/tail_mean.hpp b/contrib/restricted/boost/boost/accumulators/statistics/tail_mean.hpp deleted file mode 100644 index 67dae37b50..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/tail_mean.hpp +++ /dev/null @@ -1,246 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// tail_mean.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_TAIL_MEAN_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_TAIL_MEAN_HPP_DE_01_01_2006 - -#include <numeric> -#include <vector> -#include <limits> -#include <functional> -#include <sstream> -#include <stdexcept> -#include <boost/throw_exception.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/tail.hpp> -#include <boost/accumulators/statistics/tail_quantile.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost { namespace accumulators -{ - -namespace impl -{ - - /////////////////////////////////////////////////////////////////////////////// - // coherent_tail_mean_impl - // - /** - @brief Estimation of the coherent tail mean based on order statistics (for both left and right tails) - - The coherent tail mean \f$\widehat{CTM}_{n,\alpha}(X)\f$ is equal to the non-coherent tail mean \f$\widehat{NCTM}_{n,\alpha}(X)\f$ - plus a correction term that ensures coherence in case of non-continuous distributions. - - \f[ - \widehat{CTM}_{n,\alpha}^{\mathrm{right}}(X) = \widehat{NCTM}_{n,\alpha}^{\mathrm{right}}(X) + - \frac{1}{\lceil n(1-\alpha)\rceil}\hat{q}_{n,\alpha}(X)\left(1 - \alpha - \frac{1}{n}\lceil n(1-\alpha)\rceil \right) - \f] - - \f[ - \widehat{CTM}_{n,\alpha}^{\mathrm{left}}(X) = \widehat{NCTM}_{n,\alpha}^{\mathrm{left}}(X) + - \frac{1}{\lceil n\alpha\rceil}\hat{q}_{n,\alpha}(X)\left(\alpha - \frac{1}{n}\lceil n\alpha\rceil \right) - \f] - */ - template<typename Sample, typename LeftRight> - struct coherent_tail_mean_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - // for boost::result_of - typedef float_type result_type; - - coherent_tail_mean_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - std::size_t cnt = count(args); - - std::size_t n = static_cast<std::size_t>( - std::ceil( - cnt * ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] ) - ) - ); - - extractor<tag::non_coherent_tail_mean<LeftRight> > const some_non_coherent_tail_mean = {}; - - return some_non_coherent_tail_mean(args) - + numeric::fdiv(quantile(args), n) - * ( - ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] - - numeric::fdiv(n, count(args)) - ); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // non_coherent_tail_mean_impl - // - /** - @brief Estimation of the (non-coherent) tail mean based on order statistics (for both left and right tails) - - An estimation of the non-coherent tail mean \f$\widehat{NCTM}_{n,\alpha}(X)\f$ is given by the mean of the - \f$\lceil n\alpha\rceil\f$ smallest samples (left tail) or the mean of the \f$\lceil n(1-\alpha)\rceil\f$ - largest samples (right tail), \f$n\f$ being the total number of samples and \f$\alpha\f$ the quantile level: - - \f[ - \widehat{NCTM}_{n,\alpha}^{\mathrm{right}}(X) = \frac{1}{\lceil n(1-\alpha)\rceil} \sum_{i=\lceil \alpha n \rceil}^n X_{i:n} - \f] - - \f[ - \widehat{NCTM}_{n,\alpha}^{\mathrm{left}}(X) = \frac{1}{\lceil n\alpha\rceil} \sum_{i=1}^{\lceil \alpha n \rceil} X_{i:n} - \f] - - It thus requires the caching of at least the \f$\lceil n\alpha\rceil\f$ smallest or the \f$\lceil n(1-\alpha)\rceil\f$ - largest samples. - - @param quantile_probability - */ - template<typename Sample, typename LeftRight> - struct non_coherent_tail_mean_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - // for boost::result_of - typedef float_type result_type; - - non_coherent_tail_mean_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - std::size_t cnt = count(args); - - std::size_t n = static_cast<std::size_t>( - std::ceil( - cnt * ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] ) - ) - ); - - // If n is in a valid range, return result, otherwise return NaN or throw exception - if (n <= static_cast<std::size_t>(tail(args).size())) - return numeric::fdiv( - std::accumulate( - tail(args).begin() - , tail(args).begin() + n - , Sample(0) - ) - , n - ); - else - { - if (std::numeric_limits<result_type>::has_quiet_NaN) - { - return std::numeric_limits<result_type>::quiet_NaN(); - } - else - { - std::ostringstream msg; - msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - return Sample(0); - } - } - } - }; - -} // namespace impl - - -/////////////////////////////////////////////////////////////////////////////// -// tag::coherent_tail_mean<> -// tag::non_coherent_tail_mean<> -// -namespace tag -{ - template<typename LeftRight> - struct coherent_tail_mean - : depends_on<count, quantile, non_coherent_tail_mean<LeftRight> > - { - typedef accumulators::impl::coherent_tail_mean_impl<mpl::_1, LeftRight> impl; - }; - - template<typename LeftRight> - struct non_coherent_tail_mean - : depends_on<count, tail<LeftRight> > - { - typedef accumulators::impl::non_coherent_tail_mean_impl<mpl::_1, LeftRight> impl; - }; - - struct abstract_non_coherent_tail_mean - : depends_on<> - { - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::non_coherent_tail_mean; -// extract::coherent_tail_mean; -// -namespace extract -{ - extractor<tag::abstract_non_coherent_tail_mean> const non_coherent_tail_mean = {}; - extractor<tag::tail_mean> const coherent_tail_mean = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(non_coherent_tail_mean) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(coherent_tail_mean) -} - -using extract::non_coherent_tail_mean; -using extract::coherent_tail_mean; - -// for the purposes of feature-based dependency resolution, -// coherent_tail_mean<LeftRight> provides the same feature as tail_mean -template<typename LeftRight> -struct feature_of<tag::coherent_tail_mean<LeftRight> > - : feature_of<tag::tail_mean> -{ -}; - -template<typename LeftRight> -struct feature_of<tag::non_coherent_tail_mean<LeftRight> > - : feature_of<tag::abstract_non_coherent_tail_mean> -{ -}; - -// So that non_coherent_tail_mean can be automatically substituted -// with weighted_non_coherent_tail_mean when the weight parameter is non-void. -template<typename LeftRight> -struct as_weighted_feature<tag::non_coherent_tail_mean<LeftRight> > -{ - typedef tag::non_coherent_weighted_tail_mean<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::non_coherent_weighted_tail_mean<LeftRight> > - : feature_of<tag::non_coherent_tail_mean<LeftRight> > -{}; - -// NOTE that non_coherent_tail_mean cannot be feature-grouped with tail_mean, -// which is the base feature for coherent tail means, since (at least for -// non-continuous distributions) non_coherent_tail_mean is a different measure! - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/tail_quantile.hpp b/contrib/restricted/boost/boost/accumulators/statistics/tail_quantile.hpp deleted file mode 100644 index 9ff56b56e5..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/tail_quantile.hpp +++ /dev/null @@ -1,158 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// tail_quantile.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_TAIL_QUANTILE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_TAIL_QUANTILE_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <functional> -#include <sstream> -#include <stdexcept> -#include <boost/config/no_tr1/cmath.hpp> // For ceil -#include <boost/throw_exception.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/tail.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // tail_quantile_impl - // Tail quantile estimation based on order statistics - /** - @brief Tail quantile estimation based on order statistics (for both left and right tails) - - The estimation of a tail quantile \f$\hat{q}\f$ with level \f$\alpha\f$ based on order statistics requires the - caching of at least the \f$\lceil n\alpha\rceil\f$ smallest or the \f$\lceil n(1-\alpha)\rceil\f$ largest samples, - \f$n\f$ being the total number of samples. The largest of the \f$\lceil n\alpha\rceil\f$ smallest samples or the - smallest of the \f$\lceil n(1-\alpha)\rceil\f$ largest samples provides an estimate for the quantile: - - \f[ - \hat{q}_{n,\alpha} = X_{\lceil \alpha n \rceil:n} - \f] - - @param quantile_probability - */ - template<typename Sample, typename LeftRight> - struct tail_quantile_impl - : accumulator_base - { - // for boost::result_of - typedef Sample result_type; - - tail_quantile_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - std::size_t cnt = count(args); - - std::size_t n = static_cast<std::size_t>( - std::ceil( - cnt * ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] ) - ) - ); - - // If n is in a valid range, return result, otherwise return NaN or throw exception - if ( n < static_cast<std::size_t>(tail(args).size())) - { - // Note that the cached samples of the left are sorted in ascending order, - // whereas the samples of the right tail are sorted in descending order - return *(boost::begin(tail(args)) + n - 1); - } - else - { - if (std::numeric_limits<result_type>::has_quiet_NaN) - { - return std::numeric_limits<result_type>::quiet_NaN(); - } - else - { - std::ostringstream msg; - msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - return Sample(0); - } - } - } - }; -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::tail_quantile<> -// -namespace tag -{ - template<typename LeftRight> - struct tail_quantile - : depends_on<count, tail<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::tail_quantile_impl<mpl::_1, LeftRight> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::tail_quantile -// -namespace extract -{ - extractor<tag::quantile> const tail_quantile = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(tail_quantile) -} - -using extract::tail_quantile; - -// for the purposes of feature-based dependency resolution, -// tail_quantile<LeftRight> provide the same feature as quantile -template<typename LeftRight> -struct feature_of<tag::tail_quantile<LeftRight> > - : feature_of<tag::quantile> -{ -}; - -// So that tail_quantile can be automatically substituted with -// weighted_tail_quantile when the weight parameter is non-void. -template<typename LeftRight> -struct as_weighted_feature<tag::tail_quantile<LeftRight> > -{ - typedef tag::weighted_tail_quantile<LeftRight> type; -}; - -template<typename LeftRight> -struct feature_of<tag::weighted_tail_quantile<LeftRight> > - : feature_of<tag::tail_quantile<LeftRight> > -{}; - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/tail_variate.hpp b/contrib/restricted/boost/boost/accumulators/statistics/tail_variate.hpp deleted file mode 100644 index a9fc7d297a..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/tail_variate.hpp +++ /dev/null @@ -1,141 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// tail_variate.hpp -// -// Copyright 2005 Eric Niebler, Michael Gauckler. Distributed under the 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_STAT_STATISTICS_TAIL_VARIATE_HPP_EAN_28_10_2005 -#define BOOST_STAT_STATISTICS_TAIL_VARIATE_HPP_EAN_28_10_2005 - -#include <boost/range.hpp> -#include <boost/mpl/always.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/iterator/reverse_iterator.hpp> -#include <boost/iterator/permutation_iterator.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/tail.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // tail_variate_impl - template<typename VariateType, typename VariateTag, typename LeftRight> - struct tail_variate_impl - : accumulator_base - { - // for boost::result_of - typedef - typename detail::tail_range< - typename std::vector<VariateType>::const_iterator - , std::vector<std::size_t>::iterator - >::type - result_type; - - template<typename Args> - tail_variate_impl(Args const &args) - : variates(args[tag::tail<LeftRight>::cache_size], args[parameter::keyword<VariateTag>::get() | VariateType()]) - { - } - - template<typename Args> - void assign(Args const &args, std::size_t index) - { - this->variates[index] = args[parameter::keyword<VariateTag>::get()]; - } - - template<typename Args> - result_type result(Args const &args) const - { - // getting the order result causes the indices vector to be sorted. - extractor<tag::tail<LeftRight> > const some_tail = {}; - return this->do_result(some_tail(args)); - } - - private: - template<typename TailRng> - result_type do_result(TailRng const &rng) const - { - return detail::make_tail_range( - this->variates.begin() - , rng.end().base().base() // the index iterator - , rng.begin().base().base() // (begin and end reversed because these are reverse iterators) - ); - } - - std::vector<VariateType> variates; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::tail_variate<> -// -namespace tag -{ - template<typename VariateType, typename VariateTag, typename LeftRight> - struct tail_variate - : depends_on<tail<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef mpl::always<accumulators::impl::tail_variate_impl<VariateType, VariateTag, LeftRight> > impl; - }; - - struct abstract_tail_variate - : depends_on<> - { - }; - - template<typename LeftRight> - struct tail_weights - : depends_on<tail<LeftRight> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::tail_variate_impl<mpl::_2, tag::weight, LeftRight> impl; - }; - - struct abstract_tail_weights - : depends_on<> - { - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::tail_variate -// extract::tail_weights -// -namespace extract -{ - extractor<tag::abstract_tail_variate> const tail_variate = {}; - extractor<tag::abstract_tail_weights> const tail_weights = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(tail_variate) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(tail_weights) -} - -using extract::tail_variate; -using extract::tail_weights; - -template<typename VariateType, typename VariateTag, typename LeftRight> -struct feature_of<tag::tail_variate<VariateType, VariateTag, LeftRight> > - : feature_of<tag::abstract_tail_variate> -{ -}; - -template<typename LeftRight> -struct feature_of<tag::tail_weights<LeftRight> > -{ - typedef tag::abstract_tail_weights type; -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/tail_variate_means.hpp b/contrib/restricted/boost/boost/accumulators/statistics/tail_variate_means.hpp deleted file mode 100644 index a97eab5648..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/tail_variate_means.hpp +++ /dev/null @@ -1,262 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// tail_variate_means.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_TAIL_VARIATE_MEANS_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_TAIL_VARIATE_MEANS_HPP_DE_01_01_2006 - -#include <numeric> -#include <vector> -#include <limits> -#include <functional> -#include <sstream> -#include <stdexcept> -#include <boost/throw_exception.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/tail.hpp> -#include <boost/accumulators/statistics/tail_variate.hpp> -#include <boost/accumulators/statistics/tail_mean.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /** - @brief Estimation of the absolute and relative tail variate means (for both left and right tails) - - For all \f$j\f$-th variates associated to the \f$\lceil n(1-\alpha)\rceil\f$ largest samples (or the - \f$\lceil n(1-\alpha)\rceil\f$ smallest samples in case of the left tail), the absolute tail means - \f$\widehat{ATM}_{n,\alpha}(X, j)\f$ are computed and returned as an iterator range. Alternatively, - the relative tail means \f$\widehat{RTM}_{n,\alpha}(X, j)\f$ are returned, which are the absolute - tail means normalized with the (non-coherent) sample tail mean \f$\widehat{NCTM}_{n,\alpha}(X)\f$. - - \f[ - \widehat{ATM}_{n,\alpha}^{\mathrm{right}}(X, j) = - \frac{1}{\lceil n(1-\alpha) \rceil} - \sum_{i=\lceil \alpha n \rceil}^n \xi_{j,i} - \f] - - \f[ - \widehat{ATM}_{n,\alpha}^{\mathrm{left}}(X, j) = - \frac{1}{\lceil n\alpha \rceil} - \sum_{i=1}^{\lceil n\alpha \rceil} \xi_{j,i} - \f] - - \f[ - \widehat{RTM}_{n,\alpha}^{\mathrm{right}}(X, j) = - \frac{\sum_{i=\lceil n\alpha \rceil}^n \xi_{j,i}} - {\lceil n(1-\alpha)\rceil\widehat{NCTM}_{n,\alpha}^{\mathrm{right}}(X)} - \f] - - \f[ - \widehat{RTM}_{n,\alpha}^{\mathrm{left}}(X, j) = - \frac{\sum_{i=1}^{\lceil n\alpha \rceil} \xi_{j,i}} - {\lceil n\alpha\rceil\widehat{NCTM}_{n,\alpha}^{\mathrm{left}}(X)} - \f] - */ - - /////////////////////////////////////////////////////////////////////////////// - // tail_variate_means_impl - // by default: absolute tail_variate_means - template<typename Sample, typename Impl, typename LeftRight, typename VariateTag> - struct tail_variate_means_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef std::vector<float_type> array_type; - // for boost::result_of - typedef iterator_range<typename array_type::iterator> result_type; - - tail_variate_means_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - std::size_t cnt = count(args); - - std::size_t n = static_cast<std::size_t>( - std::ceil( - cnt * ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] ) - ) - ); - - std::size_t num_variates = tail_variate(args).begin()->size(); - - this->tail_means_.clear(); - this->tail_means_.resize(num_variates, Sample(0)); - - // If n is in a valid range, return result, otherwise return NaN or throw exception - if (n < static_cast<std::size_t>(tail(args).size())) - { - this->tail_means_ = std::accumulate( - tail_variate(args).begin() - , tail_variate(args).begin() + n - , this->tail_means_ - , numeric::plus - ); - - float_type factor = n * ( (is_same<Impl, relative>::value) ? non_coherent_tail_mean(args) : 1. ); - - std::transform( - this->tail_means_.begin() - , this->tail_means_.end() - , this->tail_means_.begin() -#ifdef BOOST_NO_CXX98_BINDERS - , std::bind(std::divides<float_type>(), std::placeholders::_1, factor) -#else - , std::bind2nd(std::divides<float_type>(), factor) -#endif - ); - } - else - { - if (std::numeric_limits<float_type>::has_quiet_NaN) - { - std::fill( - this->tail_means_.begin() - , this->tail_means_.end() - , std::numeric_limits<float_type>::quiet_NaN() - ); - } - else - { - std::ostringstream msg; - msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - } - } - return make_iterator_range(this->tail_means_); - } - - private: - - mutable array_type tail_means_; - - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::absolute_tail_variate_means -// tag::relative_tail_variate_means -// -namespace tag -{ - template<typename LeftRight, typename VariateType, typename VariateTag> - struct absolute_tail_variate_means - : depends_on<count, non_coherent_tail_mean<LeftRight>, tail_variate<VariateType, VariateTag, LeftRight> > - { - typedef accumulators::impl::tail_variate_means_impl<mpl::_1, absolute, LeftRight, VariateTag> impl; - }; - template<typename LeftRight, typename VariateType, typename VariateTag> - struct relative_tail_variate_means - : depends_on<count, non_coherent_tail_mean<LeftRight>, tail_variate<VariateType, VariateTag, LeftRight> > - { - typedef accumulators::impl::tail_variate_means_impl<mpl::_1, relative, LeftRight, VariateTag> impl; - }; - struct abstract_absolute_tail_variate_means - : depends_on<> - { - }; - struct abstract_relative_tail_variate_means - : depends_on<> - { - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::tail_variate_means -// extract::relative_tail_variate_means -// -namespace extract -{ - extractor<tag::abstract_absolute_tail_variate_means> const tail_variate_means = {}; - extractor<tag::abstract_relative_tail_variate_means> const relative_tail_variate_means = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(tail_variate_means) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(relative_tail_variate_means) -} - -using extract::tail_variate_means; -using extract::relative_tail_variate_means; - -// tail_variate_means<LeftRight, VariateType, VariateTag>(absolute) -> absolute_tail_variate_means<LeftRight, VariateType, VariateTag> -template<typename LeftRight, typename VariateType, typename VariateTag> -struct as_feature<tag::tail_variate_means<LeftRight, VariateType, VariateTag>(absolute)> -{ - typedef tag::absolute_tail_variate_means<LeftRight, VariateType, VariateTag> type; -}; - -// tail_variate_means<LeftRight, VariateType, VariateTag>(relative) ->relative_tail_variate_means<LeftRight, VariateType, VariateTag> -template<typename LeftRight, typename VariateType, typename VariateTag> -struct as_feature<tag::tail_variate_means<LeftRight, VariateType, VariateTag>(relative)> -{ - typedef tag::relative_tail_variate_means<LeftRight, VariateType, VariateTag> type; -}; - -// Provides non-templatized extractor -template<typename LeftRight, typename VariateType, typename VariateTag> -struct feature_of<tag::absolute_tail_variate_means<LeftRight, VariateType, VariateTag> > - : feature_of<tag::abstract_absolute_tail_variate_means> -{ -}; - -// Provides non-templatized extractor -template<typename LeftRight, typename VariateType, typename VariateTag> -struct feature_of<tag::relative_tail_variate_means<LeftRight, VariateType, VariateTag> > - : feature_of<tag::abstract_relative_tail_variate_means> -{ -}; - -// So that absolute_tail_means can be automatically substituted -// with absolute_weighted_tail_means when the weight parameter is non-void. -template<typename LeftRight, typename VariateType, typename VariateTag> -struct as_weighted_feature<tag::absolute_tail_variate_means<LeftRight, VariateType, VariateTag> > -{ - typedef tag::absolute_weighted_tail_variate_means<LeftRight, VariateType, VariateTag> type; -}; - -template<typename LeftRight, typename VariateType, typename VariateTag> -struct feature_of<tag::absolute_weighted_tail_variate_means<LeftRight, VariateType, VariateTag> > - : feature_of<tag::absolute_tail_variate_means<LeftRight, VariateType, VariateTag> > -{ -}; - -// So that relative_tail_means can be automatically substituted -// with relative_weighted_tail_means when the weight parameter is non-void. -template<typename LeftRight, typename VariateType, typename VariateTag> -struct as_weighted_feature<tag::relative_tail_variate_means<LeftRight, VariateType, VariateTag> > -{ - typedef tag::relative_weighted_tail_variate_means<LeftRight, VariateType, VariateTag> type; -}; - -template<typename LeftRight, typename VariateType, typename VariateTag> -struct feature_of<tag::relative_weighted_tail_variate_means<LeftRight, VariateType, VariateTag> > - : feature_of<tag::relative_tail_variate_means<LeftRight, VariateType, VariateTag> > -{ -}; - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/times2_iterator.hpp b/contrib/restricted/boost/boost/accumulators/statistics/times2_iterator.hpp deleted file mode 100644 index dbd81af7cf..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/times2_iterator.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// times2_iterator.hpp -// -// Copyright 2006 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_TIMES2_ITERATOR_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_TIMES2_ITERATOR_HPP_DE_01_01_2006 - -#include <functional> -#include <boost/detail/workaround.hpp> -#include <boost/range/begin.hpp> -#include <boost/range/end.hpp> -#include <boost/range/iterator_range.hpp> -#include <boost/iterator/transform_iterator.hpp> -#include <boost/iterator/counting_iterator.hpp> -#include <boost/iterator/permutation_iterator.hpp> - -namespace boost { namespace accumulators -{ - -namespace detail -{ - typedef transform_iterator< -#ifdef BOOST_NO_CXX98_BINDERS - decltype(std::bind(std::multiplies<std::size_t>(), 2, std::placeholders::_1)) -#else - std::binder1st<std::multiplies<std::size_t> > -#endif - , counting_iterator<std::size_t> - > times2_iterator; - - inline times2_iterator make_times2_iterator(std::size_t i) - { - return make_transform_iterator( - make_counting_iterator(i) -#ifdef BOOST_NO_CXX98_BINDERS - , std::bind(std::multiplies<std::size_t>(), 2, std::placeholders::_1) -#else - , std::bind1st(std::multiplies<std::size_t>(), 2) -#endif - ); - } - - /////////////////////////////////////////////////////////////////////////////// - // lvalue_index_iterator - template<typename Base> - struct lvalue_index_iterator - : Base - { - lvalue_index_iterator() - : Base() - {} - - lvalue_index_iterator(Base base) - : Base(base) - { - } - - typename Base::reference operator [](typename Base::difference_type n) const - { - return *(*this + n); - } - }; -} // namespace detail - -}} - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/variance.hpp b/contrib/restricted/boost/boost/accumulators/statistics/variance.hpp deleted file mode 100644 index baac55696b..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/variance.hpp +++ /dev/null @@ -1,236 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// variance.hpp -// -// Copyright 2005 Daniel Egloff, Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_VARIANCE_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_VARIANCE_HPP_EAN_28_10_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/mean.hpp> -#include <boost/accumulators/statistics/moment.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - //! Lazy calculation of variance. - /*! - Default sample variance implementation based on the second moment \f$ M_n^{(2)} \f$ moment<2>, mean and count. - \f[ - \sigma_n^2 = M_n^{(2)} - \mu_n^2. - \f] - where - \f[ - \mu_n = \frac{1}{n} \sum_{i = 1}^n x_i. - \f] - is the estimate of the sample mean and \f$n\f$ is the number of samples. - */ - template<typename Sample, typename MeanFeature> - struct lazy_variance_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - lazy_variance_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - extractor<MeanFeature> mean; - result_type tmp = mean(args); - return accumulators::moment<2>(args) - tmp * tmp; - } - }; - - //! Iterative calculation of variance. - /*! - Iterative calculation of sample variance \f$\sigma_n^2\f$ according to the formula - \f[ - \sigma_n^2 = \frac{1}{n} \sum_{i = 1}^n (x_i - \mu_n)^2 = \frac{n-1}{n} \sigma_{n-1}^2 + \frac{1}{n-1}(x_n - \mu_n)^2. - \f] - where - \f[ - \mu_n = \frac{1}{n} \sum_{i = 1}^n x_i. - \f] - is the estimate of the sample mean and \f$n\f$ is the number of samples. - - Note that the sample variance is not defined for \f$n <= 1\f$. - - A simplification can be obtained by the approximate recursion - \f[ - \sigma_n^2 \approx \frac{n-1}{n} \sigma_{n-1}^2 + \frac{1}{n}(x_n - \mu_n)^2. - \f] - because the difference - \f[ - \left(\frac{1}{n-1} - \frac{1}{n}\right)(x_n - \mu_n)^2 = \frac{1}{n(n-1)}(x_n - \mu_n)^2. - \f] - converges to zero as \f$n \rightarrow \infty\f$. However, for small \f$ n \f$ the difference - can be non-negligible. - */ - template<typename Sample, typename MeanFeature, typename Tag> - struct variance_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - template<typename Args> - variance_impl(Args const &args) - : variance(numeric::fdiv(args[sample | Sample()], numeric::one<std::size_t>::value)) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - - if(cnt > 1) - { - extractor<MeanFeature> mean; - result_type tmp = args[parameter::keyword<Tag>::get()] - mean(args); - this->variance = - numeric::fdiv(this->variance * (cnt - 1), cnt) - + numeric::fdiv(tmp * tmp, cnt - 1); - } - } - - result_type result(dont_care) const - { - return this->variance; - } - - private: - result_type variance; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::variance -// tag::immediate_variance -// -namespace tag -{ - struct lazy_variance - : depends_on<moment<2>, mean> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::lazy_variance_impl<mpl::_1, mean> impl; - }; - - struct variance - : depends_on<count, immediate_mean> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::variance_impl<mpl::_1, mean, sample> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::lazy_variance -// extract::variance -// -namespace extract -{ - extractor<tag::lazy_variance> const lazy_variance = {}; - extractor<tag::variance> const variance = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(lazy_variance) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(variance) -} - -using extract::lazy_variance; -using extract::variance; - -// variance(lazy) -> lazy_variance -template<> -struct as_feature<tag::variance(lazy)> -{ - typedef tag::lazy_variance type; -}; - -// variance(immediate) -> variance -template<> -struct as_feature<tag::variance(immediate)> -{ - typedef tag::variance type; -}; - -// for the purposes of feature-based dependency resolution, -// immediate_variance provides the same feature as variance -template<> -struct feature_of<tag::lazy_variance> - : feature_of<tag::variance> -{ -}; - -// So that variance can be automatically substituted with -// weighted_variance when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::variance> -{ - typedef tag::weighted_variance type; -}; - -// for the purposes of feature-based dependency resolution, -// weighted_variance provides the same feature as variance -template<> -struct feature_of<tag::weighted_variance> - : feature_of<tag::variance> -{ -}; - -// So that immediate_variance can be automatically substituted with -// immediate_weighted_variance when the weight parameter is non-void. -template<> -struct as_weighted_feature<tag::lazy_variance> -{ - typedef tag::lazy_weighted_variance type; -}; - -// for the purposes of feature-based dependency resolution, -// immediate_weighted_variance provides the same feature as immediate_variance -template<> -struct feature_of<tag::lazy_weighted_variance> - : feature_of<tag::lazy_variance> -{ -}; - -//////////////////////////////////////////////////////////////////////////// -//// droppable_accumulator<variance_impl> -//// need to specialize droppable lazy variance to cache the result at the -//// point the accumulator is dropped. -///// INTERNAL ONLY -///// -//template<typename Sample, typename MeanFeature> -//struct droppable_accumulator<impl::variance_impl<Sample, MeanFeature> > -// : droppable_accumulator_base< -// with_cached_result<impl::variance_impl<Sample, MeanFeature> > -// > -//{ -// template<typename Args> -// droppable_accumulator(Args const &args) -// : droppable_accumulator::base(args) -// { -// } -//}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/variates/covariate.hpp b/contrib/restricted/boost/boost/accumulators/statistics/variates/covariate.hpp deleted file mode 100644 index aba113a4a3..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/variates/covariate.hpp +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weight.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_VARIATES_COVARIATE_HPP_EAN_03_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_VARIATES_COVARIATE_HPP_EAN_03_11_2005 - -#include <boost/parameter/keyword.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> - -namespace boost { namespace accumulators -{ - -BOOST_PARAMETER_KEYWORD(tag, covariate1) -BOOST_PARAMETER_KEYWORD(tag, covariate2) - -BOOST_ACCUMULATORS_IGNORE_GLOBAL(covariate1) -BOOST_ACCUMULATORS_IGNORE_GLOBAL(covariate2) - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_covariance.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_covariance.hpp deleted file mode 100644 index 25d613c120..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_covariance.hpp +++ /dev/null @@ -1,133 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_covariance.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_COVARIANCE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_COVARIANCE_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <numeric> -#include <functional> -#include <complex> -#include <boost/mpl/assert.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/range.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/numeric/ublas/io.hpp> -#include <boost/numeric/ublas/matrix.hpp> -#include <boost/type_traits/is_scalar.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/covariance.hpp> // for numeric::outer_product() and type traits -#include <boost/accumulators/statistics/weighted_mean.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_covariance_impl - // - /** - @brief Weighted Covariance Estimator - - An iterative Monte Carlo estimator for the weighted covariance \f$\mathrm{Cov}(X,X')\f$, where \f$X\f$ is a sample - and \f$X'\f$ a variate, is given by: - - \f[ - \hat{c}_n = \frac{\bar{w}_n-w_n}{\bar{w}_n} \hat{c}_{n-1} + \frac{w_n}{\bar{w}_n-w_n}(X_n - \hat{\mu}_n)(X_n' - \hat{\mu}_n'), - \quad n\ge2,\quad\hat{c}_1 = 0, - \f] - - \f$\hat{\mu}_n\f$ and \f$\hat{\mu}_n'\f$ being the weighted means of the samples and variates and - \f$\bar{w}_n\f$ the sum of the \f$n\f$ first weights \f$w_i\f$. - */ - template<typename Sample, typename Weight, typename VariateType, typename VariateTag> - struct weighted_covariance_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Weight, typename numeric::functional::fdiv<Sample, std::size_t>::result_type>::result_type weighted_sample_type; - typedef typename numeric::functional::multiplies<Weight, typename numeric::functional::fdiv<VariateType, std::size_t>::result_type>::result_type weighted_variate_type; - // for boost::result_of - typedef typename numeric::functional::outer_product<weighted_sample_type, weighted_variate_type>::result_type result_type; - - template<typename Args> - weighted_covariance_impl(Args const &args) - : cov_( - numeric::outer_product( - numeric::fdiv(args[sample | Sample()], (std::size_t)1) - * numeric::one<Weight>::value - , numeric::fdiv(args[parameter::keyword<VariateTag>::get() | VariateType()], (std::size_t)1) - * numeric::one<Weight>::value - ) - ) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - - if (cnt > 1) - { - extractor<tag::weighted_mean_of_variates<VariateType, VariateTag> > const some_weighted_mean_of_variates = {}; - - this->cov_ = this->cov_ * (sum_of_weights(args) - args[weight]) / sum_of_weights(args) - + numeric::outer_product( - some_weighted_mean_of_variates(args) - args[parameter::keyword<VariateTag>::get()] - , weighted_mean(args) - args[sample] - ) * args[weight] / (sum_of_weights(args) - args[weight]); - } - } - - result_type result(dont_care) const - { - return this->cov_; - } - - private: - result_type cov_; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_covariance -// -namespace tag -{ - template<typename VariateType, typename VariateTag> - struct weighted_covariance - : depends_on<count, sum_of_weights, weighted_mean, weighted_mean_of_variates<VariateType, VariateTag> > - { - typedef accumulators::impl::weighted_covariance_impl<mpl::_1, mpl::_2, VariateType, VariateTag> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_covariance -// -namespace extract -{ - extractor<tag::abstract_covariance> const weighted_covariance = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_covariance) -} - -using extract::weighted_covariance; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_density.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_density.hpp deleted file mode 100644 index 1407368016..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_density.hpp +++ /dev/null @@ -1,221 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_density.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_DENSITY_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_DENSITY_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <functional> -#include <boost/range.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/max.hpp> -#include <boost/accumulators/statistics/min.hpp> -#include <boost/accumulators/statistics/density.hpp> // for named parameters density_cache_size and density_num_bins - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_density_impl - // density histogram for weighted samples - /** - @brief Histogram density estimator for weighted samples - - The histogram density estimator returns a histogram of the sample distribution. The positions and sizes of the bins - are determined using a specifiable number of cached samples (cache_size). The range between the minimum and the - maximum of the cached samples is subdivided into a specifiable number of bins (num_bins) of same size. Additionally, - an under- and an overflow bin is added to capture future under- and overflow samples. Once the bins are determined, - the cached samples and all subsequent samples are added to the correct bins. At the end, a range of std::pair is - returned, where each pair contains the position of the bin (lower bound) and the sum of the weights (normalized with the - sum of all weights). - - @param density_cache_size Number of first samples used to determine min and max. - @param density_num_bins Number of bins (two additional bins collect under- and overflow samples). - */ - template<typename Sample, typename Weight> - struct weighted_density_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Weight, std::size_t>::result_type float_type; - typedef std::vector<std::pair<float_type, float_type> > histogram_type; - typedef std::vector<float_type> array_type; - // for boost::result_of - typedef iterator_range<typename histogram_type::iterator> result_type; - - template<typename Args> - weighted_density_impl(Args const &args) - : cache_size(args[density_cache_size]) - , cache(cache_size) - , num_bins(args[density_num_bins]) - , samples_in_bin(num_bins + 2, 0.) - , bin_positions(num_bins + 2) - , histogram( - num_bins + 2 - , std::make_pair( - numeric::fdiv(args[sample | Sample()],(std::size_t)1) - , numeric::fdiv(args[sample | Sample()],(std::size_t)1) - ) - ) - , is_dirty(true) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - this->is_dirty = true; - - std::size_t cnt = count(args); - - // Fill up cache with cache_size first samples - if (cnt <= this->cache_size) - { - this->cache[cnt - 1] = std::make_pair(args[sample], args[weight]); - } - - // Once cache_size samples have been accumulated, create num_bins bins of same size between - // the minimum and maximum of the cached samples as well as an under- and an overflow bin. - // Store their lower bounds (bin_positions) and fill the bins with the cached samples (samples_in_bin). - if (cnt == this->cache_size) - { - float_type minimum = numeric::fdiv((min)(args),(std::size_t)1); - float_type maximum = numeric::fdiv((max)(args),(std::size_t)1); - float_type bin_size = numeric::fdiv(maximum - minimum, this->num_bins); - - // determine bin positions (their lower bounds) - for (std::size_t i = 0; i < this->num_bins + 2; ++i) - { - this->bin_positions[i] = minimum + (i - 1.) * bin_size; - } - - for (typename histogram_type::const_iterator iter = this->cache.begin(); iter != this->cache.end(); ++iter) - { - if (iter->first < this->bin_positions[1]) - { - this->samples_in_bin[0] += iter->second; - } - else if (iter->first >= this->bin_positions[this->num_bins + 1]) - { - this->samples_in_bin[this->num_bins + 1] += iter->second; - } - else - { - typename array_type::iterator it = std::upper_bound( - this->bin_positions.begin() - , this->bin_positions.end() - , iter->first - ); - - std::size_t d = std::distance(this->bin_positions.begin(), it); - this->samples_in_bin[d - 1] += iter->second; - } - } - } - // Add each subsequent sample to the correct bin - else if (cnt > this->cache_size) - { - if (args[sample] < this->bin_positions[1]) - { - this->samples_in_bin[0] += args[weight]; - } - else if (args[sample] >= this->bin_positions[this->num_bins + 1]) - { - this->samples_in_bin[this->num_bins + 1] += args[weight]; - } - else - { - typename array_type::iterator it = std::upper_bound( - this->bin_positions.begin() - , this->bin_positions.end() - , args[sample] - ); - - std::size_t d = std::distance(this->bin_positions.begin(), it); - this->samples_in_bin[d - 1] += args[weight]; - } - } - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - // creates a vector of std::pair where each pair i holds - // the values bin_positions[i] (x-axis of histogram) and - // samples_in_bin[i] / cnt (y-axis of histogram). - - for (std::size_t i = 0; i < this->num_bins + 2; ++i) - { - this->histogram[i] = std::make_pair(this->bin_positions[i], numeric::fdiv(this->samples_in_bin[i], sum_of_weights(args))); - } - } - - // returns a range of pairs - return make_iterator_range(this->histogram); - } - - private: - std::size_t cache_size; // number of cached samples - histogram_type cache; // cache to store the first cache_size samples with their weights as std::pair - std::size_t num_bins; // number of bins - array_type samples_in_bin; // number of samples in each bin - array_type bin_positions; // lower bounds of bins - mutable histogram_type histogram; // histogram - mutable bool is_dirty; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_density -// -namespace tag -{ - struct weighted_density - : depends_on<count, sum_of_weights, min, max> - , density_cache_size - , density_num_bins - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_density_impl<mpl::_1, mpl::_2> impl; - - #ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED - static boost::parameter::keyword<density_cache_size> const cache_size; - static boost::parameter::keyword<density_num_bins> const num_bins; - #endif - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_density -// -namespace extract -{ - extractor<tag::density> const weighted_density = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_density) -} - -using extract::weighted_density; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_extended_p_square.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_extended_p_square.hpp deleted file mode 100644 index ac857e056d..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_extended_p_square.hpp +++ /dev/null @@ -1,290 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_extended_p_square.hpp -// -// Copyright 2005 Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_EXTENDED_P_SQUARE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_EXTENDED_P_SQUARE_HPP_DE_01_01_2006 - -#include <vector> -#include <functional> -#include <boost/range/begin.hpp> -#include <boost/range/end.hpp> -#include <boost/range/iterator_range.hpp> -#include <boost/iterator/transform_iterator.hpp> -#include <boost/iterator/counting_iterator.hpp> -#include <boost/iterator/permutation_iterator.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/times2_iterator.hpp> -#include <boost/accumulators/statistics/extended_p_square.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_extended_p_square_impl - // multiple quantile estimation with weighted samples - /** - @brief Multiple quantile estimation with the extended \f$P^2\f$ algorithm for weighted samples - - This version of the extended \f$P^2\f$ algorithm extends the extended \f$P^2\f$ algorithm to - support weighted samples. The extended \f$P^2\f$ algorithm dynamically estimates several - quantiles without storing samples. Assume that \f$m\f$ quantiles - \f$\xi_{p_1}, \ldots, \xi_{p_m}\f$ are to be estimated. Instead of storing the whole sample - cumulative distribution, the algorithm maintains only \f$m+2\f$ principal markers and - \f$m+1\f$ middle markers, whose positions are updated with each sample and whose heights - are adjusted (if necessary) using a piecewise-parablic formula. The heights of the principal - markers are the current estimates of the quantiles and are returned as an iterator range. - - For further details, see - - K. E. E. Raatikainen, Simultaneous estimation of several quantiles, Simulation, Volume 49, - Number 4 (October), 1986, p. 159-164. - - The extended \f$ P^2 \f$ algorithm generalizes the \f$ P^2 \f$ algorithm of - - R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param extended_p_square_probabilities A vector of quantile probabilities. - */ - template<typename Sample, typename Weight> - struct weighted_extended_p_square_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - typedef typename numeric::functional::fdiv<weighted_sample, std::size_t>::result_type float_type; - typedef std::vector<float_type> array_type; - // for boost::result_of - typedef iterator_range< - detail::lvalue_index_iterator< - permutation_iterator< - typename array_type::const_iterator - , detail::times2_iterator - > - > - > result_type; - - template<typename Args> - weighted_extended_p_square_impl(Args const &args) - : probabilities( - boost::begin(args[extended_p_square_probabilities]) - , boost::end(args[extended_p_square_probabilities]) - ) - , heights(2 * probabilities.size() + 3) - , actual_positions(heights.size()) - , desired_positions(heights.size()) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - std::size_t sample_cell = 1; // k - std::size_t num_quantiles = this->probabilities.size(); - - // m+2 principal markers and m+1 middle markers - std::size_t num_markers = 2 * num_quantiles + 3; - - // first accumulate num_markers samples - if(cnt <= num_markers) - { - this->heights[cnt - 1] = args[sample]; - this->actual_positions[cnt - 1] = args[weight]; - - // complete the initialization of heights (and actual_positions) by sorting - if(cnt == num_markers) - { - // TODO: we need to sort the initial samples (in heights) in ascending order and - // sort their weights (in actual_positions) the same way. The following lines do - // it, but there must be a better and more efficient way of doing this. - typename array_type::iterator it_begin, it_end, it_min; - - it_begin = this->heights.begin(); - it_end = this->heights.end(); - - std::size_t pos = 0; - - while (it_begin != it_end) - { - it_min = std::min_element(it_begin, it_end); - std::size_t d = std::distance(it_begin, it_min); - std::swap(*it_begin, *it_min); - std::swap(this->actual_positions[pos], this->actual_positions[pos + d]); - ++it_begin; - ++pos; - } - - // calculate correct initial actual positions - for (std::size_t i = 1; i < num_markers; ++i) - { - actual_positions[i] += actual_positions[i - 1]; - } - } - } - else - { - if(args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - this->actual_positions[0] = args[weight]; - sample_cell = 1; - } - else if(args[sample] >= this->heights[num_markers - 1]) - { - this->heights[num_markers - 1] = args[sample]; - sample_cell = num_markers - 1; - } - else - { - // find cell k = sample_cell such that heights[k-1] <= sample < heights[k] - - typedef typename array_type::iterator iterator; - iterator it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // update actual position of all markers above sample_cell - for(std::size_t i = sample_cell; i < num_markers; ++i) - { - this->actual_positions[i] += args[weight]; - } - - // compute desired positions - { - this->desired_positions[0] = this->actual_positions[0]; - this->desired_positions[num_markers - 1] = sum_of_weights(args); - this->desired_positions[1] = (sum_of_weights(args) - this->actual_positions[0]) * probabilities[0] - / 2. + this->actual_positions[0]; - this->desired_positions[num_markers - 2] = (sum_of_weights(args) - this->actual_positions[0]) - * (probabilities[num_quantiles - 1] + 1.) - / 2. + this->actual_positions[0]; - - for (std::size_t i = 0; i < num_quantiles; ++i) - { - this->desired_positions[2 * i + 2] = (sum_of_weights(args) - this->actual_positions[0]) - * probabilities[i] + this->actual_positions[0]; - } - - for (std::size_t i = 1; i < num_quantiles; ++i) - { - this->desired_positions[2 * i + 1] = (sum_of_weights(args) - this->actual_positions[0]) - * (probabilities[i - 1] + probabilities[i]) - / 2. + this->actual_positions[0]; - } - } - - // adjust heights and actual_positions of markers 1 to num_markers - 2 if necessary - for (std::size_t i = 1; i <= num_markers - 2; ++i) - { - // offset to desired position - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if((d >= 1 && dp > 1) || (d <= -1 && dm < -1)) - { - short sign_d = static_cast<short>(d / std::abs(d)); - - float_type h = this->heights[i] + sign_d / (dp - dm) * ((sign_d - dm)*hp + (dp - sign_d) * hm); - - // try adjusting heights[i] using p-squared formula - if(this->heights[i - 1] < h && h < this->heights[i + 1]) - { - this->heights[i] = h; - } - else - { - // use linear formula - if(d > 0) - { - this->heights[i] += hp; - } - if(d < 0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - result_type result(dont_care) const - { - // for i in [1,probabilities.size()], return heights[i * 2] - detail::times2_iterator idx_begin = detail::make_times2_iterator(1); - detail::times2_iterator idx_end = detail::make_times2_iterator(this->probabilities.size() + 1); - - return result_type( - make_permutation_iterator(this->heights.begin(), idx_begin) - , make_permutation_iterator(this->heights.begin(), idx_end) - ); - } - - private: - array_type probabilities; // the quantile probabilities - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // d_i - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_extended_p_square -// -namespace tag -{ - struct weighted_extended_p_square - : depends_on<count, sum_of_weights> - , extended_p_square_probabilities - { - typedef accumulators::impl::weighted_extended_p_square_impl<mpl::_1, mpl::_2> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_extended_p_square -// -namespace extract -{ - extractor<tag::weighted_extended_p_square> const weighted_extended_p_square = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_extended_p_square) -} - -using extract::weighted_extended_p_square; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_kurtosis.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_kurtosis.hpp deleted file mode 100644 index 3fd4ed7b41..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_kurtosis.hpp +++ /dev/null @@ -1,105 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_kurtosis.hpp -// -// Copyright 2006 Olivier Gygi, Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_KURTOSIS_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_KURTOSIS_HPP_EAN_28_10_2005 - -#include <limits> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/weighted_moment.hpp> -#include <boost/accumulators/statistics/weighted_mean.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_kurtosis_impl - /** - @brief Kurtosis estimation for weighted samples - - The kurtosis of a sample distribution is defined as the ratio of the 4th central moment and the square of the 2nd central - moment (the variance) of the samples, minus 3. The term \f$ -3 \f$ is added in order to ensure that the normal distribution - has zero kurtosis. The kurtosis can also be expressed by the simple moments: - - \f[ - \hat{g}_2 = - \frac - {\widehat{m}_n^{(4)}-4\widehat{m}_n^{(3)}\hat{\mu}_n+6\widehat{m}_n^{(2)}\hat{\mu}_n^2-3\hat{\mu}_n^4} - {\left(\widehat{m}_n^{(2)} - \hat{\mu}_n^{2}\right)^2} - 3, - \f] - - where \f$ \widehat{m}_n^{(i)} \f$ are the \f$ i \f$-th moment and \f$ \hat{\mu}_n \f$ the mean (first moment) of the - \f$ n \f$ samples. - - The kurtosis estimator for weighted samples is formally identical to the estimator for unweighted samples, except that - the weighted counterparts of all measures it depends on are to be taken. - */ - template<typename Sample, typename Weight> - struct weighted_kurtosis_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - // for boost::result_of - typedef typename numeric::functional::fdiv<weighted_sample, weighted_sample>::result_type result_type; - - weighted_kurtosis_impl(dont_care) - { - } - - template<typename Args> - result_type result(Args const &args) const - { - return numeric::fdiv( - accumulators::weighted_moment<4>(args) - - 4. * accumulators::weighted_moment<3>(args) * weighted_mean(args) - + 6. * accumulators::weighted_moment<2>(args) * weighted_mean(args) * weighted_mean(args) - - 3. * weighted_mean(args) * weighted_mean(args) * weighted_mean(args) * weighted_mean(args) - , ( accumulators::weighted_moment<2>(args) - weighted_mean(args) * weighted_mean(args) ) - * ( accumulators::weighted_moment<2>(args) - weighted_mean(args) * weighted_mean(args) ) - ) - 3.; - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_kurtosis -// -namespace tag -{ - struct weighted_kurtosis - : depends_on<weighted_mean, weighted_moment<2>, weighted_moment<3>, weighted_moment<4> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_kurtosis_impl<mpl::_1, mpl::_2> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_kurtosis -// -namespace extract -{ - extractor<tag::weighted_kurtosis> const weighted_kurtosis = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_kurtosis) -} - -using extract::weighted_kurtosis; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_mean.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_mean.hpp deleted file mode 100644 index a80ef0984c..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_mean.hpp +++ /dev/null @@ -1,189 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_mean.hpp -// -// Copyright 2006 Eric Niebler, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_MEAN_HPP_EAN_03_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_MEAN_HPP_EAN_03_11_2005 - -#include <boost/mpl/assert.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/weights.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/mean.hpp> -#include <boost/accumulators/statistics/weighted_sum.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_mean_impl - // lazy, by default - template<typename Sample, typename Weight, typename Tag> - struct weighted_mean_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - // for boost::result_of - typedef typename numeric::functional::fdiv<weighted_sample, Weight>::result_type result_type; - - weighted_mean_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - typedef - typename mpl::if_< - is_same<Tag, tag::sample> - , tag::weighted_sum - , tag::weighted_sum_of_variates<Sample, Tag> - >::type - weighted_sum_tag; - - extractor<weighted_sum_tag> const some_weighted_sum = {}; - - return numeric::fdiv(some_weighted_sum(args), sum_of_weights(args)); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // immediate_weighted_mean_impl - // immediate - template<typename Sample, typename Weight, typename Tag> - struct immediate_weighted_mean_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - // for boost::result_of - typedef typename numeric::functional::fdiv<weighted_sample, Weight>::result_type result_type; - - template<typename Args> - immediate_weighted_mean_impl(Args const &args) - : mean( - numeric::fdiv( - args[parameter::keyword<Tag>::get() | Sample()] - * numeric::one<Weight>::value - , numeric::one<Weight>::value - ) - ) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - // Matthias: - // need to pass the argument pack since the weight might be an external - // accumulator set passed as a named parameter - Weight w_sum = sum_of_weights(args); - Weight w = args[weight]; - weighted_sample const &s = args[parameter::keyword<Tag>::get()] * w; - this->mean = numeric::fdiv(this->mean * (w_sum - w) + s, w_sum); - } - - result_type result(dont_care) const - { - return this->mean; - } - - private: - result_type mean; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_mean -// tag::immediate_weighted_mean -// -namespace tag -{ - struct weighted_mean - : depends_on<sum_of_weights, weighted_sum> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_mean_impl<mpl::_1, mpl::_2, tag::sample> impl; - }; - struct immediate_weighted_mean - : depends_on<sum_of_weights> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::immediate_weighted_mean_impl<mpl::_1, mpl::_2, tag::sample> impl; - }; - template<typename VariateType, typename VariateTag> - struct weighted_mean_of_variates - : depends_on<sum_of_weights, weighted_sum_of_variates<VariateType, VariateTag> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_mean_impl<VariateType, mpl::_2, VariateTag> impl; - }; - template<typename VariateType, typename VariateTag> - struct immediate_weighted_mean_of_variates - : depends_on<sum_of_weights> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::immediate_weighted_mean_impl<VariateType, mpl::_2, VariateTag> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_mean -// extract::weighted_mean_of_variates -// -namespace extract -{ - extractor<tag::mean> const weighted_mean = {}; - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, weighted_mean_of_variates, (typename)(typename)) - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_mean) -} - -using extract::weighted_mean; -using extract::weighted_mean_of_variates; - -// weighted_mean(lazy) -> weighted_mean -template<> -struct as_feature<tag::weighted_mean(lazy)> -{ - typedef tag::weighted_mean type; -}; - -// weighted_mean(immediate) -> immediate_weighted_mean -template<> -struct as_feature<tag::weighted_mean(immediate)> -{ - typedef tag::immediate_weighted_mean type; -}; - -// weighted_mean_of_variates<VariateType, VariateTag>(lazy) -> weighted_mean_of_variates<VariateType, VariateTag> -template<typename VariateType, typename VariateTag> -struct as_feature<tag::weighted_mean_of_variates<VariateType, VariateTag>(lazy)> -{ - typedef tag::weighted_mean_of_variates<VariateType, VariateTag> type; -}; - -// weighted_mean_of_variates<VariateType, VariateTag>(immediate) -> immediate_weighted_mean_of_variates<VariateType, VariateTag> -template<typename VariateType, typename VariateTag> -struct as_feature<tag::weighted_mean_of_variates<VariateType, VariateTag>(immediate)> -{ - typedef tag::immediate_weighted_mean_of_variates<VariateType, VariateTag> type; -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_median.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_median.hpp deleted file mode 100644 index ed7cadb331..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_median.hpp +++ /dev/null @@ -1,237 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_median.hpp -// -// Copyright 2006 Eric Niebler, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_MEDIAN_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_MEDIAN_HPP_EAN_28_10_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/range/iterator_range.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/median.hpp> -#include <boost/accumulators/statistics/weighted_p_square_quantile.hpp> -#include <boost/accumulators/statistics/weighted_density.hpp> -#include <boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_median_impl - // - /** - @brief Median estimation for weighted samples based on the \f$P^2\f$ quantile estimator - - The \f$P^2\f$ algorithm for weighted samples is invoked with a quantile probability of 0.5. - */ - template<typename Sample> - struct weighted_median_impl - : accumulator_base - { - // for boost::result_of - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type result_type; - - weighted_median_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - return weighted_p_square_quantile_for_median(args); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // with_density_weighted_median_impl - // - /** - @brief Median estimation for weighted samples based on the density estimator - - The algorithm determines the bin in which the \f$0.5*cnt\f$-th sample lies, \f$cnt\f$ being - the total number of samples. It returns the approximate horizontal position of this sample, - based on a linear interpolation inside the bin. - */ - template<typename Sample> - struct with_density_weighted_median_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Sample, std::size_t>::result_type float_type; - typedef std::vector<std::pair<float_type, float_type> > histogram_type; - typedef iterator_range<typename histogram_type::iterator> range_type; - // for boost::result_of - typedef float_type result_type; - - template<typename Args> - with_density_weighted_median_impl(Args const &args) - : sum(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , is_dirty(true) - { - } - - void operator ()(dont_care) - { - this->is_dirty = true; - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - std::size_t cnt = count(args); - range_type histogram = weighted_density(args); - typename range_type::iterator it = histogram.begin(); - while (this->sum < 0.5 * cnt) - { - this->sum += it->second * cnt; - ++it; - } - --it; - float_type over = numeric::fdiv(this->sum - 0.5 * cnt, it->second * cnt); - this->median = it->first * over + (it + 1)->first * ( 1. - over ); - } - - return this->median; - } - - private: - mutable float_type sum; - mutable bool is_dirty; - mutable float_type median; - }; - - /////////////////////////////////////////////////////////////////////////////// - // with_p_square_cumulative_distribution_weighted_median_impl - // - /** - @brief Median estimation for weighted samples based on the \f$P^2\f$ cumulative distribution estimator - - The algorithm determines the first (leftmost) bin with a height exceeding 0.5. It - returns the approximate horizontal position of where the cumulative distribution - equals 0.5, based on a linear interpolation inside the bin. - */ - template<typename Sample, typename Weight> - struct with_p_square_cumulative_distribution_weighted_median_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - typedef typename numeric::functional::fdiv<weighted_sample, std::size_t>::result_type float_type; - typedef std::vector<std::pair<float_type, float_type> > histogram_type; - typedef iterator_range<typename histogram_type::iterator> range_type; - // for boost::result_of - typedef float_type result_type; - - with_p_square_cumulative_distribution_weighted_median_impl(dont_care) - : is_dirty(true) - { - } - - void operator ()(dont_care) - { - this->is_dirty = true; - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - range_type histogram = weighted_p_square_cumulative_distribution(args); - typename range_type::iterator it = histogram.begin(); - while (it->second < 0.5) - { - ++it; - } - float_type over = numeric::fdiv(it->second - 0.5, it->second - (it - 1)->second); - this->median = it->first * over + (it + 1)->first * ( 1. - over ); - } - - return this->median; - } - private: - mutable bool is_dirty; - mutable float_type median; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_median -// tag::with_density_weighted_median -// tag::with_p_square_cumulative_distribution_weighted_median -// -namespace tag -{ - struct weighted_median - : depends_on<weighted_p_square_quantile_for_median> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_median_impl<mpl::_1> impl; - }; - struct with_density_weighted_median - : depends_on<count, weighted_density> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::with_density_weighted_median_impl<mpl::_1> impl; - }; - struct with_p_square_cumulative_distribution_weighted_median - : depends_on<weighted_p_square_cumulative_distribution> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::with_p_square_cumulative_distribution_weighted_median_impl<mpl::_1, mpl::_2> impl; - }; - -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_median -// -namespace extract -{ - extractor<tag::median> const weighted_median = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_median) -} - -using extract::weighted_median; -// weighted_median(with_p_square_quantile) -> weighted_median -template<> -struct as_feature<tag::weighted_median(with_p_square_quantile)> -{ - typedef tag::weighted_median type; -}; - -// weighted_median(with_density) -> with_density_weighted_median -template<> -struct as_feature<tag::weighted_median(with_density)> -{ - typedef tag::with_density_weighted_median type; -}; - -// weighted_median(with_p_square_cumulative_distribution) -> with_p_square_cumulative_distribution_weighted_median -template<> -struct as_feature<tag::weighted_median(with_p_square_cumulative_distribution)> -{ - typedef tag::with_p_square_cumulative_distribution_weighted_median type; -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_moment.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_moment.hpp deleted file mode 100644 index 011701c704..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_moment.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_moment.hpp -// -// Copyright 2006, Eric Niebler, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_MOMENT_HPP_EAN_15_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_MOMENT_HPP_EAN_15_11_2005 - -#include <boost/config/no_tr1/cmath.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/moment.hpp> // for pow() -#include <boost/accumulators/statistics/sum.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_moment_impl - template<typename N, typename Sample, typename Weight> - struct weighted_moment_impl - : accumulator_base // TODO: also depends_on sum of powers - { - BOOST_MPL_ASSERT_RELATION(N::value, >, 0); - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - // for boost::result_of - typedef typename numeric::functional::fdiv<weighted_sample, Weight>::result_type result_type; - - template<typename Args> - weighted_moment_impl(Args const &args) - : sum(args[sample | Sample()] * numeric::one<Weight>::value) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - this->sum += args[weight] * numeric::pow(args[sample], N()); - } - - template<typename Args> - result_type result(Args const &args) const - { - return numeric::fdiv(this->sum, sum_of_weights(args)); - } - - private: - weighted_sample sum; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_moment -// -namespace tag -{ - template<int N> - struct weighted_moment - : depends_on<count, sum_of_weights> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_moment_impl<mpl::int_<N>, mpl::_1, mpl::_2> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_moment -// -namespace extract -{ - BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, weighted_moment, (int)) -} - -using extract::weighted_moment; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp deleted file mode 100644 index ce750ed1f5..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp +++ /dev/null @@ -1,262 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_p_square_cumul_dist.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMUL_DIST_HPP_DE_01_01_2006 - -#include <vector> -#include <functional> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/range.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/p_square_cumul_dist.hpp> // for named parameter p_square_cumulative_distribution_num_cells - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_p_square_cumulative_distribution_impl - // cumulative distribution calculation (as histogram) - /** - @brief Histogram calculation of the cumulative distribution with the \f$P^2\f$ algorithm for weighted samples - - A histogram of the sample cumulative distribution is computed dynamically without storing samples - based on the \f$ P^2 \f$ algorithm for weighted samples. The returned histogram has a specifiable - amount (num_cells) equiprobable (and not equal-sized) cells. - - Note that applying importance sampling results in regions to be more and other regions to be less - accurately estimated than without importance sampling, i.e., with unweighted samples. - - For further details, see - - R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param p_square_cumulative_distribution_num_cells - */ - template<typename Sample, typename Weight> - struct weighted_p_square_cumulative_distribution_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - typedef typename numeric::functional::fdiv<weighted_sample, std::size_t>::result_type float_type; - typedef std::vector<std::pair<float_type, float_type> > histogram_type; - typedef std::vector<float_type> array_type; - // for boost::result_of - typedef iterator_range<typename histogram_type::iterator> result_type; - - template<typename Args> - weighted_p_square_cumulative_distribution_impl(Args const &args) - : num_cells(args[p_square_cumulative_distribution_num_cells]) - , heights(num_cells + 1) - , actual_positions(num_cells + 1) - , desired_positions(num_cells + 1) - , histogram(num_cells + 1) - , is_dirty(true) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - this->is_dirty = true; - - std::size_t cnt = count(args); - std::size_t sample_cell = 1; // k - std::size_t b = this->num_cells; - - // accumulate num_cells + 1 first samples - if (cnt <= b + 1) - { - this->heights[cnt - 1] = args[sample]; - this->actual_positions[cnt - 1] = args[weight]; - - // complete the initialization of heights by sorting - if (cnt == b + 1) - { - //std::sort(this->heights.begin(), this->heights.end()); - - // TODO: we need to sort the initial samples (in heights) in ascending order and - // sort their weights (in actual_positions) the same way. The following lines do - // it, but there must be a better and more efficient way of doing this. - typename array_type::iterator it_begin, it_end, it_min; - - it_begin = this->heights.begin(); - it_end = this->heights.end(); - - std::size_t pos = 0; - - while (it_begin != it_end) - { - it_min = std::min_element(it_begin, it_end); - std::size_t d = std::distance(it_begin, it_min); - std::swap(*it_begin, *it_min); - std::swap(this->actual_positions[pos], this->actual_positions[pos + d]); - ++it_begin; - ++pos; - } - - // calculate correct initial actual positions - for (std::size_t i = 1; i < b; ++i) - { - this->actual_positions[i] += this->actual_positions[i - 1]; - } - } - } - else - { - // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values - if (args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - this->actual_positions[0] = args[weight]; - sample_cell = 1; - } - else if (this->heights[b] <= args[sample]) - { - this->heights[b] = args[sample]; - sample_cell = b; - } - else - { - typename array_type::iterator it; - it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // increment positions of markers above sample_cell - for (std::size_t i = sample_cell; i < b + 1; ++i) - { - this->actual_positions[i] += args[weight]; - } - - // determine desired marker positions - for (std::size_t i = 1; i < b + 1; ++i) - { - this->desired_positions[i] = this->actual_positions[0] - + numeric::fdiv((i-1) * (sum_of_weights(args) - this->actual_positions[0]), b); - } - - // adjust heights of markers 2 to num_cells if necessary - for (std::size_t i = 1; i < b; ++i) - { - // offset to desire position - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) - { - short sign_d = static_cast<short>(d / std::abs(d)); - - // try adjusting heights[i] using p-squared formula - float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); - - if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) - { - this->heights[i] = h; - } - else - { - // use linear formula - if (d>0) - { - this->heights[i] += hp; - } - if (d<0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty) - { - this->is_dirty = false; - - // creates a vector of std::pair where each pair i holds - // the values heights[i] (x-axis of histogram) and - // actual_positions[i] / sum_of_weights (y-axis of histogram) - - for (std::size_t i = 0; i < this->histogram.size(); ++i) - { - this->histogram[i] = std::make_pair(this->heights[i], numeric::fdiv(this->actual_positions[i], sum_of_weights(args))); - } - } - - return make_iterator_range(this->histogram); - } - - private: - std::size_t num_cells; // number of cells b - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // n'_i - mutable histogram_type histogram; // histogram - mutable bool is_dirty; - }; - -} // namespace detail - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_p_square_cumulative_distribution -// -namespace tag -{ - struct weighted_p_square_cumulative_distribution - : depends_on<count, sum_of_weights> - , p_square_cumulative_distribution_num_cells - { - typedef accumulators::impl::weighted_p_square_cumulative_distribution_impl<mpl::_1, mpl::_2> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_p_square_cumulative_distribution -// -namespace extract -{ - extractor<tag::weighted_p_square_cumulative_distribution> const weighted_p_square_cumulative_distribution = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_p_square_cumulative_distribution) -} - -using extract::weighted_p_square_cumulative_distribution; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp deleted file mode 100644 index 918970e8dc..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_cumulative_distribution.hpp +++ /dev/null @@ -1,19 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_p_square_cumulative_distribution.hpp -// -// Copyright 2012 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_CUMULATIVE_DISTRIBUTION_HPP_03_19_2012 - -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) -# pragma message ("Warning: This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp") -#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) -# warning "This header is deprecated. Please use: boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp" -#endif - -#include <boost/accumulators/statistics/weighted_p_square_cumul_dist.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_quantile.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_quantile.hpp deleted file mode 100644 index 2ebc7b1845..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_p_square_quantile.hpp +++ /dev/null @@ -1,255 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_p_square_quantile.hpp -// -// Copyright 2005 Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_QUANTILE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_P_SQUARE_QUANTILE_HPP_DE_01_01_2006 - -#include <cmath> -#include <functional> -#include <boost/array.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl { - /////////////////////////////////////////////////////////////////////////////// - // weighted_p_square_quantile_impl - // single quantile estimation with weighted samples - /** - @brief Single quantile estimation with the \f$P^2\f$ algorithm for weighted samples - - This version of the \f$P^2\f$ algorithm extends the \f$P^2\f$ algorithm to support weighted samples. - The \f$P^2\f$ algorithm estimates a quantile dynamically without storing samples. Instead of - storing the whole sample cumulative distribution, only five points (markers) are stored. The heights - of these markers are the minimum and the maximum of the samples and the current estimates of the - \f$(p/2)\f$-, \f$p\f$ - and \f$(1+p)/2\f$ -quantiles. Their positions are equal to the number - of samples that are smaller or equal to the markers. Each time a new sample is added, the - positions of the markers are updated and if necessary their heights are adjusted using a piecewise- - parabolic formula. - - For further details, see - - R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and - histograms without storing observations, Communications of the ACM, - Volume 28 (October), Number 10, 1985, p. 1076-1085. - - @param quantile_probability - */ - template<typename Sample, typename Weight, typename Impl> - struct weighted_p_square_quantile_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - typedef typename numeric::functional::fdiv<weighted_sample, std::size_t>::result_type float_type; - typedef array<float_type, 5> array_type; - // for boost::result_of - typedef float_type result_type; - - template<typename Args> - weighted_p_square_quantile_impl(Args const &args) - : p(is_same<Impl, for_median>::value ? 0.5 : args[quantile_probability | 0.5]) - , heights() - , actual_positions() - , desired_positions() - { - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - - // accumulate 5 first samples - if (cnt <= 5) - { - this->heights[cnt - 1] = args[sample]; - - // In this initialization phase, actual_positions stores the weights of the - // initial samples that are needed at the end of the initialization phase to - // compute the correct initial positions of the markers. - this->actual_positions[cnt - 1] = args[weight]; - - // complete the initialization of heights and actual_positions by sorting - if (cnt == 5) - { - // TODO: we need to sort the initial samples (in heights) in ascending order and - // sort their weights (in actual_positions) the same way. The following lines do - // it, but there must be a better and more efficient way of doing this. - typename array_type::iterator it_begin, it_end, it_min; - - it_begin = this->heights.begin(); - it_end = this->heights.end(); - - std::size_t pos = 0; - - while (it_begin != it_end) - { - it_min = std::min_element(it_begin, it_end); - std::size_t d = std::distance(it_begin, it_min); - std::swap(*it_begin, *it_min); - std::swap(this->actual_positions[pos], this->actual_positions[pos + d]); - ++it_begin; - ++pos; - } - - // calculate correct initial actual positions - for (std::size_t i = 1; i < 5; ++i) - { - this->actual_positions[i] += this->actual_positions[i - 1]; - } - } - } - else - { - std::size_t sample_cell = 1; // k - - // find cell k such that heights[k-1] <= args[sample] < heights[k] and adjust extreme values - if (args[sample] < this->heights[0]) - { - this->heights[0] = args[sample]; - this->actual_positions[0] = args[weight]; - sample_cell = 1; - } - else if (this->heights[4] <= args[sample]) - { - this->heights[4] = args[sample]; - sample_cell = 4; - } - else - { - typedef typename array_type::iterator iterator; - iterator it = std::upper_bound( - this->heights.begin() - , this->heights.end() - , args[sample] - ); - - sample_cell = std::distance(this->heights.begin(), it); - } - - // increment positions of markers above sample_cell - for (std::size_t i = sample_cell; i < 5; ++i) - { - this->actual_positions[i] += args[weight]; - } - - // update desired positions for all markers - this->desired_positions[0] = this->actual_positions[0]; - this->desired_positions[1] = (sum_of_weights(args) - this->actual_positions[0]) - * this->p/2. + this->actual_positions[0]; - this->desired_positions[2] = (sum_of_weights(args) - this->actual_positions[0]) - * this->p + this->actual_positions[0]; - this->desired_positions[3] = (sum_of_weights(args) - this->actual_positions[0]) - * (1. + this->p)/2. + this->actual_positions[0]; - this->desired_positions[4] = sum_of_weights(args); - - // adjust height and actual positions of markers 1 to 3 if necessary - for (std::size_t i = 1; i <= 3; ++i) - { - // offset to desired positions - float_type d = this->desired_positions[i] - this->actual_positions[i]; - - // offset to next position - float_type dp = this->actual_positions[i + 1] - this->actual_positions[i]; - - // offset to previous position - float_type dm = this->actual_positions[i - 1] - this->actual_positions[i]; - - // height ds - float_type hp = (this->heights[i + 1] - this->heights[i]) / dp; - float_type hm = (this->heights[i - 1] - this->heights[i]) / dm; - - if ( ( d >= 1. && dp > 1. ) || ( d <= -1. && dm < -1. ) ) - { - short sign_d = static_cast<short>(d / std::abs(d)); - - // try adjusting heights[i] using p-squared formula - float_type h = this->heights[i] + sign_d / (dp - dm) * ( (sign_d - dm) * hp + (dp - sign_d) * hm ); - - if ( this->heights[i - 1] < h && h < this->heights[i + 1] ) - { - this->heights[i] = h; - } - else - { - // use linear formula - if (d>0) - { - this->heights[i] += hp; - } - if (d<0) - { - this->heights[i] -= hm; - } - } - this->actual_positions[i] += sign_d; - } - } - } - } - - result_type result(dont_care) const - { - return this->heights[2]; - } - - private: - float_type p; // the quantile probability p - array_type heights; // q_i - array_type actual_positions; // n_i - array_type desired_positions; // n'_i - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_p_square_quantile -// -namespace tag -{ - struct weighted_p_square_quantile - : depends_on<count, sum_of_weights> - { - typedef accumulators::impl::weighted_p_square_quantile_impl<mpl::_1, mpl::_2, regular> impl; - }; - struct weighted_p_square_quantile_for_median - : depends_on<count, sum_of_weights> - { - typedef accumulators::impl::weighted_p_square_quantile_impl<mpl::_1, mpl::_2, for_median> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_p_square_quantile -// extract::weighted_p_square_quantile_for_median -// -namespace extract -{ - extractor<tag::weighted_p_square_quantile> const weighted_p_square_quantile = {}; - extractor<tag::weighted_p_square_quantile_for_median> const weighted_p_square_quantile_for_median = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_p_square_quantile) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_p_square_quantile_for_median) -} - -using extract::weighted_p_square_quantile; -using extract::weighted_p_square_quantile_for_median; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp deleted file mode 100644 index 418b38cfe0..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_peaks_over_threshold.hpp +++ /dev/null @@ -1,289 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_peaks_over_threshold.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_PEAKS_OVER_THRESHOLD_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_PEAKS_OVER_THRESHOLD_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <numeric> -#include <functional> -#include <boost/throw_exception.hpp> -#include <boost/range.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> -#include <boost/accumulators/statistics/peaks_over_threshold.hpp> // for named parameters pot_threshold_value and pot_threshold_probability -#include <boost/accumulators/statistics/sum.hpp> -#include <boost/accumulators/statistics/tail_variate.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost { namespace accumulators -{ - -namespace impl -{ - - /////////////////////////////////////////////////////////////////////////////// - // weighted_peaks_over_threshold_impl - // works with an explicit threshold value and does not depend on order statistics of weighted samples - /** - @brief Weighted Peaks over Threshold Method for Weighted Quantile and Weighted Tail Mean Estimation - - @sa peaks_over_threshold_impl - - @param quantile_probability - @param pot_threshold_value - */ - template<typename Sample, typename Weight, typename LeftRight> - struct weighted_peaks_over_threshold_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Weight, Sample>::result_type weighted_sample; - typedef typename numeric::functional::fdiv<weighted_sample, std::size_t>::result_type float_type; - // for boost::result_of - typedef boost::tuple<float_type, float_type, float_type> result_type; - - template<typename Args> - weighted_peaks_over_threshold_impl(Args const &args) - : sign_((is_same<LeftRight, left>::value) ? -1 : 1) - , mu_(sign_ * numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , sigma2_(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , w_sum_(numeric::fdiv(args[weight | Weight()], (std::size_t)1)) - , threshold_(sign_ * args[pot_threshold_value]) - , fit_parameters_(boost::make_tuple(0., 0., 0.)) - , is_dirty_(true) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - this->is_dirty_ = true; - - if (this->sign_ * args[sample] > this->threshold_) - { - this->mu_ += args[weight] * args[sample]; - this->sigma2_ += args[weight] * args[sample] * args[sample]; - this->w_sum_ += args[weight]; - } - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty_) - { - this->is_dirty_ = false; - - this->mu_ = this->sign_ * numeric::fdiv(this->mu_, this->w_sum_); - this->sigma2_ = numeric::fdiv(this->sigma2_, this->w_sum_); - this->sigma2_ -= this->mu_ * this->mu_; - - float_type threshold_probability = numeric::fdiv(sum_of_weights(args) - this->w_sum_, sum_of_weights(args)); - - float_type tmp = numeric::fdiv(( this->mu_ - this->threshold_ )*( this->mu_ - this->threshold_ ), this->sigma2_); - float_type xi_hat = 0.5 * ( 1. - tmp ); - float_type beta_hat = 0.5 * ( this->mu_ - this->threshold_ ) * ( 1. + tmp ); - float_type beta_bar = beta_hat * std::pow(1. - threshold_probability, xi_hat); - float_type u_bar = this->threshold_ - beta_bar * ( std::pow(1. - threshold_probability, -xi_hat) - 1.)/xi_hat; - this->fit_parameters_ = boost::make_tuple(u_bar, beta_bar, xi_hat); - } - - return this->fit_parameters_; - } - - private: - short sign_; // for left tail fitting, mirror the extreme values - mutable float_type mu_; // mean of samples above threshold - mutable float_type sigma2_; // variance of samples above threshold - mutable float_type w_sum_; // sum of weights of samples above threshold - float_type threshold_; - mutable result_type fit_parameters_; // boost::tuple that stores fit parameters - mutable bool is_dirty_; - }; - - /////////////////////////////////////////////////////////////////////////////// - // weighted_peaks_over_threshold_prob_impl - // determines threshold from a given threshold probability using order statistics - /** - @brief Peaks over Threshold Method for Quantile and Tail Mean Estimation - - @sa weighted_peaks_over_threshold_impl - - @param quantile_probability - @param pot_threshold_probability - */ - template<typename Sample, typename Weight, typename LeftRight> - struct weighted_peaks_over_threshold_prob_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Weight, Sample>::result_type weighted_sample; - typedef typename numeric::functional::fdiv<weighted_sample, std::size_t>::result_type float_type; - // for boost::result_of - typedef boost::tuple<float_type, float_type, float_type> result_type; - - template<typename Args> - weighted_peaks_over_threshold_prob_impl(Args const &args) - : sign_((is_same<LeftRight, left>::value) ? -1 : 1) - , mu_(sign_ * numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , sigma2_(numeric::fdiv(args[sample | Sample()], (std::size_t)1)) - , threshold_probability_(args[pot_threshold_probability]) - , fit_parameters_(boost::make_tuple(0., 0., 0.)) - , is_dirty_(true) - { - } - - void operator ()(dont_care) - { - this->is_dirty_ = true; - } - - template<typename Args> - result_type result(Args const &args) const - { - if (this->is_dirty_) - { - this->is_dirty_ = false; - - float_type threshold = sum_of_weights(args) - * ( ( is_same<LeftRight, left>::value ) ? this->threshold_probability_ : 1. - this->threshold_probability_ ); - - std::size_t n = 0; - Weight sum = Weight(0); - - while (sum < threshold) - { - if (n < static_cast<std::size_t>(tail_weights(args).size())) - { - mu_ += *(tail_weights(args).begin() + n) * *(tail(args).begin() + n); - sigma2_ += *(tail_weights(args).begin() + n) * *(tail(args).begin() + n) * (*(tail(args).begin() + n)); - sum += *(tail_weights(args).begin() + n); - n++; - } - else - { - if (std::numeric_limits<float_type>::has_quiet_NaN) - { - return boost::make_tuple( - std::numeric_limits<float_type>::quiet_NaN() - , std::numeric_limits<float_type>::quiet_NaN() - , std::numeric_limits<float_type>::quiet_NaN() - ); - } - else - { - std::ostringstream msg; - msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - return boost::make_tuple(Sample(0), Sample(0), Sample(0)); - } - } - } - - float_type u = *(tail(args).begin() + n - 1) * this->sign_; - - - this->mu_ = this->sign_ * numeric::fdiv(this->mu_, sum); - this->sigma2_ = numeric::fdiv(this->sigma2_, sum); - this->sigma2_ -= this->mu_ * this->mu_; - - if (is_same<LeftRight, left>::value) - this->threshold_probability_ = 1. - this->threshold_probability_; - - float_type tmp = numeric::fdiv(( this->mu_ - u )*( this->mu_ - u ), this->sigma2_); - float_type xi_hat = 0.5 * ( 1. - tmp ); - float_type beta_hat = 0.5 * ( this->mu_ - u ) * ( 1. + tmp ); - float_type beta_bar = beta_hat * std::pow(1. - threshold_probability_, xi_hat); - float_type u_bar = u - beta_bar * ( std::pow(1. - threshold_probability_, -xi_hat) - 1.)/xi_hat; - this->fit_parameters_ = boost::make_tuple(u_bar, beta_bar, xi_hat); - - } - - return this->fit_parameters_; - } - - private: - short sign_; // for left tail fitting, mirror the extreme values - mutable float_type mu_; // mean of samples above threshold u - mutable float_type sigma2_; // variance of samples above threshold u - mutable float_type threshold_probability_; - mutable result_type fit_parameters_; // boost::tuple that stores fit parameters - mutable bool is_dirty_; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_peaks_over_threshold -// -namespace tag -{ - template<typename LeftRight> - struct weighted_peaks_over_threshold - : depends_on<sum_of_weights> - , pot_threshold_value - { - /// INTERNAL ONLY - typedef accumulators::impl::weighted_peaks_over_threshold_impl<mpl::_1, mpl::_2, LeftRight> impl; - }; - - template<typename LeftRight> - struct weighted_peaks_over_threshold_prob - : depends_on<sum_of_weights, tail_weights<LeftRight> > - , pot_threshold_probability - { - /// INTERNAL ONLY - typedef accumulators::impl::weighted_peaks_over_threshold_prob_impl<mpl::_1, mpl::_2, LeftRight> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_peaks_over_threshold -// -namespace extract -{ - extractor<tag::abstract_peaks_over_threshold> const weighted_peaks_over_threshold = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_peaks_over_threshold) -} - -using extract::weighted_peaks_over_threshold; - -// weighted_peaks_over_threshold<LeftRight>(with_threshold_value) -> weighted_peaks_over_threshold<LeftRight> -template<typename LeftRight> -struct as_feature<tag::weighted_peaks_over_threshold<LeftRight>(with_threshold_value)> -{ - typedef tag::weighted_peaks_over_threshold<LeftRight> type; -}; - -// weighted_peaks_over_threshold<LeftRight>(with_threshold_probability) -> weighted_peaks_over_threshold_prob<LeftRight> -template<typename LeftRight> -struct as_feature<tag::weighted_peaks_over_threshold<LeftRight>(with_threshold_probability)> -{ - typedef tag::weighted_peaks_over_threshold_prob<LeftRight> type; -}; - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_skewness.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_skewness.hpp deleted file mode 100644 index a3ac3876f5..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_skewness.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_skewness.hpp -// -// Copyright 2006 Olivier Gygi, Daniel Egloff. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_SKEWNESS_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_SKEWNESS_HPP_EAN_28_10_2005 - -#include <limits> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/weighted_moment.hpp> -#include <boost/accumulators/statistics/weighted_mean.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_skewness_impl - /** - @brief Skewness estimation for weighted samples - - The skewness of a sample distribution is defined as the ratio of the 3rd central moment and the \f$ 3/2 \f$-th power $ - of the 2nd central moment (the variance) of the samples. The skewness can also be expressed by the simple moments: - - \f[ - \hat{g}_1 = - \frac - {\widehat{m}_n^{(3)}-3\widehat{m}_n^{(2)}\hat{\mu}_n+2\hat{\mu}_n^3} - {\left(\widehat{m}_n^{(2)} - \hat{\mu}_n^{2}\right)^{3/2}} - \f] - - where \f$ \widehat{m}_n^{(i)} \f$ are the \f$ i \f$-th moment and \f$ \hat{\mu}_n \f$ the mean (first moment) of the - \f$ n \f$ samples. - - The skewness estimator for weighted samples is formally identical to the estimator for unweighted samples, except that - the weighted counterparts of all measures it depends on are to be taken. - */ - template<typename Sample, typename Weight> - struct weighted_skewness_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - // for boost::result_of - typedef typename numeric::functional::fdiv<weighted_sample, weighted_sample>::result_type result_type; - - weighted_skewness_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - return numeric::fdiv( - accumulators::weighted_moment<3>(args) - - 3. * accumulators::weighted_moment<2>(args) * weighted_mean(args) - + 2. * weighted_mean(args) * weighted_mean(args) * weighted_mean(args) - , ( accumulators::weighted_moment<2>(args) - weighted_mean(args) * weighted_mean(args) ) - * std::sqrt( accumulators::weighted_moment<2>(args) - weighted_mean(args) * weighted_mean(args) ) - ); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_skewness -// -namespace tag -{ - struct weighted_skewness - : depends_on<weighted_mean, weighted_moment<2>, weighted_moment<3> > - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_skewness_impl<mpl::_1, mpl::_2> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_skewness -// -namespace extract -{ - extractor<tag::weighted_skewness> const weighted_skewness = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_skewness) -} - -using extract::weighted_skewness; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_sum.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_sum.hpp deleted file mode 100644 index 27153906d0..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_sum.hpp +++ /dev/null @@ -1,116 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_sum.hpp -// -// Copyright 2006 Eric Niebler, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_SUM_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_SUM_HPP_EAN_28_10_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/parameters/weight.hpp> -#include <boost/accumulators/framework/accumulators/external_accumulator.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_sum_impl - template<typename Sample, typename Weight, typename Tag> - struct weighted_sum_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - - // for boost::result_of - typedef weighted_sample result_type; - - template<typename Args> - weighted_sum_impl(Args const &args) - : weighted_sum_( - args[parameter::keyword<Tag>::get() | Sample()] - * numeric::one<Weight>::value - ) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - // what about overflow? - this->weighted_sum_ += args[parameter::keyword<Tag>::get()] * args[weight]; - } - - result_type result(dont_care) const - { - return this->weighted_sum_; - } - - private: - - weighted_sample weighted_sum_; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_sum -// -namespace tag -{ - struct weighted_sum - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_sum_impl<mpl::_1, mpl::_2, tag::sample> impl; - }; - - template<typename VariateType, typename VariateTag> - struct weighted_sum_of_variates - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_sum_impl<VariateType, mpl::_2, VariateTag> impl; - }; - - struct abstract_weighted_sum_of_variates - : depends_on<> - { - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_sum -// -namespace extract -{ - extractor<tag::weighted_sum> const weighted_sum = {}; - extractor<tag::abstract_weighted_sum_of_variates> const weighted_sum_of_variates = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_sum) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_sum_of_variates) -} - -using extract::weighted_sum; -using extract::weighted_sum_of_variates; - -template<typename VariateType, typename VariateTag> -struct feature_of<tag::weighted_sum_of_variates<VariateType, VariateTag> > - : feature_of<tag::abstract_weighted_sum_of_variates> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_sum_kahan.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_sum_kahan.hpp deleted file mode 100644 index fbb0303acc..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_sum_kahan.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_sum_kahan.hpp -// -// Copyright 2011 Simon West. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_SUM_KAHAN_HPP_EAN_11_05_2011 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_SUM_KAHAN_HPP_EAN_11_05_2011 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/parameters/weight.hpp> -#include <boost/accumulators/framework/accumulators/external_accumulator.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/weighted_sum.hpp> -#include <boost/numeric/conversion/cast.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ -#if _MSC_VER > 1400 -# pragma float_control(push) -# pragma float_control(precise, on) -#endif - - /////////////////////////////////////////////////////////////////////////////// - // weighted_sum_kahan_impl - template<typename Sample, typename Weight, typename Tag> - struct weighted_sum_kahan_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - - // for boost::result_of - typedef weighted_sample result_type; - - template<typename Args> - weighted_sum_kahan_impl(Args const &args) - : weighted_sum_( - args[parameter::keyword<Tag>::get() | Sample()] * numeric::one<Weight>::value), - compensation(boost::numeric_cast<weighted_sample>(0.0)) - { - } - - template<typename Args> - void -#if BOOST_ACCUMULATORS_GCC_VERSION > 40305 - __attribute__((__optimize__("no-associative-math"))) -#endif - operator ()(Args const &args) - { - const weighted_sample myTmp1 = args[parameter::keyword<Tag>::get()] * args[weight] - this->compensation; - const weighted_sample myTmp2 = this->weighted_sum_ + myTmp1; - this->compensation = (myTmp2 - this->weighted_sum_) - myTmp1; - this->weighted_sum_ = myTmp2; - - } - - result_type result(dont_care) const - { - return this->weighted_sum_; - } - - private: - weighted_sample weighted_sum_; - weighted_sample compensation; - }; - -#if _MSC_VER > 1400 -# pragma float_control(pop) -#endif - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_sum_kahan -// tag::weighted_sum_of_variates_kahan -// -namespace tag -{ - struct weighted_sum_kahan - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_sum_kahan_impl<mpl::_1, mpl::_2, tag::sample> impl; - }; - - template<typename VariateType, typename VariateTag> - struct weighted_sum_of_variates_kahan - : depends_on<> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_sum_kahan_impl<VariateType, mpl::_2, VariateTag> impl; - }; - -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_sum_kahan -// extract::weighted_sum_of_variates_kahan -// -namespace extract -{ - extractor<tag::weighted_sum_kahan> const weighted_sum_kahan = {}; - extractor<tag::abstract_weighted_sum_of_variates> const weighted_sum_of_variates_kahan = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_sum_kahan) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_sum_of_variates_kahan) -} - -using extract::weighted_sum_kahan; -using extract::weighted_sum_of_variates_kahan; - -// weighted_sum(kahan) -> weighted_sum_kahan -template<> -struct as_feature<tag::weighted_sum(kahan)> -{ - typedef tag::weighted_sum_kahan type; -}; - -template<typename VariateType, typename VariateTag> -struct feature_of<tag::weighted_sum_of_variates_kahan<VariateType, VariateTag> > - : feature_of<tag::abstract_weighted_sum_of_variates> -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_mean.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_mean.hpp deleted file mode 100644 index bae8530674..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_mean.hpp +++ /dev/null @@ -1,169 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_tail_mean.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_TAIL_MEAN_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_TAIL_MEAN_HPP_DE_01_01_2006 - -#include <numeric> -#include <vector> -#include <limits> -#include <functional> -#include <sstream> -#include <stdexcept> -#include <boost/throw_exception.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/tail.hpp> -#include <boost/accumulators/statistics/tail_mean.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost { namespace accumulators -{ - -namespace impl -{ - - /////////////////////////////////////////////////////////////////////////////// - // coherent_weighted_tail_mean_impl - // - // TODO - - /////////////////////////////////////////////////////////////////////////////// - // non_coherent_weighted_tail_mean_impl - // - /** - @brief Estimation of the (non-coherent) weighted tail mean based on order statistics (for both left and right tails) - - - - An estimation of the non-coherent, weighted tail mean \f$\widehat{NCTM}_{n,\alpha}(X)\f$ is given by the weighted mean - of the - - \f[ - \lambda = \inf\left\{ l \left| \frac{1}{\bar{w}_n}\sum_{i=1}^{l} w_i \geq \alpha \right. \right\} - \f] - - smallest samples (left tail) or the weighted mean of the - - \f[ - n + 1 - \rho = n + 1 - \sup\left\{ r \left| \frac{1}{\bar{w}_n}\sum_{i=r}^{n} w_i \geq (1 - \alpha) \right. \right\} - \f] - - largest samples (right tail) above a quantile \f$\hat{q}_{\alpha}\f$ of level \f$\alpha\f$, \f$n\f$ being the total number of sample - and \f$\bar{w}_n\f$ the sum of all \f$n\f$ weights: - - \f[ - \widehat{NCTM}_{n,\alpha}^{\mathrm{left}}(X) = \frac{\sum_{i=1}^{\lambda} w_i X_{i:n}}{\sum_{i=1}^{\lambda} w_i}, - \f] - - \f[ - \widehat{NCTM}_{n,\alpha}^{\mathrm{right}}(X) = \frac{\sum_{i=\rho}^n w_i X_{i:n}}{\sum_{i=\rho}^n w_i}. - \f] - - @param quantile_probability - */ - template<typename Sample, typename Weight, typename LeftRight> - struct non_coherent_weighted_tail_mean_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - typedef typename numeric::functional::fdiv<Weight, std::size_t>::result_type float_type; - // for boost::result_of - typedef typename numeric::functional::fdiv<weighted_sample, std::size_t>::result_type result_type; - - non_coherent_weighted_tail_mean_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - float_type threshold = sum_of_weights(args) - * ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] ); - - std::size_t n = 0; - Weight sum = Weight(0); - - while (sum < threshold) - { - if (n < static_cast<std::size_t>(tail_weights(args).size())) - { - sum += *(tail_weights(args).begin() + n); - n++; - } - else - { - if (std::numeric_limits<result_type>::has_quiet_NaN) - { - return std::numeric_limits<result_type>::quiet_NaN(); - } - else - { - std::ostringstream msg; - msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - return result_type(0); - } - } - } - - return numeric::fdiv( - std::inner_product( - tail(args).begin() - , tail(args).begin() + n - , tail_weights(args).begin() - , weighted_sample(0) - ) - , sum - ); - } - }; - -} // namespace impl - - -/////////////////////////////////////////////////////////////////////////////// -// tag::non_coherent_weighted_tail_mean<> -// -namespace tag -{ - template<typename LeftRight> - struct non_coherent_weighted_tail_mean - : depends_on<sum_of_weights, tail_weights<LeftRight> > - { - typedef accumulators::impl::non_coherent_weighted_tail_mean_impl<mpl::_1, mpl::_2, LeftRight> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::non_coherent_weighted_tail_mean; -// -namespace extract -{ - extractor<tag::abstract_non_coherent_tail_mean> const non_coherent_weighted_tail_mean = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(non_coherent_weighted_tail_mean) -} - -using extract::non_coherent_weighted_tail_mean; - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_quantile.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_quantile.hpp deleted file mode 100644 index b143457dd0..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_quantile.hpp +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_tail_quantile.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_TAIL_QUANTILE_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_TAIL_QUANTILE_HPP_DE_01_01_2006 - -#include <vector> -#include <limits> -#include <functional> -#include <sstream> -#include <stdexcept> -#include <boost/throw_exception.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/tail.hpp> -#include <boost/accumulators/statistics/tail_quantile.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // weighted_tail_quantile_impl - // Tail quantile estimation based on order statistics of weighted samples - /** - @brief Tail quantile estimation based on order statistics of weighted samples (for both left and right tails) - - An estimator \f$\hat{q}\f$ of tail quantiles with level \f$\alpha\f$ based on order statistics - \f$X_{1:n} \leq X_{2:n} \leq\dots\leq X_{n:n}\f$ of weighted samples are given by \f$X_{\lambda:n}\f$ (left tail) - and \f$X_{\rho:n}\f$ (right tail), where - - \f[ - \lambda = \inf\left\{ l \left| \frac{1}{\bar{w}_n}\sum_{i=1}^{l} w_i \geq \alpha \right. \right\} - \f] - - and - - \f[ - \rho = \sup\left\{ r \left| \frac{1}{\bar{w}_n}\sum_{i=r}^{n} w_i \geq (1 - \alpha) \right. \right\}, - \f] - - \f$n\f$ being the number of samples and \f$\bar{w}_n\f$ the sum of all weights. - - @param quantile_probability - */ - template<typename Sample, typename Weight, typename LeftRight> - struct weighted_tail_quantile_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Weight, std::size_t>::result_type float_type; - // for boost::result_of - typedef Sample result_type; - - weighted_tail_quantile_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - float_type threshold = sum_of_weights(args) - * ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] ); - - std::size_t n = 0; - Weight sum = Weight(0); - - while (sum < threshold) - { - if (n < static_cast<std::size_t>(tail_weights(args).size())) - { - sum += *(tail_weights(args).begin() + n); - n++; - } - else - { - if (std::numeric_limits<result_type>::has_quiet_NaN) - { - return std::numeric_limits<result_type>::quiet_NaN(); - } - else - { - std::ostringstream msg; - msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - return Sample(0); - } - } - } - - // Note that the cached samples of the left are sorted in ascending order, - // whereas the samples of the right tail are sorted in descending order - return *(boost::begin(tail(args)) + n - 1); - } - }; -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_tail_quantile<> -// -namespace tag -{ - template<typename LeftRight> - struct weighted_tail_quantile - : depends_on<sum_of_weights, tail_weights<LeftRight> > - { - /// INTERNAL ONLY - typedef accumulators::impl::weighted_tail_quantile_impl<mpl::_1, mpl::_2, LeftRight> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_tail_quantile -// -namespace extract -{ - extractor<tag::quantile> const weighted_tail_quantile = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_tail_quantile) -} - -using extract::weighted_tail_quantile; - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_variate_means.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_variate_means.hpp deleted file mode 100644 index b1133109ed..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_tail_variate_means.hpp +++ /dev/null @@ -1,246 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_tail_variate_means.hpp -// -// Copyright 2006 Daniel Egloff, Olivier Gygi. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_TAIL_VARIATE_MEANS_HPP_DE_01_01_2006 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_TAIL_VARIATE_MEANS_HPP_DE_01_01_2006 - -#include <numeric> -#include <vector> -#include <limits> -#include <functional> -#include <sstream> -#include <stdexcept> -#include <boost/throw_exception.hpp> -#include <boost/parameter/keyword.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/tail.hpp> -#include <boost/accumulators/statistics/tail_variate.hpp> -#include <boost/accumulators/statistics/tail_variate_means.hpp> -#include <boost/accumulators/statistics/weighted_tail_mean.hpp> -#include <boost/accumulators/statistics/parameters/quantile_probability.hpp> - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4127) // conditional expression is constant -#endif - -namespace boost -{ - // for _BinaryOperatrion2 in std::inner_product below - // multiplies two values and promotes the result to double - namespace numeric { namespace functional - { - /////////////////////////////////////////////////////////////////////////////// - // numeric::functional::multiply_and_promote_to_double - template<typename T, typename U> - struct multiply_and_promote_to_double - : multiplies<T, double const> - { - }; - }} -} - -namespace boost { namespace accumulators -{ - -namespace impl -{ - /** - @brief Estimation of the absolute and relative weighted tail variate means (for both left and right tails) - - For all \f$j\f$-th variates associated to the - - \f[ - \lambda = \inf\left\{ l \left| \frac{1}{\bar{w}_n}\sum_{i=1}^{l} w_i \geq \alpha \right. \right\} - \f] - - smallest samples (left tail) or the weighted mean of the - - \f[ - n + 1 - \rho = n + 1 - \sup\left\{ r \left| \frac{1}{\bar{w}_n}\sum_{i=r}^{n} w_i \geq (1 - \alpha) \right. \right\} - \f] - - largest samples (right tail), the absolute weighted tail means \f$\widehat{ATM}_{n,\alpha}(X, j)\f$ - are computed and returned as an iterator range. Alternatively, the relative weighted tail means - \f$\widehat{RTM}_{n,\alpha}(X, j)\f$ are returned, which are the absolute weighted tail means - normalized with the weighted (non-coherent) sample tail mean \f$\widehat{NCTM}_{n,\alpha}(X)\f$. - - \f[ - \widehat{ATM}_{n,\alpha}^{\mathrm{right}}(X, j) = - \frac{1}{\sum_{i=\rho}^n w_i} - \sum_{i=\rho}^n w_i \xi_{j,i} - \f] - - \f[ - \widehat{ATM}_{n,\alpha}^{\mathrm{left}}(X, j) = - \frac{1}{\sum_{i=1}^{\lambda}} - \sum_{i=1}^{\lambda} w_i \xi_{j,i} - \f] - - \f[ - \widehat{RTM}_{n,\alpha}^{\mathrm{right}}(X, j) = - \frac{\sum_{i=\rho}^n w_i \xi_{j,i}} - {\sum_{i=\rho}^n w_i \widehat{NCTM}_{n,\alpha}^{\mathrm{right}}(X)} - \f] - - \f[ - \widehat{RTM}_{n,\alpha}^{\mathrm{left}}(X, j) = - \frac{\sum_{i=1}^{\lambda} w_i \xi_{j,i}} - {\sum_{i=1}^{\lambda} w_i \widehat{NCTM}_{n,\alpha}^{\mathrm{left}}(X)} - \f] - */ - - /////////////////////////////////////////////////////////////////////////////// - // weighted_tail_variate_means_impl - // by default: absolute weighted_tail_variate_means - template<typename Sample, typename Weight, typename Impl, typename LeftRight, typename VariateType> - struct weighted_tail_variate_means_impl - : accumulator_base - { - typedef typename numeric::functional::fdiv<Weight, Weight>::result_type float_type; - typedef typename numeric::functional::fdiv<typename numeric::functional::multiplies<VariateType, Weight>::result_type, Weight>::result_type array_type; - // for boost::result_of - typedef iterator_range<typename array_type::iterator> result_type; - - weighted_tail_variate_means_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - float_type threshold = sum_of_weights(args) - * ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] ); - - std::size_t n = 0; - Weight sum = Weight(0); - - while (sum < threshold) - { - if (n < static_cast<std::size_t>(tail_weights(args).size())) - { - sum += *(tail_weights(args).begin() + n); - n++; - } - else - { - if (std::numeric_limits<float_type>::has_quiet_NaN) - { - std::fill( - this->tail_means_.begin() - , this->tail_means_.end() - , std::numeric_limits<float_type>::quiet_NaN() - ); - } - else - { - std::ostringstream msg; - msg << "index n = " << n << " is not in valid range [0, " << tail(args).size() << ")"; - boost::throw_exception(std::runtime_error(msg.str())); - } - } - } - - std::size_t num_variates = tail_variate(args).begin()->size(); - - this->tail_means_.clear(); - this->tail_means_.resize(num_variates, Sample(0)); - - this->tail_means_ = std::inner_product( - tail_variate(args).begin() - , tail_variate(args).begin() + n - , tail_weights(args).begin() - , this->tail_means_ - , numeric::functional::plus<array_type const, array_type const>() - , numeric::functional::multiply_and_promote_to_double<VariateType const, Weight const>() - ); - - float_type factor = sum * ( (is_same<Impl, relative>::value) ? non_coherent_weighted_tail_mean(args) : 1. ); - - std::transform( - this->tail_means_.begin() - , this->tail_means_.end() - , this->tail_means_.begin() -#ifdef BOOST_NO_CXX98_BINDERS - , std::bind(numeric::functional::divides<typename array_type::value_type const, float_type const>(), std::placeholders::_1, factor) -#else - , std::bind2nd(numeric::functional::divides<typename array_type::value_type const, float_type const>(), factor) -#endif - ); - - return make_iterator_range(this->tail_means_); - } - - private: - - mutable array_type tail_means_; - - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::absolute_weighted_tail_variate_means -// tag::relative_weighted_tail_variate_means -// -namespace tag -{ - template<typename LeftRight, typename VariateType, typename VariateTag> - struct absolute_weighted_tail_variate_means - : depends_on<non_coherent_weighted_tail_mean<LeftRight>, tail_variate<VariateType, VariateTag, LeftRight>, tail_weights<LeftRight> > - { - typedef accumulators::impl::weighted_tail_variate_means_impl<mpl::_1, mpl::_2, absolute, LeftRight, VariateType> impl; - }; - template<typename LeftRight, typename VariateType, typename VariateTag> - struct relative_weighted_tail_variate_means - : depends_on<non_coherent_weighted_tail_mean<LeftRight>, tail_variate<VariateType, VariateTag, LeftRight>, tail_weights<LeftRight> > - { - typedef accumulators::impl::weighted_tail_variate_means_impl<mpl::_1, mpl::_2, relative, LeftRight, VariateType> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_tail_variate_means -// extract::relative_weighted_tail_variate_means -// -namespace extract -{ - extractor<tag::abstract_absolute_tail_variate_means> const weighted_tail_variate_means = {}; - extractor<tag::abstract_relative_tail_variate_means> const relative_weighted_tail_variate_means = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_tail_variate_means) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(relative_weighted_tail_variate_means) -} - -using extract::weighted_tail_variate_means; -using extract::relative_weighted_tail_variate_means; - -// weighted_tail_variate_means<LeftRight, VariateType, VariateTag>(absolute) -> absolute_weighted_tail_variate_means<LeftRight, VariateType, VariateTag> -template<typename LeftRight, typename VariateType, typename VariateTag> -struct as_feature<tag::weighted_tail_variate_means<LeftRight, VariateType, VariateTag>(absolute)> -{ - typedef tag::absolute_weighted_tail_variate_means<LeftRight, VariateType, VariateTag> type; -}; - -// weighted_tail_variate_means<LeftRight, VariateType, VariateTag>(relative) -> relative_weighted_tail_variate_means<LeftRight, VariateType, VariateTag> -template<typename LeftRight, typename VariateType, typename VariateTag> -struct as_feature<tag::weighted_tail_variate_means<LeftRight, VariateType, VariateTag>(relative)> -{ - typedef tag::relative_weighted_tail_variate_means<LeftRight, VariateType, VariateTag> type; -}; - -}} // namespace boost::accumulators - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/weighted_variance.hpp b/contrib/restricted/boost/boost/accumulators/statistics/weighted_variance.hpp deleted file mode 100644 index bc199affa4..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/weighted_variance.hpp +++ /dev/null @@ -1,186 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// weighted_variance.hpp -// -// Copyright 2005 Daniel Egloff, Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_WEIGHTED_VARIANCE_HPP_EAN_28_10_2005 -#define BOOST_ACCUMULATORS_STATISTICS_WEIGHTED_VARIANCE_HPP_EAN_28_10_2005 - -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/framework/accumulator_base.hpp> -#include <boost/accumulators/framework/extractor.hpp> -#include <boost/accumulators/numeric/functional.hpp> -#include <boost/accumulators/framework/parameters/sample.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/count.hpp> -#include <boost/accumulators/statistics/variance.hpp> -#include <boost/accumulators/statistics/weighted_sum.hpp> -#include <boost/accumulators/statistics/weighted_mean.hpp> -#include <boost/accumulators/statistics/weighted_moment.hpp> - -namespace boost { namespace accumulators -{ - -namespace impl -{ - //! Lazy calculation of variance of weighted samples. - /*! - The default implementation of the variance of weighted samples is based on the second moment - \f$\widehat{m}_n^{(2)}\f$ (weighted_moment<2>) and the mean\f$ \hat{\mu}_n\f$ (weighted_mean): - \f[ - \hat{\sigma}_n^2 = \widehat{m}_n^{(2)}-\hat{\mu}_n^2, - \f] - where \f$n\f$ is the number of samples. - */ - template<typename Sample, typename Weight, typename MeanFeature> - struct lazy_weighted_variance_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - // for boost::result_of - typedef typename numeric::functional::fdiv<weighted_sample, Weight>::result_type result_type; - - lazy_weighted_variance_impl(dont_care) {} - - template<typename Args> - result_type result(Args const &args) const - { - extractor<MeanFeature> const some_mean = {}; - result_type tmp = some_mean(args); - return accumulators::weighted_moment<2>(args) - tmp * tmp; - } - }; - - //! Iterative calculation of variance of weighted samples. - /*! - Iterative calculation of variance of weighted samples: - \f[ - \hat{\sigma}_n^2 = - \frac{\bar{w}_n - w_n}{\bar{w}_n}\hat{\sigma}_{n - 1}^2 - + \frac{w_n}{\bar{w}_n - w_n}\left(X_n - \hat{\mu}_n\right)^2 - ,\quad n\ge2,\quad\hat{\sigma}_0^2 = 0. - \f] - where \f$\bar{w}_n\f$ is the sum of the \f$n\f$ weights \f$w_i\f$ and \f$\hat{\mu}_n\f$ - the estimate of the mean of the weighted samples. Note that the sample variance is not defined for - \f$n <= 1\f$. - */ - template<typename Sample, typename Weight, typename MeanFeature, typename Tag> - struct weighted_variance_impl - : accumulator_base - { - typedef typename numeric::functional::multiplies<Sample, Weight>::result_type weighted_sample; - // for boost::result_of - typedef typename numeric::functional::fdiv<weighted_sample, Weight>::result_type result_type; - - template<typename Args> - weighted_variance_impl(Args const &args) - : weighted_variance(numeric::fdiv(args[sample | Sample()], numeric::one<Weight>::value)) - { - } - - template<typename Args> - void operator ()(Args const &args) - { - std::size_t cnt = count(args); - - if(cnt > 1) - { - extractor<MeanFeature> const some_mean = {}; - - result_type tmp = args[parameter::keyword<Tag>::get()] - some_mean(args); - - this->weighted_variance = - numeric::fdiv(this->weighted_variance * (sum_of_weights(args) - args[weight]), sum_of_weights(args)) - + numeric::fdiv(tmp * tmp * args[weight], sum_of_weights(args) - args[weight] ); - } - } - - result_type result(dont_care) const - { - return this->weighted_variance; - } - - private: - result_type weighted_variance; - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// tag::weighted_variance -// tag::immediate_weighted_variance -// -namespace tag -{ - struct lazy_weighted_variance - : depends_on<weighted_moment<2>, weighted_mean> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::lazy_weighted_variance_impl<mpl::_1, mpl::_2, weighted_mean> impl; - }; - - struct weighted_variance - : depends_on<count, immediate_weighted_mean> - { - /// INTERNAL ONLY - /// - typedef accumulators::impl::weighted_variance_impl<mpl::_1, mpl::_2, immediate_weighted_mean, sample> impl; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// extract::weighted_variance -// extract::immediate_weighted_variance -// -namespace extract -{ - extractor<tag::lazy_weighted_variance> const lazy_weighted_variance = {}; - extractor<tag::weighted_variance> const weighted_variance = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(lazy_weighted_variance) - BOOST_ACCUMULATORS_IGNORE_GLOBAL(weighted_variance) -} - -using extract::lazy_weighted_variance; -using extract::weighted_variance; - -// weighted_variance(lazy) -> lazy_weighted_variance -template<> -struct as_feature<tag::weighted_variance(lazy)> -{ - typedef tag::lazy_weighted_variance type; -}; - -// weighted_variance(immediate) -> weighted_variance -template<> -struct as_feature<tag::weighted_variance(immediate)> -{ - typedef tag::weighted_variance type; -}; - -//////////////////////////////////////////////////////////////////////////// -//// droppable_accumulator<weighted_variance_impl> -//// need to specialize droppable lazy weighted_variance to cache the result at the -//// point the accumulator is dropped. -///// INTERNAL ONLY -///// -//template<typename Sample, typename Weight, typename MeanFeature> -//struct droppable_accumulator<impl::weighted_variance_impl<Sample, Weight, MeanFeature> > -// : droppable_accumulator_base< -// with_cached_result<impl::weighted_variance_impl<Sample, Weight, MeanFeature> > -// > -//{ -// template<typename Args> -// droppable_accumulator(Args const &args) -// : droppable_accumulator::base(args) -// { -// } -//}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics/with_error.hpp b/contrib/restricted/boost/boost/accumulators/statistics/with_error.hpp deleted file mode 100644 index adafc8e0d8..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics/with_error.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// with_error.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_WITH_ERROR_HPP_EAN_01_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_WITH_ERROR_HPP_EAN_01_11_2005 - -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/mpl/transform_view.hpp> -#include <boost/mpl/placeholders.hpp> -#include <boost/accumulators/statistics_fwd.hpp> -#include <boost/accumulators/statistics/error_of.hpp> - -namespace boost { namespace accumulators -{ - -namespace detail -{ - template<typename Feature> - struct error_of_tag - { - typedef tag::error_of<Feature> type; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// with_error -// -template<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature)> -struct with_error - : mpl::transform_view< - mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_ACCUMULATORS_MAX_FEATURES, Feature)> - , detail::error_of_tag<mpl::_1> - > -{ -}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/accumulators/statistics_fwd.hpp b/contrib/restricted/boost/boost/accumulators/statistics_fwd.hpp deleted file mode 100644 index 61904f30b3..0000000000 --- a/contrib/restricted/boost/boost/accumulators/statistics_fwd.hpp +++ /dev/null @@ -1,432 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// statistics_fwd.hpp -// -// Copyright 2005 Eric Niebler. Distributed under the 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_ACCUMULATORS_STATISTICS_STATISTICS_FWD_HPP_EAN_23_11_2005 -#define BOOST_ACCUMULATORS_STATISTICS_STATISTICS_FWD_HPP_EAN_23_11_2005 - -#include <boost/mpl/apply_fwd.hpp> // for mpl::na -#include <boost/mpl/print.hpp> -#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> -#include <boost/accumulators/accumulators_fwd.hpp> -#include <boost/accumulators/framework/depends_on.hpp> -#include <boost/accumulators/framework/extractor.hpp> - -namespace boost { namespace accumulators -{ - -/////////////////////////////////////////////////////////////////////////////// -// base struct and base extractor for quantiles -namespace tag -{ - struct quantile - : depends_on<> - { - typedef mpl::print<class ____MISSING_SPECIFIC_QUANTILE_FEATURE_IN_ACCUMULATOR_SET____ > impl; - }; -} -namespace extract -{ - extractor<tag::quantile> const quantile = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(quantile) -} -using extract::quantile; - -/////////////////////////////////////////////////////////////////////////////// -// base struct and base extractor for *coherent* tail means -namespace tag -{ - struct tail_mean - : depends_on<> - { - typedef mpl::print<class ____MISSING_SPECIFIC_TAIL_MEAN_FEATURE_IN_ACCUMULATOR_SET____ > impl; - }; -} -namespace extract -{ - extractor<tag::tail_mean> const tail_mean = {}; - - BOOST_ACCUMULATORS_IGNORE_GLOBAL(tail_mean) -} -using extract::tail_mean; - -namespace tag -{ - /////////////////////////////////////////////////////////////////////////////// - // Variates tags - struct weights; - struct covariate1; - struct covariate2; - - /////////////////////////////////////////////////////////////////////////////// - // Statistic tags - struct count; - template<typename VariateType, typename VariateTag> - struct covariance; - struct density; - template<typename Feature> - struct error_of; - struct extended_p_square; - struct extended_p_square_quantile; - struct extended_p_square_quantile_quadratic; - struct kurtosis; - struct max; - struct mean; - struct immediate_mean; - struct mean_of_weights; - struct immediate_mean_of_weights; - template<typename VariateType, typename VariateTag> - struct mean_of_variates; - template<typename VariateType, typename VariateTag> - struct immediate_mean_of_variates; - struct median; - struct with_density_median; - struct with_p_square_cumulative_distribution_median; - struct min; - template<int N> - struct moment; - template<typename LeftRight> - struct peaks_over_threshold; - template<typename LeftRight> - struct peaks_over_threshold_prob; - template<typename LeftRight> - struct pot_tail_mean; - template<typename LeftRight> - struct pot_tail_mean_prob; - template<typename LeftRight> - struct pot_quantile; - template<typename LeftRight> - struct pot_quantile_prob; - struct p_square_cumulative_distribution; - struct p_square_quantile; - struct p_square_quantile_for_median; - struct skewness; - struct sum; - struct sum_of_weights; - template<typename VariateType, typename VariateTag> - struct sum_of_variates; - struct sum_kahan; - struct sum_of_weights_kahan; - template<typename VariateType, typename VariateTag> - struct sum_of_variates_kahan; - template<typename LeftRight> - struct tail; - template<typename LeftRight> - struct coherent_tail_mean; - template<typename LeftRight> - struct non_coherent_tail_mean; - template<typename LeftRight> - struct tail_quantile; - template<typename VariateType, typename VariateTag, typename LeftRight> - struct tail_variate; - template<typename LeftRight> - struct tail_weights; - template<typename VariateType, typename VariateTag, typename LeftRight> - struct right_tail_variate; - template<typename VariateType, typename VariateTag, typename LeftRight> - struct left_tail_variate; - template<typename LeftRight, typename VariateType, typename VariateTag> - struct tail_variate_means; - template<typename LeftRight, typename VariateType, typename VariateTag> - struct absolute_tail_variate_means; - template<typename LeftRight, typename VariateType, typename VariateTag> - struct relative_tail_variate_means; - struct lazy_variance; - struct variance; - template<typename VariateType, typename VariateTag> - struct weighted_covariance; - struct weighted_density; - struct weighted_kurtosis; - struct weighted_mean; - struct immediate_weighted_mean; - template<typename VariateType, typename VariateTag> - struct weighted_mean_of_variates; - template<typename VariateType, typename VariateTag> - struct immediate_weighted_mean_of_variates; - struct weighted_median; - struct with_density_weighted_median; - struct with_p_square_cumulative_distribution_weighted_median; - struct weighted_extended_p_square; - struct weighted_extended_p_square_quantile; - struct weighted_extended_p_square_quantile_quadratic; - template<int N> - struct weighted_moment; - template<typename LeftRight> - struct weighted_peaks_over_threshold; - template<typename LeftRight> - struct weighted_peaks_over_threshold_prob; - template<typename LeftRight> - struct weighted_pot_quantile; - template<typename LeftRight> - struct weighted_pot_quantile_prob; - template<typename LeftRight> - struct weighted_pot_tail_mean; - template<typename LeftRight> - struct weighted_pot_tail_mean_prob; - struct weighted_p_square_cumulative_distribution; - struct weighted_p_square_quantile; - struct weighted_p_square_quantile_for_median; - struct weighted_skewness; - template<typename LeftRight> - struct weighted_tail_quantile; - template<typename LeftRight> - struct non_coherent_weighted_tail_mean; - template<typename LeftRight> - struct weighted_tail_quantile; - template<typename LeftRight, typename VariateType, typename VariateTag> - struct weighted_tail_variate_means; - template<typename LeftRight, typename VariateType, typename VariateTag> - struct absolute_weighted_tail_variate_means; - template<typename LeftRight, typename VariateType, typename VariateTag> - struct relative_weighted_tail_variate_means; - struct lazy_weighted_variance; - struct weighted_variance; - struct weighted_sum; - template<typename VariateType, typename VariateTag> - struct weighted_sum_of_variates; - struct rolling_window_plus1; - struct rolling_window; - struct rolling_sum; - struct rolling_count; - struct rolling_mean; -} // namespace tag - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////////// - // Statistics impls - struct count_impl; - - template<typename Sample, typename VariateType, typename VariateTag> - struct covariance_impl; - - template<typename Sample> - struct density_impl; - - template<typename Sample, typename Feature> - struct error_of_impl; - - template<typename Sample, typename Variance> - struct error_of_mean_impl; - - template<typename Sample> - struct extended_p_square_impl; - - template<typename Sample, typename Impl1, typename Impl2> - struct extended_p_square_quantile_impl; - - template<typename Sample> - struct kurtosis_impl; - - template<typename Sample> - struct max_impl; - - template<typename Sample> - struct median_impl; - - template<typename Sample> - struct with_density_median_impl; - - template<typename Sample> - struct with_p_square_cumulative_distribution_median_impl; - - template<typename Sample> - struct min_impl; - - template<typename Sample, typename SumFeature = tag::sum> - struct mean_impl; - - template<typename Sample, typename Tag = tag::sample> - struct immediate_mean_impl; - - template<typename N, typename Sample> - struct moment_impl; - - template<typename Sample, typename LeftRight> - struct peaks_over_threshold_prob_impl; - - template<typename Sample, typename Impl, typename LeftRight> - struct pot_quantile_impl; - - template<typename Sample, typename Impl, typename LeftRight> - struct pot_tail_mean_impl; - - template<typename Sample> - struct p_square_cumulative_distribution_impl; - - template<typename Sample, typename Impl> - struct p_square_quantile_impl; - - template<typename Sample> - struct skewness_impl; - - template<typename Sample, typename Tag = tag::sample> - struct sum_impl; - - template<typename Sample, typename Tag> - struct sum_kahan_impl; - - template<typename Sample, typename LeftRight> - struct tail_impl; - - template<typename Sample, typename LeftRight> - struct coherent_tail_mean_impl; - - template<typename Sample, typename LeftRight> - struct non_coherent_tail_mean_impl; - - template<typename Sample, typename LeftRight> - struct tail_quantile_impl; - - template<typename VariateType, typename VariateTag, typename LeftRight> - struct tail_variate_impl; - - template<typename Sample, typename Impl, typename LeftRight, typename VariateTag> - struct tail_variate_means_impl; - - template<typename Sample, typename MeanFeature> - struct lazy_variance_impl; - - template<typename Sample, typename MeanFeature, typename Tag> - struct variance_impl; - - template<typename Sample, typename Weight, typename VariateType, typename VariateTag> - struct weighted_covariance_impl; - - template<typename Sample, typename Weight> - struct weighted_density_impl; - - template<typename Sample, typename Weight> - struct weighted_kurtosis_impl; - - template<typename Sample> - struct weighted_median_impl; - - template<typename Sample> - struct with_density_weighted_median_impl; - - template<typename Sample, typename Weight> - struct with_p_square_cumulative_distribution_weighted_median_impl; - - template<typename Sample, typename Weight, typename Tag> - struct weighted_mean_impl; - - template<typename Sample, typename Weight, typename Tag> - struct immediate_weighted_mean_impl; - - template<typename Sample, typename Weight, typename LeftRight> - struct weighted_peaks_over_threshold_impl; - - template<typename Sample, typename Weight, typename LeftRight> - struct weighted_peaks_over_threshold_prob_impl; - - template<typename Sample, typename Weight> - struct with_p_square_cumulative_distribution_weighted_median_impl; - - template<typename Sample, typename Weight> - struct weighted_extended_p_square_impl; - - template<typename N, typename Sample, typename Weight> - struct weighted_moment_impl; - - template<typename Sample, typename Weight> - struct weighted_p_square_cumulative_distribution_impl; - - template<typename Sample, typename Weight, typename Impl> - struct weighted_p_square_quantile_impl; - - template<typename Sample, typename Weight> - struct weighted_skewness_impl; - - template<typename Sample, typename Weight, typename Tag> - struct weighted_sum_impl; - - template<typename Sample, typename Weight, typename Tag> - struct weighted_sum_kahan_impl; - - template<typename Sample, typename Weight, typename LeftRight> - struct non_coherent_weighted_tail_mean_impl; - - template<typename Sample, typename Weight, typename LeftRight> - struct weighted_tail_quantile_impl; - - template<typename Sample, typename Weight, typename Impl, typename LeftRight, typename VariateType> - struct weighted_tail_variate_means_impl; - - template<typename Sample, typename Weight, typename MeanFeature> - struct lazy_weighted_variance_impl; - - template<typename Sample, typename Weight, typename MeanFeature, typename Tag> - struct weighted_variance_impl; - - template<typename Sample> - struct rolling_window_plus1_impl; - - template<typename Sample> - struct rolling_window_impl; - - template<typename Sample> - struct rolling_sum_impl; - - template<typename Sample> - struct rolling_count_impl; - - template<typename Sample> - struct rolling_mean_impl; -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// stats -// A more descriptive name for an MPL sequence of statistics. -template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)> -struct stats; - -template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_ACCUMULATORS_MAX_FEATURES, typename Feature, mpl::na)> -struct with_error; - -// modifiers for the mean and variance stats -struct lazy {}; -struct immediate {}; - -// modifiers for the variance stat -// struct fast {}; -// struct accurate {}; - -// modifiers for order -struct right {}; -struct left {}; -// typedef right default_order_tag_type; - -// modifiers for the tail_variate_means stat -struct absolute {}; -struct relative {}; - -// modifiers for median and weighted_median stats -struct with_density {}; -struct with_p_square_cumulative_distribution {}; -struct with_p_square_quantile {}; - -// modifiers for peaks_over_threshold stat -struct with_threshold_value {}; -struct with_threshold_probability {}; - -// modifiers for extended_p_square_quantile and weighted_extended_p_square_quantile stats -struct weighted {}; -struct unweighted {}; -struct linear {}; -struct quadratic {}; - -// modifiers for p_square_quantile -struct regular {}; -struct for_median {}; - -// modifier for sum_kahan, sum_of_weights_kahan, sum_of_variates_kahan, weighted_sum_kahan -struct kahan {}; - -}} // namespace boost::accumulators - -#endif diff --git a/contrib/restricted/boost/boost/assign.hpp b/contrib/restricted/boost/boost/assign.hpp deleted file mode 100644 index fffb7ecee1..0000000000 --- a/contrib/restricted/boost/boost/assign.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_HPP -#define BOOST_ASSIGN_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/std.hpp> -#include <boost/assign/list_of.hpp> -#include <boost/assign/list_inserter.hpp> -#include <boost/assign/assignment_exception.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/assign/assignment_exception.hpp b/contrib/restricted/boost/boost/assign/assignment_exception.hpp deleted file mode 100644 index 7da9a25b92..0000000000 --- a/contrib/restricted/boost/boost/assign/assignment_exception.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_ASSIGNMENT_EXCEPTION_HPP -#define BOOST_ASSIGN_ASSIGNMENT_EXCEPTION_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <exception> - -namespace boost -{ - namespace assign - { - class assignment_exception : public std::exception - { - public: - assignment_exception( const char* _what ) - : what_( _what ) - { } - - virtual const char* what() const noexcept - { - return what_; - } - - private: - const char* what_; - }; - } -} - -#endif diff --git a/contrib/restricted/boost/boost/assign/list_inserter.hpp b/contrib/restricted/boost/boost/assign/list_inserter.hpp deleted file mode 100644 index 46d572c51d..0000000000 --- a/contrib/restricted/boost/boost/assign/list_inserter.hpp +++ /dev/null @@ -1,400 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - -#ifndef BOOST_ASSIGN_LIST_INSERTER_HPP -#define BOOST_ASSIGN_LIST_INSERTER_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/detail/workaround.hpp> - -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/range/begin.hpp> -#include <boost/range/end.hpp> -#include <boost/config.hpp> -#include <cstddef> - -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/iteration/local.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> - -namespace boost -{ -namespace assign_detail -{ - template< class T > - struct repeater - { - std::size_t sz; - T val; - - repeater( std::size_t sz_, T r ) : sz( sz_ ), val( r ) - { } - }; - - template< class Fun > - struct fun_repeater - { - std::size_t sz; - Fun val; - - fun_repeater( std::size_t sz_, Fun r ) : sz( sz_ ), val( r ) - { } - }; - - template< class C > - class call_push_back - { - C& c_; - public: - call_push_back( C& c ) : c_( c ) - { } - - template< class T > - void operator()( T r ) - { - c_.push_back( r ); - } - }; - - template< class C > - class call_push_front - { - C& c_; - public: - call_push_front( C& c ) : c_( c ) - { } - - template< class T > - void operator()( T r ) - { - c_.push_front( r ); - } - }; - - template< class C > - class call_push - { - C& c_; - public: - call_push( C& c ) : c_( c ) - { } - - template< class T > - void operator()( T r ) - { - c_.push( r ); - } - }; - - template< class C > - class call_insert - { - C& c_; - public: - call_insert( C& c ) : c_( c ) - { } - - template< class T > - void operator()( T r ) - { - c_.insert( r ); - } - }; - - template< class C > - class call_add_edge - { - C& c_; - public: - call_add_edge( C& c ) : c_(c) - { } - - template< class T > - void operator()( T l, T r ) - { - add_edge( l, r, c_ ); - } - - template< class T, class EP > - void operator()( T l, T r, const EP& ep ) - { - add_edge( l, r, ep, c_ ); - } - - }; - - struct forward_n_arguments {}; - -} // namespace 'assign_detail' - -namespace assign -{ - - template< class T > - inline assign_detail::repeater<T> - repeat( std::size_t sz, T r ) - { - return assign_detail::repeater<T>( sz, r ); - } - - template< class Function > - inline assign_detail::fun_repeater<Function> - repeat_fun( std::size_t sz, Function r ) - { - return assign_detail::fun_repeater<Function>( sz, r ); - } - - - template< class Function, class Argument = assign_detail::forward_n_arguments > - class list_inserter - { - struct single_arg_type {}; - struct n_arg_type {}; - - typedef BOOST_DEDUCED_TYPENAME mpl::if_c< is_same<Argument,assign_detail::forward_n_arguments>::value, - n_arg_type, - single_arg_type >::type arg_type; - - public: - - list_inserter( Function fun ) : insert_( fun ) - {} - - template< class Function2, class Arg > - list_inserter( const list_inserter<Function2,Arg>& r ) - : insert_( r.fun_private() ) - {} - - list_inserter( const list_inserter& r ) : insert_( r.insert_ ) - {} - - list_inserter& operator()() - { - insert_( Argument() ); - return *this; - } - - template< class T > - list_inserter& operator=( const T& r ) - { - insert_( r ); - return *this; - } - - template< class T > - list_inserter& operator=( assign_detail::repeater<T> r ) - { - return operator,( r ); - } - - template< class Nullary_function > - list_inserter& operator=( const assign_detail::fun_repeater<Nullary_function>& r ) - { - return operator,( r ); - } - - template< class T > - list_inserter& operator,( const T& r ) - { - insert_( r ); - return *this; - } - -#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) - template< class T > - list_inserter& operator,( const assign_detail::repeater<T> & r ) - { - return repeat( r.sz, r.val ); - } -#else - template< class T > - list_inserter& operator,( assign_detail::repeater<T> r ) - { - return repeat( r.sz, r.val ); - } -#endif - - template< class Nullary_function > - list_inserter& operator,( const assign_detail::fun_repeater<Nullary_function>& r ) - { - return repeat_fun( r.sz, r.val ); - } - - template< class T > - list_inserter& repeat( std::size_t sz, T r ) - { - std::size_t i = 0; - while( i++ != sz ) - insert_( r ); - return *this; - } - - template< class Nullary_function > - list_inserter& repeat_fun( std::size_t sz, Nullary_function fun ) - { - std::size_t i = 0; - while( i++ != sz ) - insert_( fun() ); - return *this; - } - - template< class SinglePassIterator > - list_inserter& range( SinglePassIterator first, - SinglePassIterator last ) - { - for( ; first != last; ++first ) - insert_( *first ); - return *this; - } - - template< class SinglePassRange > - list_inserter& range( const SinglePassRange& r ) - { - return range( boost::begin(r), boost::end(r) ); - } - - template< class T > - list_inserter& operator()( const T& t ) - { - insert_( t ); - return *this; - } - -#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value -#define BOOST_ASSIGN_MAX_PARAMS 5 -#endif -#define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1) -#define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class T) -#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& t) -#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, t) - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class T, BOOST_ASSIGN_PARAMS1(n) > \ - list_inserter& operator()(T t, BOOST_ASSIGN_PARAMS2(n) ) \ - { \ - BOOST_PP_CAT(insert, BOOST_PP_INC(n))(t, BOOST_ASSIGN_PARAMS3(n), arg_type()); \ - return *this; \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class T, BOOST_ASSIGN_PARAMS1(n) > \ - void BOOST_PP_CAT(insert, BOOST_PP_INC(n))(T const& t, BOOST_ASSIGN_PARAMS2(n), single_arg_type) \ - { \ - insert_( Argument(t, BOOST_ASSIGN_PARAMS3(n) )); \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class T, BOOST_ASSIGN_PARAMS1(n) > \ - void BOOST_PP_CAT(insert, BOOST_PP_INC(n))(T const& t, BOOST_ASSIGN_PARAMS2(n), n_arg_type) \ - { \ - insert_(t, BOOST_ASSIGN_PARAMS3(n) ); \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - - - Function fun_private() const - { - return insert_; - } - - private: - - list_inserter& operator=( const list_inserter& ); - Function insert_; - }; - - template< class Function > - inline list_inserter< Function > - make_list_inserter( Function fun ) - { - return list_inserter< Function >( fun ); - } - - template< class Function, class Argument > - inline list_inserter<Function,Argument> - make_list_inserter( Function fun, Argument* ) - { - return list_inserter<Function,Argument>( fun ); - } - - template< class C > - inline list_inserter< assign_detail::call_push_back<C>, - BOOST_DEDUCED_TYPENAME C::value_type > - push_back( C& c ) - { - static BOOST_DEDUCED_TYPENAME C::value_type* p = 0; - return make_list_inserter( assign_detail::call_push_back<C>( c ), - p ); - } - - template< class C > - inline list_inserter< assign_detail::call_push_front<C>, - BOOST_DEDUCED_TYPENAME C::value_type > - push_front( C& c ) - { - static BOOST_DEDUCED_TYPENAME C::value_type* p = 0; - return make_list_inserter( assign_detail::call_push_front<C>( c ), - p ); - } - - template< class C > - inline list_inserter< assign_detail::call_insert<C>, - BOOST_DEDUCED_TYPENAME C::value_type > - insert( C& c ) - { - static BOOST_DEDUCED_TYPENAME C::value_type* p = 0; - return make_list_inserter( assign_detail::call_insert<C>( c ), - p ); - } - - template< class C > - inline list_inserter< assign_detail::call_push<C>, - BOOST_DEDUCED_TYPENAME C::value_type > - push( C& c ) - { - static BOOST_DEDUCED_TYPENAME C::value_type* p = 0; - return make_list_inserter( assign_detail::call_push<C>( c ), - p ); - } - - template< class C > - inline list_inserter< assign_detail::call_add_edge<C> > - add_edge( C& c ) - { - return make_list_inserter( assign_detail::call_add_edge<C>( c ) ); - } - -} // namespace 'assign' -} // namespace 'boost' - -#undef BOOST_ASSIGN_PARAMS1 -#undef BOOST_ASSIGN_PARAMS2 -#undef BOOST_ASSIGN_PARAMS3 -#undef BOOST_ASSIGN_MAX_PARAMETERS - -#endif diff --git a/contrib/restricted/boost/boost/assign/list_of.hpp b/contrib/restricted/boost/boost/assign/list_of.hpp deleted file mode 100644 index cc043d375d..0000000000 --- a/contrib/restricted/boost/boost/assign/list_of.hpp +++ /dev/null @@ -1,682 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_LIST_OF_HPP -#define BOOST_ASSIGN_LIST_OF_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/assignment_exception.hpp> -#include <boost/range/iterator_range.hpp> -#include <boost/config.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/type_traits/remove_const.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/is_reference.hpp> -#include <boost/static_assert.hpp> -#include <boost/throw_exception.hpp> -#include <boost/type_traits/detail/yes_no_type.hpp> -#include <boost/type_traits/decay.hpp> -#include <boost/type_traits/is_array.hpp> -#include <boost/mpl/if.hpp> -#include <deque> -#include <cstddef> -#include <utility> - -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/iteration/local.hpp> - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -// BCB requires full type definition for is_array<> to work correctly. -#include <boost/array.hpp> -#endif - -namespace boost -{ - -// this here is necessary to avoid compiler error in <boost/array.hpp> -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - template< class T, std::size_t sz > - class array; -#endif - -namespace assign_detail -{ - ///////////////////////////////////////////////////////////////////////// - // Part 0: common conversion code - ///////////////////////////////////////////////////////////////////////// - - template< class T > - struct assign_decay - { - // - // Add constness to array parameters - // to support string literals properly - // - typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< - ::boost::is_array<T>, - ::boost::decay<const T>, - ::boost::decay<T> >::type type; - }; - - template< class T, std::size_t sz > - type_traits::yes_type assign_is_array( const array<T,sz>* ); - type_traits::no_type assign_is_array( ... ); - template< class T, class U > - type_traits::yes_type assign_is_pair( const std::pair<T,U>* ); - type_traits::no_type assign_is_pair( ... ); - - - - struct array_type_tag - { - #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - private: - char dummy_; // BCB would by default use 8 bytes - #endif - }; - struct adapter_type_tag - { - #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - private: - char dummy_; // BCB would by default use 8 bytes - #endif - }; - struct pair_type_tag - { - #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - private: - char dummy_; // BCB would by default use 8 bytes - #endif - }; - struct default_type_tag - { - #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - private: - char dummy_; // BCB would by default use 8 bytes - #endif - }; - - - - template< class DerivedTAssign, class Iterator > - class converter - { - public: // Range operations - typedef Iterator iterator; - typedef Iterator const_iterator; - - iterator begin() const - { - return static_cast<const DerivedTAssign*>(this)->begin(); - } - - iterator end() const - { - return static_cast<const DerivedTAssign*>(this)->end(); - } - - public: - - template< class Container > - Container convert_to_container() const - { - static Container* c = 0; - BOOST_STATIC_CONSTANT( bool, is_array_flag = sizeof( assign_detail::assign_is_array( c ) ) - == sizeof( type_traits::yes_type ) ); - - typedef BOOST_DEDUCED_TYPENAME mpl::if_c< is_array_flag, - array_type_tag, - default_type_tag >::type tag_type; - - return convert<Container>( c, tag_type() ); - } - - private: - - template< class Container > - Container convert( const Container*, default_type_tag ) const - { - -#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) -// old Dinkumware doesn't support iterator type as template - Container result; - iterator it = begin(), - e = end(); - while( it != e ) - { - result.insert( result.end(), *it ); - ++it; - } - return result; -#else - return Container( begin(), end() ); -#endif - } - - template< class Array > - Array convert( const Array*, array_type_tag ) const - { - typedef BOOST_DEDUCED_TYPENAME Array::value_type value_type; - -#if BOOST_WORKAROUND(BOOST_INTEL, <= 910 ) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580 ) - BOOST_DEDUCED_TYPENAME remove_const<Array>::type ar; -#else - Array ar; -#endif - const std::size_t sz = ar.size(); - if( sz < static_cast<const DerivedTAssign*>(this)->size() ) - BOOST_THROW_EXCEPTION( assign::assignment_exception( "array initialized with too many elements" ) ); - std::size_t n = 0; - iterator i = begin(), - e = end(); - for( ; i != e; ++i, ++n ) - ar[n] = *i; - for( ; n < sz; ++n ) - ar[n] = value_type(); - return ar; - } - - template< class Adapter > - Adapter convert_to_adapter( const Adapter* = 0 ) const - { - Adapter a; - iterator i = begin(), - e = end(); - for( ; i != e; ++i ) - a.push( *i ); - return a; - } - - private: - struct adapter_converter; - friend struct adapter_converter; - - struct adapter_converter - { - const converter& gl; - adapter_converter( const converter& this_ ) : gl( this_ ) - {} - - adapter_converter( const adapter_converter& r ) - : gl( r.gl ) - { } - - template< class Adapter > - operator Adapter() const - { - return gl.convert_to_adapter<Adapter>(); - } - }; - - public: - template< class Container > - Container to_container( Container& c ) const - { - return convert( &c, default_type_tag() ); - } - - adapter_converter to_adapter() const - { - return adapter_converter( *this ); - } - - template< class Adapter > - Adapter to_adapter( Adapter& a ) const - { - return this->convert_to_adapter( &a ); - } - - template< class Array > - Array to_array( Array& a ) const - { - return convert( &a, array_type_tag() ); - } - }; - - template< class T, class I, class Range > - inline bool operator==( const converter<T,I>& l, const Range& r ) - { - return ::boost::iterator_range_detail::equal( l, r ); - } - - template< class T, class I, class Range > - inline bool operator==( const Range& l, const converter<T,I>& r ) - { - return r == l; - } - - template< class T, class I, class Range > - inline bool operator!=( const converter<T,I>& l, const Range& r ) - { - return !( l == r ); - } - - template< class T, class I, class Range > - inline bool operator!=( const Range& l, const converter<T,I>& r ) - { - return !( l == r ); - } - - template< class T, class I, class Range > - inline bool operator<( const converter<T,I>& l, const Range& r ) - { - return ::boost::iterator_range_detail::less_than( l, r ); - } - - template< class T, class I, class Range > - inline bool operator<( const Range& l, const converter<T,I>& r ) - { - return ::boost::iterator_range_detail::less_than( l, r ); - } - - template< class T, class I, class Range > - inline bool operator>( const converter<T,I>& l, const Range& r ) - { - return r < l; - } - - template< class T, class I, class Range > - inline bool operator>( const Range& l, const converter<T,I>& r ) - { - return r < l; - } - - template< class T, class I, class Range > - inline bool operator<=( const converter<T,I>& l, const Range& r ) - { - return !( l > r ); - } - - template< class T, class I, class Range > - inline bool operator<=( const Range& l, const converter<T,I>& r ) - { - return !( l > r ); - } - - template< class T, class I, class Range > - inline bool operator>=( const converter<T,I>& l, const Range& r ) - { - return !( l < r ); - } - - template< class T, class I, class Range > - inline bool operator>=( const Range& l, const converter<T,I>& r ) - { - return !( l < r ); - } - - template< class T, class I, class Elem, class Traits > - inline std::basic_ostream<Elem,Traits>& - operator<<( std::basic_ostream<Elem, Traits>& Os, - const converter<T,I>& r ) - { - return Os << ::boost::make_iterator_range( r.begin(), r.end() ); - } - - ///////////////////////////////////////////////////////////////////////// - // Part 1: flexible, but inefficient interface - ///////////////////////////////////////////////////////////////////////// - - template< class T > - class generic_list : - public converter< generic_list< BOOST_DEDUCED_TYPENAME assign_decay<T>::type >, - BOOST_DEDUCED_TYPENAME std::deque<BOOST_DEDUCED_TYPENAME - assign_decay<T>::type>::iterator > - { - typedef BOOST_DEDUCED_TYPENAME assign_decay<T>::type Ty; - typedef std::deque<Ty> impl_type; - mutable impl_type values_; - - public: - typedef BOOST_DEDUCED_TYPENAME impl_type::iterator iterator; - typedef iterator const_iterator; - typedef BOOST_DEDUCED_TYPENAME impl_type::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME impl_type::size_type size_type; - typedef BOOST_DEDUCED_TYPENAME impl_type::difference_type difference_type; - - public: - iterator begin() const { return values_.begin(); } - iterator end() const { return values_.end(); } - bool empty() const { return values_.empty(); } - size_type size() const { return values_.size(); } - - private: - void push_back( value_type r ) { values_.push_back( r ); } - - public: - generic_list& operator,( const Ty& u ) - { - this->push_back( u ); - return *this; - } - - generic_list& operator()() - { - this->push_back( Ty() ); - return *this; - } - - generic_list& operator()( const Ty& u ) - { - this->push_back( u ); - return *this; - } - - -#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value -#define BOOST_ASSIGN_MAX_PARAMS 5 -#endif -#define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1) -#define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class U) -#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, U, const& u) -#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, u) -#define BOOST_ASSIGN_PARAMS4(n) BOOST_PP_ENUM_PARAMS(n, U) -#define BOOST_ASSIGN_PARAMS2_NO_REF(n) BOOST_PP_ENUM_BINARY_PARAMS(n, U, u) - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class U, BOOST_ASSIGN_PARAMS1(n) > \ - generic_list& operator()(U const& u, BOOST_ASSIGN_PARAMS2(n) ) \ - { \ - this->push_back( Ty(u, BOOST_ASSIGN_PARAMS3(n))); \ - return *this; \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - - - template< class U > - generic_list& repeat( std::size_t sz, U u ) - { - std::size_t i = 0; - while( i++ != sz ) - this->push_back( u ); - return *this; - } - - template< class Nullary_function > - generic_list& repeat_fun( std::size_t sz, Nullary_function fun ) - { - std::size_t i = 0; - while( i++ != sz ) - this->push_back( fun() ); - return *this; - } - - template< class SinglePassIterator > - generic_list& range( SinglePassIterator first, - SinglePassIterator last ) - { - for( ; first != last; ++first ) - this->push_back( *first ); - return *this; - } - - template< class SinglePassRange > - generic_list& range( const SinglePassRange& r ) - { - return range( boost::begin(r), boost::end(r) ); - } - - template< class Container > - operator Container() const - { - return this-> BOOST_NESTED_TEMPLATE convert_to_container<Container>(); - } - }; - - ///////////////////////////////////////////////////////////////////////// - // Part 2: efficient, but inconvenient interface - ///////////////////////////////////////////////////////////////////////// - - template< class T > - struct assign_reference - { - assign_reference() - { /* intentionally empty */ } - - assign_reference( T& r ) : ref_(&r) - { } - - void operator=( T& r ) - { - ref_ = &r; - } - - operator T&() const - { - return *ref_; - } - - void swap( assign_reference& r ) - { - std::swap( *ref_, *r.ref_ ); - } - - T& get_ref() const - { - return *ref_; - } - - private: - T* ref_; - - }; - - template< class T > - inline bool operator<( const assign_reference<T>& l, - const assign_reference<T>& r ) - { - return l.get_ref() < r.get_ref(); - } - - template< class T > - inline bool operator>( const assign_reference<T>& l, - const assign_reference<T>& r ) - { - return l.get_ref() > r.get_ref(); - } - - template< class T > - inline void swap( assign_reference<T>& l, - assign_reference<T>& r ) - { - l.swap( r ); - } - - - - template< class T, int N > - struct static_generic_list : - public converter< static_generic_list<T,N>, assign_reference<T>* > - { - private: - typedef T internal_value_type; - - public: - typedef assign_reference<internal_value_type> value_type; - typedef value_type* iterator; - typedef value_type* const_iterator; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - - static_generic_list( T& r ) : - current_(1) - { - refs_[0] = r; - } - - static_generic_list& operator()( T& r ) - { - insert( r ); - return *this; - } - - iterator begin() const - { - return &refs_[0]; - } - - iterator end() const - { - return &refs_[current_]; - } - - size_type size() const - { - return static_cast<size_type>( current_ ); - } - - bool empty() const - { - return false; - } - - template< class ForwardIterator > - static_generic_list& range( ForwardIterator first, - ForwardIterator last ) - { - for( ; first != last; ++first ) - this->insert( *first ); - return *this; - } - - template< class ForwardRange > - static_generic_list& range( ForwardRange& r ) - { - return range( boost::begin(r), boost::end(r) ); - } - - template< class ForwardRange > - static_generic_list& range( const ForwardRange& r ) - { - return range( boost::begin(r), boost::end(r) ); - } - - template< class Container > - operator Container() const - { - return this-> BOOST_NESTED_TEMPLATE convert_to_container<Container>(); - } - - private: - void insert( T& r ) - { - refs_[current_] = r; - ++current_; - } - - static_generic_list(); - - mutable assign_reference<internal_value_type> refs_[N]; - int current_; - }; - -} // namespace 'assign_detail' - -namespace assign -{ - template< class T > - inline assign_detail::generic_list<T> - list_of() - { - return assign_detail::generic_list<T>()( T() ); - } - - template< class T > - inline assign_detail::generic_list<T> - list_of( const T& t ) - { - return assign_detail::generic_list<T>()( t ); - } - - template< int N, class T > - inline assign_detail::static_generic_list< BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<T>::type,N> - ref_list_of( T& t ) - { - return assign_detail::static_generic_list<BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<T>::type,N>( t ); - } - - template< int N, class T > - inline assign_detail::static_generic_list<const BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<T>::type,N> - cref_list_of( const T& t ) - { - return assign_detail::static_generic_list<const BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<T>::type,N>( t ); - } - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class T, class U, BOOST_ASSIGN_PARAMS1(n) > \ - inline assign_detail::generic_list<T> \ - list_of(U const& u, BOOST_ASSIGN_PARAMS2(n) ) \ - { \ - return assign_detail::generic_list<T>()(u, BOOST_ASSIGN_PARAMS3(n)); \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class U, BOOST_ASSIGN_PARAMS1(n) > \ - inline assign_detail::generic_list< tuple<U, BOOST_ASSIGN_PARAMS4(n)> > \ - tuple_list_of(U u, BOOST_ASSIGN_PARAMS2_NO_REF(n) ) \ - { \ - return assign_detail::generic_list< tuple<U, BOOST_ASSIGN_PARAMS4(n)> >()( tuple<U,BOOST_ASSIGN_PARAMS4(n)>( u, BOOST_ASSIGN_PARAMS3(n) )); \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - - - template< class Key, class T > - inline assign_detail::generic_list< std::pair - < - BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<Key>::type, - BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<T>::type - > > - map_list_of( const Key& k, const T& t ) - { - typedef BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<Key>::type k_type; - typedef BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<T>::type t_type; - return assign_detail::generic_list< std::pair<k_type,t_type> >()( k, t ); - } - - template< class F, class S > - inline assign_detail::generic_list< std::pair - < - BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<F>::type, - BOOST_DEDUCED_TYPENAME assign_detail::assign_decay<S>::type - > > - pair_list_of( const F& f, const S& s ) - { - return map_list_of( f, s ); - } - - -} // namespace 'assign' -} // namespace 'boost' - - -#undef BOOST_ASSIGN_PARAMS1 -#undef BOOST_ASSIGN_PARAMS2 -#undef BOOST_ASSIGN_PARAMS3 -#undef BOOST_ASSIGN_PARAMS4 -#undef BOOST_ASSIGN_PARAMS2_NO_REF -#undef BOOST_ASSIGN_MAX_PARAMETERS - -#endif diff --git a/contrib/restricted/boost/boost/assign/ptr_list_inserter.hpp b/contrib/restricted/boost/boost/assign/ptr_list_inserter.hpp deleted file mode 100644 index 20741f2c9c..0000000000 --- a/contrib/restricted/boost/boost/assign/ptr_list_inserter.hpp +++ /dev/null @@ -1,164 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2005. 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) -// -// For more information, see http://www.boost.org/libs/assign/ -// - -#ifndef BOOST_ASSIGN_PTR_LIST_INSERTER_HPP -#define BOOST_ASSIGN_PTR_LIST_INSERTER_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/remove_pointer.hpp> - -namespace boost -{ - -namespace assign -{ - template< class Function, class Obj > - class ptr_list_inserter - { - typedef BOOST_DEDUCED_TYPENAME - remove_pointer< BOOST_DEDUCED_TYPENAME - remove_reference<Obj>::type >::type - obj_type; - public: - - ptr_list_inserter( Function fun ) : insert_( fun ) - {} - - template< class Function2, class Obj2 > - ptr_list_inserter( const ptr_list_inserter<Function2,Obj2>& r ) - : insert_( r.fun_private() ) - {} - - ptr_list_inserter( const ptr_list_inserter& r ) : insert_( r.insert_ ) - {} - - ptr_list_inserter& operator()() - { - insert_( new obj_type() ); - return *this; - } - - template< class T > - ptr_list_inserter& operator()( const T& t ) - { - insert_( new obj_type(t) ); - return *this; - } - -#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value -#define BOOST_ASSIGN_MAX_PARAMS 5 -#endif -#define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1) -#define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class T) -#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& t) -#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, t) - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class T, BOOST_ASSIGN_PARAMS1(n) > \ - ptr_list_inserter& operator()( const T& t, BOOST_ASSIGN_PARAMS2(n) ) \ - { \ - insert_( new obj_type(t, BOOST_ASSIGN_PARAMS3(n) )); \ - return *this; \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - - private: - - ptr_list_inserter& operator=( const ptr_list_inserter& ); - Function insert_; - }; - - template< class Obj, class Function > - inline ptr_list_inserter< Function, Obj > - make_ptr_list_inserter( Function fun ) - { - return ptr_list_inserter< Function, Obj >( fun ); - } - - template< class C > - inline ptr_list_inserter< assign_detail::call_push_back<C>, - BOOST_DEDUCED_TYPENAME C::reference > - ptr_push_back( C& c ) - { - return make_ptr_list_inserter<BOOST_DEDUCED_TYPENAME C::reference> - ( assign_detail::call_push_back<C>( c ) ); - } - -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - - template< class T, class C > - inline ptr_list_inserter< assign_detail::call_push_back<C>, T > - ptr_push_back( C& c ) - { - return make_ptr_list_inserter<T>( - assign_detail::call_push_back<C>( c ) ); - } - -#endif - - template< class C > - inline ptr_list_inserter< assign_detail::call_push_front<C>, - BOOST_DEDUCED_TYPENAME C::reference > - ptr_push_front( C& c ) - { - return make_ptr_list_inserter<BOOST_DEDUCED_TYPENAME C::reference> - ( assign_detail::call_push_front<C>( c ) ); - } - -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - - template< class T, class C > - inline ptr_list_inserter< assign_detail::call_push_front<C>, T > - ptr_push_front( C& c ) - { - return make_ptr_list_inserter<T>( - assign_detail::call_push_front<C>( c ) ); - } - -#endif - - template< class C > - inline ptr_list_inserter< assign_detail::call_insert<C>, - BOOST_DEDUCED_TYPENAME C::reference> - ptr_insert( C& c ) - { - return make_ptr_list_inserter<BOOST_DEDUCED_TYPENAME C::reference> - ( assign_detail::call_insert<C>( c ) ); - } - -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - - template< class T, class C > - inline ptr_list_inserter< assign_detail::call_insert<C>, T > - ptr_insert( C& c ) - { - return make_ptr_list_inserter<T>( assign_detail::call_insert<C>( c ) ); - } - -#endif - - -} // namespace 'assign' -} // namespace 'boost' - -#undef BOOST_ASSIGN_PARAMS1 -#undef BOOST_ASSIGN_PARAMS2 -#undef BOOST_ASSIGN_PARAMS3 -#undef BOOST_ASSIGN_MAX_PARAMETERS - -#endif diff --git a/contrib/restricted/boost/boost/assign/ptr_list_of.hpp b/contrib/restricted/boost/boost/assign/ptr_list_of.hpp deleted file mode 100644 index 082f3725f1..0000000000 --- a/contrib/restricted/boost/boost/assign/ptr_list_of.hpp +++ /dev/null @@ -1,209 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2005. 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) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_PTR_LIST_OF_HPP -#define BOOST_ASSIGN_PTR_LIST_OF_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_of.hpp> -#include <boost/type_traits/remove_const.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/is_reference.hpp> -#include <boost/static_assert.hpp> -#include <boost/type_traits/detail/yes_no_type.hpp> -#include <boost/type_traits/decay.hpp> -#include <boost/type_traits/is_array.hpp> -#include <boost/mpl/if.hpp> -#include <boost/ptr_container/ptr_vector.hpp> - -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/iteration/local.hpp> - -namespace boost -{ - -namespace assign_detail -{ - ///////////////////////////////////////////////////////////////////////// - // Part 1: flexible and efficient interface - ///////////////////////////////////////////////////////////////////////// - - template< class T > - class generic_ptr_list : - public converter< generic_ptr_list<T>, - BOOST_DEDUCED_TYPENAME boost::ptr_vector<T>::iterator > - { - protected: - typedef boost::ptr_vector<T> impl_type; -#if defined(BOOST_NO_AUTO_PTR) - typedef std::unique_ptr<impl_type> release_type; -#else - typedef std::auto_ptr<impl_type> release_type; -#endif - mutable impl_type values_; - - public: - typedef BOOST_DEDUCED_TYPENAME impl_type::iterator iterator; - typedef iterator const_iterator; - typedef BOOST_DEDUCED_TYPENAME impl_type::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME impl_type::size_type size_type; - typedef BOOST_DEDUCED_TYPENAME impl_type::difference_type difference_type; - public: - generic_ptr_list() : values_( 32u ) - { } - - generic_ptr_list( release_type r ) : values_(r) - { } - - release_type release() - { - return values_.release(); - } - - public: - iterator begin() const { return values_.begin(); } - iterator end() const { return values_.end(); } - bool empty() const { return values_.empty(); } - size_type size() const { return values_.size(); } - - public: - - operator impl_type() const - { - return values_; - } - - template< template<class,class,class> class Seq, class U, - class CA, class A > - operator Seq<U,CA,A>() const - { - Seq<U,CA,A> result; - result.transfer( result.end(), values_ ); - BOOST_ASSERT( empty() ); - return result; - } - - template< class PtrContainer > -#if defined(BOOST_NO_AUTO_PTR) - std::unique_ptr<PtrContainer> -#else - std::auto_ptr<PtrContainer> -#endif - convert( const PtrContainer* c ) const - { -#if defined(BOOST_NO_AUTO_PTR) - std::unique_ptr<PtrContainer> res( new PtrContainer() ); -#else - std::auto_ptr<PtrContainer> res( new PtrContainer() ); -#endif - while( !empty() ) - res->insert( res->end(), - values_.pop_back().release() ); - return res; - } - - template< class PtrContainer > -#if defined(BOOST_NO_AUTO_PTR) - std::unique_ptr<PtrContainer> -#else - std::auto_ptr<PtrContainer> -#endif - to_container( const PtrContainer& c ) const - { - return convert( &c ); - } - - protected: - void push_back( T* r ) { values_.push_back( r ); } - - public: - generic_ptr_list& operator()() - { - this->push_back( new T() ); - return *this; - } - - template< class U > - generic_ptr_list& operator()( const U& u ) - { - this->push_back( new T(u) ); - return *this; - } - - -#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value -#define BOOST_ASSIGN_MAX_PARAMS 5 -#endif -#define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1) -#define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class U) -#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, U, const& u) -#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, u) - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class U, BOOST_ASSIGN_PARAMS1(n) > \ - generic_ptr_list& operator()(U const& u, BOOST_ASSIGN_PARAMS2(n) ) \ - { \ - this->push_back( new T(u, BOOST_ASSIGN_PARAMS3(n))); \ - return *this; \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - - }; // class 'generic_ptr_list' - -} // namespace 'assign_detail' - -namespace assign -{ - template< class T > - inline assign_detail::generic_ptr_list<T> - ptr_list_of() - { - return assign_detail::generic_ptr_list<T>()(); - } - - template< class T, class U > - inline assign_detail::generic_ptr_list<T> - ptr_list_of( const U& t ) - { - return assign_detail::generic_ptr_list<T>()( t ); - } - - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class T, class U, BOOST_ASSIGN_PARAMS1(n) > \ - inline assign_detail::generic_ptr_list<T> \ - ptr_list_of(U const& u, BOOST_ASSIGN_PARAMS2(n) ) \ - { \ - return assign_detail::generic_ptr_list<T>()(u, BOOST_ASSIGN_PARAMS3(n)); \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - - -} // namespace 'assign' -} // namespace 'boost' - - -#undef BOOST_ASSIGN_PARAMS1 -#undef BOOST_ASSIGN_PARAMS2 -#undef BOOST_ASSIGN_PARAMS3 -#undef BOOST_ASSIGN_MAX_PARAMETERS - -#endif diff --git a/contrib/restricted/boost/boost/assign/ptr_map_inserter.hpp b/contrib/restricted/boost/boost/assign/ptr_map_inserter.hpp deleted file mode 100644 index fb180f28fd..0000000000 --- a/contrib/restricted/boost/boost/assign/ptr_map_inserter.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2006. 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) -// -// For more information, see http://www.boost.org/libs/assign/ -// - -#ifndef BOOST_ASSIGN_PTR_CONTAINER_PTR_MAP_INSERTER_HPP -#define BOOST_ASSIGN_PTR_CONTAINER_PTR_MAP_INSERTER_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/remove_pointer.hpp> - -namespace boost -{ - -namespace assign -{ - template< class PtrMap, class Obj > - class ptr_map_inserter - { - typedef BOOST_DEDUCED_TYPENAME - remove_pointer< BOOST_DEDUCED_TYPENAME - remove_reference<Obj>::type >::type - obj_type; - typedef BOOST_DEDUCED_TYPENAME PtrMap::key_type - key_type; - - public: - - ptr_map_inserter( PtrMap& m ) : m_( m ) - {} - - template< class Key > - ptr_map_inserter& operator()( const Key& t ) - { - key_type k(t); - m_.insert( k, new obj_type ); - return *this; - } - -#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value -#define BOOST_ASSIGN_MAX_PARAMS 6 -#endif -#define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1) -#define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class T) -#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& t) -#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, t) - -#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS) -#define BOOST_PP_LOCAL_MACRO(n) \ - template< class T, BOOST_ASSIGN_PARAMS1(n) > \ - ptr_map_inserter& operator()( const T& t, BOOST_ASSIGN_PARAMS2(n) ) \ - { \ - key_type k(t); \ - m_.insert( k, new obj_type( BOOST_ASSIGN_PARAMS3(n) ) ); \ - return *this; \ - } \ - /**/ - -#include BOOST_PP_LOCAL_ITERATE() - - private: - - ptr_map_inserter& operator=( const ptr_map_inserter& ); - PtrMap& m_; - }; - - template< class PtrMap > - inline ptr_map_inserter< PtrMap, typename PtrMap::mapped_reference > - ptr_map_insert( PtrMap& m ) - { - return ptr_map_inserter< PtrMap, typename PtrMap::mapped_reference >( m ); - } - -#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - - template< class T, class PtrMap > - inline ptr_map_inserter< PtrMap, T > - ptr_map_insert( PtrMap& m ) - { - return ptr_map_inserter< PtrMap, T >( m ); - } - -#endif - -} // namespace 'assign' -} // namespace 'boost' - -#undef BOOST_ASSIGN_PARAMS1 -#undef BOOST_ASSIGN_PARAMS2 -#undef BOOST_ASSIGN_PARAMS3 -#undef BOOST_ASSIGN_MAX_PARAMETERS - -#endif diff --git a/contrib/restricted/boost/boost/assign/std.hpp b/contrib/restricted/boost/boost/assign/std.hpp deleted file mode 100644 index 302ff6a0b5..0000000000 --- a/contrib/restricted/boost/boost/assign/std.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - -#ifndef BOOST_ASSIGN_STD_HPP -#define BOOST_ASSIGN_STD_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/std/vector.hpp> -#include <boost/assign/std/deque.hpp> -#include <boost/assign/std/list.hpp> -#include <boost/assign/std/slist.hpp> -#include <boost/assign/std/stack.hpp> -#include <boost/assign/std/queue.hpp> -#include <boost/assign/std/set.hpp> -#include <boost/assign/std/map.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/assign/std/deque.hpp b/contrib/restricted/boost/boost/assign/std/deque.hpp deleted file mode 100644 index f808b70ca3..0000000000 --- a/contrib/restricted/boost/boost/assign/std/deque.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_STD_DEQUE_HPP -#define BOOST_ASSIGN_STD_DEQUE_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/config.hpp> -#include <deque> - -namespace boost -{ -namespace assign -{ - - template< class V, class A, class V2 > - inline list_inserter< assign_detail::call_push_back< std::deque<V,A> >, V > - operator+=( std::deque<V,A>& c, V2 v ) - { - return push_back( c )( v ); - } - -} -} - -#endif diff --git a/contrib/restricted/boost/boost/assign/std/list.hpp b/contrib/restricted/boost/boost/assign/std/list.hpp deleted file mode 100644 index 439006da59..0000000000 --- a/contrib/restricted/boost/boost/assign/std/list.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_STD_LIST_HPP -#define BOOST_ASSIGN_STD_LIST_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/config.hpp> -#include <list> - -namespace boost -{ -namespace assign -{ - - template< class V, class A, class V2 > - inline list_inserter< assign_detail::call_push_back< std::list<V,A> >, V > - operator+=( std::list<V,A>& c, V2 v ) - { - return push_back( c )( v ); - } - -} -} - -#endif diff --git a/contrib/restricted/boost/boost/assign/std/map.hpp b/contrib/restricted/boost/boost/assign/std/map.hpp deleted file mode 100644 index 2476a1d96b..0000000000 --- a/contrib/restricted/boost/boost/assign/std/map.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_STD_MAP_HPP -#define BOOST_ASSIGN_STD_MAP_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/config.hpp> -#include <map> - -namespace boost -{ -namespace assign -{ - - template< class K, class V, class C, class A, class P > - inline list_inserter< assign_detail::call_insert< std::map<K,V,C,A> >, P > - operator+=( std::map<K,V,C,A>& m, const P& p ) - { - return insert( m )( p ); - } - - template< class K, class V, class C, class A, class P > - inline list_inserter< assign_detail::call_insert< std::multimap<K,V,C,A> >, P > - operator+=( std::multimap<K,V,C,A>& m, const P& p ) - { - return insert( m )( p ); - } - -} -} - -#endif diff --git a/contrib/restricted/boost/boost/assign/std/queue.hpp b/contrib/restricted/boost/boost/assign/std/queue.hpp deleted file mode 100644 index d6023e8a12..0000000000 --- a/contrib/restricted/boost/boost/assign/std/queue.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_STD_QUEUE_HPP -#define BOOST_ASSIGN_STD_QUEUE_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/config.hpp> -#include <queue> - -namespace boost -{ -namespace assign -{ - - template< class V, class C, class V2 > - inline list_inserter< assign_detail::call_push< std::queue<V,C> >, V > - operator+=( std::queue<V,C>& c, V2 v ) - { - return push( c )( v ); - } - - template< class V, class C, class V2 > - inline list_inserter< assign_detail::call_push< std::priority_queue<V,C> >, V > - operator+=( std::priority_queue<V,C>& c, V2 v ) - { - return push( c )( v ); - } - -} -} - -#endif diff --git a/contrib/restricted/boost/boost/assign/std/set.hpp b/contrib/restricted/boost/boost/assign/std/set.hpp deleted file mode 100644 index e4d5ee2f86..0000000000 --- a/contrib/restricted/boost/boost/assign/std/set.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - - -#ifndef BOOST_ASSIGN_STD_SET_HPP -#define BOOST_ASSIGN_STD_SET_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/config.hpp> -#include <set> - -namespace boost -{ -namespace assign -{ - template< class K, class C, class A, class K2 > - inline list_inserter< assign_detail::call_insert< std::set<K,C,A> >, K > - operator+=( std::set<K,C,A>& c, K2 k ) - { - return insert( c )( k ); - } - - template< class K, class C, class A, class K2 > - inline list_inserter< assign_detail::call_insert< std::multiset<K,C,A> >, K > - operator+=( std::multiset<K,C,A>& c, K2 k ) - { - return insert( c )( k ); - } - -} -} - -#endif diff --git a/contrib/restricted/boost/boost/assign/std/slist.hpp b/contrib/restricted/boost/boost/assign/std/slist.hpp deleted file mode 100644 index 0704b238ce..0000000000 --- a/contrib/restricted/boost/boost/assign/std/slist.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - -#ifndef BOOST_ASSIGN_STD_SLIST_HPP -#define BOOST_ASSIGN_STD_SLIST_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_SLIST - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#ifdef BOOST_SLIST_HEADER -# include BOOST_SLIST_HEADER -#else -# include <slist> -#endif - -namespace boost -{ -namespace assign -{ - - template< class V, class A, class V2 > - inline list_inserter< assign_detail::call_push_back< BOOST_STD_EXTENSION_NAMESPACE::slist<V,A> >, V > - operator+=( BOOST_STD_EXTENSION_NAMESPACE::slist<V,A>& c, V2 v ) - { - return push_back( c )( v ); - } - -} -} - -#endif // BOOST_HAS_SLIST - -#endif diff --git a/contrib/restricted/boost/boost/assign/std/stack.hpp b/contrib/restricted/boost/boost/assign/std/stack.hpp deleted file mode 100644 index e528f169b1..0000000000 --- a/contrib/restricted/boost/boost/assign/std/stack.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - -#ifndef BOOST_ASSIGN_STD_STACK_HPP -#define BOOST_ASSIGN_STD_STACK_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/config.hpp> -#include <stack> - -namespace boost -{ -namespace assign -{ - - template< class V, class C, class V2 > - inline list_inserter< assign_detail::call_push< std::stack<V,C> >, V > - operator+=( std::stack<V,C>& c, V2 v ) - { - return push( c )( v ); - } - -} -} - -#endif diff --git a/contrib/restricted/boost/boost/assign/std/vector.hpp b/contrib/restricted/boost/boost/assign/std/vector.hpp deleted file mode 100644 index 8861de9b43..0000000000 --- a/contrib/restricted/boost/boost/assign/std/vector.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// Boost.Assign library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/assign/ -// - -#ifndef BOOST_ASSIGN_STD_VECTOR_HPP -#define BOOST_ASSIGN_STD_VECTOR_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assign/list_inserter.hpp> -#include <boost/config.hpp> -#include <vector> - -namespace boost -{ -namespace assign -{ - - template< class V, class A, class V2 > - inline list_inserter< assign_detail::call_push_back< std::vector<V,A> >, V > - operator+=( std::vector<V,A>& c, V2 v ) - { - return push_back( c )( v ); - } - -} -} - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/file_parser_error.hpp b/contrib/restricted/boost/boost/property_tree/detail/file_parser_error.hpp deleted file mode 100644 index 305ca91d7a..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/file_parser_error.hpp +++ /dev/null @@ -1,88 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_FILE_PARSER_ERROR_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_FILE_PARSER_ERROR_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> -#include <string> - -namespace boost { namespace property_tree -{ - - //! File parse error - class file_parser_error: public ptree_error - { - - public: - - /////////////////////////////////////////////////////////////////////// - // Construction & destruction - - // Construct error - file_parser_error(const std::string &msg, - const std::string &file, - unsigned long l) : - ptree_error(format_what(msg, file, l)), - m_message(msg), m_filename(file), m_line(l) - { - } - - ~file_parser_error() - // gcc 3.4.2 complains about lack of throw specifier on compiler - // generated dtor - { - } - - /////////////////////////////////////////////////////////////////////// - // Data access - - // Get error message (without line and file - use what() to get - // full message) - std::string message() const - { - return m_message; - } - - // Get error filename - std::string filename() const - { - return m_filename; - } - - // Get error line number - unsigned long line() const - { - return m_line; - } - - private: - - std::string m_message; - std::string m_filename; - unsigned long m_line; - - // Format error message to be returned by std::runtime_error::what() - static std::string format_what(const std::string &msg, - const std::string &file, - unsigned long l) - { - std::stringstream stream; - stream << (file.empty() ? "<unspecified file>" : file.c_str()); - if (l > 0) - stream << '(' << l << ')'; - stream << ": " << msg; - return stream.str(); - } - - }; - -} } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/info_parser_error.hpp b/contrib/restricted/boost/boost/property_tree/detail/info_parser_error.hpp deleted file mode 100644 index e7f06a167e..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/info_parser_error.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_ERROR_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_ERROR_HPP_INCLUDED - -#include <boost/property_tree/detail/file_parser_error.hpp> -#include <string> - -namespace boost { namespace property_tree { namespace info_parser -{ - - class info_parser_error: public file_parser_error - { - public: - info_parser_error(const std::string &message, - const std::string &filename, - unsigned long line) : - file_parser_error(message, filename, line) - { - } - }; - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/info_parser_read.hpp b/contrib/restricted/boost/boost/property_tree/detail/info_parser_read.hpp deleted file mode 100644 index 87ef2cd489..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/info_parser_read.hpp +++ /dev/null @@ -1,391 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_READ_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_READ_HPP_INCLUDED - -#include "boost/property_tree/ptree.hpp" -#include "boost/property_tree/detail/info_parser_error.hpp" -#include "boost/property_tree/detail/info_parser_utils.hpp" -#include <iterator> -#include <string> -#include <stack> -#include <fstream> -#include <cctype> - -namespace boost { namespace property_tree { namespace info_parser -{ - - // Expand known escape sequences - template<class It> - std::basic_string<typename std::iterator_traits<It>::value_type> - expand_escapes(It b, It e) - { - typedef typename std::iterator_traits<It>::value_type Ch; - std::basic_string<Ch> result; - while (b != e) - { - if (*b == Ch('\\')) - { - ++b; - if (b == e) - { - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "character expected after backslash", "", 0)); - } - else if (*b == Ch('0')) result += Ch('\0'); - else if (*b == Ch('a')) result += Ch('\a'); - else if (*b == Ch('b')) result += Ch('\b'); - else if (*b == Ch('f')) result += Ch('\f'); - else if (*b == Ch('n')) result += Ch('\n'); - else if (*b == Ch('r')) result += Ch('\r'); - else if (*b == Ch('t')) result += Ch('\t'); - else if (*b == Ch('v')) result += Ch('\v'); - else if (*b == Ch('"')) result += Ch('"'); - else if (*b == Ch('\'')) result += Ch('\''); - else if (*b == Ch('\\')) result += Ch('\\'); - else - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "unknown escape sequence", "", 0)); - } - else - result += *b; - ++b; - } - return result; - } - - // Detect whitespace in a not very smart way. - template <class Ch> - bool is_ascii_space(Ch c) - { - // Everything outside ASCII is not space. - unsigned n = c; - if (n > 127) - return false; - return std::isspace(c) != 0; - } - - // Advance pointer past whitespace - template<class Ch> - void skip_whitespace(const Ch *&text) - { - using namespace std; - while (is_ascii_space(*text)) - ++text; - } - - // Extract word (whitespace delimited) and advance pointer accordingly - template<class Ch> - std::basic_string<Ch> read_word(const Ch *&text) - { - using namespace std; - skip_whitespace(text); - const Ch *start = text; - while (!is_ascii_space(*text) && *text != Ch(';') && *text != Ch('\0')) - ++text; - return expand_escapes(start, text); - } - - // Extract line (eol delimited) and advance pointer accordingly - template<class Ch> - std::basic_string<Ch> read_line(const Ch *&text) - { - using namespace std; - skip_whitespace(text); - const Ch *start = text; - while (*text != Ch('\0') && *text != Ch(';')) - ++text; - while (text > start && is_ascii_space(*(text - 1))) - --text; - return expand_escapes(start, text); - } - - // Extract string (inside ""), and advance pointer accordingly - // Set need_more_lines to true if \ continuator found - template<class Ch> - std::basic_string<Ch> read_string(const Ch *&text, bool *need_more_lines) - { - skip_whitespace(text); - if (*text == Ch('\"')) - { - - // Skip " - ++text; - - // Find end of string, but skip escaped " - bool escaped = false; - const Ch *start = text; - while ((escaped || *text != Ch('\"')) && *text != Ch('\0')) - { - escaped = (!escaped && *text == Ch('\\')); - ++text; - } - - // If end of string found - if (*text == Ch('\"')) - { - std::basic_string<Ch> result = expand_escapes(start, text++); - skip_whitespace(text); - if (*text == Ch('\\')) - { - if (!need_more_lines) - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "unexpected \\", "", 0)); - ++text; - skip_whitespace(text); - if (*text == Ch('\0') || *text == Ch(';')) - *need_more_lines = true; - else - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "expected end of line after \\", "", 0)); - } - else - if (need_more_lines) - *need_more_lines = false; - return result; - } - else - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "unexpected end of line", "", 0)); - - } - else - BOOST_PROPERTY_TREE_THROW(info_parser_error("expected \"", "", 0)); - } - - // Extract key - template<class Ch> - std::basic_string<Ch> read_key(const Ch *&text) - { - skip_whitespace(text); - if (*text == Ch('\"')) - return read_string(text, NULL); - else - return read_word(text); - } - - // Extract data - template<class Ch> - std::basic_string<Ch> read_data(const Ch *&text, bool *need_more_lines) - { - skip_whitespace(text); - if (*text == Ch('\"')) - return read_string(text, need_more_lines); - else - { - *need_more_lines = false; - return read_word(text); - } - } - - // Build ptree from info stream - template<class Ptree, class Ch> - void read_info_internal(std::basic_istream<Ch> &stream, - Ptree &pt, - const std::string &filename, - int include_depth) - { - typedef std::basic_string<Ch> str_t; - // Possible parser states - enum state_t { - s_key, // Parser expects key - s_data, // Parser expects data - s_data_cont // Parser expects data continuation - }; - - unsigned long line_no = 0; - state_t state = s_key; // Parser state - Ptree *last = NULL; // Pointer to last created ptree - // Define line here to minimize reallocations - str_t line; - - // Initialize ptree stack (used to handle nesting) - std::stack<Ptree *> stack; - stack.push(&pt); // Push root ptree on stack initially - - try { - // While there are characters in the stream - while (stream.good()) { - // Read one line from stream - ++line_no; - std::getline(stream, line); - if (!stream.good() && !stream.eof()) - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "read error", filename, line_no)); - const Ch *text = line.c_str(); - - // If directive found - skip_whitespace(text); - if (*text == Ch('#')) { - // Determine directive type - ++text; // skip # - std::basic_string<Ch> directive = read_word(text); - if (directive == convert_chtype<Ch, char>("include")) { - // #include - if (include_depth > 100) { - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "include depth too large, " - "probably recursive include", - filename, line_no)); - } - str_t s = read_string(text, NULL); - std::string inc_name = - convert_chtype<char, Ch>(s.c_str()); - std::basic_ifstream<Ch> inc_stream(inc_name.c_str()); - if (!inc_stream.good()) - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "cannot open include file " + inc_name, - filename, line_no)); - read_info_internal(inc_stream, *stack.top(), - inc_name, include_depth + 1); - } else { // Unknown directive - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "unknown directive", filename, line_no)); - } - - // Directive must be followed by end of line - skip_whitespace(text); - if (*text != Ch('\0')) { - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "expected end of line", filename, line_no)); - } - - // Go to next line - continue; - } - - // While there are characters left in line - while (1) { - - // Stop parsing on end of line or comment - skip_whitespace(text); - if (*text == Ch('\0') || *text == Ch(';')) { - if (state == s_data) // If there was no data set state to s_key - state = s_key; - break; - } - - // Process according to current parser state - switch (state) - { - - // Parser expects key - case s_key: - { - - if (*text == Ch('{')) // Brace opening found - { - if (!last) - BOOST_PROPERTY_TREE_THROW(info_parser_error("unexpected {", "", 0)); - stack.push(last); - last = NULL; - ++text; - } - else if (*text == Ch('}')) // Brace closing found - { - if (stack.size() <= 1) - BOOST_PROPERTY_TREE_THROW(info_parser_error("unmatched }", "", 0)); - stack.pop(); - last = NULL; - ++text; - } - else // Key text found - { - std::basic_string<Ch> key = read_key(text); - last = &stack.top()->push_back( - std::make_pair(key, Ptree()))->second; - state = s_data; - } - - }; break; - - // Parser expects data - case s_data: - { - - // Last ptree must be defined because we are going to add data to it - BOOST_ASSERT(last); - - if (*text == Ch('{')) // Brace opening found - { - stack.push(last); - last = NULL; - ++text; - state = s_key; - } - else if (*text == Ch('}')) // Brace closing found - { - if (stack.size() <= 1) - BOOST_PROPERTY_TREE_THROW(info_parser_error("unmatched }", "", 0)); - stack.pop(); - last = NULL; - ++text; - state = s_key; - } - else // Data text found - { - bool need_more_lines; - std::basic_string<Ch> data = read_data(text, &need_more_lines); - last->data() = data; - state = need_more_lines ? s_data_cont : s_key; - } - - - }; break; - - // Parser expects continuation of data after \ on previous line - case s_data_cont: - { - - // Last ptree must be defined because we are going to update its data - BOOST_ASSERT(last); - - if (*text == Ch('\"')) // Continuation must start with " - { - bool need_more_lines; - std::basic_string<Ch> data = read_string(text, &need_more_lines); - last->put_value(last->template get_value<std::basic_string<Ch> >() + data); - state = need_more_lines ? s_data_cont : s_key; - } - else - BOOST_PROPERTY_TREE_THROW(info_parser_error("expected \" after \\ in previous line", "", 0)); - - }; break; - - // Should never happen - default: - BOOST_ASSERT(0); - - } - } - } - - // Check if stack has initial size, otherwise some {'s have not been closed - if (stack.size() != 1) - BOOST_PROPERTY_TREE_THROW(info_parser_error("unmatched {", "", 0)); - - } - catch (info_parser_error &e) - { - // If line undefined rethrow error with correct filename and line - if (e.line() == 0) - { - BOOST_PROPERTY_TREE_THROW(info_parser_error(e.message(), filename, line_no)); - } - else - BOOST_PROPERTY_TREE_THROW(e); - - } - - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/info_parser_utils.hpp b/contrib/restricted/boost/boost/property_tree/detail/info_parser_utils.hpp deleted file mode 100644 index f30010eb8a..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/info_parser_utils.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_CHCONV_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_CHCONV_HPP_INCLUDED - -#include <string> - -namespace boost { namespace property_tree { namespace info_parser -{ - - template<class ChDest, class ChSrc> - std::basic_string<ChDest> convert_chtype(const ChSrc *text) - { - std::basic_string<ChDest> result; - while (*text) - { - result += ChDest(*text); - ++text; - } - return result; - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/info_parser_write.hpp b/contrib/restricted/boost/boost/property_tree/detail/info_parser_write.hpp deleted file mode 100644 index 6abd72c7ef..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/info_parser_write.hpp +++ /dev/null @@ -1,147 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_WRITE_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_WRITE_HPP_INCLUDED - -#include "boost/property_tree/ptree.hpp" -#include "boost/property_tree/detail/info_parser_utils.hpp" -#include <string> - -namespace boost { namespace property_tree { namespace info_parser -{ - template<class Ch> - void write_info_indent(std::basic_ostream<Ch> &stream, - int indent, - const info_writer_settings<Ch> &settings - ) - { - stream << std::basic_string<Ch>(indent * settings.indent_count, settings.indent_char); - } - - // Create necessary escape sequences from illegal characters - template<class Ch> - std::basic_string<Ch> create_escapes(const std::basic_string<Ch> &s) - { - std::basic_string<Ch> result; - typename std::basic_string<Ch>::const_iterator b = s.begin(); - typename std::basic_string<Ch>::const_iterator e = s.end(); - while (b != e) - { - if (*b == Ch('\0')) result += Ch('\\'), result += Ch('0'); - else if (*b == Ch('\a')) result += Ch('\\'), result += Ch('a'); - else if (*b == Ch('\b')) result += Ch('\\'), result += Ch('b'); - else if (*b == Ch('\f')) result += Ch('\\'), result += Ch('f'); - else if (*b == Ch('\n')) result += Ch('\\'), result += Ch('n'); - else if (*b == Ch('\r')) result += Ch('\\'), result += Ch('r'); - else if (*b == Ch('\v')) result += Ch('\\'), result += Ch('v'); - else if (*b == Ch('"')) result += Ch('\\'), result += Ch('"'); - else if (*b == Ch('\\')) result += Ch('\\'), result += Ch('\\'); - else - result += *b; - ++b; - } - return result; - } - - template<class Ch> - bool is_simple_key(const std::basic_string<Ch> &key) - { - const static std::basic_string<Ch> chars = convert_chtype<Ch, char>(" \t{};\n\""); - return !key.empty() && key.find_first_of(chars) == key.npos; - } - - template<class Ch> - bool is_simple_data(const std::basic_string<Ch> &data) - { - const static std::basic_string<Ch> chars = convert_chtype<Ch, char>(" \t{};\n\""); - return !data.empty() && data.find_first_of(chars) == data.npos; - } - - template<class Ptree> - void write_info_helper(std::basic_ostream<typename Ptree::key_type::value_type> &stream, - const Ptree &pt, - int indent, - const info_writer_settings<typename Ptree::key_type::value_type> &settings) - { - - // Character type - typedef typename Ptree::key_type::value_type Ch; - - // Write data - if (indent >= 0) - { - if (!pt.data().empty()) - { - std::basic_string<Ch> data = create_escapes(pt.template get_value<std::basic_string<Ch> >()); - if (is_simple_data(data)) - stream << Ch(' ') << data << Ch('\n'); - else - stream << Ch(' ') << Ch('\"') << data << Ch('\"') << Ch('\n'); - } - else if (pt.empty()) - stream << Ch(' ') << Ch('\"') << Ch('\"') << Ch('\n'); - else - stream << Ch('\n'); - } - - // Write keys - if (!pt.empty()) - { - - // Open brace - if (indent >= 0) - { - write_info_indent( stream, indent, settings); - stream << Ch('{') << Ch('\n'); - } - - // Write keys - typename Ptree::const_iterator it = pt.begin(); - for (; it != pt.end(); ++it) - { - - // Output key - std::basic_string<Ch> key = create_escapes(it->first); - write_info_indent( stream, indent+1, settings); - if (is_simple_key(key)) - stream << key; - else - stream << Ch('\"') << key << Ch('\"'); - - // Output data and children - write_info_helper(stream, it->second, indent + 1, settings); - - } - - // Close brace - if (indent >= 0) - { - write_info_indent( stream, indent, settings); - stream << Ch('}') << Ch('\n'); - } - - } - } - - // Write ptree to info stream - template<class Ptree> - void write_info_internal(std::basic_ostream<typename Ptree::key_type::value_type> &stream, - const Ptree &pt, - const std::string &filename, - const info_writer_settings<typename Ptree::key_type::value_type> &settings) - { - write_info_helper(stream, pt, -1, settings); - if (!stream.good()) - BOOST_PROPERTY_TREE_THROW(info_parser_error("write error", filename, 0)); - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/info_parser_writer_settings.hpp b/contrib/restricted/boost/boost/property_tree/detail/info_parser_writer_settings.hpp deleted file mode 100644 index a391daed48..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/info_parser_writer_settings.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// Copyright (C) 2007 Alexey Baskakov -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_WRITER_SETTINGS_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_INFO_PARSER_WRITER_SETTINGS_HPP_INCLUDED - -#include <string> - -namespace boost { namespace property_tree { namespace info_parser -{ - - template <class Ch> - class info_writer_settings - { - public: - info_writer_settings(Ch indent_char = Ch(' '), unsigned indent_count = 4): - indent_char(indent_char), - indent_count(indent_count) - { - } - Ch indent_char; - int indent_count; - }; - - template <class Ch> - info_writer_settings<Ch> info_writer_make_settings(Ch indent_char = Ch(' '), unsigned indent_count = 4) - { - return info_writer_settings<Ch>(indent_char, indent_count); - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/rapidxml.hpp b/contrib/restricted/boost/boost/property_tree/detail/rapidxml.hpp deleted file mode 100644 index ba83695e52..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/rapidxml.hpp +++ /dev/null @@ -1,2595 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2006, 2009 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_RAPIDXML_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_RAPIDXML_HPP_INCLUDED - -//! \file rapidxml.hpp This file contains rapidxml parser and DOM implementation - -#include <boost/assert.hpp> -#include <cstdlib> // For std::size_t -#include <new> // For placement new - -// On MSVC, disable "conditional expression is constant" warning (level 4). -// This warning is almost impossible to avoid with certain types of templated code -#ifdef _MSC_VER - #pragma warning(push) - #pragma warning(disable:4127) // Conditional expression is constant -#endif - -/////////////////////////////////////////////////////////////////////////// -// BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR - -#include <exception> // For std::exception - -#define BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR(what, where) throw parse_error(what, where) - -namespace boost { namespace property_tree { namespace detail {namespace rapidxml -{ - - //! Parse error exception. - //! This exception is thrown by the parser when an error occurs. - //! Use what() function to get human-readable error message. - //! Use where() function to get a pointer to position within source text where error was detected. - //! <br><br> - //! If throwing exceptions by the parser is undesirable, - //! it can be disabled by defining RAPIDXML_NO_EXCEPTIONS macro before rapidxml.hpp is included. - //! This will cause the parser to call rapidxml::parse_error_handler() function instead of throwing an exception. - //! This function must be defined by the user. - //! <br><br> - //! This class derives from <code>std::exception</code> class. - class parse_error: public std::exception - { - - public: - - //! Constructs parse error - parse_error(const char *wa, void *we) - : m_what(wa) - , m_where(we) - { - } - - //! Gets human readable description of error. - //! \return Pointer to null terminated description of the error. - virtual const char *what() const noexcept - { - return m_what; - } - - //! Gets pointer to character data where error happened. - //! Ch should be the same as char type of xml_document that produced the error. - //! \return Pointer to location within the parsed string where error occurred. - template<class Ch> - Ch *where() const - { - return reinterpret_cast<Ch *>(m_where); - } - - private: - - const char *m_what; - void *m_where; - - }; -}}}} - -/////////////////////////////////////////////////////////////////////////// -// Pool sizes - -#ifndef BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE - // Size of static memory block of memory_pool. - // Define BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE before including rapidxml.hpp if you want to override the default value. - // No dynamic memory allocations are performed by memory_pool until static memory is exhausted. - #define BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE (64 * 1024) -#endif - -#ifndef BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE - // Size of dynamic memory block of memory_pool. - // Define BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE before including rapidxml.hpp if you want to override the default value. - // After the static block is exhausted, dynamic blocks with approximately this size are allocated by memory_pool. - #define BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE (64 * 1024) -#endif - -#ifndef BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - // Memory allocation alignment. - // Define BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT before including rapidxml.hpp if you want to override the default value, which is the size of pointer. - // All memory allocations for nodes, attributes and strings will be aligned to this value. - // This must be a power of 2 and at least 1, otherwise memory_pool will not work. - #define BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT sizeof(void *) -#endif - -namespace boost { namespace property_tree { namespace detail {namespace rapidxml -{ - // Forward declarations - template<class Ch> class xml_node; - template<class Ch> class xml_attribute; - template<class Ch> class xml_document; - - //! Enumeration listing all node types produced by the parser. - //! Use xml_node::type() function to query node type. - enum node_type - { - node_document, //!< A document node. Name and value are empty. - node_element, //!< An element node. Name contains element name. Value contains text of first data node. - node_data, //!< A data node. Name is empty. Value contains data text. - node_cdata, //!< A CDATA node. Name is empty. Value contains data text. - node_comment, //!< A comment node. Name is empty. Value contains comment text. - node_declaration, //!< A declaration node. Name and value are empty. Declaration parameters (version, encoding and standalone) are in node attributes. - node_doctype, //!< A DOCTYPE node. Name is empty. Value contains DOCTYPE text. - node_pi //!< A PI node. Name contains target. Value contains instructions. - }; - - /////////////////////////////////////////////////////////////////////// - // Parsing flags - - //! Parse flag instructing the parser to not create data nodes. - //! Text of first data node will still be placed in value of parent element, unless rapidxml::parse_no_element_values flag is also specified. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_no_data_nodes = 0x1; - - //! Parse flag instructing the parser to not use text of first data node as a value of parent element. - //! Can be combined with other flags by use of | operator. - //! Note that child data nodes of element node take precendence over its value when printing. - //! That is, if element has one or more child data nodes <em>and</em> a value, the value will be ignored. - //! Use rapidxml::parse_no_data_nodes flag to prevent creation of data nodes if you want to manipulate data using values of elements. - //! <br><br> - //! See xml_document::parse() function. - const int parse_no_element_values = 0x2; - - //! Parse flag instructing the parser to not place zero terminators after strings in the source text. - //! By default zero terminators are placed, modifying source text. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_no_string_terminators = 0x4; - - //! Parse flag instructing the parser to not translate entities in the source text. - //! By default entities are translated, modifying source text. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_no_entity_translation = 0x8; - - //! Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters. - //! By default, UTF-8 handling is enabled. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_no_utf8 = 0x10; - - //! Parse flag instructing the parser to create XML declaration node. - //! By default, declaration node is not created. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_declaration_node = 0x20; - - //! Parse flag instructing the parser to create comments nodes. - //! By default, comment nodes are not created. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_comment_nodes = 0x40; - - //! Parse flag instructing the parser to create DOCTYPE node. - //! By default, doctype node is not created. - //! Although W3C specification allows at most one DOCTYPE node, RapidXml will silently accept documents with more than one. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_doctype_node = 0x80; - - //! Parse flag instructing the parser to create PI nodes. - //! By default, PI nodes are not created. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_pi_nodes = 0x100; - - //! Parse flag instructing the parser to validate closing tag names. - //! If not set, name inside closing tag is irrelevant to the parser. - //! By default, closing tags are not validated. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_validate_closing_tags = 0x200; - - //! Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes. - //! By default, whitespace is not trimmed. - //! This flag does not cause the parser to modify source text. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_trim_whitespace = 0x400; - - //! Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space character. - //! Trimming of leading and trailing whitespace of data is controlled by rapidxml::parse_trim_whitespace flag. - //! By default, whitespace is not normalized. - //! If this flag is specified, source text will be modified. - //! Can be combined with other flags by use of | operator. - //! <br><br> - //! See xml_document::parse() function. - const int parse_normalize_whitespace = 0x800; - - // Compound flags - - //! Parse flags which represent default behaviour of the parser. - //! This is always equal to 0, so that all other flags can be simply ored together. - //! Normally there is no need to inconveniently disable flags by anding with their negated (~) values. - //! This also means that meaning of each flag is a <i>negation</i> of the default setting. - //! For example, if flag name is rapidxml::parse_no_utf8, it means that utf-8 is <i>enabled</i> by default, - //! and using the flag will disable it. - //! <br><br> - //! See xml_document::parse() function. - const int parse_default = 0; - - //! A combination of parse flags that forbids any modifications of the source text. - //! This also results in faster parsing. However, note that the following will occur: - //! <ul> - //! <li>names and values of nodes will not be zero terminated, you have to use xml_base::name_size() and xml_base::value_size() functions to determine where name and value ends</li> - //! <li>entities will not be translated</li> - //! <li>whitespace will not be normalized</li> - //! </ul> - //! See xml_document::parse() function. - const int parse_non_destructive = parse_no_string_terminators | parse_no_entity_translation; - - //! A combination of parse flags resulting in fastest possible parsing, without sacrificing important data. - //! <br><br> - //! See xml_document::parse() function. - const int parse_fastest = parse_non_destructive | parse_no_data_nodes; - - //! A combination of parse flags resulting in largest amount of data being extracted. - //! This usually results in slowest parsing. - //! <br><br> - //! See xml_document::parse() function. - const int parse_full = parse_declaration_node | parse_comment_nodes | parse_doctype_node | parse_pi_nodes | parse_validate_closing_tags; - - /////////////////////////////////////////////////////////////////////// - // Internals - - //! \cond internal - namespace internal - { - - // Struct that contains lookup tables for the parser - // It must be a template to allow correct linking (because it has static data members, which are defined in a header file). - template<int Dummy> - struct lookup_tables - { - static const unsigned char lookup_whitespace[256]; // Whitespace table - static const unsigned char lookup_node_name[256]; // Node name table - static const unsigned char lookup_text[256]; // Text table - static const unsigned char lookup_text_pure_no_ws[256]; // Text table - static const unsigned char lookup_text_pure_with_ws[256]; // Text table - static const unsigned char lookup_attribute_name[256]; // Attribute name table - static const unsigned char lookup_attribute_data_1[256]; // Attribute data table with single quote - static const unsigned char lookup_attribute_data_1_pure[256]; // Attribute data table with single quote - static const unsigned char lookup_attribute_data_2[256]; // Attribute data table with double quotes - static const unsigned char lookup_attribute_data_2_pure[256]; // Attribute data table with double quotes - static const unsigned char lookup_digits[256]; // Digits - static const unsigned char lookup_upcase[256]; // To uppercase conversion table for ASCII characters - }; - - // Find length of the string - template<class Ch> - inline std::size_t measure(const Ch *p) - { - const Ch *tmp = p; - while (*tmp) - ++tmp; - return tmp - p; - } - - // Compare strings for equality - template<class Ch> - inline bool compare(const Ch *p1, std::size_t size1, const Ch *p2, std::size_t size2, bool case_sensitive) - { - if (size1 != size2) - return false; - if (case_sensitive) - { - for (const Ch *end = p1 + size1; p1 < end; ++p1, ++p2) - if (*p1 != *p2) - return false; - } - else - { - for (const Ch *end = p1 + size1; p1 < end; ++p1, ++p2) - if (lookup_tables<0>::lookup_upcase[static_cast<unsigned char>(*p1)] != lookup_tables<0>::lookup_upcase[static_cast<unsigned char>(*p2)]) - return false; - } - return true; - } - - template<class Ch> - inline size_t get_index(const Ch c) - { - // If not ASCII char, its semantic is same as plain 'z'. - // char could be signed, so first stretch and make unsigned. - unsigned n = c; - if (n > 127) - { - return 'z'; - } - return c; - } - } - //! \endcond - - /////////////////////////////////////////////////////////////////////// - // Memory pool - - //! This class is used by the parser to create new nodes and attributes, without overheads of dynamic memory allocation. - //! In most cases, you will not need to use this class directly. - //! However, if you need to create nodes manually or modify names/values of nodes, - //! you are encouraged to use memory_pool of relevant xml_document to allocate the memory. - //! Not only is this faster than allocating them by using <code>new</code> operator, - //! but also their lifetime will be tied to the lifetime of document, - //! possibly simplyfing memory management. - //! <br><br> - //! Call allocate_node() or allocate_attribute() functions to obtain new nodes or attributes from the pool. - //! You can also call allocate_string() function to allocate strings. - //! Such strings can then be used as names or values of nodes without worrying about their lifetime. - //! Note that there is no <code>free()</code> function -- all allocations are freed at once when clear() function is called, - //! or when the pool is destroyed. - //! <br><br> - //! It is also possible to create a standalone memory_pool, and use it - //! to allocate nodes, whose lifetime will not be tied to any document. - //! <br><br> - //! Pool maintains <code>BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE</code> bytes of statically allocated memory. - //! Until static memory is exhausted, no dynamic memory allocations are done. - //! When static memory is exhausted, pool allocates additional blocks of memory of size <code>BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE</code> each, - //! by using global <code>new[]</code> and <code>delete[]</code> operators. - //! This behaviour can be changed by setting custom allocation routines. - //! Use set_allocator() function to set them. - //! <br><br> - //! Allocations for nodes, attributes and strings are aligned at <code>BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT</code> bytes. - //! This value defaults to the size of pointer on target architecture. - //! <br><br> - //! To obtain absolutely top performance from the parser, - //! it is important that all nodes are allocated from a single, contiguous block of memory. - //! Otherwise, cache misses when jumping between two (or more) disjoint blocks of memory can slow down parsing quite considerably. - //! If required, you can tweak <code>BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE</code>, <code>BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE</code> and <code>BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT</code> - //! to obtain best wasted memory to performance compromise. - //! To do it, define their values before rapidxml.hpp file is included. - //! \param Ch Character type of created nodes. - template<class Ch = char> - class memory_pool - { - - public: - - //! \cond internal - // Prefixed names to work around weird MSVC lookup bug. - typedef void *(boost_ptree_raw_alloc_func)(std::size_t); // Type of user-defined function used to allocate memory - typedef void (boost_ptree_raw_free_func)(void *); // Type of user-defined function used to free memory - //! \endcond - - //! Constructs empty pool with default allocator functions. - memory_pool() - : m_alloc_func(0) - , m_free_func(0) - { - init(); - } - - //! Destroys pool and frees all the memory. - //! This causes memory occupied by nodes allocated by the pool to be freed. - //! Nodes allocated from the pool are no longer valid. - ~memory_pool() - { - clear(); - } - - //! Allocates a new node from the pool, and optionally assigns name and value to it. - //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>. - //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function - //! will call rapidxml::parse_error_handler() function. - //! \param type Type of node to create. - //! \param name Name to assign to the node, or 0 to assign no name. - //! \param value Value to assign to the node, or 0 to assign no value. - //! \param name_size Size of name to assign, or 0 to automatically calculate size from name string. - //! \param value_size Size of value to assign, or 0 to automatically calculate size from value string. - //! \return Pointer to allocated node. This pointer will never be NULL. - xml_node<Ch> *allocate_node(node_type type, - const Ch *name = 0, const Ch *value = 0, - std::size_t name_size = 0, std::size_t value_size = 0) - { - void *memory = allocate_aligned(sizeof(xml_node<Ch>)); - xml_node<Ch> *node = new(memory) xml_node<Ch>(type); - if (name) - { - if (name_size > 0) - node->name(name, name_size); - else - node->name(name); - } - if (value) - { - if (value_size > 0) - node->value(value, value_size); - else - node->value(value); - } - return node; - } - - //! Allocates a new attribute from the pool, and optionally assigns name and value to it. - //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>. - //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function - //! will call rapidxml::parse_error_handler() function. - //! \param name Name to assign to the attribute, or 0 to assign no name. - //! \param value Value to assign to the attribute, or 0 to assign no value. - //! \param name_size Size of name to assign, or 0 to automatically calculate size from name string. - //! \param value_size Size of value to assign, or 0 to automatically calculate size from value string. - //! \return Pointer to allocated attribute. This pointer will never be NULL. - xml_attribute<Ch> *allocate_attribute(const Ch *name = 0, const Ch *value = 0, - std::size_t name_size = 0, std::size_t value_size = 0) - { - void *memory = allocate_aligned(sizeof(xml_attribute<Ch>)); - xml_attribute<Ch> *attribute = new(memory) xml_attribute<Ch>; - if (name) - { - if (name_size > 0) - attribute->name(name, name_size); - else - attribute->name(name); - } - if (value) - { - if (value_size > 0) - attribute->value(value, value_size); - else - attribute->value(value); - } - return attribute; - } - - //! Allocates a char array of given size from the pool, and optionally copies a given string to it. - //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>. - //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function - //! will call rapidxml::parse_error_handler() function. - //! \param source String to initialize the allocated memory with, or 0 to not initialize it. - //! \param size Number of characters to allocate, or zero to calculate it automatically from source string length; if size is 0, source string must be specified and null terminated. - //! \return Pointer to allocated char array. This pointer will never be NULL. - Ch *allocate_string(const Ch *source = 0, std::size_t size = 0) - { - BOOST_ASSERT(source || size); // Either source or size (or both) must be specified - if (size == 0) - size = internal::measure(source) + 1; - Ch *result = static_cast<Ch *>(allocate_aligned(size * sizeof(Ch))); - if (source) - for (std::size_t i = 0; i < size; ++i) - result[i] = source[i]; - return result; - } - - //! Clones an xml_node and its hierarchy of child nodes and attributes. - //! Nodes and attributes are allocated from this memory pool. - //! Names and values are not cloned, they are shared between the clone and the source. - //! Result node can be optionally specified as a second parameter, - //! in which case its contents will be replaced with cloned source node. - //! This is useful when you want to clone entire document. - //! \param source Node to clone. - //! \param result Node to put results in, or 0 to automatically allocate result node - //! \return Pointer to cloned node. This pointer will never be NULL. - xml_node<Ch> *clone_node(const xml_node<Ch> *source, xml_node<Ch> *result = 0) - { - // Prepare result node - if (result) - { - result->remove_all_attributes(); - result->remove_all_nodes(); - result->type(source->type()); - } - else - result = allocate_node(source->type()); - - // Clone name and value - result->name(source->name(), source->name_size()); - result->value(source->value(), source->value_size()); - - // Clone child nodes and attributes - for (xml_node<Ch> *child = source->first_node(); child; child = child->next_sibling()) - result->append_node(clone_node(child)); - for (xml_attribute<Ch> *attr = source->first_attribute(); attr; attr = attr->next_attribute()) - result->append_attribute(allocate_attribute(attr->name(), attr->value(), attr->name_size(), attr->value_size())); - - return result; - } - - //! Clears the pool. - //! This causes memory occupied by nodes allocated by the pool to be freed. - //! Any nodes or strings allocated from the pool will no longer be valid. - void clear() - { - while (m_begin != m_static_memory) - { - char *previous_begin = reinterpret_cast<header *>(align(m_begin))->previous_begin; - if (m_free_func) - m_free_func(m_begin); - else - delete[] m_begin; - m_begin = previous_begin; - } - init(); - } - - //! Sets or resets the user-defined memory allocation functions for the pool. - //! This can only be called when no memory is allocated from the pool yet, otherwise results are undefined. - //! Allocation function must not return invalid pointer on failure. It should either throw, - //! stop the program, or use <code>longjmp()</code> function to pass control to other place of program. - //! If it returns invalid pointer, results are undefined. - //! <br><br> - //! User defined allocation functions must have the following forms: - //! <br><code> - //! <br>void *allocate(std::size_t size); - //! <br>void free(void *pointer); - //! </code><br> - //! \param af Allocation function, or 0 to restore default function - //! \param ff Free function, or 0 to restore default function - void set_allocator(boost_ptree_raw_alloc_func *af, boost_ptree_raw_free_func *ff) - { - BOOST_ASSERT(m_begin == m_static_memory && m_ptr == align(m_begin)); // Verify that no memory is allocated yet - m_alloc_func = af; - m_free_func = ff; - } - - private: - - struct header - { - char *previous_begin; - }; - - void init() - { - m_begin = m_static_memory; - m_ptr = align(m_begin); - m_end = m_static_memory + sizeof(m_static_memory); - } - - char *align(char *ptr) - { - std::size_t alignment = ((BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - (std::size_t(ptr) & (BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - 1))) & (BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - 1)); - return ptr + alignment; - } - - char *allocate_raw(std::size_t size) - { - // Allocate - void *memory; - if (m_alloc_func) // Allocate memory using either user-specified allocation function or global operator new[] - { - memory = m_alloc_func(size); - BOOST_ASSERT(memory); // Allocator is not allowed to return 0, on failure it must either throw, stop the program or use longjmp - } - else - { - memory = new char[size]; - } - return static_cast<char *>(memory); - } - - void *allocate_aligned(std::size_t size) - { - // Calculate aligned pointer - char *result = align(m_ptr); - - // If not enough memory left in current pool, allocate a new pool - if (result + size > m_end) - { - // Calculate required pool size (may be bigger than BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE) - std::size_t pool_size = BOOST_PROPERTY_TREE_RAPIDXML_DYNAMIC_POOL_SIZE; - if (pool_size < size) - pool_size = size; - - // Allocate - std::size_t alloc_size = sizeof(header) + (2 * BOOST_PROPERTY_TREE_RAPIDXML_ALIGNMENT - 2) + pool_size; // 2 alignments required in worst case: one for header, one for actual allocation - char *raw_memory = allocate_raw(alloc_size); - - // Setup new pool in allocated memory - char *pool = align(raw_memory); - header *new_header = reinterpret_cast<header *>(pool); - new_header->previous_begin = m_begin; - m_begin = raw_memory; - m_ptr = pool + sizeof(header); - m_end = raw_memory + alloc_size; - - // Calculate aligned pointer again using new pool - result = align(m_ptr); - } - - // Update pool and return aligned pointer - m_ptr = result + size; - return result; - } - - char *m_begin; // Start of raw memory making up current pool - char *m_ptr; // First free byte in current pool - char *m_end; // One past last available byte in current pool - char m_static_memory[BOOST_PROPERTY_TREE_RAPIDXML_STATIC_POOL_SIZE]; // Static raw memory - boost_ptree_raw_alloc_func *m_alloc_func; // Allocator function, or 0 if default is to be used - boost_ptree_raw_free_func *m_free_func; // Free function, or 0 if default is to be used - }; - - /////////////////////////////////////////////////////////////////////////// - // XML base - - //! Base class for xml_node and xml_attribute implementing common functions: - //! name(), name_size(), value(), value_size() and parent(). - //! \param Ch Character type to use - template<class Ch = char> - class xml_base - { - - public: - - /////////////////////////////////////////////////////////////////////////// - // Construction & destruction - - // Construct a base with empty name, value and parent - xml_base() - : m_name(0) - , m_value(0) - , m_parent(0) - { - } - - /////////////////////////////////////////////////////////////////////////// - // Node data access - - //! Gets name of the node. - //! Interpretation of name depends on type of node. - //! Note that name will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse. - //! <br><br> - //! Use name_size() function to determine length of the name. - //! \return Name of node, or empty string if node has no name. - Ch *name() const - { - return m_name ? m_name : nullstr(); - } - - //! Gets size of node name, not including terminator character. - //! This function works correctly irrespective of whether name is or is not zero terminated. - //! \return Size of node name, in characters. - std::size_t name_size() const - { - return m_name ? m_name_size : 0; - } - - //! Gets value of node. - //! Interpretation of value depends on type of node. - //! Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse. - //! <br><br> - //! Use value_size() function to determine length of the value. - //! \return Value of node, or empty string if node has no value. - Ch *value() const - { - return m_value ? m_value : nullstr(); - } - - //! Gets size of node value, not including terminator character. - //! This function works correctly irrespective of whether value is or is not zero terminated. - //! \return Size of node value, in characters. - std::size_t value_size() const - { - return m_value ? m_value_size : 0; - } - - /////////////////////////////////////////////////////////////////////////// - // Node modification - - //! Sets name of node to a non zero-terminated string. - //! See \ref ownership_of_strings. - //! <br><br> - //! Note that node does not own its name or value, it only stores a pointer to it. - //! It will not delete or otherwise free the pointer on destruction. - //! It is reponsibility of the user to properly manage lifetime of the string. - //! The easiest way to achieve it is to use memory_pool of the document to allocate the string - - //! on destruction of the document the string will be automatically freed. - //! <br><br> - //! Size of name must be specified separately, because name does not have to be zero terminated. - //! Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated). - //! \param n Name of node to set. Does not have to be zero terminated. - //! \param size Size of name, in characters. This does not include zero terminator, if one is present. - void name(const Ch *n, std::size_t size) - { - m_name = const_cast<Ch *>(n); - m_name_size = size; - } - - //! Sets name of node to a zero-terminated string. - //! See also \ref ownership_of_strings and xml_node::name(const Ch *, std::size_t). - //! \param n Name of node to set. Must be zero terminated. - void name(const Ch *n) - { - name(n, internal::measure(n)); - } - - //! Sets value of node to a non zero-terminated string. - //! See \ref ownership_of_strings. - //! <br><br> - //! Note that node does not own its name or value, it only stores a pointer to it. - //! It will not delete or otherwise free the pointer on destruction. - //! It is reponsibility of the user to properly manage lifetime of the string. - //! The easiest way to achieve it is to use memory_pool of the document to allocate the string - - //! on destruction of the document the string will be automatically freed. - //! <br><br> - //! Size of value must be specified separately, because it does not have to be zero terminated. - //! Use value(const Ch *) function to have the length automatically calculated (string must be zero terminated). - //! <br><br> - //! If an element has a child node of type node_data, it will take precedence over element value when printing. - //! If you want to manipulate data of elements using values, use parser flag rapidxml::parse_no_data_nodes to prevent creation of data nodes by the parser. - //! \param val value of node to set. Does not have to be zero terminated. - //! \param size Size of value, in characters. This does not include zero terminator, if one is present. - void value(const Ch *val, std::size_t size) - { - m_value = const_cast<Ch *>(val); - m_value_size = size; - } - - //! Sets value of node to a zero-terminated string. - //! See also \ref ownership_of_strings and xml_node::value(const Ch *, std::size_t). - //! \param val Vame of node to set. Must be zero terminated. - void value(const Ch *val) - { - this->value(val, internal::measure(val)); - } - - /////////////////////////////////////////////////////////////////////////// - // Related nodes access - - //! Gets node parent. - //! \return Pointer to parent node, or 0 if there is no parent. - xml_node<Ch> *parent() const - { - return m_parent; - } - - protected: - - // Return empty string - static Ch *nullstr() - { - static Ch zero = Ch('\0'); - return &zero; - } - - Ch *m_name; // Name of node, or 0 if no name - Ch *m_value; // Value of node, or 0 if no value - std::size_t m_name_size; // Length of node name, or undefined of no name - std::size_t m_value_size; // Length of node value, or undefined if no value - xml_node<Ch> *m_parent; // Pointer to parent node, or 0 if none - - }; - - //! Class representing attribute node of XML document. - //! Each attribute has name and value strings, which are available through name() and value() functions (inherited from xml_base). - //! Note that after parse, both name and value of attribute will point to interior of source text used for parsing. - //! Thus, this text must persist in memory for the lifetime of attribute. - //! \param Ch Character type to use. - template<class Ch = char> - class xml_attribute: public xml_base<Ch> - { - - friend class xml_node<Ch>; - - public: - - /////////////////////////////////////////////////////////////////////////// - // Construction & destruction - - //! Constructs an empty attribute with the specified type. - //! Consider using memory_pool of appropriate xml_document if allocating attributes manually. - xml_attribute() - { - } - - /////////////////////////////////////////////////////////////////////////// - // Related nodes access - - //! Gets document of which attribute is a child. - //! \return Pointer to document that contains this attribute, or 0 if there is no parent document. - xml_document<Ch> *document() const - { - if (xml_node<Ch> *node = this->parent()) - { - while (node->parent()) - node = node->parent(); - return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0; - } - else - return 0; - } - - //! Gets previous attribute, optionally matching attribute name. - //! \param n Name of attribute to find, or 0 to return previous attribute regardless of its name; this string doesn't have to be zero-terminated if nsize is non-zero - //! \param nsize Size of name, in characters, or 0 to have size calculated automatically from string - //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters - //! \return Pointer to found attribute, or 0 if not found. - xml_attribute<Ch> *previous_attribute(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const - { - if (n) - { - if (nsize == 0) - nsize = internal::measure(n); - for (xml_attribute<Ch> *attribute = m_prev_attribute; attribute; attribute = attribute->m_prev_attribute) - if (internal::compare(attribute->name(), attribute->name_size(), n, nsize, case_sensitive)) - return attribute; - return 0; - } - else - return this->m_parent ? m_prev_attribute : 0; - } - - //! Gets next attribute, optionally matching attribute name. - //! \param n Name of attribute to find, or 0 to return next attribute regardless of its name; this string doesn't have to be zero-terminated if nsize is non-zero - //! \param nsize Size of name, in characters, or 0 to have size calculated automatically from string - //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters - //! \return Pointer to found attribute, or 0 if not found. - xml_attribute<Ch> *next_attribute(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const - { - if (n) - { - if (nsize == 0) - nsize = internal::measure(n); - for (xml_attribute<Ch> *attribute = m_next_attribute; attribute; attribute = attribute->m_next_attribute) - if (internal::compare(attribute->name(), attribute->name_size(), n, nsize, case_sensitive)) - return attribute; - return 0; - } - else - return this->m_parent ? m_next_attribute : 0; - } - - private: - - xml_attribute<Ch> *m_prev_attribute; // Pointer to previous sibling of attribute, or 0 if none; only valid if parent is non-zero - xml_attribute<Ch> *m_next_attribute; // Pointer to next sibling of attribute, or 0 if none; only valid if parent is non-zero - - }; - - /////////////////////////////////////////////////////////////////////////// - // XML node - - //! Class representing a node of XML document. - //! Each node may have associated name and value strings, which are available through name() and value() functions. - //! Interpretation of name and value depends on type of the node. - //! Type of node can be determined by using type() function. - //! <br><br> - //! Note that after parse, both name and value of node, if any, will point interior of source text used for parsing. - //! Thus, this text must persist in the memory for the lifetime of node. - //! \param Ch Character type to use. - template<class Ch = char> - class xml_node: public xml_base<Ch> - { - - public: - - /////////////////////////////////////////////////////////////////////////// - // Construction & destruction - - //! Constructs an empty node with the specified type. - //! Consider using memory_pool of appropriate document to allocate nodes manually. - //! \param t Type of node to construct. - xml_node(node_type t) - : m_type(t) - , m_first_node(0) - , m_first_attribute(0) - { - } - - /////////////////////////////////////////////////////////////////////////// - // Node data access - - //! Gets type of node. - //! \return Type of node. - node_type type() const - { - return m_type; - } - - /////////////////////////////////////////////////////////////////////////// - // Related nodes access - - //! Gets document of which node is a child. - //! \return Pointer to document that contains this node, or 0 if there is no parent document. - xml_document<Ch> *document() const - { - xml_node<Ch> *node = const_cast<xml_node<Ch> *>(this); - while (node->parent()) - node = node->parent(); - return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0; - } - - //! Gets first child node, optionally matching node name. - //! \param n Name of child to find, or 0 to return first child regardless of its name; this string doesn't have to be zero-terminated if nsize is non-zero - //! \param nsize Size of name, in characters, or 0 to have size calculated automatically from string - //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters - //! \return Pointer to found child, or 0 if not found. - xml_node<Ch> *first_node(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const - { - if (n) - { - if (nsize == 0) - nsize = internal::measure(n); - for (xml_node<Ch> *child = m_first_node; child; child = child->next_sibling()) - if (internal::compare(child->name(), child->name_size(), n, nsize, case_sensitive)) - return child; - return 0; - } - else - return m_first_node; - } - - //! Gets last child node, optionally matching node name. - //! Behaviour is undefined if node has no children. - //! Use first_node() to test if node has children. - //! \param n Name of child to find, or 0 to return last child regardless of its name; this string doesn't have to be zero-terminated if nsize is non-zero - //! \param nsize Size of name, in characters, or 0 to have size calculated automatically from string - //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters - //! \return Pointer to found child, or 0 if not found. - xml_node<Ch> *last_node(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const - { - BOOST_ASSERT(m_first_node); // Cannot query for last child if node has no children - if (n) - { - if (nsize == 0) - nsize = internal::measure(n); - for (xml_node<Ch> *child = m_last_node; child; child = child->previous_sibling()) - if (internal::compare(child->name(), child->name_size(), n, nsize, case_sensitive)) - return child; - return 0; - } - else - return m_last_node; - } - - //! Gets previous sibling node, optionally matching node name. - //! Behaviour is undefined if node has no parent. - //! Use parent() to test if node has a parent. - //! \param n Name of sibling to find, or 0 to return previous sibling regardless of its name; this string doesn't have to be zero-terminated if nsize is non-zero - //! \param nsize Size of name, in characters, or 0 to have size calculated automatically from string - //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters - //! \return Pointer to found sibling, or 0 if not found. - xml_node<Ch> *previous_sibling(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const - { - BOOST_ASSERT(this->m_parent); // Cannot query for siblings if node has no parent - if (n) - { - if (nsize == 0) - nsize = internal::measure(n); - for (xml_node<Ch> *sibling = m_prev_sibling; sibling; sibling = sibling->m_prev_sibling) - if (internal::compare(sibling->name(), sibling->name_size(), n, nsize, case_sensitive)) - return sibling; - return 0; - } - else - return m_prev_sibling; - } - - //! Gets next sibling node, optionally matching node name. - //! Behaviour is undefined if node has no parent. - //! Use parent() to test if node has a parent. - //! \param n Name of sibling to find, or 0 to return next sibling regardless of its name; this string doesn't have to be zero-terminated if nsize is non-zero - //! \param nsize Size of name, in characters, or 0 to have size calculated automatically from string - //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters - //! \return Pointer to found sibling, or 0 if not found. - xml_node<Ch> *next_sibling(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const - { - BOOST_ASSERT(this->m_parent); // Cannot query for siblings if node has no parent - if (n) - { - if (nsize == 0) - nsize = internal::measure(n); - for (xml_node<Ch> *sibling = m_next_sibling; sibling; sibling = sibling->m_next_sibling) - if (internal::compare(sibling->name(), sibling->name_size(), n, nsize, case_sensitive)) - return sibling; - return 0; - } - else - return m_next_sibling; - } - - //! Gets first attribute of node, optionally matching attribute name. - //! \param n Name of attribute to find, or 0 to return first attribute regardless of its name; this string doesn't have to be zero-terminated if nsize is non-zero - //! \param nsize Size of name, in characters, or 0 to have size calculated automatically from string - //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters - //! \return Pointer to found attribute, or 0 if not found. - xml_attribute<Ch> *first_attribute(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const - { - if (n) - { - if (nsize == 0) - nsize = internal::measure(n); - for (xml_attribute<Ch> *attribute = m_first_attribute; attribute; attribute = attribute->m_next_attribute) - if (internal::compare(attribute->name(), attribute->name_size(), n, nsize, case_sensitive)) - return attribute; - return 0; - } - else - return m_first_attribute; - } - - //! Gets last attribute of node, optionally matching attribute name. - //! \param n Name of attribute to find, or 0 to return last attribute regardless of its name; this string doesn't have to be zero-terminated if nsize is non-zero - //! \param nsize Size of name, in characters, or 0 to have size calculated automatically from string - //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters - //! \return Pointer to found attribute, or 0 if not found. - xml_attribute<Ch> *last_attribute(const Ch *n = 0, std::size_t nsize = 0, bool case_sensitive = true) const - { - if (n) - { - if (nsize == 0) - nsize = internal::measure(n); - for (xml_attribute<Ch> *attribute = m_last_attribute; attribute; attribute = attribute->m_prev_attribute) - if (internal::compare(attribute->name(), attribute->name_size(), n, nsize, case_sensitive)) - return attribute; - return 0; - } - else - return m_first_attribute ? m_last_attribute : 0; - } - - /////////////////////////////////////////////////////////////////////////// - // Node modification - - //! Sets type of node. - //! \param t Type of node to set. - void type(node_type t) - { - m_type = t; - } - - /////////////////////////////////////////////////////////////////////////// - // Node manipulation - - //! Prepends a new child node. - //! The prepended child becomes the first child, and all existing children are moved one position back. - //! \param child Node to prepend. - void prepend_node(xml_node<Ch> *child) - { - BOOST_ASSERT(child && !child->parent() && child->type() != node_document); - if (first_node()) - { - child->m_next_sibling = m_first_node; - m_first_node->m_prev_sibling = child; - } - else - { - child->m_next_sibling = 0; - m_last_node = child; - } - m_first_node = child; - child->m_parent = this; - child->m_prev_sibling = 0; - } - - //! Appends a new child node. - //! The appended child becomes the last child. - //! \param child Node to append. - void append_node(xml_node<Ch> *child) - { - BOOST_ASSERT(child && !child->parent() && child->type() != node_document); - if (first_node()) - { - child->m_prev_sibling = m_last_node; - m_last_node->m_next_sibling = child; - } - else - { - child->m_prev_sibling = 0; - m_first_node = child; - } - m_last_node = child; - child->m_parent = this; - child->m_next_sibling = 0; - } - - //! Inserts a new child node at specified place inside the node. - //! All children after and including the specified node are moved one position back. - //! \param where Place where to insert the child, or 0 to insert at the back. - //! \param child Node to insert. - void insert_node(xml_node<Ch> *where, xml_node<Ch> *child) - { - BOOST_ASSERT(!where || where->parent() == this); - BOOST_ASSERT(child && !child->parent() && child->type() != node_document); - if (where == m_first_node) - prepend_node(child); - else if (where == 0) - append_node(child); - else - { - child->m_prev_sibling = where->m_prev_sibling; - child->m_next_sibling = where; - where->m_prev_sibling->m_next_sibling = child; - where->m_prev_sibling = child; - child->m_parent = this; - } - } - - //! Removes first child node. - //! If node has no children, behaviour is undefined. - //! Use first_node() to test if node has children. - void remove_first_node() - { - BOOST_ASSERT(first_node()); - xml_node<Ch> *child = m_first_node; - m_first_node = child->m_next_sibling; - if (child->m_next_sibling) - child->m_next_sibling->m_prev_sibling = 0; - else - m_last_node = 0; - child->m_parent = 0; - } - - //! Removes last child of the node. - //! If node has no children, behaviour is undefined. - //! Use first_node() to test if node has children. - void remove_last_node() - { - BOOST_ASSERT(first_node()); - xml_node<Ch> *child = m_last_node; - if (child->m_prev_sibling) - { - m_last_node = child->m_prev_sibling; - child->m_prev_sibling->m_next_sibling = 0; - } - else - m_first_node = 0; - child->m_parent = 0; - } - - //! Removes specified child from the node - // \param where Pointer to child to be removed. - void remove_node(xml_node<Ch> *where) - { - BOOST_ASSERT(where && where->parent() == this); - BOOST_ASSERT(first_node()); - if (where == m_first_node) - remove_first_node(); - else if (where == m_last_node) - remove_last_node(); - else - { - where->m_prev_sibling->m_next_sibling = where->m_next_sibling; - where->m_next_sibling->m_prev_sibling = where->m_prev_sibling; - where->m_parent = 0; - } - } - - //! Removes all child nodes (but not attributes). - void remove_all_nodes() - { - for (xml_node<Ch> *node = first_node(); node; node = node->m_next_sibling) - node->m_parent = 0; - m_first_node = 0; - } - - //! Prepends a new attribute to the node. - //! \param attribute Attribute to prepend. - void prepend_attribute(xml_attribute<Ch> *attribute) - { - BOOST_ASSERT(attribute && !attribute->parent()); - if (first_attribute()) - { - attribute->m_next_attribute = m_first_attribute; - m_first_attribute->m_prev_attribute = attribute; - } - else - { - attribute->m_next_attribute = 0; - m_last_attribute = attribute; - } - m_first_attribute = attribute; - attribute->m_parent = this; - attribute->m_prev_attribute = 0; - } - - //! Appends a new attribute to the node. - //! \param attribute Attribute to append. - void append_attribute(xml_attribute<Ch> *attribute) - { - BOOST_ASSERT(attribute && !attribute->parent()); - if (first_attribute()) - { - attribute->m_prev_attribute = m_last_attribute; - m_last_attribute->m_next_attribute = attribute; - } - else - { - attribute->m_prev_attribute = 0; - m_first_attribute = attribute; - } - m_last_attribute = attribute; - attribute->m_parent = this; - attribute->m_next_attribute = 0; - } - - //! Inserts a new attribute at specified place inside the node. - //! All attributes after and including the specified attribute are moved one position back. - //! \param where Place where to insert the attribute, or 0 to insert at the back. - //! \param attribute Attribute to insert. - void insert_attribute(xml_attribute<Ch> *where, xml_attribute<Ch> *attribute) - { - BOOST_ASSERT(!where || where->parent() == this); - BOOST_ASSERT(attribute && !attribute->parent()); - if (where == m_first_attribute) - prepend_attribute(attribute); - else if (where == 0) - append_attribute(attribute); - else - { - attribute->m_prev_attribute = where->m_prev_attribute; - attribute->m_next_attribute = where; - where->m_prev_attribute->m_next_attribute = attribute; - where->m_prev_attribute = attribute; - attribute->m_parent = this; - } - } - - //! Removes first attribute of the node. - //! If node has no attributes, behaviour is undefined. - //! Use first_attribute() to test if node has attributes. - void remove_first_attribute() - { - BOOST_ASSERT(first_attribute()); - xml_attribute<Ch> *attribute = m_first_attribute; - if (attribute->m_next_attribute) - { - attribute->m_next_attribute->m_prev_attribute = 0; - } - else - m_last_attribute = 0; - attribute->m_parent = 0; - m_first_attribute = attribute->m_next_attribute; - } - - //! Removes last attribute of the node. - //! If node has no attributes, behaviour is undefined. - //! Use first_attribute() to test if node has attributes. - void remove_last_attribute() - { - BOOST_ASSERT(first_attribute()); - xml_attribute<Ch> *attribute = m_last_attribute; - if (attribute->m_prev_attribute) - { - attribute->m_prev_attribute->m_next_attribute = 0; - m_last_attribute = attribute->m_prev_attribute; - } - else - m_first_attribute = 0; - attribute->m_parent = 0; - } - - //! Removes specified attribute from node. - //! \param where Pointer to attribute to be removed. - void remove_attribute(xml_attribute<Ch> *where) - { - BOOST_ASSERT(first_attribute() && where->parent() == this); - if (where == m_first_attribute) - remove_first_attribute(); - else if (where == m_last_attribute) - remove_last_attribute(); - else - { - where->m_prev_attribute->m_next_attribute = where->m_next_attribute; - where->m_next_attribute->m_prev_attribute = where->m_prev_attribute; - where->m_parent = 0; - } - } - - //! Removes all attributes of node. - void remove_all_attributes() - { - for (xml_attribute<Ch> *attribute = first_attribute(); attribute; attribute = attribute->m_next_attribute) - attribute->m_parent = 0; - m_first_attribute = 0; - } - - private: - - /////////////////////////////////////////////////////////////////////////// - // Restrictions - - // No copying - xml_node(const xml_node &); - void operator =(const xml_node &); - - /////////////////////////////////////////////////////////////////////////// - // Data members - - // Note that some of the pointers below have UNDEFINED values if certain other pointers are 0. - // This is required for maximum performance, as it allows the parser to omit initialization of - // unneded/redundant values. - // - // The rules are as follows: - // 1. first_node and first_attribute contain valid pointers, or 0 if node has no children/attributes respectively - // 2. last_node and last_attribute are valid only if node has at least one child/attribute respectively, otherwise they contain garbage - // 3. prev_sibling and next_sibling are valid only if node has a parent, otherwise they contain garbage - - node_type m_type; // Type of node; always valid - xml_node<Ch> *m_first_node; // Pointer to first child node, or 0 if none; always valid - xml_node<Ch> *m_last_node; // Pointer to last child node, or 0 if none; this value is only valid if m_first_node is non-zero - xml_attribute<Ch> *m_first_attribute; // Pointer to first attribute of node, or 0 if none; always valid - xml_attribute<Ch> *m_last_attribute; // Pointer to last attribute of node, or 0 if none; this value is only valid if m_first_attribute is non-zero - xml_node<Ch> *m_prev_sibling; // Pointer to previous sibling of node, or 0 if none; this value is only valid if m_parent is non-zero - xml_node<Ch> *m_next_sibling; // Pointer to next sibling of node, or 0 if none; this value is only valid if m_parent is non-zero - - }; - - /////////////////////////////////////////////////////////////////////////// - // XML document - - //! This class represents root of the DOM hierarchy. - //! It is also an xml_node and a memory_pool through public inheritance. - //! Use parse() function to build a DOM tree from a zero-terminated XML text string. - //! parse() function allocates memory for nodes and attributes by using functions of xml_document, - //! which are inherited from memory_pool. - //! To access root node of the document, use the document itself, as if it was an xml_node. - //! \param Ch Character type to use. - template<class Ch = char> - class xml_document: public xml_node<Ch>, public memory_pool<Ch> - { - - public: - - //! Constructs empty XML document - xml_document() - : xml_node<Ch>(node_document) - { - } - - //! Parses zero-terminated XML string according to given flags. - //! Passed string will be modified by the parser, unless rapidxml::parse_non_destructive flag is used. - //! The string must persist for the lifetime of the document. - //! In case of error, rapidxml::parse_error exception will be thrown. - //! <br><br> - //! If you want to parse contents of a file, you must first load the file into the memory, and pass pointer to its beginning. - //! Make sure that data is zero-terminated. - //! <br><br> - //! Document can be parsed into multiple times. - //! Each new call to parse removes previous nodes and attributes (if any), but does not clear memory pool. - //! \param text XML data to parse; pointer is non-const to denote fact that this data may be modified by the parser. - template<int Flags> - void parse(Ch *text) - { - BOOST_ASSERT(text); - - // Remove current contents - this->remove_all_nodes(); - this->remove_all_attributes(); - - // Parse BOM, if any - parse_bom<Flags>(text); - - // Parse children - while (1) - { - // Skip whitespace before node - skip<whitespace_pred, Flags>(text); - if (*text == 0) - break; - - // Parse and append new child - if (*text == Ch('<')) - { - ++text; // Skip '<' - if (xml_node<Ch> *node = parse_node<Flags>(text)) - this->append_node(node); - } - else - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected <", text); - } - - } - - //! Clears the document by deleting all nodes and clearing the memory pool. - //! All nodes owned by document pool are destroyed. - void clear() - { - this->remove_all_nodes(); - this->remove_all_attributes(); - memory_pool<Ch>::clear(); - } - - private: - - /////////////////////////////////////////////////////////////////////// - // Internal character utility functions - - // Detect whitespace character - struct whitespace_pred - { - static unsigned char test(Ch ch) - { - return internal::lookup_tables<0>::lookup_whitespace[internal::get_index(ch)]; - } - }; - - // Detect node name character - struct node_name_pred - { - static unsigned char test(Ch ch) - { - return internal::lookup_tables<0>::lookup_node_name[internal::get_index(ch)]; - } - }; - - // Detect attribute name character - struct attribute_name_pred - { - static unsigned char test(Ch ch) - { - return internal::lookup_tables<0>::lookup_attribute_name[internal::get_index(ch)]; - } - }; - - // Detect text character (PCDATA) - struct text_pred - { - static unsigned char test(Ch ch) - { - return internal::lookup_tables<0>::lookup_text[internal::get_index(ch)]; - } - }; - - // Detect text character (PCDATA) that does not require processing - struct text_pure_no_ws_pred - { - static unsigned char test(Ch ch) - { - return internal::lookup_tables<0>::lookup_text_pure_no_ws[internal::get_index(ch)]; - } - }; - - // Detect text character (PCDATA) that does not require processing - struct text_pure_with_ws_pred - { - static unsigned char test(Ch ch) - { - return internal::lookup_tables<0>::lookup_text_pure_with_ws[internal::get_index(ch)]; - } - }; - - // Detect attribute value character - template<Ch Quote> - struct attribute_value_pred - { - static unsigned char test(Ch ch) - { - if (Quote == Ch('\'')) - return internal::lookup_tables<0>::lookup_attribute_data_1[internal::get_index(ch)]; - if (Quote == Ch('\"')) - return internal::lookup_tables<0>::lookup_attribute_data_2[internal::get_index(ch)]; - return 0; // Should never be executed, to avoid warnings on Comeau - } - }; - - // Detect attribute value character - template<Ch Quote> - struct attribute_value_pure_pred - { - static unsigned char test(Ch ch) - { - if (Quote == Ch('\'')) - return internal::lookup_tables<0>::lookup_attribute_data_1_pure[internal::get_index(ch)]; - if (Quote == Ch('\"')) - return internal::lookup_tables<0>::lookup_attribute_data_2_pure[internal::get_index(ch)]; - return 0; // Should never be executed, to avoid warnings on Comeau - } - }; - - // Insert coded character, using UTF8 or 8-bit ASCII - template<int Flags> - static void insert_coded_character(Ch *&text, unsigned long code) - { - if (Flags & parse_no_utf8) - { - // Insert 8-bit ASCII character - // Todo: possibly verify that code is less than 256 and use replacement char otherwise? - text[0] = static_cast<unsigned char>(code); - text += 1; - } - else - { - // Insert UTF8 sequence - if (code < 0x80) // 1 byte sequence - { - text[0] = static_cast<unsigned char>(code); - text += 1; - } - else if (code < 0x800) // 2 byte sequence - { - text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6; - text[0] = static_cast<unsigned char>(code | 0xC0); - text += 2; - } - else if (code < 0x10000) // 3 byte sequence - { - text[2] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6; - text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6; - text[0] = static_cast<unsigned char>(code | 0xE0); - text += 3; - } - else if (code < 0x110000) // 4 byte sequence - { - text[3] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6; - text[2] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6; - text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6; - text[0] = static_cast<unsigned char>(code | 0xF0); - text += 4; - } - else // Invalid, only codes up to 0x10FFFF are allowed in Unicode - { - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("invalid numeric character entity", text); - } - } - } - - // Skip characters until predicate evaluates to true - template<class StopPred, int Flags> - static void skip(Ch *&text) - { - Ch *tmp = text; - while (StopPred::test(*tmp)) - ++tmp; - text = tmp; - } - - // Skip characters until predicate evaluates to true while doing the following: - // - replacing XML character entity references with proper characters (' & " < > &#...;) - // - condensing whitespace sequences to single space character - template<class StopPred, class StopPredPure, int Flags> - static Ch *skip_and_expand_character_refs(Ch *&text) - { - // If entity translation, whitespace condense and whitespace trimming is disabled, use plain skip - if (Flags & parse_no_entity_translation && - !(Flags & parse_normalize_whitespace) && - !(Flags & parse_trim_whitespace)) - { - skip<StopPred, Flags>(text); - return text; - } - - // Use simple skip until first modification is detected - skip<StopPredPure, Flags>(text); - - // Use translation skip - Ch *src = text; - Ch *dest = src; - while (StopPred::test(*src)) - { - // If entity translation is enabled - if (!(Flags & parse_no_entity_translation)) - { - // Test if replacement is needed - if (src[0] == Ch('&')) - { - switch (src[1]) - { - - // & ' - case Ch('a'): - if (src[2] == Ch('m') && src[3] == Ch('p') && src[4] == Ch(';')) - { - *dest = Ch('&'); - ++dest; - src += 5; - continue; - } - if (src[2] == Ch('p') && src[3] == Ch('o') && src[4] == Ch('s') && src[5] == Ch(';')) - { - *dest = Ch('\''); - ++dest; - src += 6; - continue; - } - break; - - // " - case Ch('q'): - if (src[2] == Ch('u') && src[3] == Ch('o') && src[4] == Ch('t') && src[5] == Ch(';')) - { - *dest = Ch('"'); - ++dest; - src += 6; - continue; - } - break; - - // > - case Ch('g'): - if (src[2] == Ch('t') && src[3] == Ch(';')) - { - *dest = Ch('>'); - ++dest; - src += 4; - continue; - } - break; - - // < - case Ch('l'): - if (src[2] == Ch('t') && src[3] == Ch(';')) - { - *dest = Ch('<'); - ++dest; - src += 4; - continue; - } - break; - - // &#...; - assumes ASCII - case Ch('#'): - if (src[2] == Ch('x')) - { - unsigned long code = 0; - src += 3; // Skip &#x - while (1) - { - unsigned char digit = internal::lookup_tables<0>::lookup_digits[static_cast<unsigned char>(*src)]; - if (digit == 0xFF) - break; - code = code * 16 + digit; - ++src; - } - insert_coded_character<Flags>(dest, code); // Put character in output - } - else - { - unsigned long code = 0; - src += 2; // Skip &# - while (1) - { - unsigned char digit = internal::lookup_tables<0>::lookup_digits[static_cast<unsigned char>(*src)]; - if (digit == 0xFF) - break; - code = code * 10 + digit; - ++src; - } - insert_coded_character<Flags>(dest, code); // Put character in output - } - if (*src == Ch(';')) - ++src; - else - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected ;", src); - continue; - - // Something else - default: - // Ignore, just copy '&' verbatim - break; - - } - } - } - - // If whitespace condensing is enabled - if (Flags & parse_normalize_whitespace) - { - // Test if condensing is needed - if (whitespace_pred::test(*src)) - { - *dest = Ch(' '); ++dest; // Put single space in dest - ++src; // Skip first whitespace char - // Skip remaining whitespace chars - while (whitespace_pred::test(*src)) - ++src; - continue; - } - } - - // No replacement, only copy character - *dest++ = *src++; - - } - - // Return new end - text = src; - return dest; - - } - - /////////////////////////////////////////////////////////////////////// - // Internal parsing functions - - // Parse UTF-8 BOM, if any - template<int Flags> - void parse_bom(char *&text) - { - if (static_cast<unsigned char>(text[0]) == 0xEF && - static_cast<unsigned char>(text[1]) == 0xBB && - static_cast<unsigned char>(text[2]) == 0xBF) - { - text += 3; - } - } - - // Parse UTF-16/32 BOM, if any - template<int Flags> - void parse_bom(wchar_t *&text) - { - const wchar_t bom = 0xFEFF; - if (text[0] == bom) - { - ++text; - } - } - - // Parse XML declaration (<?xml...) - template<int Flags> - xml_node<Ch> *parse_xml_declaration(Ch *&text) - { - // If parsing of declaration is disabled - if (!(Flags & parse_declaration_node)) - { - // Skip until end of declaration - while (text[0] != Ch('?') || text[1] != Ch('>')) - { - if (!text[0]) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - ++text; - } - text += 2; // Skip '?>' - return 0; - } - - // Create declaration - xml_node<Ch> *declaration = this->allocate_node(node_declaration); - - // Skip whitespace before attributes or ?> - skip<whitespace_pred, Flags>(text); - - // Parse declaration attributes - parse_node_attributes<Flags>(text, declaration); - - // Skip ?> - if (text[0] != Ch('?') || text[1] != Ch('>')) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected ?>", text); - text += 2; - - return declaration; - } - - // Parse XML comment (<!--...) - template<int Flags> - xml_node<Ch> *parse_comment(Ch *&text) - { - // If parsing of comments is disabled - if (!(Flags & parse_comment_nodes)) - { - // Skip until end of comment - while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>')) - { - if (!text[0]) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - ++text; - } - text += 3; // Skip '-->' - return 0; // Do not produce comment node - } - - // Remember value start - Ch *val = text; - - // Skip until end of comment - while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>')) - { - if (!text[0]) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - ++text; - } - - // Create comment node - xml_node<Ch> *comment = this->allocate_node(node_comment); - comment->value(val, text - val); - - // Place zero terminator after comment value - if (!(Flags & parse_no_string_terminators)) - *text = Ch('\0'); - - text += 3; // Skip '-->' - return comment; - } - - // Parse DOCTYPE - template<int Flags> - xml_node<Ch> *parse_doctype(Ch *&text) - { - // Remember value start - Ch *val = text; - - // Skip to > - while (*text != Ch('>')) - { - // Determine character type - switch (*text) - { - - // If '[' encountered, scan for matching ending ']' using naive algorithm with depth - // This works for all W3C test files except for 2 most wicked - case Ch('['): - { - ++text; // Skip '[' - int depth = 1; - while (depth > 0) - { - switch (*text) - { - case Ch('['): ++depth; break; - case Ch(']'): --depth; break; - case 0: BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - default: break; - } - ++text; - } - break; - } - - // Error on end of text - case Ch('\0'): - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - - // Other character, skip it - default: - ++text; - - } - } - - // If DOCTYPE nodes enabled - if (Flags & parse_doctype_node) - { - // Create a new doctype node - xml_node<Ch> *doctype = this->allocate_node(node_doctype); - doctype->value(val, text - val); - - // Place zero terminator after value - if (!(Flags & parse_no_string_terminators)) - *text = Ch('\0'); - - text += 1; // skip '>' - return doctype; - } - else - { - text += 1; // skip '>' - return 0; - } - - } - - // Parse PI - template<int Flags> - xml_node<Ch> *parse_pi(Ch *&text) - { - // If creation of PI nodes is enabled - if (Flags & parse_pi_nodes) - { - // Create pi node - xml_node<Ch> *pi = this->allocate_node(node_pi); - - // Extract PI target name - Ch *n = text; - skip<node_name_pred, Flags>(text); - if (text == n) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected PI target", text); - pi->name(n, text - n); - - // Skip whitespace between pi target and pi - skip<whitespace_pred, Flags>(text); - - // Remember start of pi - Ch *val = text; - - // Skip to '?>' - while (text[0] != Ch('?') || text[1] != Ch('>')) - { - if (*text == Ch('\0')) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - ++text; - } - - // Set pi value (verbatim, no entity expansion or whitespace normalization) - pi->value(val, text - val); - - // Place zero terminator after name and value - if (!(Flags & parse_no_string_terminators)) - { - pi->name()[pi->name_size()] = Ch('\0'); - pi->value()[pi->value_size()] = Ch('\0'); - } - - text += 2; // Skip '?>' - return pi; - } - else - { - // Skip to '?>' - while (text[0] != Ch('?') || text[1] != Ch('>')) - { - if (*text == Ch('\0')) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - ++text; - } - text += 2; // Skip '?>' - return 0; - } - } - - // Parse and append data - // Return character that ends data. - // This is necessary because this character might have been overwritten by a terminating 0 - template<int Flags> - Ch parse_and_append_data(xml_node<Ch> *node, Ch *&text, Ch *contents_start) - { - // Backup to contents start if whitespace trimming is disabled - if (!(Flags & parse_trim_whitespace)) - text = contents_start; - - // Skip until end of data - Ch *val = text, *end; - if (Flags & parse_normalize_whitespace) - end = skip_and_expand_character_refs<text_pred, text_pure_with_ws_pred, Flags>(text); - else - end = skip_and_expand_character_refs<text_pred, text_pure_no_ws_pred, Flags>(text); - - // Trim trailing whitespace if flag is set; leading was already trimmed by whitespace skip after > - if (Flags & parse_trim_whitespace) - { - if (Flags & parse_normalize_whitespace) - { - // Whitespace is already condensed to single space characters by skipping function, so just trim 1 char off the end - if (*(end - 1) == Ch(' ')) - --end; - } - else - { - // Backup until non-whitespace character is found - while (whitespace_pred::test(*(end - 1))) - --end; - } - } - - // If characters are still left between end and value (this test is only necessary if normalization is enabled) - // Create new data node - if (!(Flags & parse_no_data_nodes)) - { - xml_node<Ch> *data = this->allocate_node(node_data); - data->value(val, end - val); - node->append_node(data); - } - - // Add data to parent node if no data exists yet - if (!(Flags & parse_no_element_values)) - if (*node->value() == Ch('\0')) - node->value(val, end - val); - - // Place zero terminator after value - if (!(Flags & parse_no_string_terminators)) - { - Ch ch = *text; - *end = Ch('\0'); - return ch; // Return character that ends data; this is required because zero terminator overwritten it - } - - // Return character that ends data - return *text; - } - - // Parse CDATA - template<int Flags> - xml_node<Ch> *parse_cdata(Ch *&text) - { - // If CDATA is disabled - if (Flags & parse_no_data_nodes) - { - // Skip until end of cdata - while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>')) - { - if (!text[0]) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - ++text; - } - text += 3; // Skip ]]> - return 0; // Do not produce CDATA node - } - - // Skip until end of cdata - Ch *val = text; - while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>')) - { - if (!text[0]) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - ++text; - } - - // Create new cdata node - xml_node<Ch> *cdata = this->allocate_node(node_cdata); - cdata->value(val, text - val); - - // Place zero terminator after value - if (!(Flags & parse_no_string_terminators)) - *text = Ch('\0'); - - text += 3; // Skip ]]> - return cdata; - } - - // Parse element node - template<int Flags> - xml_node<Ch> *parse_element(Ch *&text) - { - // Create element node - xml_node<Ch> *element = this->allocate_node(node_element); - - // Extract element name - Ch *n = text; - skip<node_name_pred, Flags>(text); - if (text == n) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected element name", text); - element->name(n, text - n); - - // Skip whitespace between element name and attributes or > - skip<whitespace_pred, Flags>(text); - - // Parse attributes, if any - parse_node_attributes<Flags>(text, element); - - // Determine ending type - if (*text == Ch('>')) - { - ++text; - parse_node_contents<Flags>(text, element); - } - else if (*text == Ch('/')) - { - ++text; - if (*text != Ch('>')) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected >", text); - ++text; - } - else - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected >", text); - - // Place zero terminator after name - if (!(Flags & parse_no_string_terminators)) - element->name()[element->name_size()] = Ch('\0'); - - // Return parsed element - return element; - } - - // Determine node type, and parse it - template<int Flags> - xml_node<Ch> *parse_node(Ch *&text) - { - // Parse proper node type - switch (text[0]) - { - - // <... - default: - // Parse and append element node - return parse_element<Flags>(text); - - // <?... - case Ch('?'): - ++text; // Skip ? - if ((text[0] == Ch('x') || text[0] == Ch('X')) && - (text[1] == Ch('m') || text[1] == Ch('M')) && - (text[2] == Ch('l') || text[2] == Ch('L')) && - whitespace_pred::test(text[3])) - { - // '<?xml ' - xml declaration - text += 4; // Skip 'xml ' - return parse_xml_declaration<Flags>(text); - } - else - { - // Parse PI - return parse_pi<Flags>(text); - } - - // <!... - case Ch('!'): - - // Parse proper subset of <! node - switch (text[1]) - { - - // <!- - case Ch('-'): - if (text[2] == Ch('-')) - { - // '<!--' - xml comment - text += 3; // Skip '!--' - return parse_comment<Flags>(text); - } - break; - - // <![ - case Ch('['): - if (text[2] == Ch('C') && text[3] == Ch('D') && text[4] == Ch('A') && - text[5] == Ch('T') && text[6] == Ch('A') && text[7] == Ch('[')) - { - // '<![CDATA[' - cdata - text += 8; // Skip '![CDATA[' - return parse_cdata<Flags>(text); - } - break; - - // <!D - case Ch('D'): - if (text[2] == Ch('O') && text[3] == Ch('C') && text[4] == Ch('T') && - text[5] == Ch('Y') && text[6] == Ch('P') && text[7] == Ch('E') && - whitespace_pred::test(text[8])) - { - // '<!DOCTYPE ' - doctype - text += 9; // skip '!DOCTYPE ' - return parse_doctype<Flags>(text); - } - break; - - default: break; - - } // switch - - // Attempt to skip other, unrecognized node types starting with <! - ++text; // Skip ! - while (*text != Ch('>')) - { - if (*text == 0) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - ++text; - } - ++text; // Skip '>' - return 0; // No node recognized - - } - } - - // Parse contents of the node - children, data etc. - template<int Flags> - void parse_node_contents(Ch *&text, xml_node<Ch> *node) - { - // For all children and text - while (1) - { - // Skip whitespace between > and node contents - Ch *contents_start = text; // Store start of node contents before whitespace is skipped - if (Flags & parse_trim_whitespace) - skip<whitespace_pred, Flags>(text); - Ch next_char = *text; - - // After data nodes, instead of continuing the loop, control jumps here. - // This is because zero termination inside parse_and_append_data() function - // would wreak havoc with the above code. - // Also, skipping whitespace after data nodes is unnecessary. - after_data_node: - - // Determine what comes next: node closing, child node, data node, or 0? - switch (next_char) - { - - // Node closing or child node - case Ch('<'): - if (text[1] == Ch('/')) - { - // Node closing - text += 2; // Skip '</' - if (Flags & parse_validate_closing_tags) - { - // Skip and validate closing tag name - Ch *closing_name = text; - skip<node_name_pred, Flags>(text); - if (!internal::compare(node->name(), node->name_size(), closing_name, text - closing_name, true)) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("invalid closing tag name", text); - } - else - { - // No validation, just skip name - skip<node_name_pred, Flags>(text); - } - // Skip remaining whitespace after node name - skip<whitespace_pred, Flags>(text); - if (*text != Ch('>')) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected >", text); - ++text; // Skip '>' - return; // Node closed, finished parsing contents - } - else - { - // Child node - ++text; // Skip '<' - if (xml_node<Ch> *child = parse_node<Flags>(text)) - node->append_node(child); - } - break; - - // End of data - error - case Ch('\0'): - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("unexpected end of data", text); - - // Data node - default: - next_char = parse_and_append_data<Flags>(node, text, contents_start); - goto after_data_node; // Bypass regular processing after data nodes - - } - } - } - - // Parse XML attributes of the node - template<int Flags> - void parse_node_attributes(Ch *&text, xml_node<Ch> *node) - { - // For all attributes - while (attribute_name_pred::test(*text)) - { - // Extract attribute name - Ch *n = text; - ++text; // Skip first character of attribute name - skip<attribute_name_pred, Flags>(text); - if (text == n) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected attribute name", n); - - // Create new attribute - xml_attribute<Ch> *attribute = this->allocate_attribute(); - attribute->name(n, text - n); - node->append_attribute(attribute); - - // Skip whitespace after attribute name - skip<whitespace_pred, Flags>(text); - - // Skip = - if (*text != Ch('=')) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected =", text); - ++text; - - // Add terminating zero after name - if (!(Flags & parse_no_string_terminators)) - attribute->name()[attribute->name_size()] = 0; - - // Skip whitespace after = - skip<whitespace_pred, Flags>(text); - - // Skip quote and remember if it was ' or " - Ch quote = *text; - if (quote != Ch('\'') && quote != Ch('"')) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected ' or \"", text); - ++text; - - // Extract attribute value and expand char refs in it - Ch *val = text, *end; - const int AttFlags = Flags & ~parse_normalize_whitespace; // No whitespace normalization in attributes - if (quote == Ch('\'')) - end = skip_and_expand_character_refs<attribute_value_pred<Ch('\'')>, attribute_value_pure_pred<Ch('\'')>, AttFlags>(text); - else - end = skip_and_expand_character_refs<attribute_value_pred<Ch('"')>, attribute_value_pure_pred<Ch('"')>, AttFlags>(text); - - // Set attribute value - attribute->value(val, end - val); - - // Make sure that end quote is present - if (*text != quote) - BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR("expected ' or \"", text); - ++text; // Skip quote - - // Add terminating zero after value - if (!(Flags & parse_no_string_terminators)) - attribute->value()[attribute->value_size()] = 0; - - // Skip whitespace after attribute value - skip<whitespace_pred, Flags>(text); - } - } - - }; - - //! \cond internal - namespace internal - { - - // Whitespace (space \n \r \t) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_whitespace[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, // 0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1 - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 4 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 5 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // B - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // C - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // D - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // F - }; - - // Node name (anything but space \n \r \t / > ? \0) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_node_name[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Text (i.e. PCDATA) (anything but < \0) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_text[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Text (i.e. PCDATA) that does not require processing when ws normalization is disabled - // (anything but < \0 &) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_text_pure_no_ws[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Text (i.e. PCDATA) that does not require processing when ws normalizationis is enabled - // (anything but < \0 & space \n \r \t) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_text_pure_with_ws[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Attribute name (anything but space \n \r \t / < > = ? ! \0) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_attribute_name[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Attribute data with single quote (anything but ' \0) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_attribute_data_1[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Attribute data with single quote that does not require processing (anything but ' \0 &) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_attribute_data_1_pure[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Attribute data with double quote (anything but " \0) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_attribute_data_2[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Attribute data with double quote that does not require processing (anything but " \0 &) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_attribute_data_2_pure[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 - 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F - }; - - // Digits (dec and hex, 255 denotes end of numeric character reference) - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_digits[256] = - { - // 0 1 2 3 4 5 6 7 8 9 A B C D E F - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 0 - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 1 - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 2 - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,255,255,255,255,255,255, // 3 - 255, 10, 11, 12, 13, 14, 15,255,255,255,255,255,255,255,255,255, // 4 - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 5 - 255, 10, 11, 12, 13, 14, 15,255,255,255,255,255,255,255,255,255, // 6 - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 7 - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 8 - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // 9 - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // A - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // B - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // C - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // D - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, // E - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 // F - }; - - // Upper case conversion - template<int Dummy> - const unsigned char lookup_tables<Dummy>::lookup_upcase[256] = - { - // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A B C D E F - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0 - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1 - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2 - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3 - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4 - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5 - 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 6 - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123,124,125,126,127, // 7 - 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, // 8 - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, // 9 - 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, // A - 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, // B - 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, // C - 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, // D - 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, // E - 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 // F - }; - } - //! \endcond - -}}}} - -// Undefine internal macros -#undef BOOST_PROPERTY_TREE_RAPIDXML_PARSE_ERROR - -// On MSVC, restore warnings state -#ifdef _MSC_VER - #pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_error.hpp b/contrib/restricted/boost/boost/property_tree/detail/xml_parser_error.hpp deleted file mode 100644 index c79835c43f..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_error.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_ERROR_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_ERROR_HPP_INCLUDED - -#include <boost/property_tree/detail/file_parser_error.hpp> -#include <string> - -namespace boost { namespace property_tree { namespace xml_parser -{ - - //! Xml parser error - class xml_parser_error: public file_parser_error - { - public: - xml_parser_error(const std::string &msg, - const std::string &file, - unsigned long l): - file_parser_error(msg, file, l) - { - } - }; - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_flags.hpp b/contrib/restricted/boost/boost/property_tree/detail/xml_parser_flags.hpp deleted file mode 100644 index 9340fe2516..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_flags.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_FLAGS_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_FLAGS_HPP_INCLUDED - -namespace boost { namespace property_tree { namespace xml_parser -{ - - /// Text elements should be put in separate keys, - /// not concatenated in parent data. - static const int no_concat_text = 0x1; - /// Comments should be omitted. - static const int no_comments = 0x2; - /// Whitespace should be collapsed and trimmed. - static const int trim_whitespace = 0x4; - - inline bool validate_flags(int flags) - { - return (flags & ~(no_concat_text | no_comments | trim_whitespace)) == 0; - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_read_rapidxml.hpp b/contrib/restricted/boost/boost/property_tree/detail/xml_parser_read_rapidxml.hpp deleted file mode 100644 index 9c04219189..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_read_rapidxml.hpp +++ /dev/null @@ -1,144 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2007 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_READ_RAPIDXML_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_READ_RAPIDXML_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/detail/xml_parser_error.hpp> -#include <boost/property_tree/detail/xml_parser_flags.hpp> -#include <boost/property_tree/detail/xml_parser_utils.hpp> -#include <boost/property_tree/detail/rapidxml.hpp> -#include <vector> - -namespace boost { namespace property_tree { namespace xml_parser -{ - - template<class Ptree, class Ch> - void read_xml_node(detail::rapidxml::xml_node<Ch> *node, - Ptree &pt, int flags) - { - using namespace detail::rapidxml; - switch (node->type()) - { - // Element nodes - case node_element: - { - // Create node - Ptree &pt_node = pt.push_back(std::make_pair(node->name(), - Ptree()))->second; - - // Copy attributes - if (node->first_attribute()) - { - Ptree &pt_attr_root = pt_node.push_back( - std::make_pair(xmlattr<typename Ptree::key_type>(), Ptree()))->second; - for (xml_attribute<Ch> *attr = node->first_attribute(); - attr; attr = attr->next_attribute()) - { - Ptree &pt_attr = pt_attr_root.push_back( - std::make_pair(attr->name(), Ptree()))->second; - pt_attr.data() = typename Ptree::key_type(attr->value(), attr->value_size()); - } - } - - // Copy children - for (xml_node<Ch> *child = node->first_node(); - child; child = child->next_sibling()) - read_xml_node(child, pt_node, flags); - } - break; - - // Data nodes - case node_data: - case node_cdata: - { - if (flags & no_concat_text) - pt.push_back(std::make_pair(xmltext<typename Ptree::key_type>(), - Ptree(node->value()))); - else - pt.data() += typename Ptree::key_type(node->value(), node->value_size()); - } - break; - - // Comment nodes - case node_comment: - { - if (!(flags & no_comments)) - pt.push_back(std::make_pair(xmlcomment<typename Ptree::key_type>(), - Ptree(typename Ptree::key_type(node->value(), node->value_size())))); - } - break; - - default: - // Skip other node types - break; - } - } - - template<class Ptree> - void read_xml_internal(std::basic_istream< - typename Ptree::key_type::value_type> &stream, - Ptree &pt, - int flags, - const std::string &filename) - { - typedef typename Ptree::key_type::value_type Ch; - using namespace detail::rapidxml; - - // Load data into vector - stream.unsetf(std::ios::skipws); - std::vector<Ch> v(std::istreambuf_iterator<Ch>(stream.rdbuf()), - std::istreambuf_iterator<Ch>()); - if (!stream.good()) - BOOST_PROPERTY_TREE_THROW( - xml_parser_error("read error", filename, 0)); - v.push_back(0); // zero-terminate - - try { - // Parse using appropriate flags - const int f_tws = parse_normalize_whitespace - | parse_trim_whitespace; - const int f_c = parse_comment_nodes; - // Some compilers don't like the bitwise or in the template arg. - const int f_tws_c = parse_normalize_whitespace - | parse_trim_whitespace - | parse_comment_nodes; - xml_document<Ch> doc; - if (flags & no_comments) { - if (flags & trim_whitespace) - doc.BOOST_NESTED_TEMPLATE parse<f_tws>(&v.front()); - else - doc.BOOST_NESTED_TEMPLATE parse<0>(&v.front()); - } else { - if (flags & trim_whitespace) - doc.BOOST_NESTED_TEMPLATE parse<f_tws_c>(&v.front()); - else - doc.BOOST_NESTED_TEMPLATE parse<f_c>(&v.front()); - } - - // Create ptree from nodes - Ptree local; - for (xml_node<Ch> *child = doc.first_node(); - child; child = child->next_sibling()) - read_xml_node(child, local, flags); - - // Swap local and result ptrees - pt.swap(local); - } catch (parse_error &e) { - long line = static_cast<long>( - std::count(&v.front(), e.where<Ch>(), Ch('\n')) + 1); - BOOST_PROPERTY_TREE_THROW( - xml_parser_error(e.what(), filename, line)); - } - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_utils.hpp b/contrib/restricted/boost/boost/property_tree/detail/xml_parser_utils.hpp deleted file mode 100644 index fbbde0153e..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_utils.hpp +++ /dev/null @@ -1,139 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_UTILS_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_UTILS_HPP_INCLUDED - -#include <boost/property_tree/detail/ptree_utils.hpp> -#include <boost/property_tree/detail/xml_parser_error.hpp> -#include <boost/property_tree/detail/xml_parser_writer_settings.hpp> -#include <string> -#include <algorithm> -#include <locale> - -namespace boost { namespace property_tree { namespace xml_parser -{ - - template<class Str> - Str condense(const Str &s) - { - typedef typename Str::value_type Ch; - Str r; - std::locale loc; - bool space = false; - typename Str::const_iterator end = s.end(); - for (typename Str::const_iterator it = s.begin(); - it != end; ++it) - { - if (isspace(*it, loc) || *it == Ch('\n')) - { - if (!space) - r += Ch(' '), space = true; - } - else - r += *it, space = false; - } - return r; - } - - - template<class Str> - Str encode_char_entities(const Str &s) - { - // Don't do anything for empty strings. - if(s.empty()) return s; - - typedef typename Str::value_type Ch; - - Str r; - // To properly round-trip spaces and not uglify the XML beyond - // recognition, we have to encode them IF the text contains only spaces. - Str sp(1, Ch(' ')); - if(s.find_first_not_of(sp) == Str::npos) { - // The first will suffice. - r = detail::widen<Str>(" "); - r += Str(s.size() - 1, Ch(' ')); - } else { - typename Str::const_iterator end = s.end(); - for (typename Str::const_iterator it = s.begin(); it != end; ++it) - { - switch (*it) - { - case Ch('<'): r += detail::widen<Str>("<"); break; - case Ch('>'): r += detail::widen<Str>(">"); break; - case Ch('&'): r += detail::widen<Str>("&"); break; - case Ch('"'): r += detail::widen<Str>("""); break; - case Ch('\''): r += detail::widen<Str>("'"); break; - default: r += *it; break; - } - } - } - return r; - } - - template<class Str> - Str decode_char_entities(const Str &s) - { - typedef typename Str::value_type Ch; - Str r; - typename Str::const_iterator end = s.end(); - for (typename Str::const_iterator it = s.begin(); it != end; ++it) - { - if (*it == Ch('&')) - { - typename Str::const_iterator semicolon = std::find(it + 1, end, Ch(';')); - if (semicolon == end) - BOOST_PROPERTY_TREE_THROW(xml_parser_error("invalid character entity", "", 0)); - Str ent(it + 1, semicolon); - if (ent == detail::widen<Str>("lt")) r += Ch('<'); - else if (ent == detail::widen<Str>("gt")) r += Ch('>'); - else if (ent == detail::widen<Str>("amp")) r += Ch('&'); - else if (ent == detail::widen<Str>("quot")) r += Ch('"'); - else if (ent == detail::widen<Str>("apos")) r += Ch('\''); - else - BOOST_PROPERTY_TREE_THROW(xml_parser_error("invalid character entity", "", 0)); - it = semicolon; - } - else - r += *it; - } - return r; - } - - template<class Str> - const Str &xmldecl() - { - static Str s = detail::widen<Str>("<?xml>"); - return s; - } - - template<class Str> - const Str &xmlattr() - { - static Str s = detail::widen<Str>("<xmlattr>"); - return s; - } - - template<class Str> - const Str &xmlcomment() - { - static Str s = detail::widen<Str>("<xmlcomment>"); - return s; - } - - template<class Str> - const Str &xmltext() - { - static Str s = detail::widen<Str>("<xmltext>"); - return s; - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_write.hpp b/contrib/restricted/boost/boost/property_tree/detail/xml_parser_write.hpp deleted file mode 100644 index 0af2265fa4..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_write.hpp +++ /dev/null @@ -1,195 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// Copyright (C) 2013 Sebastian Redl -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITE_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITE_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/detail/xml_parser_utils.hpp> -#include <string> -#include <ostream> -#include <iomanip> - -namespace boost { namespace property_tree { namespace xml_parser -{ - template<class Str> - void write_xml_indent(std::basic_ostream<typename Str::value_type> &stream, - int indent, - const xml_writer_settings<Str> & settings - ) - { - stream << std::basic_string<typename Str::value_type>(indent * settings.indent_count, settings.indent_char); - } - - template<class Str> - void write_xml_comment(std::basic_ostream<typename Str::value_type> &stream, - const Str &s, - int indent, - bool separate_line, - const xml_writer_settings<Str> & settings - ) - { - typedef typename Str::value_type Ch; - if (separate_line) - write_xml_indent(stream,indent,settings); - stream << Ch('<') << Ch('!') << Ch('-') << Ch('-'); - stream << s; - stream << Ch('-') << Ch('-') << Ch('>'); - if (separate_line) - stream << Ch('\n'); - } - - template<class Str> - void write_xml_text(std::basic_ostream<typename Str::value_type> &stream, - const Str &s, - int indent, - bool separate_line, - const xml_writer_settings<Str> & settings - ) - { - typedef typename Str::value_type Ch; - if (separate_line) - write_xml_indent(stream,indent,settings); - stream << encode_char_entities(s); - if (separate_line) - stream << Ch('\n'); - } - - template<class Ptree> - void write_xml_element(std::basic_ostream<typename Ptree::key_type::value_type> &stream, - const typename Ptree::key_type &key, - const Ptree &pt, - int indent, - const xml_writer_settings<typename Ptree::key_type> & settings) - { - typedef typename Ptree::key_type::value_type Ch; - typedef typename Ptree::key_type Str; - typedef typename Ptree::const_iterator It; - - bool want_pretty = settings.indent_count > 0; - // Find if elements present - bool has_elements = false; - bool has_attrs_only = pt.data().empty(); - for (It it = pt.begin(), end = pt.end(); it != end; ++it) - { - if (it->first != xmlattr<Str>() ) - { - has_attrs_only = false; - if (it->first != xmltext<Str>()) - { - has_elements = true; - break; - } - } - } - - // Write element - if (pt.data().empty() && pt.empty()) // Empty key - { - if (indent >= 0) - { - write_xml_indent(stream,indent,settings); - stream << Ch('<') << key << - Ch('/') << Ch('>'); - if (want_pretty) - stream << Ch('\n'); - } - } - else // Nonempty key - { - // Write opening tag, attributes and data - if (indent >= 0) - { - // Write opening brace and key - write_xml_indent(stream,indent,settings); - stream << Ch('<') << key; - - // Write attributes - if (optional<const Ptree &> attribs = pt.get_child_optional(xmlattr<Str>())) - for (It it = attribs.get().begin(); it != attribs.get().end(); ++it) - stream << Ch(' ') << it->first << Ch('=') - << Ch('"') - << encode_char_entities( - it->second.template get_value<Str>()) - << Ch('"'); - - if ( has_attrs_only ) - { - // Write closing brace - stream << Ch('/') << Ch('>'); - if (want_pretty) - stream << Ch('\n'); - } - else - { - // Write closing brace - stream << Ch('>'); - - // Break line if needed and if we want pretty-printing - if (has_elements && want_pretty) - stream << Ch('\n'); - } - } - - // Write data text, if present - if (!pt.data().empty()) - write_xml_text(stream, - pt.template get_value<Str>(), - indent + 1, has_elements && want_pretty, settings); - - // Write elements, comments and texts - for (It it = pt.begin(); it != pt.end(); ++it) - { - if (it->first == xmlattr<Str>()) - continue; - else if (it->first == xmlcomment<Str>()) - write_xml_comment(stream, - it->second.template get_value<Str>(), - indent + 1, want_pretty, settings); - else if (it->first == xmltext<Str>()) - write_xml_text(stream, - it->second.template get_value<Str>(), - indent + 1, has_elements && want_pretty, settings); - else - write_xml_element(stream, it->first, it->second, - indent + 1, settings); - } - - // Write closing tag - if (indent >= 0 && !has_attrs_only) - { - if (has_elements) - write_xml_indent(stream,indent,settings); - stream << Ch('<') << Ch('/') << key << Ch('>'); - if (want_pretty) - stream << Ch('\n'); - } - - } - } - - template<class Ptree> - void write_xml_internal(std::basic_ostream<typename Ptree::key_type::value_type> &stream, - const Ptree &pt, - const std::string &filename, - const xml_writer_settings<typename Ptree::key_type> & settings) - { - typedef typename Ptree::key_type Str; - stream << detail::widen<Str>("<?xml version=\"1.0\" encoding=\"") - << settings.encoding - << detail::widen<Str>("\"?>\n"); - write_xml_element(stream, Str(), pt, -1, settings); - if (!stream) - BOOST_PROPERTY_TREE_THROW(xml_parser_error("write error", filename, 0)); - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_writer_settings.hpp b/contrib/restricted/boost/boost/property_tree/detail/xml_parser_writer_settings.hpp deleted file mode 100644 index 5fb79f3e6f..0000000000 --- a/contrib/restricted/boost/boost/property_tree/detail/xml_parser_writer_settings.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2007 Marcin Kalicinski -// Copyright (C) 2007 Alexey Baskakov -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITER_SETTINGS_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_WRITER_SETTINGS_HPP_INCLUDED - -#include <string> -#include <boost/property_tree/detail/ptree_utils.hpp> - -namespace boost { namespace property_tree { namespace xml_parser -{ - - // Naively convert narrow string to another character type - template<class Str> - Str widen(const char *text) - { - typedef typename Str::value_type Ch; - Str result; - while (*text) - { - result += Ch(*text); - ++text; - } - return result; - } - - //! Xml writer settings. The default settings lead to no pretty printing. - template<class Str> - class xml_writer_settings - { - typedef typename Str::value_type Ch; - public: - xml_writer_settings(Ch inchar = Ch(' '), - typename Str::size_type incount = 0, - const Str &enc = widen<Str>("utf-8")) - : indent_char(inchar) - , indent_count(incount) - , encoding(enc) - { - } - - Ch indent_char; - typename Str::size_type indent_count; - Str encoding; - }; - - template <class Str> - xml_writer_settings<Str> xml_writer_make_settings(typename Str::value_type indent_char = (typename Str::value_type)(' '), - typename Str::size_type indent_count = 0, - const Str &encoding = widen<Str>("utf-8")) - { - return xml_writer_settings<Str>(indent_char, indent_count, encoding); - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/info_parser.hpp b/contrib/restricted/boost/boost/property_tree/info_parser.hpp deleted file mode 100644 index 683ddad46d..0000000000 --- a/contrib/restricted/boost/boost/property_tree/info_parser.hpp +++ /dev/null @@ -1,151 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_INFO_PARSER_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_INFO_PARSER_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/detail/info_parser_error.hpp> -#include <boost/property_tree/detail/info_parser_writer_settings.hpp> -#include <boost/property_tree/detail/info_parser_read.hpp> -#include <boost/property_tree/detail/info_parser_write.hpp> -#include <istream> - -namespace boost { namespace property_tree { namespace info_parser -{ - - /** - * Read INFO from a the given stream and translate it to a property tree. - * @note Replaces the existing contents. Strong exception guarantee. - * @throw info_parser_error If the stream cannot be read, doesn't contain - * valid INFO, or a conversion fails. - */ - template<class Ptree, class Ch> - void read_info(std::basic_istream<Ch> &stream, Ptree &pt) - { - Ptree local; - read_info_internal(stream, local, std::string(), 0); - pt.swap(local); - } - - /** - * Read INFO from a the given stream and translate it to a property tree. - * @note Replaces the existing contents. Strong exception guarantee. - * @param default_ptree If parsing fails, pt is set to a copy of this tree. - */ - template<class Ptree, class Ch> - void read_info(std::basic_istream<Ch> &stream, Ptree &pt, - const Ptree &default_ptree) - { - try { - read_info(stream, pt); - } catch(file_parser_error &) { - pt = default_ptree; - } - } - - /** - * Read INFO from a the given file and translate it to a property tree. The - * tree's key type must be a string type, i.e. it must have a nested - * value_type typedef that is a valid parameter for basic_ifstream. - * @note Replaces the existing contents. Strong exception guarantee. - * @throw info_parser_error If the file cannot be read, doesn't contain - * valid INFO, or a conversion fails. - */ - template<class Ptree> - void read_info(const std::string &filename, Ptree &pt, - const std::locale &loc = std::locale()) - { - std::basic_ifstream<typename Ptree::key_type::value_type> - stream(filename.c_str()); - if (!stream) { - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "cannot open file for reading", filename, 0)); - } - stream.imbue(loc); - Ptree local; - read_info_internal(stream, local, filename, 0); - pt.swap(local); - } - - /** - * Read INFO from a the given file and translate it to a property tree. The - * tree's key type must be a string type, i.e. it must have a nested - * value_type typedef that is a valid parameter for basic_ifstream. - * @note Replaces the existing contents. Strong exception guarantee. - * @param default_ptree If parsing fails, pt is set to a copy of this tree. - */ - template<class Ptree> - void read_info(const std::string &filename, - Ptree &pt, - const Ptree &default_ptree, - const std::locale &loc = std::locale()) - { - try { - read_info(filename, pt, loc); - } catch(file_parser_error &) { - pt = default_ptree; - } - } - - /** - * Writes a tree to the stream in INFO format. - * @throw info_parser_error If the stream cannot be written to, or a - * conversion fails. - * @param settings The settings to use when writing the INFO data. - */ - template<class Ptree, class Ch> - void write_info(std::basic_ostream<Ch> &stream, - const Ptree &pt, - const info_writer_settings<Ch> &settings = - info_writer_settings<Ch>()) - { - write_info_internal(stream, pt, std::string(), settings); - } - - /** - * Writes a tree to the file in INFO format. The tree's key type must be a - * string type, i.e. it must have a nested value_type typedef that is a - * valid parameter for basic_ofstream. - * @throw info_parser_error If the file cannot be written to, or a - * conversion fails. - * @param settings The settings to use when writing the INFO data. - */ - template<class Ptree> - void write_info(const std::string &filename, - const Ptree &pt, - const std::locale &loc = std::locale(), - const info_writer_settings< - typename Ptree::key_type::value_type - > &settings = - info_writer_make_settings< - typename Ptree::key_type::value_type>()) - { - std::basic_ofstream<typename Ptree::key_type::value_type> - stream(filename.c_str()); - if (!stream) { - BOOST_PROPERTY_TREE_THROW(info_parser_error( - "cannot open file for writing", filename, 0)); - } - stream.imbue(loc); - write_info_internal(stream, pt, filename, settings); - } - -} } } - -namespace boost { namespace property_tree -{ - using info_parser::info_parser_error; - using info_parser::read_info; - using info_parser::write_info; - using info_parser::info_writer_settings; - using info_parser::info_writer_make_settings; -} } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/ini_parser.hpp b/contrib/restricted/boost/boost/property_tree/ini_parser.hpp deleted file mode 100644 index 50d3c97f6a..0000000000 --- a/contrib/restricted/boost/boost/property_tree/ini_parser.hpp +++ /dev/null @@ -1,334 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// Copyright (C) 2009 Sebastian Redl -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_INI_PARSER_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_INI_PARSER_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/detail/ptree_utils.hpp> -#include <boost/property_tree/detail/file_parser_error.hpp> -#include <fstream> -#include <string> -#include <sstream> -#include <stdexcept> -#include <locale> - -namespace boost { namespace property_tree { namespace ini_parser -{ - - /** - * Determines whether the @c flags are valid for use with the ini_parser. - * @param flags value to check for validity as flags to ini_parser. - * @return true if the flags are valid, false otherwise. - */ - inline bool validate_flags(int flags) - { - return flags == 0; - } - - /** Indicates an error parsing INI formatted data. */ - class ini_parser_error: public file_parser_error - { - public: - /** - * Construct an @c ini_parser_error - * @param message Message describing the parser error. - * @param filename The name of the file being parsed containing the - * error. - * @param line The line in the given file where an error was - * encountered. - */ - ini_parser_error(const std::string &message, - const std::string &filename, - unsigned long line) - : file_parser_error(message, filename, line) - { - } - }; - - /** - * Read INI from a the given stream and translate it to a property tree. - * @note Clears existing contents of property tree. In case of error - * the property tree is not modified. - * @throw ini_parser_error If a format violation is found. - * @param stream Stream from which to read in the property tree. - * @param[out] pt The property tree to populate. - */ - template<class Ptree> - void read_ini(std::basic_istream< - typename Ptree::key_type::value_type> &stream, - Ptree &pt) - { - typedef typename Ptree::key_type::value_type Ch; - typedef std::basic_string<Ch> Str; - const Ch semicolon = stream.widen(';'); - const Ch hash = stream.widen('#'); - const Ch lbracket = stream.widen('['); - const Ch rbracket = stream.widen(']'); - - Ptree local; - unsigned long line_no = 0; - Ptree *section = 0; - Str line; - - // For all lines - while (stream.good()) - { - - // Get line from stream - ++line_no; - std::getline(stream, line); - if (!stream.good() && !stream.eof()) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "read error", "", line_no)); - - // If line is non-empty - line = property_tree::detail::trim(line, stream.getloc()); - if (!line.empty()) - { - // Comment, section or key? - if (line[0] == semicolon || line[0] == hash) - { - // Ignore comments - } - else if (line[0] == lbracket) - { - // If the previous section was empty, drop it again. - if (section && section->empty()) - local.pop_back(); - typename Str::size_type end = line.find(rbracket); - if (end == Str::npos) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "unmatched '['", "", line_no)); - Str key = property_tree::detail::trim( - line.substr(1, end - 1), stream.getloc()); - if (local.find(key) != local.not_found()) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "duplicate section name", "", line_no)); - section = &local.push_back( - std::make_pair(key, Ptree()))->second; - } - else - { - Ptree &container = section ? *section : local; - typename Str::size_type eqpos = line.find(Ch('=')); - if (eqpos == Str::npos) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "'=' character not found in line", "", line_no)); - if (eqpos == 0) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "key expected", "", line_no)); - Str key = property_tree::detail::trim( - line.substr(0, eqpos), stream.getloc()); - Str data = property_tree::detail::trim( - line.substr(eqpos + 1, Str::npos), stream.getloc()); - if (container.find(key) != container.not_found()) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "duplicate key name", "", line_no)); - container.push_back(std::make_pair(key, Ptree(data))); - } - } - } - // If the last section was empty, drop it again. - if (section && section->empty()) - local.pop_back(); - - // Swap local ptree with result ptree - pt.swap(local); - - } - - /** - * Read INI from a the given file and translate it to a property tree. - * @note Clears existing contents of property tree. In case of error the - * property tree unmodified. - * @throw ini_parser_error In case of error deserializing the property tree. - * @param filename Name of file from which to read in the property tree. - * @param[out] pt The property tree to populate. - * @param loc The locale to use when reading in the file contents. - */ - template<class Ptree> - void read_ini(const std::string &filename, - Ptree &pt, - const std::locale &loc = std::locale()) - { - std::basic_ifstream<typename Ptree::key_type::value_type> - stream(filename.c_str()); - if (!stream) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "cannot open file", filename, 0)); - stream.imbue(loc); - try { - read_ini(stream, pt); - } - catch (ini_parser_error &e) { - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - e.message(), filename, e.line())); - } - } - - namespace detail - { - template<class Ptree> - void check_dupes(const Ptree &pt) - { - if(pt.size() <= 1) - return; - const typename Ptree::key_type *lastkey = 0; - typename Ptree::const_assoc_iterator it = pt.ordered_begin(), - end = pt.not_found(); - lastkey = &it->first; - for(++it; it != end; ++it) { - if(*lastkey == it->first) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "duplicate key", "", 0)); - lastkey = &it->first; - } - } - - template <typename Ptree> - void write_keys(std::basic_ostream< - typename Ptree::key_type::value_type - > &stream, - const Ptree& pt, - bool throw_on_children) - { - typedef typename Ptree::key_type::value_type Ch; - for (typename Ptree::const_iterator it = pt.begin(), end = pt.end(); - it != end; ++it) - { - if (!it->second.empty()) { - if (throw_on_children) { - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "ptree is too deep", "", 0)); - } - continue; - } - stream << it->first << Ch('=') - << it->second.template get_value< - std::basic_string<Ch> >() - << Ch('\n'); - } - } - - template <typename Ptree> - void write_top_level_keys(std::basic_ostream< - typename Ptree::key_type::value_type - > &stream, - const Ptree& pt) - { - write_keys(stream, pt, false); - } - - template <typename Ptree> - void write_sections(std::basic_ostream< - typename Ptree::key_type::value_type - > &stream, - const Ptree& pt) - { - typedef typename Ptree::key_type::value_type Ch; - for (typename Ptree::const_iterator it = pt.begin(), end = pt.end(); - it != end; ++it) - { - if (!it->second.empty()) { - check_dupes(it->second); - if (!it->second.data().empty()) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "mixed data and children", "", 0)); - stream << Ch('[') << it->first << Ch(']') << Ch('\n'); - write_keys(stream, it->second, true); - } - } - } - } - - /** - * Translates the property tree to INI and writes it the given output - * stream. - * @pre @e pt cannot have data in its root. - * @pre @e pt cannot have keys both data and children. - * @pre @e pt cannot be deeper than two levels. - * @pre There cannot be duplicate keys on any given level of @e pt. - * @throw ini_parser_error In case of error translating the property tree to - * INI or writing to the output stream. - * @param stream The stream to which to write the INI representation of the - * property tree. - * @param pt The property tree to tranlsate to INI and output. - * @param flags The flags to use when writing the INI file. - * No flags are currently supported. - */ - template<class Ptree> - void write_ini(std::basic_ostream< - typename Ptree::key_type::value_type - > &stream, - const Ptree &pt, - int flags = 0) - { - BOOST_ASSERT(validate_flags(flags)); - (void)flags; - - if (!pt.data().empty()) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "ptree has data on root", "", 0)); - detail::check_dupes(pt); - - detail::write_top_level_keys(stream, pt); - detail::write_sections(stream, pt); - } - - /** - * Translates the property tree to INI and writes it the given file. - * @pre @e pt cannot have data in its root. - * @pre @e pt cannot have keys both data and children. - * @pre @e pt cannot be deeper than two levels. - * @pre There cannot be duplicate keys on any given level of @e pt. - * @throw info_parser_error In case of error translating the property tree - * to INI or writing to the file. - * @param filename The name of the file to which to write the INI - * representation of the property tree. - * @param pt The property tree to tranlsate to INI and output. - * @param flags The flags to use when writing the INI file. - * The following flags are supported: - * @li @c skip_ini_validity_check -- Skip check if ptree is a valid ini. The - * validity check covers the preconditions but takes <tt>O(n log n)</tt> - * time. - * @param loc The locale to use when writing the file. - */ - template<class Ptree> - void write_ini(const std::string &filename, - const Ptree &pt, - int flags = 0, - const std::locale &loc = std::locale()) - { - std::basic_ofstream<typename Ptree::key_type::value_type> - stream(filename.c_str()); - if (!stream) - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - "cannot open file", filename, 0)); - stream.imbue(loc); - try { - write_ini(stream, pt, flags); - } - catch (ini_parser_error &e) { - BOOST_PROPERTY_TREE_THROW(ini_parser_error( - e.message(), filename, e.line())); - } - } - -} } } - -namespace boost { namespace property_tree -{ - using ini_parser::ini_parser_error; - using ini_parser::read_ini; - using ini_parser::write_ini; -} } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/json_parser.hpp b/contrib/restricted/boost/boost/property_tree/json_parser.hpp deleted file mode 100644 index 62fd89f855..0000000000 --- a/contrib/restricted/boost/boost/property_tree/json_parser.hpp +++ /dev/null @@ -1,140 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// Copyright (C) 2015 Sebastian Redl -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_JSON_PARSER_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_JSON_PARSER_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/json_parser/error.hpp> -#include <boost/property_tree/json_parser/detail/read.hpp> -#include <boost/property_tree/json_parser/detail/write.hpp> - -#include <fstream> -#include <string> -#include <locale> - -namespace boost { namespace property_tree { namespace json_parser -{ - - /** - * Read JSON from a the given stream and translate it to a property tree. - * @note Clears existing contents of property tree. In case of error the - * property tree unmodified. - * @note Items of JSON arrays are translated into ptree keys with empty - * names. Members of objects are translated into named keys. - * @note JSON data can be a string, a numeric value, or one of literals - * "null", "true" and "false". During parse, any of the above is - * copied verbatim into ptree data string. - * @throw json_parser_error In case of error deserializing the property - * tree. - * @param stream Stream from which to read in the property tree. - * @param[out] pt The property tree to populate. - */ - template<class Ptree> - void read_json(std::basic_istream< - typename Ptree::key_type::value_type - > &stream, - Ptree &pt) - { - detail::read_json_internal(stream, pt, std::string()); - } - - /** - * Read JSON from a the given file and translate it to a property tree. - * @note Clears existing contents of property tree. In case of error the - * property tree unmodified. - * @note Items of JSON arrays are translated into ptree keys with empty - * names. Members of objects are translated into named keys. - * @note JSON data can be a string, a numeric value, or one of literals - * "null", "true" and "false". During parse, any of the above is - * copied verbatim into ptree data string. - * @throw json_parser_error In case of error deserializing the property - * tree. - * @param filename Name of file from which to read in the property tree. - * @param[out] pt The property tree to populate. - * @param loc The locale to use when reading in the file contents. - */ - template<class Ptree> - void read_json(const std::string &filename, - Ptree &pt, - const std::locale &loc = std::locale()) - { - std::basic_ifstream<typename Ptree::key_type::value_type> - stream(filename.c_str()); - if (!stream) - BOOST_PROPERTY_TREE_THROW(json_parser_error( - "cannot open file", filename, 0)); - stream.imbue(loc); - detail::read_json_internal(stream, pt, filename); - } - - /** - * Translates the property tree to JSON and writes it the given output - * stream. - * @note Any property tree key containing only unnamed subkeys will be - * rendered as JSON arrays. - * @pre @e pt cannot contain keys that have both subkeys and non-empty data. - * @throw json_parser_error In case of error translating the property tree - * to JSON or writing to the output stream. - * @param stream The stream to which to write the JSON representation of the - * property tree. - * @param pt The property tree to tranlsate to JSON and output. - * @param pretty Whether to pretty-print. Defaults to true for backward - * compatibility. - */ - template<class Ptree> - void write_json(std::basic_ostream< - typename Ptree::key_type::value_type - > &stream, - const Ptree &pt, - bool pretty = true) - { - write_json_internal(stream, pt, std::string(), pretty); - } - - /** - * Translates the property tree to JSON and writes it the given file. - * @note Any property tree key containing only unnamed subkeys will be - * rendered as JSON arrays. - * @pre @e pt cannot contain keys that have both subkeys and non-empty data. - * @throw json_parser_error In case of error translating the property tree - * to JSON or writing to the file. - * @param filename The name of the file to which to write the JSON - * representation of the property tree. - * @param pt The property tree to translate to JSON and output. - * @param loc The locale to use when writing out to the output file. - * @param pretty Whether to pretty-print. Defaults to true and last place - * for backward compatibility. - */ - template<class Ptree> - void write_json(const std::string &filename, - const Ptree &pt, - const std::locale &loc = std::locale(), - bool pretty = true) - { - std::basic_ofstream<typename Ptree::key_type::value_type> - stream(filename.c_str()); - if (!stream) - BOOST_PROPERTY_TREE_THROW(json_parser_error( - "cannot open file", filename, 0)); - stream.imbue(loc); - write_json_internal(stream, pt, filename, pretty); - } - -} } } - -namespace boost { namespace property_tree -{ - using json_parser::read_json; - using json_parser::write_json; - using json_parser::json_parser_error; -} } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/json_parser/detail/narrow_encoding.hpp b/contrib/restricted/boost/boost/property_tree/json_parser/detail/narrow_encoding.hpp deleted file mode 100644 index 4e25e686ac..0000000000 --- a/contrib/restricted/boost/boost/property_tree/json_parser/detail/narrow_encoding.hpp +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_NARROW_ENCODING_HPP -#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_NARROW_ENCODING_HPP - -#include <boost/assert.hpp> -#include <boost/range/iterator_range_core.hpp> - -#include <utility> - -namespace boost { namespace property_tree { - namespace json_parser { namespace detail -{ - - struct external_ascii_superset_encoding - { - typedef char external_char; - - bool is_nl(char c) const { return c == '\n'; } - bool is_ws(char c) const { - return c == ' ' || c == '\t' || c == '\n' || c == '\r'; - } - - bool is_minus(char c) const { return c == '-'; } - bool is_plusminus(char c) const { return c == '+' || c == '-'; } - bool is_dot(char c) const { return c == '.'; } - bool is_eE(char c) const { return c == 'e' || c == 'E'; } - bool is_0(char c) const { return c == '0'; } - bool is_digit(char c) const { return c >= '0' && c <= '9'; } - bool is_digit0(char c) const { return c >= '1' && c <= '9'; } - - bool is_quote(char c) const { return c == '"'; } - bool is_backslash(char c) const { return c == '\\'; } - bool is_slash(char c) const { return c == '/'; } - - bool is_comma(char c) const { return c == ','; } - bool is_open_bracket(char c) const { return c == '['; } - bool is_close_bracket(char c) const { return c == ']'; } - bool is_colon(char c) const { return c == ':'; } - bool is_open_brace(char c) const { return c == '{'; } - bool is_close_brace(char c) const { return c == '}'; } - - bool is_a(char c) const { return c == 'a'; } - bool is_b(char c) const { return c == 'b'; } - bool is_e(char c) const { return c == 'e'; } - bool is_f(char c) const { return c == 'f'; } - bool is_l(char c) const { return c == 'l'; } - bool is_n(char c) const { return c == 'n'; } - bool is_r(char c) const { return c == 'r'; } - bool is_s(char c) const { return c == 's'; } - bool is_t(char c) const { return c == 't'; } - bool is_u(char c) const { return c == 'u'; } - - int decode_hexdigit(char c) { - if (c >= '0' && c <= '9') return c - '0'; - if (c >= 'A' && c <= 'F') return c - 'A' + 10; - if (c >= 'a' && c <= 'f') return c - 'a' + 10; - return -1; - } - }; - - struct utf8_utf8_encoding : external_ascii_superset_encoding - { - typedef char internal_char; - - template <typename Iterator> - boost::iterator_range<Iterator> - to_internal(Iterator first, Iterator last) const { - return boost::make_iterator_range(first, last); - } - - char to_internal_trivial(char c) const { - BOOST_ASSERT(static_cast<unsigned char>(c) <= 0x7f); - return c; - } - - template <typename Iterator, typename Sentinel, - typename EncodingErrorFn> - void skip_codepoint(Iterator& cur, Sentinel end, - EncodingErrorFn error_fn) const { - transcode_codepoint(cur, end, DoNothing(), error_fn); - } - - template <typename Iterator, typename Sentinel, typename TranscodedFn, - typename EncodingErrorFn> - void transcode_codepoint(Iterator& cur, Sentinel end, - TranscodedFn transcoded_fn, EncodingErrorFn error_fn) const { - unsigned char c = *cur; - ++cur; - if (c <= 0x7f) { - // Solo byte, filter out disallowed codepoints. - if (c < 0x20) { - error_fn(); - } - transcoded_fn(c); - return; - } - int trailing = trail_table(c); - if (trailing == -1) { - // Standalone trailing byte or overly long sequence. - error_fn(); - } - transcoded_fn(c); - for (int i = 0; i < trailing; ++i) { - if (cur == end || !is_trail(*cur)) { - error_fn(); - } - transcoded_fn(*cur); - ++cur; - } - } - - template <typename TranscodedFn> - void feed_codepoint(unsigned codepoint, - TranscodedFn transcoded_fn) const { - if (codepoint <= 0x7f) { - transcoded_fn(static_cast<char>(codepoint)); - } else if (codepoint <= 0x7ff) { - transcoded_fn(static_cast<char>(0xc0 | (codepoint >> 6))); - transcoded_fn(trail(codepoint)); - } else if (codepoint <= 0xffff) { - transcoded_fn(static_cast<char>(0xe0 | (codepoint >> 12))); - transcoded_fn(trail(codepoint >> 6)); - transcoded_fn(trail(codepoint)); - } else if (codepoint <= 0x10ffff) { - transcoded_fn(static_cast<char>(0xf0 | (codepoint >> 18))); - transcoded_fn(trail(codepoint >> 12)); - transcoded_fn(trail(codepoint >> 6)); - transcoded_fn(trail(codepoint)); - } - } - - template <typename Iterator, typename Sentinel> - void skip_introduction(Iterator& cur, Sentinel end) const { - if (cur != end && static_cast<unsigned char>(*cur) == 0xef) { - if (++cur == end) return; - if (++cur == end) return; - if (++cur == end) return; - } - } - - private: - struct DoNothing { - void operator ()(char) const {} - }; - - bool is_trail(unsigned char c) const { - return (c & 0xc0) == 0x80; - } - - int trail_table(unsigned char c) const { - static const signed char table[] = { - /* not a lead byte */ - /* 0x10???sss */ -1, -1, -1, -1, -1, -1, -1, -1, - /* 0x110??sss */ 1, 1, 1, 1, /* 1 trailing byte */ - /* 0x1110?sss */ 2, 2, /* 2 trailing bytes */ - /* 0x11110sss */ 3, /* 3 trailing bytes */ - /* 0x11111sss */ -1 /* 4 or 5 trailing bytes, disallowed */ - }; - return table[(c & 0x7f) >> 3]; - } - - char trail(unsigned unmasked) const { - return static_cast<char>(0x80 | (unmasked & 0x3f)); - } - }; - -}}}} - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/json_parser/detail/parser.hpp b/contrib/restricted/boost/boost/property_tree/json_parser/detail/parser.hpp deleted file mode 100644 index 5554990fb2..0000000000 --- a/contrib/restricted/boost/boost/property_tree/json_parser/detail/parser.hpp +++ /dev/null @@ -1,530 +0,0 @@ -#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_PARSER_HPP -#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_PARSER_HPP - -#include <boost/property_tree/json_parser/error.hpp> - -#include <boost/ref.hpp> -#include <boost/bind.hpp> -#include <boost/format.hpp> - -#include <iterator> -#include <sstream> -#include <string> - -namespace boost { namespace property_tree { - namespace json_parser { namespace detail -{ - - template <typename Encoding, typename Iterator, typename Sentinel> - class source - { - public: - typedef typename std::iterator_traits<Iterator>::value_type - code_unit; - typedef bool (Encoding::*encoding_predicate)(code_unit c) const; - - explicit source(Encoding& encoding) : encoding(encoding) {} - - template <typename Range> - void set_input(const std::string& filename, const Range& r) - { - this->filename = filename; - cur = r.begin(); - end = r.end(); - // Note that there is no backtracking, so if e.g. a UTF-8 file - // starts with something that initially looks like a BOM but isn't, - // there's trouble. - // However, no valid JSON file can start with a UTF-8 EF byte. - encoding.skip_introduction(cur, end); - line = 1; - offset = 0; - } - - bool done() const { return cur == end; } - - void parse_error(const char* msg) { - BOOST_PROPERTY_TREE_THROW( - json_parser_error(msg, filename, line)); - } - - void next() { - if (encoding.is_nl(*cur)) { - ++line; - offset = 0; - } else { - ++offset; - } - ++cur; - } - - template <typename Action> - bool have(encoding_predicate p, Action& a) { - bool found = cur != end && (encoding.*p)(*cur); - if (found) { - a(*cur); - next(); - } - return found; - } - - bool have(encoding_predicate p) { - DoNothing n; - return have(p, n); - } - - template <typename Action> - void expect(encoding_predicate p, const char* msg, Action& a) { - if (!have(p, a)) { - parse_error(msg); - } - } - - void expect(encoding_predicate p, const char* msg) { - DoNothing n; - expect(p, msg, n); - } - - code_unit need_cur(const char* msg) { - if (cur == end) { - parse_error(msg); - } - return *cur; - } - - Iterator& raw_cur() { return cur; } - Sentinel raw_end() { return end; } - - private: - struct DoNothing { - void operator ()(code_unit) const {} - }; - - Encoding& encoding; - Iterator cur; - Sentinel end; - std::string filename; - int line; - int offset; - }; - - template <typename Callbacks, typename Encoding, typename Iterator, - typename = typename std::iterator_traits<Iterator> - ::iterator_category> - class number_callback_adapter - { - public: - number_callback_adapter(Callbacks& callbacks, Encoding& encoding, - Iterator& cur) - : callbacks(callbacks), encoding(encoding), first(cur), cur(cur) - {} - - void operator ()(typename Encoding::external_char) {} - - void finish() const { - callbacks.on_number(encoding.to_internal(first, cur)); - } - - private: - number_callback_adapter(const number_callback_adapter&); - - Callbacks& callbacks; - Encoding& encoding; - Iterator first; - Iterator& cur; - }; - - template <typename Callbacks, typename Encoding, typename Iterator> - class number_callback_adapter<Callbacks, Encoding, Iterator, - std::input_iterator_tag> - { - public: - number_callback_adapter(Callbacks& callbacks, Encoding& encoding, - Iterator&) - : callbacks(callbacks), encoding(encoding), first(true) - {} - - void operator ()(typename Encoding::external_char c) { - if (first) { - callbacks.on_begin_number(); - first = false; - } - callbacks.on_digit(encoding.to_internal_trivial(c)); - } - - void finish() const { - callbacks.on_end_number(); - } - private: - number_callback_adapter(const number_callback_adapter&); - - Callbacks& callbacks; - Encoding& encoding; - bool first; - }; - - template <typename Callbacks, typename Encoding, typename Iterator, - typename = typename std::iterator_traits<Iterator> - ::iterator_category> - class string_callback_adapter - { - public: - string_callback_adapter(Callbacks& callbacks, Encoding& encoding, - Iterator& cur) - : callbacks(callbacks), encoding(encoding), cur(cur), - run_begin(cur) - {} - - void start_run() { - run_begin = cur; - } - - void finish_run() { - callbacks.on_code_units(encoding.to_internal(run_begin, cur)); - } - - template <typename Sentinel, typename EncodingErrorFn> - void process_codepoint(Sentinel end, EncodingErrorFn error_fn) { - encoding.skip_codepoint(cur, end, error_fn); - } - - private: - string_callback_adapter(const string_callback_adapter&); - - Callbacks& callbacks; - Encoding& encoding; - Iterator& cur; - Iterator run_begin; - }; - - template <typename Callbacks, typename Encoding, typename Iterator> - class string_callback_adapter<Callbacks, Encoding, Iterator, - std::input_iterator_tag> - { - public: - string_callback_adapter(Callbacks& callbacks, Encoding& encoding, - Iterator& cur) - : callbacks(callbacks), encoding(encoding), cur(cur) - {} - - void start_run() {} - - void finish_run() {} - - template <typename Sentinel, typename EncodingErrorFn> - void process_codepoint(Sentinel end, EncodingErrorFn error_fn) { - encoding.transcode_codepoint(cur, end, - boost::bind(&Callbacks::on_code_unit, - boost::ref(callbacks), _1), - error_fn); - } - - private: - string_callback_adapter(const string_callback_adapter&); - - Callbacks& callbacks; - Encoding& encoding; - Iterator& cur; - }; - - template <typename Callbacks, typename Encoding, typename Iterator, - typename Sentinel> - class parser - { - typedef detail::number_callback_adapter<Callbacks, Encoding, Iterator> - number_adapter; - typedef detail::string_callback_adapter<Callbacks, Encoding, Iterator> - string_adapter; - typedef detail::source<Encoding, Iterator, Sentinel> source; - typedef typename source::code_unit code_unit; - - public: - parser(Callbacks& callbacks, Encoding& encoding) - : callbacks(callbacks), encoding(encoding), src(encoding) - {} - - template <typename Range> - void set_input(const std::string& filename, const Range& r) { - src.set_input(filename, r); - } - - void finish() { - skip_ws(); - if (!src.done()) { - parse_error("garbage after data"); - } - } - - void parse_value() { - if (parse_object()) return; - if (parse_array()) return; - if (parse_string()) return; - if (parse_boolean()) return; - if (parse_null()) return; - if (parse_number()) return; - parse_error("expected value"); - } - - bool parse_null() { - skip_ws(); - if (!have(&Encoding::is_n)) { - return false; - } - expect(&Encoding::is_u, "expected 'null'"); - expect(&Encoding::is_l, "expected 'null'"); - expect(&Encoding::is_l, "expected 'null'"); - callbacks.on_null(); - return true; - } - - bool parse_boolean() { - skip_ws(); - if (have(&Encoding::is_t)) { - expect(&Encoding::is_r, "expected 'true'"); - expect(&Encoding::is_u, "expected 'true'"); - expect(&Encoding::is_e, "expected 'true'"); - callbacks.on_boolean(true); - return true; - } - if (have(&Encoding::is_f)) { - expect(&Encoding::is_a, "expected 'false'"); - expect(&Encoding::is_l, "expected 'false'"); - expect(&Encoding::is_s, "expected 'false'"); - expect(&Encoding::is_e, "expected 'false'"); - callbacks.on_boolean(false); - return true; - } - return false; - } - - bool parse_number() { - skip_ws(); - - number_adapter adapter(callbacks, encoding, src.raw_cur()); - bool started = false; - if (have(&Encoding::is_minus, adapter)) { - started = true; - } - if (!have(&Encoding::is_0, adapter) && !parse_int_part(adapter)) { - if (started) { - parse_error("expected digits after -"); - } - return false; - } - parse_frac_part(adapter); - parse_exp_part(adapter); - adapter.finish(); - return true; - } - - bool parse_string() { - skip_ws(); - - if (!have(&Encoding::is_quote)) { - return false; - } - - callbacks.on_begin_string(); - string_adapter adapter(callbacks, encoding, src.raw_cur()); - while (!encoding.is_quote(need_cur("unterminated string"))) { - if (encoding.is_backslash(*src.raw_cur())) { - adapter.finish_run(); - next(); - parse_escape(); - adapter.start_run(); - } else { - adapter.process_codepoint(src.raw_end(), - boost::bind(&parser::parse_error, - this, "invalid code sequence")); - } - } - adapter.finish_run(); - callbacks.on_end_string(); - next(); - return true; - } - - bool parse_array() { - skip_ws(); - - if (!have(&Encoding::is_open_bracket)) { - return false; - } - - callbacks.on_begin_array(); - skip_ws(); - if (have(&Encoding::is_close_bracket)) { - callbacks.on_end_array(); - return true; - } - do { - parse_value(); - skip_ws(); - } while (have(&Encoding::is_comma)); - expect(&Encoding::is_close_bracket, "expected ']' or ','"); - callbacks.on_end_array(); - return true; - } - - bool parse_object() { - skip_ws(); - - if (!have(&Encoding::is_open_brace)) { - return false; - } - - callbacks.on_begin_object(); - skip_ws(); - if (have(&Encoding::is_close_brace)) { - callbacks.on_end_object(); - return true; - } - do { - if (!parse_string()) { - parse_error("expected key string"); - } - skip_ws(); - expect(&Encoding::is_colon, "expected ':'"); - parse_value(); - skip_ws(); - } while (have(&Encoding::is_comma)); - expect(&Encoding::is_close_brace, "expected '}' or ','"); - callbacks.on_end_object(); - return true; - } - - private: - typedef typename source::encoding_predicate encoding_predicate; - - void parse_error(const char* msg) { src.parse_error(msg); } - void next() { src.next(); } - template <typename Action> - bool have(encoding_predicate p, Action& a) { return src.have(p, a); } - bool have(encoding_predicate p) { return src.have(p); } - template <typename Action> - void expect(encoding_predicate p, const char* msg, Action& a) { - src.expect(p, msg, a); - } - void expect(encoding_predicate p, const char* msg) { - src.expect(p, msg); - } - code_unit need_cur(const char* msg) { return src.need_cur(msg); } - - void skip_ws() { - while (have(&Encoding::is_ws)) { - } - } - - bool parse_int_part(number_adapter& action) { - if (!have(&Encoding::is_digit0, action)) { - return false; - } - parse_digits(action); - return true; - } - - void parse_frac_part(number_adapter& action) { - if (!have(&Encoding::is_dot, action)) { - return; - } - expect(&Encoding::is_digit, "need at least one digit after '.'", - action); - parse_digits(action); - } - - void parse_exp_part(number_adapter& action) { - if (!have(&Encoding::is_eE, action)) { - return; - } - have(&Encoding::is_plusminus, action); - expect(&Encoding::is_digit, "need at least one digit in exponent", - action); - parse_digits(action); - } - - void parse_digits(number_adapter& action) { - while (have(&Encoding::is_digit, action)) { - } - } - - void parse_escape() { - if (have(&Encoding::is_quote)) { - feed(0x22); - } else if (have(&Encoding::is_backslash)) { - feed(0x5c); - } else if (have(&Encoding::is_slash)) { - feed(0x2f); - } else if (have(&Encoding::is_b)) { - feed(0x08); // backspace - } else if (have(&Encoding::is_f)) { - feed(0x0c); // formfeed - } else if (have(&Encoding::is_n)) { - feed(0x0a); // line feed - } else if (have(&Encoding::is_r)) { - feed(0x0d); // carriage return - } else if (have(&Encoding::is_t)) { - feed(0x09); // horizontal tab - } else if (have(&Encoding::is_u)) { - parse_codepoint_ref(); - } else { - parse_error("invalid escape sequence"); - } - } - - unsigned parse_hex_quad() { - unsigned codepoint = 0; - for (int i = 0; i < 4; ++i) { - int value = encoding.decode_hexdigit( - need_cur("invalid escape sequence")); - if (value < 0) { - parse_error("invalid escape sequence"); - } - codepoint *= 16; - codepoint += value; - next(); - } - return codepoint; - } - - static bool is_surrogate_high(unsigned codepoint) { - return (codepoint & 0xfc00) == 0xd800; - } - static bool is_surrogate_low(unsigned codepoint) { - return (codepoint & 0xfc00) == 0xdc00; - } - static unsigned combine_surrogates(unsigned high, unsigned low) { - return 0x010000 + (((high & 0x3ff) << 10) | (low & 0x3ff)); - } - - void parse_codepoint_ref() { - unsigned codepoint = parse_hex_quad(); - if (is_surrogate_low(codepoint)) { - parse_error("invalid codepoint, stray low surrogate"); - } - if (is_surrogate_high(codepoint)) { - expect(&Encoding::is_backslash, - "invalid codepoint, stray high surrogate"); - expect(&Encoding::is_u, - "expected codepoint reference after high surrogate"); - int low = parse_hex_quad(); - if (!is_surrogate_low(low)) { - parse_error("expected low surrogate after high surrogate"); - } - codepoint = combine_surrogates(codepoint, low); - } - feed(codepoint); - } - - void feed(unsigned codepoint) { - encoding.feed_codepoint(codepoint, - boost::bind(&Callbacks::on_code_unit, - boost::ref(callbacks), _1)); - } - - Callbacks& callbacks; - Encoding& encoding; - source src; - }; - -}}}} - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/json_parser/detail/read.hpp b/contrib/restricted/boost/boost/property_tree/json_parser/detail/read.hpp deleted file mode 100644 index d7f0ba6790..0000000000 --- a/contrib/restricted/boost/boost/property_tree/json_parser/detail/read.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2015 Sebastian Redl -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_READ_HPP -#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_READ_HPP - -#include <boost/property_tree/json_parser/detail/parser.hpp> -#include <boost/property_tree/json_parser/detail/narrow_encoding.hpp> -#include <boost/property_tree/json_parser/detail/wide_encoding.hpp> -#include <boost/property_tree/json_parser/detail/standard_callbacks.hpp> - -#include <boost/static_assert.hpp> -#include <boost/type_traits/is_same.hpp> - -#include <istream> -#include <iterator> -#include <string> - -namespace boost { namespace property_tree { - namespace json_parser { namespace detail -{ - - template <typename Iterator, typename Sentinel> - class minirange - { - public: - minirange(Iterator first, Sentinel last) : first(first), last(last) {} - Iterator begin() const { return first; } - Sentinel end() const { return last; } - - private: - Iterator first; - Sentinel last; - }; - template <typename Iterator, typename Sentinel> - minirange<Iterator, Sentinel> make_minirange(Iterator first, Sentinel last) - { - return minirange<Iterator, Sentinel>(first, last); - } - - template <typename Iterator, typename Sentinel, - typename Encoding, typename Callbacks> - void read_json_internal(Iterator first, Sentinel last, Encoding& encoding, - Callbacks& callbacks, const std::string& filename) - { - BOOST_STATIC_ASSERT_MSG((boost::is_same< - typename std::iterator_traits<Iterator>::value_type, - typename Encoding::external_char>::value), - "Encoding is not capable of using the iterator's value type."); - BOOST_STATIC_ASSERT_MSG((boost::is_same< - typename Callbacks::char_type, - typename Encoding::internal_char>::value), - "Encoding is not capable of producing the needed character type."); - - detail::parser<Callbacks, Encoding, Iterator, Sentinel> - parser(callbacks, encoding); - parser.set_input(filename, make_minirange(first, last)); - parser.parse_value(); - parser.finish(); - } - - template <typename Ch> struct encoding; - template <> struct encoding<char> : utf8_utf8_encoding {}; - template <> struct encoding<wchar_t> : wide_wide_encoding {}; - - template <typename Ptree> - void read_json_internal( - std::basic_istream<typename Ptree::key_type::value_type> &stream, - Ptree &pt, const std::string &filename) - { - typedef typename Ptree::key_type::value_type char_type; - typedef standard_callbacks<Ptree> callbacks_type; - typedef detail::encoding<char_type> encoding_type; - typedef std::istreambuf_iterator<char_type> iterator; - callbacks_type callbacks; - encoding_type encoding; - read_json_internal(iterator(stream), iterator(), - encoding, callbacks, filename); - pt.swap(callbacks.output()); - } - -}}}} - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/json_parser/detail/standard_callbacks.hpp b/contrib/restricted/boost/boost/property_tree/json_parser/detail/standard_callbacks.hpp deleted file mode 100644 index 0ece280891..0000000000 --- a/contrib/restricted/boost/boost/property_tree/json_parser/detail/standard_callbacks.hpp +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_STANDARD_CALLBACKS_HPP -#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_STANDARD_CALLBACKS_HPP - -#include <boost/assert.hpp> -#include <boost/property_tree/ptree.hpp> -#include <vector> - -namespace boost { namespace property_tree { - namespace json_parser { namespace detail -{ - - namespace constants - { - template <typename Ch> const Ch* null_value(); - template <> inline const char* null_value() { return "null"; } - template <> inline const wchar_t* null_value() { return L"null"; } - - template <typename Ch> const Ch* true_value(); - template <> inline const char* true_value() { return "true"; } - template <> inline const wchar_t* true_value() { return L"true"; } - - template <typename Ch> const Ch* false_value(); - template <> inline const char* false_value() { return "false"; } - template <> inline const wchar_t* false_value() { return L"false"; } - } - - template <typename Ptree> - class standard_callbacks { - public: - typedef typename Ptree::data_type string; - typedef typename string::value_type char_type; - - void on_null() { - new_value() = constants::null_value<char_type>(); - } - - void on_boolean(bool b) { - new_value() = b ? constants::true_value<char_type>() - : constants::false_value<char_type>(); - } - - template <typename Range> - void on_number(Range code_units) { - new_value().assign(code_units.begin(), code_units.end()); - } - void on_begin_number() { - new_value(); - } - void on_digit(char_type d) { - current_value() += d; - } - void on_end_number() {} - - void on_begin_string() { - new_value(); - } - template <typename Range> - void on_code_units(Range code_units) { - current_value().append(code_units.begin(), code_units.end()); - } - void on_code_unit(char_type c) { - current_value() += c; - } - void on_end_string() {} - - void on_begin_array() { - new_tree(); - stack.back().k = array; - } - void on_end_array() { - if (stack.back().k == leaf) stack.pop_back(); - stack.pop_back(); - } - - void on_begin_object() { - new_tree(); - stack.back().k = object; - } - void on_end_object() { - if (stack.back().k == leaf) stack.pop_back(); - stack.pop_back(); - } - - Ptree& output() { return root; } - - protected: - bool is_key() const { - return stack.back().k == key; - } - string& current_value() { - layer& l = stack.back(); - switch (l.k) { - case key: return key_buffer; - default: return l.t->data(); - } - } - - private: - Ptree root; - string key_buffer; - enum kind { array, object, key, leaf }; - struct layer { kind k; Ptree* t; }; - std::vector<layer> stack; - - Ptree& new_tree() { - if (stack.empty()) { - layer l = {leaf, &root}; - stack.push_back(l); - return root; - } - layer& l = stack.back(); - switch (l.k) { - case array: { - l.t->push_back(std::make_pair(string(), Ptree())); - layer nl = {leaf, &l.t->back().second}; - stack.push_back(nl); - return *stack.back().t; - } - case object: - default: - BOOST_ASSERT(false); // must start with string, i.e. call new_value - case key: { - l.t->push_back(std::make_pair(key_buffer, Ptree())); - l.k = object; - layer nl = {leaf, &l.t->back().second}; - stack.push_back(nl); - return *stack.back().t; - } - case leaf: - stack.pop_back(); - return new_tree(); - } - } - string& new_value() { - if (stack.empty()) return new_tree().data(); - layer& l = stack.back(); - switch (l.k) { - case leaf: - stack.pop_back(); - return new_value(); - case object: - l.k = key; - key_buffer.clear(); - return key_buffer; - default: - return new_tree().data(); - } - } - }; - -}}}} - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/json_parser/detail/wide_encoding.hpp b/contrib/restricted/boost/boost/property_tree/json_parser/detail/wide_encoding.hpp deleted file mode 100644 index a213ae94c2..0000000000 --- a/contrib/restricted/boost/boost/property_tree/json_parser/detail/wide_encoding.hpp +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_WIDE_ENCODING_HPP -#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_WIDE_ENCODING_HPP - -#include <boost/assert.hpp> -#include <boost/range/iterator_range_core.hpp> - -#include <utility> - -namespace boost { namespace property_tree { - namespace json_parser { namespace detail -{ - - struct external_wide_encoding - { - typedef wchar_t external_char; - - bool is_nl(wchar_t c) const { return c == L'\n'; } - bool is_ws(wchar_t c) const { - return c == L' ' || c == L'\t' || c == L'\n' || c == L'\r'; - } - - bool is_minus(wchar_t c) const { return c == L'-'; } - bool is_plusminus(wchar_t c) const { return c == L'+' || c == L'-'; } - bool is_dot(wchar_t c) const { return c == L'.'; } - bool is_eE(wchar_t c) const { return c == L'e' || c == L'E'; } - bool is_0(wchar_t c) const { return c == L'0'; } - bool is_digit(wchar_t c) const { return c >= L'0' && c <= L'9'; } - bool is_digit0(wchar_t c) const { return c >= L'1' && c <= L'9'; } - - bool is_quote(wchar_t c) const { return c == L'"'; } - bool is_backslash(wchar_t c) const { return c == L'\\'; } - bool is_slash(wchar_t c) const { return c == L'/'; } - - bool is_comma(wchar_t c) const { return c == L','; } - bool is_open_bracket(wchar_t c) const { return c == L'['; } - bool is_close_bracket(wchar_t c) const { return c == L']'; } - bool is_colon(wchar_t c) const { return c == L':'; } - bool is_open_brace(wchar_t c) const { return c == L'{'; } - bool is_close_brace(wchar_t c) const { return c == L'}'; } - - bool is_a(wchar_t c) const { return c == L'a'; } - bool is_b(wchar_t c) const { return c == L'b'; } - bool is_e(wchar_t c) const { return c == L'e'; } - bool is_f(wchar_t c) const { return c == L'f'; } - bool is_l(wchar_t c) const { return c == L'l'; } - bool is_n(wchar_t c) const { return c == L'n'; } - bool is_r(wchar_t c) const { return c == L'r'; } - bool is_s(wchar_t c) const { return c == L's'; } - bool is_t(wchar_t c) const { return c == L't'; } - bool is_u(wchar_t c) const { return c == L'u'; } - - int decode_hexdigit(wchar_t c) { - if (c >= L'0' && c <= L'9') return c - L'0'; - if (c >= L'A' && c <= L'F') return c - L'A' + 10; - if (c >= L'a' && c <= L'f') return c - L'a' + 10; - return -1; - } - }; - - template <bool B> struct is_utf16 {}; - - class wide_wide_encoding : public external_wide_encoding - { - typedef is_utf16<sizeof(wchar_t) == 2> test_utf16; - public: - typedef wchar_t internal_char; - - template <typename Iterator> - boost::iterator_range<Iterator> - to_internal(Iterator first, Iterator last) const { - return boost::make_iterator_range(first, last); - } - - wchar_t to_internal_trivial(wchar_t c) const { - BOOST_ASSERT(!is_surrogate_high(c) && !is_surrogate_low(c)); - return c; - } - - template <typename Iterator, typename Sentinel, - typename EncodingErrorFn> - void skip_codepoint(Iterator& cur, Sentinel end, - EncodingErrorFn error_fn) const { - transcode_codepoint(cur, end, DoNothing(), error_fn); - } - - template <typename Iterator, typename Sentinel, typename TranscodedFn, - typename EncodingErrorFn> - void transcode_codepoint(Iterator& cur, Sentinel end, - TranscodedFn transcoded_fn, EncodingErrorFn error_fn) const { - return transcode_codepoint(cur, end, transcoded_fn, error_fn, - test_utf16()); - } - - template <typename TranscodedFn> - void feed_codepoint(unsigned codepoint, - TranscodedFn transcoded_fn) const { - feed_codepoint(codepoint, transcoded_fn, test_utf16()); - } - - template <typename Iterator, typename Sentinel> - void skip_introduction(Iterator& cur, Sentinel end) const { - // Endianness is already decoded at this level. - if (cur != end && *cur == 0xfeff) { - ++cur; - } - } - - private: - struct DoNothing { - void operator ()(wchar_t) const {} - }; - - template <typename Iterator, typename Sentinel, typename TranscodedFn, - typename EncodingErrorFn> - void transcode_codepoint(Iterator& cur, Sentinel, - TranscodedFn transcoded_fn, - EncodingErrorFn error_fn, - is_utf16<false>) const { - wchar_t c = *cur; - if (c < 0x20) { - error_fn(); - } - transcoded_fn(c); - ++cur; - } - template <typename Iterator, typename Sentinel, typename TranscodedFn, - typename EncodingErrorFn> - void transcode_codepoint(Iterator& cur, Sentinel end, - TranscodedFn transcoded_fn, - EncodingErrorFn error_fn, - is_utf16<true>) const { - wchar_t c = *cur; - if (c < 0x20) { - error_fn(); - } - if (is_surrogate_low(c)) { - error_fn(); - } - transcoded_fn(c); - ++cur; - if (is_surrogate_high(c)) { - if (cur == end) { - error_fn(); - } - c = *cur; - if (!is_surrogate_low(c)) { - error_fn(); - } - transcoded_fn(c); - ++cur; - } - } - - template <typename TranscodedFn> - void feed_codepoint(unsigned codepoint, TranscodedFn transcoded_fn, - is_utf16<false>) const { - transcoded_fn(static_cast<wchar_t>(codepoint)); - } - template <typename TranscodedFn> - void feed_codepoint(unsigned codepoint, TranscodedFn transcoded_fn, - is_utf16<true>) const { - if (codepoint < 0x10000) { - transcoded_fn(static_cast<wchar_t>(codepoint)); - } else { - codepoint -= 0x10000; - transcoded_fn(static_cast<wchar_t>((codepoint >> 10) | 0xd800)); - transcoded_fn(static_cast<wchar_t>( - (codepoint & 0x3ff) | 0xdc00)); - } - } - - static bool is_surrogate_high(unsigned codepoint) { - return (codepoint & 0xfc00) == 0xd800; - } - static bool is_surrogate_low(unsigned codepoint) { - return (codepoint & 0xfc00) == 0xdc00; - } - }; - -}}}} - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/json_parser/detail/write.hpp b/contrib/restricted/boost/boost/property_tree/json_parser/detail/write.hpp deleted file mode 100644 index bba10038bb..0000000000 --- a/contrib/restricted/boost/boost/property_tree/json_parser/detail/write.hpp +++ /dev/null @@ -1,168 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_WRITE_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_WRITE_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> -#include <boost/next_prior.hpp> -#include <boost/type_traits/make_unsigned.hpp> -#include <string> -#include <ostream> -#include <iomanip> - -namespace boost { namespace property_tree { namespace json_parser -{ - - // Create necessary escape sequences from illegal characters - template<class Ch> - std::basic_string<Ch> create_escapes(const std::basic_string<Ch> &s) - { - std::basic_string<Ch> result; - typename std::basic_string<Ch>::const_iterator b = s.begin(); - typename std::basic_string<Ch>::const_iterator e = s.end(); - while (b != e) - { - typedef typename make_unsigned<Ch>::type UCh; - UCh c(*b); - // This assumes an ASCII superset. But so does everything in PTree. - // We escape everything outside ASCII, because this code can't - // handle high unicode characters. - if (c == 0x20 || c == 0x21 || (c >= 0x23 && c <= 0x2E) || - (c >= 0x30 && c <= 0x5B) || (c >= 0x5D && c <= 0xFF)) - result += *b; - else if (*b == Ch('\b')) result += Ch('\\'), result += Ch('b'); - else if (*b == Ch('\f')) result += Ch('\\'), result += Ch('f'); - else if (*b == Ch('\n')) result += Ch('\\'), result += Ch('n'); - else if (*b == Ch('\r')) result += Ch('\\'), result += Ch('r'); - else if (*b == Ch('\t')) result += Ch('\\'), result += Ch('t'); - else if (*b == Ch('/')) result += Ch('\\'), result += Ch('/'); - else if (*b == Ch('"')) result += Ch('\\'), result += Ch('"'); - else if (*b == Ch('\\')) result += Ch('\\'), result += Ch('\\'); - else - { - const char *hexdigits = "0123456789ABCDEF"; - unsigned long u = (std::min)(static_cast<unsigned long>( - static_cast<UCh>(*b)), - 0xFFFFul); - unsigned long d1 = u / 4096; u -= d1 * 4096; - unsigned long d2 = u / 256; u -= d2 * 256; - unsigned long d3 = u / 16; u -= d3 * 16; - unsigned long d4 = u; - result += Ch('\\'); result += Ch('u'); - result += Ch(hexdigits[d1]); result += Ch(hexdigits[d2]); - result += Ch(hexdigits[d3]); result += Ch(hexdigits[d4]); - } - ++b; - } - return result; - } - - template<class Ptree> - void write_json_helper(std::basic_ostream<typename Ptree::key_type::value_type> &stream, - const Ptree &pt, - int indent, bool pretty) - { - - typedef typename Ptree::key_type::value_type Ch; - typedef typename std::basic_string<Ch> Str; - - // Value or object or array - if (indent > 0 && pt.empty()) - { - // Write value - Str data = create_escapes(pt.template get_value<Str>()); - stream << Ch('"') << data << Ch('"'); - - } - else if (indent > 0 && pt.count(Str()) == pt.size()) - { - // Write array - stream << Ch('['); - if (pretty) stream << Ch('\n'); - typename Ptree::const_iterator it = pt.begin(); - for (; it != pt.end(); ++it) - { - if (pretty) stream << Str(4 * (indent + 1), Ch(' ')); - write_json_helper(stream, it->second, indent + 1, pretty); - if (boost::next(it) != pt.end()) - stream << Ch(','); - if (pretty) stream << Ch('\n'); - } - if (pretty) stream << Str(4 * indent, Ch(' ')); - stream << Ch(']'); - - } - else - { - // Write object - stream << Ch('{'); - if (pretty) stream << Ch('\n'); - typename Ptree::const_iterator it = pt.begin(); - for (; it != pt.end(); ++it) - { - if (pretty) stream << Str(4 * (indent + 1), Ch(' ')); - stream << Ch('"') << create_escapes(it->first) << Ch('"') << Ch(':'); - if (pretty) stream << Ch(' '); - write_json_helper(stream, it->second, indent + 1, pretty); - if (boost::next(it) != pt.end()) - stream << Ch(','); - if (pretty) stream << Ch('\n'); - } - if (pretty) stream << Str(4 * indent, Ch(' ')); - stream << Ch('}'); - } - - } - - // Verify if ptree does not contain information that cannot be written to json - template<class Ptree> - bool verify_json(const Ptree &pt, int depth) - { - - typedef typename Ptree::key_type::value_type Ch; - typedef typename std::basic_string<Ch> Str; - - // Root ptree cannot have data - if (depth == 0 && !pt.template get_value<Str>().empty()) - return false; - - // Ptree cannot have both children and data - if (!pt.template get_value<Str>().empty() && !pt.empty()) - return false; - - // Check children - typename Ptree::const_iterator it = pt.begin(); - for (; it != pt.end(); ++it) - if (!verify_json(it->second, depth + 1)) - return false; - - // Success - return true; - - } - - // Write ptree to json stream - template<class Ptree> - void write_json_internal(std::basic_ostream<typename Ptree::key_type::value_type> &stream, - const Ptree &pt, - const std::string &filename, - bool pretty) - { - if (!verify_json(pt, 0)) - BOOST_PROPERTY_TREE_THROW(json_parser_error("ptree contains data that cannot be represented in JSON format", filename, 0)); - write_json_helper(stream, pt, 0, pretty); - stream << std::endl; - if (!stream.good()) - BOOST_PROPERTY_TREE_THROW(json_parser_error("write error", filename, 0)); - } - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/json_parser/error.hpp b/contrib/restricted/boost/boost/property_tree/json_parser/error.hpp deleted file mode 100644 index d48c72f090..0000000000 --- a/contrib/restricted/boost/boost/property_tree/json_parser/error.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_ERROR_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_DETAIL_JSON_PARSER_ERROR_HPP_INCLUDED - -#include <boost/property_tree/detail/file_parser_error.hpp> -#include <string> - -namespace boost { namespace property_tree { namespace json_parser -{ - - //! Json parser error - class json_parser_error: public file_parser_error - { - public: - json_parser_error(const std::string &message, - const std::string &filename, - unsigned long line): - file_parser_error(message, filename, line) - { - } - }; - -} } } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/ptree_serialization.hpp b/contrib/restricted/boost/boost/property_tree/ptree_serialization.hpp deleted file mode 100644 index a8181ca3b7..0000000000 --- a/contrib/restricted/boost/boost/property_tree/ptree_serialization.hpp +++ /dev/null @@ -1,129 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_PTREE_SERIALIZATION_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_PTREE_SERIALIZATION_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> - -#include <boost/serialization/nvp.hpp> -#include <boost/serialization/collections_save_imp.hpp> -#include <boost/serialization/detail/stack_constructor.hpp> -#include <boost/serialization/split_free.hpp> -#include <boost/serialization/utility.hpp> - -namespace boost { namespace property_tree -{ - - /////////////////////////////////////////////////////////////////////////// - // boost::serialization support - - /** - * Serialize the property tree to the given archive. - * @note In addition to serializing to regular archives, this supports - * serializing to archives requiring name-value pairs, e.g. XML - * archives. However, the output format in the XML archive is not - * guaranteed to be the same as that when using the Boost.PropertyTree - * library's @c boost::property_tree::xml_parser::write_xml. - * @param ar The archive to which to save the serialized property tree. - * This archive should conform to the concept laid out by the - * Boost.Serialization library. - * @param t The property tree to serialize. - * @param file_version file_version for the archive. - * @post @c ar will contain the serialized form of @c t. - */ - template<class Archive, class K, class D, class C> - inline void save(Archive &ar, - const basic_ptree<K, D, C> &t, - const unsigned int file_version) - { - using namespace boost::serialization; - stl::save_collection<Archive, basic_ptree<K, D, C> >(ar, t); - ar << make_nvp("data", t.data()); - } - - namespace detail - { - template <class Archive, class K, class D, class C> - inline void load_children(Archive &ar, - basic_ptree<K, D, C> &t) - { - namespace bsl = boost::serialization; - namespace bsa = boost::archive; - - typedef basic_ptree<K, D, C> tree; - typedef typename tree::value_type value_type; - - bsl::collection_size_type count; - ar >> BOOST_SERIALIZATION_NVP(count); - bsl::item_version_type item_version(0); - const bsa::library_version_type library_version( - ar.get_library_version() - ); - if(bsa::library_version_type(3) < library_version){ - ar >> BOOST_SERIALIZATION_NVP(item_version); - } - // Can't use the serialization helper, it expects resize() to exist - // for default-constructible elements. - // This is a copy/paste of the fallback version. - t.clear(); - while(count-- > 0){ - bsl::detail::stack_construct<Archive, value_type> - u(ar, item_version); - ar >> bsl::make_nvp("item", u.reference()); - t.push_back(u.reference()); - ar.reset_object_address(& t.back() , & u.reference()); - } - } - } - - /** - * De-serialize the property tree to the given archive. - * @note In addition to de-serializing from regular archives, this supports - * loading from archives requiring name-value pairs, e.g. XML - * archives. The format should be that used by - * boost::property_tree::save. - * @param ar The archive from which to load the serialized property tree. - * This archive should conform to the concept laid out by the - * Boost.Serialization library. - * @param t The property tree to de-serialize. - * @param file_version file_version for the archive. - * @post @c t will contain the de-serialized data from @c ar. - */ - template<class Archive, class K, class D, class C> - inline void load(Archive &ar, - basic_ptree<K, D, C> &t, - const unsigned int file_version) - { - namespace bsl = boost::serialization; - - detail::load_children(ar, t); - ar >> bsl::make_nvp("data", t.data()); - } - - /** - * Load or store the property tree using the given archive. - * @param ar The archive from which to load or save the serialized property - * tree. The type of this archive will determine whether saving or - * loading is performed. - * @param t The property tree to load or save. - * @param file_version file_version for the archive. - */ - template<class Archive, class K, class D, class C> - inline void serialize(Archive &ar, - basic_ptree<K, D, C> &t, - const unsigned int file_version) - { - using namespace boost::serialization; - split_free(ar, t, file_version); - } - -} } - -#endif diff --git a/contrib/restricted/boost/boost/property_tree/xml_parser.hpp b/contrib/restricted/boost/boost/property_tree/xml_parser.hpp deleted file mode 100644 index 0544c55544..0000000000 --- a/contrib/restricted/boost/boost/property_tree/xml_parser.hpp +++ /dev/null @@ -1,152 +0,0 @@ -// ---------------------------------------------------------------------------- -// Copyright (C) 2002-2006 Marcin Kalicinski -// Copyright (C) 2009 Sebastian Redl -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see www.boost.org -// ---------------------------------------------------------------------------- -#ifndef BOOST_PROPERTY_TREE_XML_PARSER_HPP_INCLUDED -#define BOOST_PROPERTY_TREE_XML_PARSER_HPP_INCLUDED - -#include <boost/property_tree/ptree.hpp> -#include <boost/property_tree/detail/xml_parser_write.hpp> -#include <boost/property_tree/detail/xml_parser_error.hpp> -#include <boost/property_tree/detail/xml_parser_writer_settings.hpp> -#include <boost/property_tree/detail/xml_parser_flags.hpp> -#include <boost/property_tree/detail/xml_parser_read_rapidxml.hpp> - -#include <fstream> -#include <string> -#include <locale> - -namespace boost { namespace property_tree { namespace xml_parser -{ - - /** - * Reads XML from an input stream and translates it to property tree. - * @note Clears existing contents of property tree. In case of error the - * property tree unmodified. - * @note XML attributes are placed under keys named @c \<xmlattr\>. - * @throw xml_parser_error In case of error deserializing the property tree. - * @param stream Stream from which to read in the property tree. - * @param[out] pt The property tree to populate. - * @param flags Flags controlling the behaviour of the parser. - * The following flags are supported: - * @li @c no_concat_text -- Prevents concatenation of text nodes into - * datastring of property tree. Puts them in - * separate @c \<xmltext\> strings instead. - * @li @c no_comments -- Skip XML comments. - * @li @c trim_whitespace -- Trim leading and trailing whitespace from text, - * and collapse sequences of whitespace. - */ - template<class Ptree> - void read_xml(std::basic_istream< - typename Ptree::key_type::value_type - > &stream, - Ptree &pt, - int flags = 0) - { - read_xml_internal(stream, pt, flags, std::string()); - } - - /** - * Reads XML from a file using the given locale and translates it to - * property tree. - * @note Clears existing contents of property tree. In case of error the - * property tree unmodified. - * @note XML attributes are placed under keys named @c \<xmlattr\>. - * @throw xml_parser_error In case of error deserializing the property tree. - * @param filename The file from which to read in the property tree. - * @param[out] pt The property tree to populate. - * @param flags Flags controlling the bahviour of the parser. - * The following flags are supported: - * @li @c no_concat_text -- Prevents concatenation of text nodes into - * datastring of property tree. Puts them in - * separate @c \<xmltext\> strings instead. - * @li @c no_comments -- Skip XML comments. - * @param loc The locale to use when reading in the file contents. - */ - template<class Ptree> - void read_xml(const std::string &filename, - Ptree &pt, - int flags = 0, - const std::locale &loc = std::locale()) - { - BOOST_ASSERT(validate_flags(flags)); - std::basic_ifstream<typename Ptree::key_type::value_type> - stream(filename.c_str()); - if (!stream) - BOOST_PROPERTY_TREE_THROW(xml_parser_error( - "cannot open file", filename, 0)); - stream.imbue(loc); - read_xml_internal(stream, pt, flags, filename); - } - - /** - * Translates the property tree to XML and writes it the given output - * stream. - * @throw xml_parser_error In case of error translating the property tree to - * XML or writing to the output stream. - * @param stream The stream to which to write the XML representation of the - * property tree. - * @param pt The property tree to tranlsate to XML and output. - * @param settings The settings to use when writing out the property tree as - * XML. - */ - template<class Ptree> - void write_xml(std::basic_ostream< - typename Ptree::key_type::value_type - > &stream, - const Ptree &pt, - const xml_writer_settings< - typename Ptree::key_type - > & settings = xml_writer_settings< - typename Ptree::key_type>() ) - { - write_xml_internal(stream, pt, std::string(), settings); - } - - /** - * Translates the property tree to XML and writes it the given file. - * @throw xml_parser_error In case of error translating the property tree to - * XML or writing to the output stream. - * @param filename The file to which to write the XML representation of the - * property tree. - * @param pt The property tree to tranlsate to XML and output. - * @param loc The locale to use when writing the output to file. - * @param settings The settings to use when writing out the property tree as - * XML. - */ - template<class Ptree> - void write_xml(const std::string &filename, - const Ptree &pt, - const std::locale &loc = std::locale(), - const xml_writer_settings< - typename Ptree::key_type - > & settings = xml_writer_settings<typename Ptree::key_type>()) - { - std::basic_ofstream<typename Ptree::key_type::value_type> - stream(filename.c_str()); - if (!stream) - BOOST_PROPERTY_TREE_THROW(xml_parser_error( - "cannot open file", filename, 0)); - stream.imbue(loc); - write_xml_internal(stream, pt, filename, settings); - } - -} } } - -namespace boost { namespace property_tree -{ - using xml_parser::read_xml; - using xml_parser::write_xml; - using xml_parser::xml_parser_error; - - using xml_parser::xml_writer_settings; - using xml_parser::xml_writer_make_settings; -} } - -#endif diff --git a/contrib/restricted/boost/boost/signals2.hpp b/contrib/restricted/boost/boost/signals2.hpp deleted file mode 100644 index 22b111981f..0000000000 --- a/contrib/restricted/boost/boost/signals2.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// A convenience header for Boost.Signals2, should pull in everying in the library. - -// Copyright (c) 2008-2009 Frank Mori Hess - -// Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_SIGNALS2_HPP -#define BOOST_SIGNALS2_HPP - -// For documentation, see http://www.boost.org/libs/signals2/ - -#include <boost/signals2/deconstruct.hpp> -#include <boost/signals2/deconstruct_ptr.hpp> -#include <boost/signals2/dummy_mutex.hpp> -#include <boost/signals2/last_value.hpp> -#include <boost/signals2/signal.hpp> -#include <boost/signals2/signal_type.hpp> -#include <boost/signals2/shared_connection_block.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/signals2/connection.hpp b/contrib/restricted/boost/boost/signals2/connection.hpp deleted file mode 100644 index dac806b221..0000000000 --- a/contrib/restricted/boost/boost/signals2/connection.hpp +++ /dev/null @@ -1,374 +0,0 @@ -/* - boost::signals2::connection provides a handle to a signal/slot connection. - - Author: Frank Mori Hess <fmhess@users.sourceforge.net> - Begin: 2007-01-23 -*/ -// Copyright Frank Mori Hess 2007-2008. -// Distributed under the 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/signals2 for library home page. - -#ifndef BOOST_SIGNALS2_CONNECTION_HPP -#define BOOST_SIGNALS2_CONNECTION_HPP - -#include <boost/function.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/signals2/detail/auto_buffer.hpp> -#include <boost/signals2/detail/null_output_iterator.hpp> -#include <boost/signals2/detail/unique_lock.hpp> -#include <boost/signals2/slot.hpp> -#include <boost/weak_ptr.hpp> - -namespace boost -{ - namespace signals2 - { - inline void null_deleter(const void*) {} - namespace detail - { - // This lock maintains a list of shared_ptr<void> - // which will be destroyed only after the lock - // has released its mutex. Used to garbage - // collect disconnected slots - template<typename Mutex> - class garbage_collecting_lock: public noncopyable - { - public: - garbage_collecting_lock(Mutex &m): - lock(m) - {} - void add_trash(const shared_ptr<void> &piece_of_trash) - { - garbage.push_back(piece_of_trash); - } - private: - // garbage must be declared before lock - // to insure it is destroyed after lock is - // destroyed. - auto_buffer<shared_ptr<void>, store_n_objects<10> > garbage; - unique_lock<Mutex> lock; - }; - - class connection_body_base - { - public: - connection_body_base(): - _connected(true), m_slot_refcount(1) - { - } - virtual ~connection_body_base() {} - void disconnect() - { - garbage_collecting_lock<connection_body_base> local_lock(*this); - nolock_disconnect(local_lock); - } - template<typename Mutex> - void nolock_disconnect(garbage_collecting_lock<Mutex> &lock_arg) const - { - if(_connected) - { - _connected = false; - dec_slot_refcount(lock_arg); - } - } - virtual bool connected() const = 0; - shared_ptr<void> get_blocker() - { - unique_lock<connection_body_base> local_lock(*this); - shared_ptr<void> blocker = _weak_blocker.lock(); - if(blocker == shared_ptr<void>()) - { - blocker.reset(this, &null_deleter); - _weak_blocker = blocker; - } - return blocker; - } - bool blocked() const - { - return !_weak_blocker.expired(); - } - bool nolock_nograb_blocked() const - { - return nolock_nograb_connected() == false || blocked(); - } - bool nolock_nograb_connected() const {return _connected;} - // expose part of Lockable concept of mutex - virtual void lock() = 0; - virtual void unlock() = 0; - - // Slot refcount should be incremented while - // a signal invocation is using the slot, in order - // to prevent slot from being destroyed mid-invocation. - // garbage_collecting_lock parameter enforces - // the existance of a lock before this - // method is called - template<typename Mutex> - void inc_slot_refcount(const garbage_collecting_lock<Mutex> &) - { - BOOST_ASSERT(m_slot_refcount != 0); - ++m_slot_refcount; - } - // if slot refcount decrements to zero due to this call, - // it puts a - // shared_ptr to the slot in the garbage collecting lock, - // which will destroy the slot only after it unlocks. - template<typename Mutex> - void dec_slot_refcount(garbage_collecting_lock<Mutex> &lock_arg) const - { - BOOST_ASSERT(m_slot_refcount != 0); - if(--m_slot_refcount == 0) - { - lock_arg.add_trash(release_slot()); - } - } - - protected: - virtual shared_ptr<void> release_slot() const = 0; - - weak_ptr<void> _weak_blocker; - private: - mutable bool _connected; - mutable unsigned m_slot_refcount; - }; - - template<typename GroupKey, typename SlotType, typename Mutex> - class connection_body: public connection_body_base - { - public: - typedef Mutex mutex_type; - connection_body(const SlotType &slot_in, const boost::shared_ptr<mutex_type> &signal_mutex): - m_slot(new SlotType(slot_in)), _mutex(signal_mutex) - { - } - virtual ~connection_body() {} - virtual bool connected() const - { - garbage_collecting_lock<mutex_type> local_lock(*_mutex); - nolock_grab_tracked_objects(local_lock, detail::null_output_iterator()); - return nolock_nograb_connected(); - } - const GroupKey& group_key() const {return _group_key;} - void set_group_key(const GroupKey &key) {_group_key = key;} - template<typename M> - void disconnect_expired_slot(garbage_collecting_lock<M> &lock_arg) - { - if(!m_slot) return; - bool expired = slot().expired(); - if(expired == true) - { - nolock_disconnect(lock_arg); - } - } - template<typename M, typename OutputIterator> - void nolock_grab_tracked_objects(garbage_collecting_lock<M> &lock_arg, - OutputIterator inserter) const - { - if(!m_slot) return; - slot_base::tracked_container_type::const_iterator it; - for(it = slot().tracked_objects().begin(); - it != slot().tracked_objects().end(); - ++it) - { - void_shared_ptr_variant locked_object - ( - apply_visitor - ( - detail::lock_weak_ptr_visitor(), - *it - ) - ); - if(apply_visitor(detail::expired_weak_ptr_visitor(), *it)) - { - nolock_disconnect(lock_arg); - return; - } - *inserter++ = locked_object; - } - } - // expose Lockable concept of mutex - virtual void lock() - { - _mutex->lock(); - } - virtual void unlock() - { - _mutex->unlock(); - } - SlotType &slot() - { - return *m_slot; - } - const SlotType &slot() const - { - return *m_slot; - } - protected: - virtual shared_ptr<void> release_slot() const - { - - shared_ptr<void> released_slot = m_slot; - m_slot.reset(); - return released_slot; - } - private: - mutable boost::shared_ptr<SlotType> m_slot; - const boost::shared_ptr<mutex_type> _mutex; - GroupKey _group_key; - }; - } - - class shared_connection_block; - - class connection - { - public: - friend class shared_connection_block; - - connection() {} - connection(const connection &other): _weak_connection_body(other._weak_connection_body) - {} - connection(const boost::weak_ptr<detail::connection_body_base> &connectionBody): - _weak_connection_body(connectionBody) - {} - - // move support -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - connection(connection && other): _weak_connection_body(std::move(other._weak_connection_body)) - { - // make sure other is reset, in case it is a scoped_connection (so it - // won't disconnect on destruction after being moved away from). - other._weak_connection_body.reset(); - } - connection & operator=(connection && other) - { - if(&other == this) return *this; - _weak_connection_body = std::move(other._weak_connection_body); - // make sure other is reset, in case it is a scoped_connection (so it - // won't disconnect on destruction after being moved away from). - other._weak_connection_body.reset(); - return *this; - } -#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - connection & operator=(const connection & other) - { - if(&other == this) return *this; - _weak_connection_body = other._weak_connection_body; - return *this; - } - - ~connection() {} - void disconnect() const - { - boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock()); - if(connectionBody == 0) return; - connectionBody->disconnect(); - } - bool connected() const - { - boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock()); - if(connectionBody == 0) return false; - return connectionBody->connected(); - } - bool blocked() const - { - boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock()); - if(connectionBody == 0) return true; - return connectionBody->blocked(); - } - bool operator==(const connection& other) const - { - boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock()); - boost::shared_ptr<detail::connection_body_base> otherConnectionBody(other._weak_connection_body.lock()); - return connectionBody == otherConnectionBody; - } - bool operator!=(const connection& other) const - { - return !(*this == other); - } - bool operator<(const connection& other) const - { - boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock()); - boost::shared_ptr<detail::connection_body_base> otherConnectionBody(other._weak_connection_body.lock()); - return connectionBody < otherConnectionBody; - } - void swap(connection &other) - { - using std::swap; - swap(_weak_connection_body, other._weak_connection_body); - } - protected: - - boost::weak_ptr<detail::connection_body_base> _weak_connection_body; - }; - inline void swap(connection &conn1, connection &conn2) - { - conn1.swap(conn2); - } - - class scoped_connection: public connection - { - public: - scoped_connection() {} - scoped_connection(const connection &other): - connection(other) - {} - ~scoped_connection() - { - disconnect(); - } - scoped_connection& operator=(const connection &rhs) - { - disconnect(); - connection::operator=(rhs); - return *this; - } - - // move support -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - scoped_connection(scoped_connection && other): connection(std::move(other)) - { - } - scoped_connection(connection && other): connection(std::move(other)) - { - } - scoped_connection & operator=(scoped_connection && other) - { - if(&other == this) return *this; - disconnect(); - connection::operator=(std::move(other)); - return *this; - } - scoped_connection & operator=(connection && other) - { - if(&other == this) return *this; - disconnect(); - connection::operator=(std::move(other)); - return *this; - } -#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - - connection release() - { - connection conn(_weak_connection_body); - _weak_connection_body.reset(); - return conn; - } - private: - scoped_connection(const scoped_connection &other); - scoped_connection& operator=(const scoped_connection &rhs); - }; - // Sun 5.9 compiler doesn't find the swap for base connection class when - // arguments are scoped_connection, so we provide this explicitly. - inline void swap(scoped_connection &conn1, scoped_connection &conn2) - { - conn1.swap(conn2); - } - } -} - -#endif // BOOST_SIGNALS2_CONNECTION_HPP diff --git a/contrib/restricted/boost/boost/signals2/deconstruct.hpp b/contrib/restricted/boost/boost/signals2/deconstruct.hpp deleted file mode 100644 index dd78d921ee..0000000000 --- a/contrib/restricted/boost/boost/signals2/deconstruct.hpp +++ /dev/null @@ -1,546 +0,0 @@ -#ifndef BOOST_SIGNALS2_DECONSTRUCT_HPP -#define BOOST_SIGNALS2_DECONSTRUCT_HPP - -// deconstruct.hpp -// -// A factory function for creating a shared_ptr which creates -// an object and its owning shared_ptr with one allocation, similar -// to make_shared<T>(). It also supports postconstructors -// and predestructors through unqualified calls of adl_postconstruct() and -// adl_predestruct, relying on argument-dependent -// lookup to find the appropriate postconstructor or predestructor. -// Passing arguments to postconstructors is also supported. -// -// based on make_shared.hpp and make_shared_access patch from Michael Marcin -// -// Copyright (c) 2007, 2008 Peter Dimov -// Copyright (c) 2008 Michael Marcin -// Copyright (c) 2009 Frank Mori Hess -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org -// for more information - -#include <boost/config.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/type_traits/alignment_of.hpp> -#include <boost/type_traits/remove_const.hpp> -#include <boost/type_traits/type_with_alignment.hpp> -#include <cstddef> -#include <new> - -namespace boost -{ - template<typename T> class enable_shared_from_this; - -namespace signals2 -{ - class deconstruct_access; - -namespace detail -{ - inline void adl_predestruct(...) {} -} // namespace detail - -template<typename T> - class postconstructor_invoker -{ -public: - operator const shared_ptr<T> & () const - { - return postconstruct(); - } - const shared_ptr<T>& postconstruct() const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get())); - _postconstructed = true; - } - return _sp; - } -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - template<class... Args> - const shared_ptr<T>& postconstruct(Args && ... args) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - std::forward<Args>(args)...); - _postconstructed = true; - } - return _sp; - } -#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - template<typename A1> - const shared_ptr<T>& postconstruct(const A1 &a1) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1); - _postconstructed = true; - } - return _sp; - } - template<typename A1, typename A2> - const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1, a2); - _postconstructed = true; - } - return _sp; - } - template<typename A1, typename A2, typename A3> - const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1, a2, a3); - _postconstructed = true; - } - return _sp; - } - template<typename A1, typename A2, typename A3, typename A4> - const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1, a2, a3, a4); - _postconstructed = true; - } - return _sp; - } - template<typename A1, typename A2, typename A3, typename A4, typename A5> - const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1, a2, a3, a4, a5); - _postconstructed = true; - } - return _sp; - } - template<typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6> - const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, - const A6 &a6) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1, a2, a3, a4, a5, a6); - _postconstructed = true; - } - return _sp; - } - template<typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename A7> - const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, - const A6 &a6, const A7 &a7) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1, a2, a3, a4, a5, a6, a7); - _postconstructed = true; - } - return _sp; - } - template<typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename A7, typename A8> - const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, - const A6 &a6, const A7 &a7, const A8 &a8) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1, a2, a3, a4, a5, a6, a7, a8); - _postconstructed = true; - } - return _sp; - } - template<typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename A7, typename A8, typename A9> - const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, - const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9) const - { - if(!_postconstructed) - { - adl_postconstruct(_sp, const_cast<typename boost::remove_const<T>::type *>(_sp.get()), - a1, a2, a3, a4, a5, a6, a7, a8, a9); - _postconstructed = true; - } - return _sp; - } -#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -private: - friend class boost::signals2::deconstruct_access; - postconstructor_invoker(const shared_ptr<T> & sp): - _sp(sp), _postconstructed(false) - {} - shared_ptr<T> _sp; - mutable bool _postconstructed; -}; - -namespace detail -{ - -template< std::size_t N, std::size_t A > struct sp_aligned_storage -{ - union type - { - char data_[ N ]; - typename boost::type_with_alignment< A >::type align_; - }; -}; - -template< class T > class deconstruct_deleter -{ -private: - - typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; - - bool initialized_; - storage_type storage_; - -private: - - void destroy() - { - if( initialized_ ) - { - T* p = reinterpret_cast< T* >( storage_.data_ ); - using boost::signals2::detail::adl_predestruct; - adl_predestruct(const_cast<typename boost::remove_const<T>::type *>(p)); - p->~T(); - initialized_ = false; - } - } - -public: - - deconstruct_deleter(): initialized_( false ) - { - } - - // this copy constructor is an optimization: we don't need to copy the storage_ member, - // and shouldn't be copying anyways after initialized_ becomes true - deconstruct_deleter(const deconstruct_deleter &): initialized_( false ) - { - } - - ~deconstruct_deleter() - { - destroy(); - } - - void operator()( T * ) - { - destroy(); - } - - void * address() - { - return storage_.data_; - } - - void set_initialized() - { - initialized_ = true; - } -}; -} // namespace detail - -class deconstruct_access -{ -public: - - template< class T > - static postconstructor_invoker<T> deconstruct() - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T(); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - - } - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - - // Variadic templates, rvalue reference - - template< class T, class... Args > - static postconstructor_invoker<T> deconstruct( Args && ... args ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( std::forward<Args>( args )... ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - -#else - - template< class T, class A1 > - static postconstructor_invoker<T> deconstruct( A1 const & a1 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - - template< class T, class A1, class A2 > - static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1, a2 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - - template< class T, class A1, class A2, class A3 > - static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1, a2, a3 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - - template< class T, class A1, class A2, class A3, class A4 > - static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1, a2, a3, a4 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - - template< class T, class A1, class A2, class A3, class A4, class A5 > - static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1, a2, a3, a4, a5 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - - template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > - static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1, a2, a3, a4, a5, a6 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - - template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > - static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1, a2, a3, a4, a5, a6, a7 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - - template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > - static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - - template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > - static postconstructor_invoker<T> deconstruct( 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 ) - { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() ); - - detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt ); - - void * pv = pd->address(); - - new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); - pd->set_initialized(); - - boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) ); - boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get()); - return retval; - } - -#endif -}; - -// Zero-argument versions -// -// Used even when variadic templates are available because of the new T() vs new T issue - -template< class T > postconstructor_invoker<T> deconstruct() -{ - return deconstruct_access::deconstruct<T>(); -} - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - -// Variadic templates, rvalue reference - -template< class T, class... Args > postconstructor_invoker< T > deconstruct( Args && ... args ) -{ - return deconstruct_access::deconstruct<T>( std::forward<Args>( args )... ); -} - -#else - -// C++03 version - -template< class T, class A1 > -postconstructor_invoker<T> deconstruct( A1 const & a1 ) -{ - return deconstruct_access::deconstruct<T>(a1); -} - -template< class T, class A1, class A2 > -postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2 ) -{ - return deconstruct_access::deconstruct<T>(a1,a2); -} - -template< class T, class A1, class A2, class A3 > -postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3 ) -{ - return deconstruct_access::deconstruct<T>(a1,a2,a3); -} - -template< class T, class A1, class A2, class A3, class A4 > -postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 ) -{ - return deconstruct_access::deconstruct<T>(a1,a2,a3,a4); -} - -template< class T, class A1, class A2, class A3, class A4, class A5 > -postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 ) -{ - return deconstruct_access::deconstruct<T>(a1,a2,a3,a4,a5); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > -postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 ) -{ - return deconstruct_access::deconstruct<T>(a1,a2,a3,a4,a5,a6); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > -postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 ) -{ - return deconstruct_access::deconstruct<T>(a1,a2,a3,a4,a5,a6,a7); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > -postconstructor_invoker<T> deconstruct( 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 deconstruct_access::deconstruct<T>(a1,a2,a3,a4,a5,a6,a7,a8); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > -postconstructor_invoker<T> deconstruct( 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 deconstruct_access::deconstruct<T>(a1,a2,a3,a4,a5,a6,a7,a8,a9); -} - -#endif - -} // namespace signals2 -} // namespace boost - -#endif // #ifndef BOOST_SIGNALS2_DECONSTRUCT_HPP diff --git a/contrib/restricted/boost/boost/signals2/deconstruct_ptr.hpp b/contrib/restricted/boost/boost/signals2/deconstruct_ptr.hpp deleted file mode 100644 index 6c3611be7d..0000000000 --- a/contrib/restricted/boost/boost/signals2/deconstruct_ptr.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// DEPRECATED in favor of adl_postconstruct and adl_predestruct with -// deconstruct<T>(). -// A factory function for creating a shared_ptr that enhances the plain -// shared_ptr constructors by adding support for postconstructors -// and predestructors through the boost::signals2::postconstructible and -// boost::signals2::predestructible base classes. -// -// Copyright Frank Mori Hess 2007-2008. -// -// Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_SIGNALS2_DECONSTRUCT_PTR_HPP -#define BOOST_SIGNALS2_DECONSTRUCT_PTR_HPP - -#include <boost/assert.hpp> -#include <boost/checked_delete.hpp> -#include <boost/core/no_exceptions_support.hpp> -#include <boost/signals2/postconstructible.hpp> -#include <boost/signals2/predestructible.hpp> -#include <boost/shared_ptr.hpp> - -namespace boost -{ - namespace signals2 - { - namespace detail - { - inline void do_postconstruct(const postconstructible *ptr) - { - postconstructible *nonconst_ptr = const_cast<postconstructible*>(ptr); - nonconst_ptr->postconstruct(); - } - inline void do_postconstruct(...) - { - } - inline void do_predestruct(...) - { - } - inline void do_predestruct(const predestructible *ptr) - { - BOOST_TRY - { - predestructible *nonconst_ptr = const_cast<predestructible*>(ptr); - nonconst_ptr->predestruct(); - } - BOOST_CATCH(...) - { - BOOST_ASSERT(false); - } - BOOST_CATCH_END - } - } - - template<typename T> class predestructing_deleter - { - public: - void operator()(const T *ptr) const - { - detail::do_predestruct(ptr); - checked_delete(ptr); - } - }; - - template<typename T> - shared_ptr<T> deconstruct_ptr(T *ptr) - { - if(ptr == 0) return shared_ptr<T>(ptr); - shared_ptr<T> shared(ptr, boost::signals2::predestructing_deleter<T>()); - detail::do_postconstruct(ptr); - return shared; - } - template<typename T, typename D> - shared_ptr<T> deconstruct_ptr(T *ptr, D deleter) - { - shared_ptr<T> shared(ptr, deleter); - if(ptr == 0) return shared; - detail::do_postconstruct(ptr); - return shared; - } - } -} - -#endif // BOOST_SIGNALS2_DECONSTRUCT_PTR_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/auto_buffer.hpp b/contrib/restricted/boost/boost/signals2/detail/auto_buffer.hpp deleted file mode 100644 index 5ff8dd2c63..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/auto_buffer.hpp +++ /dev/null @@ -1,1142 +0,0 @@ -// Copyright Thorsten Ottosen, 2009. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_SIGNALS2_DETAIL_AUTO_BUFFER_HPP_25_02_2009 -#define BOOST_SIGNALS2_DETAIL_AUTO_BUFFER_HPP_25_02_2009 - -#include <boost/detail/workaround.hpp> - -#if defined(_MSC_VER) -# pragma once -#endif - -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) -#pragma warning(push) -#pragma warning(disable:4996) -#endif - -#include <boost/assert.hpp> -#include <boost/iterator/reverse_iterator.hpp> -#include <boost/iterator/iterator_traits.hpp> -#include <boost/mpl/if.hpp> -#include <boost/multi_index/detail/scope_guard.hpp> -#include <boost/swap.hpp> -#include <boost/type_traits/aligned_storage.hpp> -#include <boost/type_traits/alignment_of.hpp> -#include <boost/type_traits/has_nothrow_copy.hpp> -#include <boost/type_traits/has_nothrow_assign.hpp> -#include <boost/type_traits/has_trivial_assign.hpp> -#include <boost/type_traits/has_trivial_constructor.hpp> -#include <boost/type_traits/has_trivial_destructor.hpp> -#include <algorithm> -#include <cstring> -#include <iterator> -#include <memory> -#include <stdexcept> - -namespace boost -{ -namespace signals2 -{ -namespace detail -{ - // - // Policies for creating the stack buffer. - // - template< unsigned N > - struct store_n_objects - { - BOOST_STATIC_CONSTANT( unsigned, value = N ); - }; - - template< unsigned N > - struct store_n_bytes - { - BOOST_STATIC_CONSTANT( unsigned, value = N ); - }; - - namespace auto_buffer_detail - { - template< class Policy, class T > - struct compute_buffer_size - { - BOOST_STATIC_CONSTANT( unsigned, value = Policy::value * sizeof(T) ); - }; - - template< unsigned N, class T > - struct compute_buffer_size< store_n_bytes<N>, T > - { - BOOST_STATIC_CONSTANT( unsigned, value = N ); - }; - - template< class Policy, class T > - struct compute_buffer_objects - { - BOOST_STATIC_CONSTANT( unsigned, value = Policy::value ); - }; - - template< unsigned N, class T > - struct compute_buffer_objects< store_n_bytes<N>, T > - { - BOOST_STATIC_CONSTANT( unsigned, value = N / sizeof(T) ); - }; - } - - struct default_grow_policy - { - template< class SizeType > - static SizeType new_capacity( SizeType capacity ) - { - // - // @remark: we grow the capacity quite agressively. - // this is justified since we aim to minimize - // heap-allocations, and because we mostly use - // the buffer locally. - return capacity * 4u; - } - - template< class SizeType > - static bool should_shrink( SizeType, SizeType ) - { - // - // @remark: when defining a new grow policy, one might - // choose that if the waated space is less - // than a certain percentage, then it is of - // little use to shrink. - // - return true; - } - }; - - template< class T, - class StackBufferPolicy = store_n_objects<256>, - class GrowPolicy = default_grow_policy, - class Allocator = std::allocator<T> > - class auto_buffer; - - - - template - < - class T, - class StackBufferPolicy, - class GrowPolicy, - class Allocator - > - class auto_buffer : Allocator - { - private: - enum { N = auto_buffer_detail:: - compute_buffer_objects<StackBufferPolicy,T>::value }; - - BOOST_STATIC_CONSTANT( bool, is_stack_buffer_empty = N == 0u ); - - typedef auto_buffer<T, store_n_objects<0>, GrowPolicy, Allocator> - local_buffer; - - public: - typedef Allocator allocator_type; - typedef T value_type; - typedef typename Allocator::size_type size_type; - typedef typename Allocator::difference_type difference_type; - typedef T* pointer; - typedef typename Allocator::pointer allocator_pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef pointer iterator; - typedef const_pointer const_iterator; - typedef boost::reverse_iterator<iterator> reverse_iterator; - typedef boost::reverse_iterator<const_iterator> const_reverse_iterator; - typedef typename boost::mpl::if_c< boost::has_trivial_assign<T>::value - && sizeof(T) <= sizeof(long double), - const value_type, - const_reference >::type - optimized_const_reference; - private: - - pointer allocate( size_type capacity_arg ) - { - if( capacity_arg > N ) - return &*get_allocator().allocate( capacity_arg ); - else - return static_cast<T*>( members_.address() ); - } - - void deallocate( pointer where, size_type capacity_arg ) - { - if( capacity_arg <= N ) - return; - get_allocator().deallocate( allocator_pointer(where), capacity_arg ); - } - - template< class I > - static void copy_impl( I begin, I end, pointer where, std::random_access_iterator_tag ) - { - copy_rai( begin, end, where, boost::has_trivial_assign<T>() ); - } - - static void copy_rai( const T* begin, const T* end, - pointer where, const boost::true_type& ) - { - std::memcpy( where, begin, sizeof(T) * std::distance(begin,end) ); - } - - template< class I, bool b > - static void copy_rai( I begin, I end, - pointer where, const boost::integral_constant<bool, b>& ) - { - std::uninitialized_copy( begin, end, where ); - } - - template< class I > - static void copy_impl( I begin, I end, pointer where, std::bidirectional_iterator_tag ) - { - std::uninitialized_copy( begin, end, where ); - } - - template< class I > - static void copy_impl( I begin, I end, pointer where ) - { - copy_impl( begin, end, where, - typename std::iterator_traits<I>::iterator_category() ); - } - - template< class I, class I2 > - static void assign_impl( I begin, I end, I2 where ) - { - assign_impl( begin, end, where, boost::has_trivial_assign<T>() ); - } - - template< class I, class I2 > - static void assign_impl( I begin, I end, I2 where, const boost::true_type& ) - { - std::memcpy( where, begin, sizeof(T) * std::distance(begin,end) ); - } - - template< class I, class I2 > - static void assign_impl( I begin, I end, I2 where, const boost::false_type& ) - { - for( ; begin != end; ++begin, ++where ) - *where = *begin; - } - - void unchecked_push_back_n( size_type n, const boost::true_type& ) - { - std::uninitialized_fill( end(), end() + n, T() ); - size_ += n; - } - - void unchecked_push_back_n( size_type n, const boost::false_type& ) - { - for( size_type i = 0u; i < n; ++i ) - unchecked_push_back(); - } - - void auto_buffer_destroy( pointer where, const boost::false_type& ) - { - (*where).~T(); - } - - void auto_buffer_destroy( pointer, const boost::true_type& ) - { } - - void auto_buffer_destroy( pointer where ) - { - auto_buffer_destroy( where, boost::has_trivial_destructor<T>() ); - } - - void auto_buffer_destroy() - { - BOOST_ASSERT( is_valid() ); - if( buffer_ ) // do we need this check? Yes, but only - // for N = 0u + local instances in one_sided_swap() - auto_buffer_destroy( boost::has_trivial_destructor<T>() ); - } - - void destroy_back_n( size_type n, const boost::false_type& ) - { - BOOST_ASSERT( n > 0 ); - pointer buffer = buffer_ + size_ - 1u; - pointer new_end = buffer - n; - for( ; buffer > new_end; --buffer ) - auto_buffer_destroy( buffer ); - } - - void destroy_back_n( size_type, const boost::true_type& ) - { } - - void destroy_back_n( size_type n ) - { - destroy_back_n( n, boost::has_trivial_destructor<T>() ); - } - - void auto_buffer_destroy( const boost::false_type& x ) - { - if( size_ ) - destroy_back_n( size_, x ); - deallocate( buffer_, members_.capacity_ ); - } - - void auto_buffer_destroy( const boost::true_type& ) - { - deallocate( buffer_, members_.capacity_ ); - } - - pointer move_to_new_buffer( size_type new_capacity, const boost::false_type& ) - { - pointer new_buffer = allocate( new_capacity ); // strong - boost::multi_index::detail::scope_guard guard = - boost::multi_index::detail::make_obj_guard( *this, - &auto_buffer::deallocate, - new_buffer, - new_capacity ); - copy_impl( begin(), end(), new_buffer ); // strong - guard.dismiss(); // nothrow - return new_buffer; - } - - pointer move_to_new_buffer( size_type new_capacity, const boost::true_type& ) - { - pointer new_buffer = allocate( new_capacity ); // strong - copy_impl( begin(), end(), new_buffer ); // nothrow - return new_buffer; - } - - void reserve_impl( size_type new_capacity ) - { - pointer new_buffer = move_to_new_buffer( new_capacity, - boost::has_nothrow_copy<T>() ); - auto_buffer_destroy(); - buffer_ = new_buffer; - members_.capacity_ = new_capacity; - BOOST_ASSERT( size_ <= members_.capacity_ ); - } - - size_type new_capacity_impl( size_type n ) - { - BOOST_ASSERT( n > members_.capacity_ ); - size_type new_capacity = GrowPolicy::new_capacity( members_.capacity_ ); - // @todo: consider to check for allocator.max_size() - return (std::max)(new_capacity,n); - } - - static void swap_helper( auto_buffer& l, auto_buffer& r, - const boost::true_type& ) - { - BOOST_ASSERT( l.is_on_stack() && r.is_on_stack() ); - - auto_buffer temp( l.begin(), l.end() ); - assign_impl( r.begin(), r.end(), l.begin() ); - assign_impl( temp.begin(), temp.end(), r.begin() ); - boost::swap( l.size_, r.size_ ); - boost::swap( l.members_.capacity_, r.members_.capacity_ ); - } - - static void swap_helper( auto_buffer& l, auto_buffer& r, - const boost::false_type& ) - { - BOOST_ASSERT( l.is_on_stack() && r.is_on_stack() ); - size_type min_size = (std::min)(l.size_,r.size_); - size_type max_size = (std::max)(l.size_,r.size_); - size_type diff = max_size - min_size; - auto_buffer* smallest = l.size_ == min_size ? &l : &r; - auto_buffer* largest = smallest == &l ? &r : &l; - - // @remark: the implementation below is not as fast - // as it could be if we assumed T had a default - // constructor. - - size_type i = 0u; - for( ; i < min_size; ++i ) - boost::swap( (*smallest)[i], (*largest)[i] ); - - for( ; i < max_size; ++i ) - smallest->unchecked_push_back( (*largest)[i] ); - - largest->pop_back_n( diff ); - boost::swap( l.members_.capacity_, r.members_.capacity_ ); - } - - void one_sided_swap( auto_buffer& temp ) // nothrow - { - BOOST_ASSERT( !temp.is_on_stack() ); - auto_buffer_destroy(); - // @remark: must be nothrow - get_allocator() = temp.get_allocator(); - members_.capacity_ = temp.members_.capacity_; - buffer_ = temp.buffer_; - BOOST_ASSERT( temp.size_ >= size_ + 1u ); - size_ = temp.size_; - temp.buffer_ = 0; - BOOST_ASSERT( temp.is_valid() ); - } - - template< class I > - void insert_impl( const_iterator before, I begin_arg, I end_arg, - std::input_iterator_tag ) - { - for( ; begin_arg != end_arg; ++begin_arg ) - { - before = insert( before, *begin_arg ); - ++before; - } - } - - void grow_back( size_type n, const boost::true_type& ) - { - BOOST_ASSERT( size_ + n <= members_.capacity_ ); - size_ += n; - } - - void grow_back( size_type n, const boost::false_type& ) - { - unchecked_push_back_n(n); - } - - void grow_back( size_type n ) - { - grow_back( n, boost::has_trivial_constructor<T>() ); - } - - void grow_back_one( const boost::true_type& ) - { - BOOST_ASSERT( size_ + 1 <= members_.capacity_ ); - size_ += 1; - } - - void grow_back_one( const boost::false_type& ) - { - unchecked_push_back(); - } - - void grow_back_one() - { - grow_back_one( boost::has_trivial_constructor<T>() ); - } - - template< class I > - void insert_impl( const_iterator before, I begin_arg, I end_arg, - std::forward_iterator_tag ) - { - difference_type n = std::distance(begin_arg, end_arg); - - if( size_ + n <= members_.capacity_ ) - { - bool is_back_insertion = before == cend(); - if( !is_back_insertion ) - { - grow_back( n ); - iterator where = const_cast<T*>(before); - std::copy( before, cend() - n, where + n ); - assign_impl( begin_arg, end_arg, where ); - } - else - { - unchecked_push_back( begin_arg, end_arg ); - } - BOOST_ASSERT( is_valid() ); - return; - } - - auto_buffer temp( new_capacity_impl( size_ + n ) ); - temp.unchecked_push_back( cbegin(), before ); - temp.unchecked_push_back( begin_arg, end_arg ); - temp.unchecked_push_back( before, cend() ); - one_sided_swap( temp ); - BOOST_ASSERT( is_valid() ); - } - - public: - bool is_valid() const // invariant - { - // @remark: allowed for N==0 and when - // using a locally instance - // in insert()/one_sided_swap() - if( buffer_ == 0 ) - return true; - - if( members_.capacity_ < N ) - return false; - - if( !is_on_stack() && members_.capacity_ <= N ) - return false; - - if( buffer_ == members_.address() ) - if( members_.capacity_ > N ) - return false; - - if( size_ > members_.capacity_ ) - return false; - - return true; - } - - auto_buffer() - : members_( N ), - buffer_( static_cast<T*>(members_.address()) ), - size_( 0u ) - { - BOOST_ASSERT( is_valid() ); - } - - auto_buffer( const auto_buffer& r ) - : members_( (std::max)(r.size_,size_type(N)) ), - buffer_( allocate( members_.capacity_ ) ), - size_( 0 ) - { - copy_impl( r.begin(), r.end(), buffer_ ); - size_ = r.size_; - BOOST_ASSERT( is_valid() ); - } - - auto_buffer& operator=( const auto_buffer& r ) // basic - { - if( this == &r ) - return *this; - - difference_type diff = size_ - r.size_; - if( diff >= 0 ) - { - pop_back_n( static_cast<size_type>(diff) ); - assign_impl( r.begin(), r.end(), begin() ); - } - else - { - if( members_.capacity_ >= r.size() ) - { - unchecked_push_back_n( static_cast<size_type>(-diff) ); - assign_impl( r.begin(), r.end(), begin() ); - } - else - { - // @remark: we release memory as early as possible - // since we only give the basic guarantee - auto_buffer_destroy(); - buffer_ = 0; - pointer new_buffer = allocate( r.size() ); - boost::multi_index::detail::scope_guard guard = - boost::multi_index::detail::make_obj_guard( *this, - &auto_buffer::deallocate, - new_buffer, - r.size() ); - copy_impl( r.begin(), r.end(), new_buffer ); - guard.dismiss(); - buffer_ = new_buffer; - members_.capacity_ = r.size(); - size_ = members_.capacity_; - } - } - - BOOST_ASSERT( size() == r.size() ); - BOOST_ASSERT( is_valid() ); - return *this; - } - - explicit auto_buffer( size_type capacity_arg ) - : members_( (std::max)(capacity_arg, size_type(N)) ), - buffer_( allocate(members_.capacity_) ), - size_( 0 ) - { - BOOST_ASSERT( is_valid() ); - } - - auto_buffer( size_type size_arg, optimized_const_reference init_value ) - : members_( (std::max)(size_arg, size_type(N)) ), - buffer_( allocate(members_.capacity_) ), - size_( 0 ) - { - std::uninitialized_fill( buffer_, buffer_ + size_arg, init_value ); - size_ = size_arg; - BOOST_ASSERT( is_valid() ); - } - - auto_buffer( size_type capacity_arg, const allocator_type& a ) - : allocator_type( a ), - members_( (std::max)(capacity_arg, size_type(N)) ), - buffer_( allocate(members_.capacity_) ), - size_( 0 ) - { - BOOST_ASSERT( is_valid() ); - } - - auto_buffer( size_type size_arg, optimized_const_reference init_value, - const allocator_type& a ) - : allocator_type( a ), - members_( (std::max)(size_arg, size_type(N)) ), - buffer_( allocate(members_.capacity_) ), - size_( 0 ) - { - std::uninitialized_fill( buffer_, buffer_ + size_arg, init_value ); - size_ = size_arg; - BOOST_ASSERT( is_valid() ); - } - - template< class ForwardIterator > - auto_buffer( ForwardIterator begin_arg, ForwardIterator end_arg ) - : - members_( std::distance(begin_arg, end_arg) ), - buffer_( allocate(members_.capacity_) ), - size_( 0 ) - { - copy_impl( begin_arg, end_arg, buffer_ ); - size_ = members_.capacity_; - if( members_.capacity_ < N ) - members_.capacity_ = N; - BOOST_ASSERT( is_valid() ); - } - - template< class ForwardIterator > - auto_buffer( ForwardIterator begin_arg, ForwardIterator end_arg, - const allocator_type& a ) - : allocator_type( a ), - members_( std::distance(begin_arg, end_arg) ), - buffer_( allocate(members_.capacity_) ), - size_( 0 ) - { - copy_impl( begin_arg, end_arg, buffer_ ); - size_ = members_.capacity_; - if( members_.capacity_ < N ) - members_.capacity_ = N; - BOOST_ASSERT( is_valid() ); - } - - ~auto_buffer() - { - auto_buffer_destroy(); - } - - public: - bool empty() const - { - return size_ == 0; - } - - bool full() const - { - return size_ == members_.capacity_; - } - - bool is_on_stack() const - { - return members_.capacity_ <= N; - } - - size_type size() const - { - return size_; - } - - size_type capacity() const - { - return members_.capacity_; - } - - public: - pointer data() - { - return buffer_; - } - - const_pointer data() const - { - return buffer_; - } - - allocator_type& get_allocator() - { - return static_cast<allocator_type&>(*this); - } - - const allocator_type& get_allocator() const - { - return static_cast<const allocator_type&>(*this); - } - - public: - iterator begin() - { - return buffer_; - } - - const_iterator begin() const - { - return buffer_; - } - - iterator end() - { - return buffer_ + size_; - } - - const_iterator end() const - { - return buffer_ + size_; - } - - reverse_iterator rbegin() - { - return reverse_iterator(end()); - } - - const_reverse_iterator rbegin() const - { - return const_reverse_iterator(end()); - } - - reverse_iterator rend() - { - return reverse_iterator(begin()); - } - - const_reverse_iterator rend() const - { - return const_reverse_iterator(begin()); - } - - const_iterator cbegin() const - { - return const_cast<const auto_buffer*>(this)->begin(); - } - - const_iterator cend() const - { - return const_cast<const auto_buffer*>(this)->end(); - } - - const_reverse_iterator crbegin() const - { - return const_cast<const auto_buffer*>(this)->rbegin(); - } - - const_reverse_iterator crend() const - { - return const_cast<const auto_buffer*>(this)->rend(); - } - - public: - reference front() - { - return buffer_[0]; - } - - optimized_const_reference front() const - { - return buffer_[0]; - } - - reference back() - { - return buffer_[size_-1]; - } - - optimized_const_reference back() const - { - return buffer_[size_-1]; - } - - reference operator[]( size_type n ) - { - BOOST_ASSERT( n < size_ ); - return buffer_[n]; - } - - optimized_const_reference operator[]( size_type n ) const - { - BOOST_ASSERT( n < size_ ); - return buffer_[n]; - } - - void unchecked_push_back() - { - BOOST_ASSERT( !full() ); - new (buffer_ + size_) T; - ++size_; - } - - void unchecked_push_back_n( size_type n ) - { - BOOST_ASSERT( size_ + n <= members_.capacity_ ); - unchecked_push_back_n( n, boost::has_trivial_assign<T>() ); - } - - void unchecked_push_back( optimized_const_reference x ) // non-growing - { - BOOST_ASSERT( !full() ); - new (buffer_ + size_) T( x ); - ++size_; - } - - template< class ForwardIterator > - void unchecked_push_back( ForwardIterator begin_arg, - ForwardIterator end_arg ) // non-growing - { - BOOST_ASSERT( size_ + std::distance(begin_arg, end_arg) <= members_.capacity_ ); - copy_impl( begin_arg, end_arg, buffer_ + size_ ); - size_ += std::distance(begin_arg, end_arg); - } - - void reserve_precisely( size_type n ) - { - BOOST_ASSERT( members_.capacity_ >= N ); - - if( n <= members_.capacity_ ) - return; - reserve_impl( n ); - BOOST_ASSERT( members_.capacity_ == n ); - } - - void reserve( size_type n ) // strong - { - BOOST_ASSERT( members_.capacity_ >= N ); - - if( n <= members_.capacity_ ) - return; - - reserve_impl( new_capacity_impl( n ) ); - BOOST_ASSERT( members_.capacity_ >= n ); - } - - void push_back() - { - if( size_ != members_.capacity_ ) - { - unchecked_push_back(); - } - else - { - reserve( size_ + 1u ); - unchecked_push_back(); - } - } - - void push_back( optimized_const_reference x ) - { - if( size_ != members_.capacity_ ) - { - unchecked_push_back( x ); - } - else - { - reserve( size_ + 1u ); - unchecked_push_back( x ); - } - } - - template< class ForwardIterator > - void push_back( ForwardIterator begin_arg, ForwardIterator end_arg ) - { - difference_type diff = std::distance(begin_arg, end_arg); - if( size_ + diff > members_.capacity_ ) - reserve( size_ + diff ); - unchecked_push_back( begin_arg, end_arg ); - } - - iterator insert( const_iterator before, optimized_const_reference x ) // basic - { - // @todo: consider if we want to support x in 'this' - if( size_ < members_.capacity_ ) - { - bool is_back_insertion = before == cend(); - iterator where = const_cast<T*>(before); - - if( !is_back_insertion ) - { - grow_back_one(); - std::copy( before, cend() - 1u, where + 1u ); - *where = x; - BOOST_ASSERT( is_valid() ); - } - else - { - unchecked_push_back( x ); - } - return where; - } - - auto_buffer temp( new_capacity_impl( size_ + 1u ) ); - temp.unchecked_push_back( cbegin(), before ); - iterator result = temp.end(); - temp.unchecked_push_back( x ); - temp.unchecked_push_back( before, cend() ); - one_sided_swap( temp ); - BOOST_ASSERT( is_valid() ); - return result; - } - - void insert( const_iterator before, size_type n, - optimized_const_reference x ) - { - // @todo: see problems above - if( size_ + n <= members_.capacity_ ) - { - grow_back( n ); - iterator where = const_cast<T*>(before); - std::copy( before, cend() - n, where + n ); - std::fill( where, where + n, x ); - BOOST_ASSERT( is_valid() ); - return; - } - - auto_buffer temp( new_capacity_impl( size_ + n ) ); - temp.unchecked_push_back( cbegin(), before ); - std::uninitialized_fill_n( temp.end(), n, x ); - temp.size_ += n; - temp.unchecked_push_back( before, cend() ); - one_sided_swap( temp ); - BOOST_ASSERT( is_valid() ); - } - - template< class ForwardIterator > - void insert( const_iterator before, - ForwardIterator begin_arg, ForwardIterator end_arg ) // basic - { - typedef typename std::iterator_traits<ForwardIterator> - ::iterator_category category; - insert_impl( before, begin_arg, end_arg, category() ); - } - - void pop_back() - { - BOOST_ASSERT( !empty() ); - auto_buffer_destroy( buffer_ + size_ - 1, boost::has_trivial_destructor<T>() ); - --size_; - } - - void pop_back_n( size_type n ) - { - BOOST_ASSERT( n <= size_ ); - if( n ) - { - destroy_back_n( n ); - size_ -= n; - } - } - - void clear() - { - pop_back_n( size_ ); - } - - iterator erase( const_iterator where ) - { - BOOST_ASSERT( !empty() ); - BOOST_ASSERT( cbegin() <= where ); - BOOST_ASSERT( cend() > where ); - - unsigned elements = cend() - where - 1u; - - if( elements > 0u ) - { - const_iterator start = where + 1u; - std::copy( start, start + elements, - const_cast<T*>(where) ); - } - pop_back(); - BOOST_ASSERT( !full() ); - iterator result = const_cast<T*>( where ); - BOOST_ASSERT( result <= end() ); - return result; - } - - iterator erase( const_iterator from, const_iterator to ) - { - BOOST_ASSERT( !(std::distance(from,to)>0) || - !empty() ); - BOOST_ASSERT( cbegin() <= from ); - BOOST_ASSERT( cend() >= to ); - - unsigned elements = std::distance(to,cend()); - - if( elements > 0u ) - { - BOOST_ASSERT( elements > 0u ); - std::copy( to, to + elements, - const_cast<T*>(from) ); - } - pop_back_n( std::distance(from,to) ); - BOOST_ASSERT( !full() ); - iterator result = const_cast<T*>( from ); - BOOST_ASSERT( result <= end() ); - return result; - } - - void shrink_to_fit() - { - if( is_on_stack() || !GrowPolicy::should_shrink(size_,members_.capacity_) ) - return; - - reserve_impl( size_ ); - members_.capacity_ = (std::max)(size_type(N),members_.capacity_); - BOOST_ASSERT( is_on_stack() || size_ == members_.capacity_ ); - BOOST_ASSERT( !is_on_stack() || size_ <= members_.capacity_ ); - } - - pointer uninitialized_grow( size_type n ) // strong - { - if( size_ + n > members_.capacity_ ) - reserve( size_ + n ); - - pointer res = end(); - size_ += n; - return res; - } - - void uninitialized_shrink( size_type n ) // nothrow - { - // @remark: test for wrap-around - BOOST_ASSERT( size_ - n <= members_.capacity_ ); - size_ -= n; - } - - void uninitialized_resize( size_type n ) - { - if( n > size() ) - uninitialized_grow( n - size() ); - else if( n < size() ) - uninitialized_shrink( size() - n ); - - BOOST_ASSERT( size() == n ); - } - - // nothrow - if both buffer are on the heap, or - // - if one buffer is on the heap and one has - // 'has_allocated_buffer() == false', or - // - if copy-construction cannot throw - // basic - otherwise (better guarantee impossible) - // requirement: the allocator must be no-throw-swappable - void swap( auto_buffer& r ) - { - bool on_stack = is_on_stack(); - bool r_on_stack = r.is_on_stack(); - bool both_on_heap = !on_stack && !r_on_stack; - if( both_on_heap ) - { - boost::swap( get_allocator(), r.get_allocator() ); - boost::swap( members_.capacity_, r.members_.capacity_ ); - boost::swap( buffer_, r.buffer_ ); - boost::swap( size_, r.size_ ); - BOOST_ASSERT( is_valid() ); - BOOST_ASSERT( r.is_valid() ); - return; - } - - BOOST_ASSERT( on_stack || r_on_stack ); - bool exactly_one_on_stack = (on_stack && !r_on_stack) || - (!on_stack && r_on_stack); - - // - // Remark: we now know that we can copy into - // the unused stack buffer. - // - if( exactly_one_on_stack ) - { - auto_buffer* one_on_stack = on_stack ? this : &r; - auto_buffer* other = on_stack ? &r : this; - pointer new_buffer = static_cast<T*>(other->members_.address()); - copy_impl( one_on_stack->begin(), one_on_stack->end(), - new_buffer ); // strong - one_on_stack->auto_buffer_destroy(); // nothrow - boost::swap( get_allocator(), r.get_allocator() ); // assume nothrow - boost::swap( members_.capacity_, r.members_.capacity_ ); - boost::swap( size_, r.size_ ); - one_on_stack->buffer_ = other->buffer_; - other->buffer_ = new_buffer; - BOOST_ASSERT( other->is_on_stack() ); - BOOST_ASSERT( !one_on_stack->is_on_stack() ); - BOOST_ASSERT( is_valid() ); - BOOST_ASSERT( r.is_valid() ); - return; - } - - BOOST_ASSERT( on_stack && r_on_stack ); - swap_helper( *this, r, boost::has_trivial_assign<T>() ); - BOOST_ASSERT( is_valid() ); - BOOST_ASSERT( r.is_valid() ); - } - - private: - typedef boost::aligned_storage< N * sizeof(T), - boost::alignment_of<T>::value > - storage; - - struct members_type : storage /* to enable EBO */ - { - size_type capacity_; - - members_type( size_type capacity ) - : capacity_(capacity) - { } - - void* address() const - { return const_cast<storage&>(static_cast<const storage&>(*this)).address(); } - }; - - members_type members_; - pointer buffer_; - size_type size_; - - }; - - template< class T, class SBP, class GP, class A > - inline void swap( auto_buffer<T,SBP,GP,A>& l, auto_buffer<T,SBP,GP,A>& r ) - { - l.swap( r ); - } - - template< class T, class SBP, class GP, class A > - inline bool operator==( const auto_buffer<T,SBP,GP,A>& l, - const auto_buffer<T,SBP,GP,A>& r ) - { - if( l.size() != r.size() ) - return false; - return std::equal( l.begin(), l.end(), r.begin() ); - } - - template< class T, class SBP, class GP, class A > - inline bool operator!=( const auto_buffer<T,SBP,GP,A>& l, - const auto_buffer<T,SBP,GP,A>& r ) - { - return !(l == r); - } - - template< class T, class SBP, class GP, class A > - inline bool operator<( const auto_buffer<T,SBP,GP,A>& l, - const auto_buffer<T,SBP,GP,A>& r ) - { - return std::lexicographical_compare( l.begin(), l.end(), - r.begin(), r.end() ); - } - - template< class T, class SBP, class GP, class A > - inline bool operator>( const auto_buffer<T,SBP,GP,A>& l, - const auto_buffer<T,SBP,GP,A>& r ) - { - return (r < l); - } - - template< class T, class SBP, class GP, class A > - inline bool operator<=( const auto_buffer<T,SBP,GP,A>& l, - const auto_buffer<T,SBP,GP,A>& r ) - { - return !(l > r); - } - - template< class T, class SBP, class GP, class A > - inline bool operator>=( const auto_buffer<T,SBP,GP,A>& l, - const auto_buffer<T,SBP,GP,A>& r ) - { - return !(l < r); - } - -} // namespace detail -} // namespace signals2 -} - -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) -#pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/boost/signals2/detail/foreign_ptr.hpp b/contrib/restricted/boost/boost/signals2/detail/foreign_ptr.hpp deleted file mode 100644 index a28ba4337c..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/foreign_ptr.hpp +++ /dev/null @@ -1,180 +0,0 @@ - -// helper code for dealing with tracking non-boost shared_ptr/weak_ptr - -// Copyright Frank Mori Hess 2009. -// Distributed under the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/signals2 for library home page. - -#ifndef BOOST_SIGNALS2_FOREIGN_PTR_HPP -#define BOOST_SIGNALS2_FOREIGN_PTR_HPP - -#include <algorithm> -#include <boost/config.hpp> -#include <boost/assert.hpp> -#include <boost/scoped_ptr.hpp> -#include <boost/smart_ptr/bad_weak_ptr.hpp> -#include <boost/utility/swap.hpp> - -#ifndef BOOST_NO_CXX11_SMART_PTR -#include <memory> -#endif - -namespace boost -{ - template<typename T> class shared_ptr; - template<typename T> class weak_ptr; - - namespace signals2 - { - template<typename WeakPtr> struct weak_ptr_traits - {}; - template<typename T> struct weak_ptr_traits<boost::weak_ptr<T> > - { - typedef boost::shared_ptr<T> shared_type; - }; -#ifndef BOOST_NO_CXX11_SMART_PTR - template<typename T> struct weak_ptr_traits<std::weak_ptr<T> > - { - typedef std::shared_ptr<T> shared_type; - }; -#endif - - template<typename SharedPtr> struct shared_ptr_traits - {}; - - template<typename T> struct shared_ptr_traits<boost::shared_ptr<T> > - { - typedef boost::weak_ptr<T> weak_type; - }; -#ifndef BOOST_NO_CXX11_SMART_PTR - template<typename T> struct shared_ptr_traits<std::shared_ptr<T> > - { - typedef std::weak_ptr<T> weak_type; - }; -#endif - - namespace detail - { - struct foreign_shared_ptr_impl_base - { - virtual ~foreign_shared_ptr_impl_base() {} - virtual foreign_shared_ptr_impl_base * clone() const = 0; - }; - - template<typename FSP> - class foreign_shared_ptr_impl: public foreign_shared_ptr_impl_base - { - public: - foreign_shared_ptr_impl(const FSP &p): _p(p) - {} - virtual foreign_shared_ptr_impl * clone() const - { - return new foreign_shared_ptr_impl(*this); - } - private: - FSP _p; - }; - - class foreign_void_shared_ptr - { - public: - foreign_void_shared_ptr(): - _p(0) - {} - foreign_void_shared_ptr(const foreign_void_shared_ptr &other): - _p(other._p->clone()) - {} - template<typename FSP> - explicit foreign_void_shared_ptr(const FSP &fsp): - _p(new foreign_shared_ptr_impl<FSP>(fsp)) - {} - ~foreign_void_shared_ptr() - { - delete _p; - } - foreign_void_shared_ptr & operator=(const foreign_void_shared_ptr &other) - { - if(&other == this) return *this; - foreign_void_shared_ptr(other).swap(*this); - return *this; - } - void swap(foreign_void_shared_ptr &other) - { - boost::swap(_p, other._p); - } - private: - foreign_shared_ptr_impl_base *_p; - }; - - struct foreign_weak_ptr_impl_base - { - virtual ~foreign_weak_ptr_impl_base() {} - virtual foreign_void_shared_ptr lock() const = 0; - virtual bool expired() const = 0; - virtual foreign_weak_ptr_impl_base * clone() const = 0; - }; - - template<typename FWP> - class foreign_weak_ptr_impl: public foreign_weak_ptr_impl_base - { - public: - foreign_weak_ptr_impl(const FWP &p): _p(p) - {} - virtual foreign_void_shared_ptr lock() const - { - return foreign_void_shared_ptr(_p.lock()); - } - virtual bool expired() const - { - return _p.expired(); - } - virtual foreign_weak_ptr_impl * clone() const - { - return new foreign_weak_ptr_impl(*this); - } - private: - FWP _p; - }; - - class foreign_void_weak_ptr - { - public: - foreign_void_weak_ptr() - {} - foreign_void_weak_ptr(const foreign_void_weak_ptr &other): - _p(other._p->clone()) - {} - template<typename FWP> - explicit foreign_void_weak_ptr(const FWP &fwp): - _p(new foreign_weak_ptr_impl<FWP>(fwp)) - {} - foreign_void_weak_ptr & operator=(const foreign_void_weak_ptr &other) - { - if(&other == this) return *this; - foreign_void_weak_ptr(other).swap(*this); - return *this; - } - void swap(foreign_void_weak_ptr &other) - { - boost::swap(_p, other._p); - } - foreign_void_shared_ptr lock() const - { - return _p->lock(); - } - bool expired() const - { - return _p->expired(); - } - private: - boost::scoped_ptr<foreign_weak_ptr_impl_base> _p; - }; - } // namespace detail - - } // namespace signals2 -} // namespace boost - -#endif // BOOST_SIGNALS2_FOREIGN_PTR_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/lwm_nop.hpp b/contrib/restricted/boost/boost/signals2/detail/lwm_nop.hpp deleted file mode 100644 index 2b705440ed..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/lwm_nop.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// -// boost/signals2/detail/lwm_nop.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2008 Frank Mori Hess -// -// Distributed under the 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_SIGNALS2_LWM_NOP_HPP -#define BOOST_SIGNALS2_LWM_NOP_HPP - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) -# pragma once -#endif - - -#include <boost/signals2/dummy_mutex.hpp> - -namespace boost -{ - -namespace signals2 -{ - -class mutex: public dummy_mutex -{ -}; - -} // namespace signals2 - -} // namespace boost - -#endif // #ifndef BOOST_SIGNALS2_LWM_NOP_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/lwm_pthreads.hpp b/contrib/restricted/boost/boost/signals2/detail/lwm_pthreads.hpp deleted file mode 100644 index fb0dd66e71..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/lwm_pthreads.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// -// boost/signals2/detail/lwm_pthreads.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2008 Frank Mori Hess -// -// Distributed under the 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_SIGNALS2_LWM_PTHREADS_HPP -#define BOOST_SIGNALS2_LWM_PTHREADS_HPP - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/assert.hpp> -#include <pthread.h> - -namespace boost -{ - -namespace signals2 -{ - -class mutex -{ -private: - - pthread_mutex_t m_; - - mutex(mutex const &); - mutex & operator=(mutex const &); - -public: - - mutex() - { - -// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init - -#if defined(__hpux) && defined(_DECTHREADS_) - BOOST_VERIFY(pthread_mutex_init(&m_, pthread_mutexattr_default) == 0); -#else - BOOST_VERIFY(pthread_mutex_init(&m_, 0) == 0); -#endif - } - - ~mutex() - { - BOOST_VERIFY(pthread_mutex_destroy(&m_) == 0); - } - - void lock() - { - BOOST_VERIFY(pthread_mutex_lock(&m_) == 0); - } - - bool try_lock() - { - return pthread_mutex_trylock(&m_) == 0; - } - - void unlock() - { - BOOST_VERIFY(pthread_mutex_unlock(&m_) == 0); - } -}; - -} // namespace signals2 - -} // namespace boost - -#endif // #ifndef BOOST_SIGNALS2_LWM_PTHREADS_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/lwm_win32_cs.hpp b/contrib/restricted/boost/boost/signals2/detail/lwm_win32_cs.hpp deleted file mode 100644 index 8ac63368ea..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/lwm_win32_cs.hpp +++ /dev/null @@ -1,144 +0,0 @@ -// -// boost/signals2/detail/lwm_win32_cs.hpp -// -// Copyright (c) 2002, 2003 Peter Dimov -// Copyright (c) 2008 Frank Mori Hess -// Copyright (c) Microsoft Corporation 2014 -// -// Distributed under the 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_SIGNALS2_LWM_WIN32_CS_HPP -#define BOOST_SIGNALS2_LWM_WIN32_CS_HPP - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/predef.h> -#include <boost/assert.hpp> - -#ifdef BOOST_USE_WINDOWS_H - -#include <windows.h> - -#else - -struct _RTL_CRITICAL_SECTION; - -#endif - -namespace boost -{ - -namespace signals2 -{ - -namespace detail -{ - -#ifndef BOOST_USE_WINDOWS_H - -struct critical_section -{ - struct critical_section_debug * DebugInfo; - long LockCount; - long RecursionCount; - void * OwningThread; - void * LockSemaphore; -#if defined(_WIN64) - unsigned __int64 SpinCount; -#else - unsigned long SpinCount; -#endif -}; - -#if BOOST_PLAT_WINDOWS_RUNTIME -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(::_RTL_CRITICAL_SECTION *, unsigned long, unsigned long); -#else -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *); -#endif -extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *); -extern "C" __declspec(dllimport) int __stdcall TryEnterCriticalSection(::_RTL_CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *); - -typedef ::_RTL_CRITICAL_SECTION rtl_critical_section; - -#else // #ifndef BOOST_USE_WINDOWS_H - -typedef ::CRITICAL_SECTION critical_section; - -#if BOOST_PLAT_WINDOWS_RUNTIME -using ::InitializeCriticalSectionEx; -#else -using ::InitializeCriticalSection; -#endif -using ::EnterCriticalSection; -using ::TryEnterCriticalSection; -using ::LeaveCriticalSection; -using ::DeleteCriticalSection; - -typedef ::CRITICAL_SECTION rtl_critical_section; - -#endif // #ifndef BOOST_USE_WINDOWS_H - -} // namespace detail - -class mutex -{ -private: - - boost::signals2::detail::critical_section cs_; - - mutex(mutex const &); - mutex & operator=(mutex const &); - -public: - - mutex() - { -#if BOOST_PLAT_WINDOWS_RUNTIME - boost::signals2::detail::InitializeCriticalSectionEx(reinterpret_cast< boost::signals2::detail::rtl_critical_section* >(&cs_), 4000, 0); -#else - boost::signals2::detail::InitializeCriticalSection(reinterpret_cast< boost::signals2::detail::rtl_critical_section* >(&cs_)); -#endif - } - - ~mutex() - { - boost::signals2::detail::DeleteCriticalSection(reinterpret_cast< boost::signals2::detail::rtl_critical_section* >(&cs_)); - } - - void lock() - { - boost::signals2::detail::EnterCriticalSection(reinterpret_cast< boost::signals2::detail::rtl_critical_section* >(&cs_)); - } -// TryEnterCriticalSection only exists on Windows NT 4.0 and later -#if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)) - bool try_lock() - { - return boost::signals2::detail::TryEnterCriticalSection(reinterpret_cast< boost::signals2::detail::rtl_critical_section* >(&cs_)) != 0; - } -#else - bool try_lock() - { - BOOST_ASSERT(false); - return false; - } -#endif - void unlock() - { - boost::signals2::detail::LeaveCriticalSection(reinterpret_cast< boost::signals2::detail::rtl_critical_section* >(&cs_)); - } -}; - -} // namespace signals2 - -} // namespace boost - -#endif // #ifndef BOOST_SIGNALS2_LWM_WIN32_CS_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/null_output_iterator.hpp b/contrib/restricted/boost/boost/signals2/detail/null_output_iterator.hpp deleted file mode 100644 index 9e98695912..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/null_output_iterator.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - An output iterator which simply discards output. -*/ -// Copyright Frank Mori Hess 2008. -// Distributed under the 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/signals2 for library home page. - -#ifndef BOOST_SIGNALS2_NULL_OUTPUT_ITERATOR_HPP -#define BOOST_SIGNALS2_NULL_OUTPUT_ITERATOR_HPP - -#include <boost/function_output_iterator.hpp> - -namespace boost -{ - namespace signals2 - { - namespace detail - { - class does_nothing - { - public: - template<typename T> - void operator()(const T&) const - {} - }; - typedef boost::function_output_iterator<does_nothing> null_output_iterator; - } // namespace detail - } // namespace signals2 -} // namespace boost - -#endif // BOOST_SIGNALS2_NULL_OUTPUT_ITERATOR_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/preprocessed_arg_type.hpp b/contrib/restricted/boost/boost/signals2/detail/preprocessed_arg_type.hpp deleted file mode 100644 index 02717c9d29..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/preprocessed_arg_type.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2009. -// Copyright Timmo Stange 2007. -// Copyright Douglas Gregor 2001-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_PREPROCESSED_ARG_TYPE_HPP -#define BOOST_SIGNALS2_PREPROCESSED_ARG_TYPE_HPP - -#include <boost/preprocessor/repetition.hpp> -#include <boost/signals2/detail/signals_common_macros.hpp> - -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_INC(BOOST_SIGNALS2_MAX_ARGS)) -#define BOOST_PP_FILENAME_1 <boost/signals2/detail/preprocessed_arg_type_template.hpp> -#include BOOST_PP_ITERATE() - -namespace boost -{ - namespace signals2 - { - namespace detail - { - struct std_functional_base - {}; - } // namespace detail - } // namespace signals2 -} // namespace boost - -#endif // BOOST_SIGNALS2_PREPROCESSED_ARG_TYPE_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/preprocessed_arg_type_template.hpp b/contrib/restricted/boost/boost/signals2/detail/preprocessed_arg_type_template.hpp deleted file mode 100644 index 4f3943346a..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/preprocessed_arg_type_template.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright Frank Mori Hess 2009 -// -// 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) - -// For more information, see http://www.boost.org - -// This file is included iteratively, and should not be protected from multiple inclusion - -#define BOOST_SIGNALS2_NUM_ARGS BOOST_PP_ITERATION() - -namespace boost -{ - namespace signals2 - { - namespace detail - { - template<unsigned n BOOST_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_PREPROCESSED_ARG_N_TYPE_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS); - -// template<typename T1, typename T2, ... , typename TN> class preprocessed_arg_typeN<n, T1, T2, ..., TN>{...} ... -#define BOOST_SIGNALS2_PREPROCESSED_ARG_TYPE_CLASS_TEMPLATE_SPECIALIZATION(z, n, data) \ - template<BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> \ - class BOOST_SIGNALS2_PREPROCESSED_ARG_N_TYPE_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)<n, \ - BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(BOOST_SIGNALS2_NUM_ARGS)> \ - { \ - public: \ - typedef BOOST_PP_CAT(T, BOOST_PP_INC(n)) type; \ - }; - BOOST_PP_REPEAT(BOOST_SIGNALS2_NUM_ARGS, BOOST_SIGNALS2_PREPROCESSED_ARG_TYPE_CLASS_TEMPLATE_SPECIALIZATION, ~) - - } // namespace detail - } // namespace signals2 -} // namespace boost - -#undef BOOST_SIGNALS2_NUM_ARGS diff --git a/contrib/restricted/boost/boost/signals2/detail/replace_slot_function.hpp b/contrib/restricted/boost/boost/signals2/detail/replace_slot_function.hpp deleted file mode 100644 index de8f4259ee..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/replace_slot_function.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright Frank Mori Hess 2007-2009 -// -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_DETAIL_REPLACE_SLOT_FUNCTION_HPP -#define BOOST_SIGNALS2_DETAIL_REPLACE_SLOT_FUNCTION_HPP - -#include <boost/signals2/slot_base.hpp> - -namespace boost -{ - namespace signals2 - { - namespace detail - { - template<typename ResultSlot, typename SlotIn, typename SlotFunction> - ResultSlot replace_slot_function(const SlotIn &slot_in, const SlotFunction &fun) - { - ResultSlot slot(fun); - slot.track(slot_in); - return slot; - } - } // namespace detail - } // namespace signals2 -} // namespace boost - -#endif // BOOST_SIGNALS2_DETAIL_REPLACE_SLOT_FUNCTION_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/result_type_wrapper.hpp b/contrib/restricted/boost/boost/signals2/detail/result_type_wrapper.hpp deleted file mode 100644 index 35dea7cc6c..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/result_type_wrapper.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// Boost.Signals2 library - -// Copyright Douglas Gregor 2001-2004. -// Copyright Frank Mori Hess 2007. 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_RESULT_TYPE_WRAPPER_HPP -#define BOOST_SIGNALS2_RESULT_TYPE_WRAPPER_HPP - -#include <boost/config.hpp> - -namespace boost { - namespace signals2 { - namespace detail { - // A placeholder for void on compilers that don't support void returns - struct void_type {}; - - // Replaces void with void_type - template<typename R> - struct nonvoid { - typedef R type; - }; - template<> - struct nonvoid<void> { - typedef void_type type; - }; - - // Replaces void with void_type only if compiler doesn't support void returns - template<typename R> - struct result_type_wrapper { - typedef R type; - }; -#ifdef BOOST_NO_VOID_RETURNS - template<> - struct result_type_wrapper<void> { - typedef void_type type; - }; -#endif - - // specialization deals with possible void return from combiners - template<typename R> class combiner_invoker - { - public: - typedef R result_type; - template<typename Combiner, typename InputIterator> - result_type operator()(Combiner &combiner, - InputIterator first, InputIterator last) const - { - return combiner(first, last); - } - }; - template<> class combiner_invoker<void> - { - public: - typedef result_type_wrapper<void>::type result_type; - template<typename Combiner, typename InputIterator> - result_type operator()(Combiner &combiner, - InputIterator first, InputIterator last) const - { - combiner(first, last); - return result_type(); - } - }; - } // end namespace detail - } // end namespace signals2 -} // end namespace boost - -#endif // BOOST_SIGNALS2_RESULT_TYPE_WRAPPER_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/signal_template.hpp b/contrib/restricted/boost/boost/signals2/detail/signal_template.hpp deleted file mode 100644 index b92a143ade..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/signal_template.hpp +++ /dev/null @@ -1,861 +0,0 @@ -/* - Template for Signa1, Signal2, ... classes that support signals - with 1, 2, ... parameters - - Begin: 2007-01-23 -*/ -// Copyright Frank Mori Hess 2007-2008 -// -// Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// This file is included iteratively, and should not be protected from multiple inclusion - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES -#define BOOST_SIGNALS2_NUM_ARGS BOOST_PP_ITERATION() -#else -#define BOOST_SIGNALS2_NUM_ARGS 1 -#endif - -// R, T1, T2, ..., TN, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION \ - BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS2_NUM_ARGS), \ - Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex - -namespace boost -{ - namespace signals2 - { - namespace detail - { - // helper for bound_extended_slot_function that handles specialization for void return - template<typename R> - class BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(BOOST_SIGNALS2_NUM_ARGS) - { - public: - typedef R result_type; - template<typename ExtendedSlotFunction BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> - result_type operator()(ExtendedSlotFunction &func, const connection &conn - BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_FULL_FORWARD_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const - { - return func(conn BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_FORWARDED_ARGS(BOOST_SIGNALS2_NUM_ARGS)); - } - }; -#ifdef BOOST_NO_VOID_RETURNS - template<> - class BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(BOOST_SIGNALS2_NUM_ARGS)<void> - { - public: - typedef result_type_wrapper<void>::type result_type; - template<typename ExtendedSlotFunction BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> - result_type operator()(ExtendedSlotFunction &func, const connection &conn - BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_FULL_FORWARD_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const - { - func(conn BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_FORWARDED_ARGS(BOOST_SIGNALS2_NUM_ARGS)); - return result_type(); - } - }; -#endif -// wrapper around an signalN::extended_slot_function which binds the -// connection argument so it looks like a normal -// signalN::slot_function - - template<typename ExtendedSlotFunction> - class BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(BOOST_SIGNALS2_NUM_ARGS) - { - public: - typedef typename result_type_wrapper<typename ExtendedSlotFunction::result_type>::type result_type; - BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(BOOST_SIGNALS2_NUM_ARGS)(const ExtendedSlotFunction &fun): - _fun(fun), _connection(new connection) - {} - void set_connection(const connection &conn) - { - *_connection = conn; - } - -#if BOOST_SIGNALS2_NUM_ARGS > 0 - template<BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> -#endif // BOOST_SIGNALS2_NUM_ARGS > 0 - result_type operator()(BOOST_SIGNALS2_FULL_FORWARD_ARGS(BOOST_SIGNALS2_NUM_ARGS)) - { - return BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(BOOST_SIGNALS2_NUM_ARGS) - <typename ExtendedSlotFunction::result_type>() - (_fun, *_connection BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_FORWARDED_ARGS(BOOST_SIGNALS2_NUM_ARGS)); - } - // const overload -#if BOOST_SIGNALS2_NUM_ARGS > 0 - template<BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> -#endif // BOOST_SIGNALS2_NUM_ARGS > 0 - result_type operator()(BOOST_SIGNALS2_FULL_FORWARD_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const - { - return BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(BOOST_SIGNALS2_NUM_ARGS) - <typename ExtendedSlotFunction::result_type>() - (_fun, *_connection BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_FORWARDED_ARGS(BOOST_SIGNALS2_NUM_ARGS)); - } - template<typename T> - bool operator==(const T &other) const - { - return _fun == other; - } - private: - BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(BOOST_SIGNALS2_NUM_ARGS)() - {} - - ExtendedSlotFunction _fun; - boost::shared_ptr<connection> _connection; - }; - - template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS); - - template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION - { - public: - typedef SlotFunction slot_function_type; - // typedef slotN<Signature, SlotFunction> slot_type; - typedef BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS2_NUM_ARGS), - slot_function_type> slot_type; - typedef ExtendedSlotFunction extended_slot_function_type; - // typedef slotN+1<R, const connection &, T1, T2, ..., TN, extended_slot_function_type> extended_slot_type; - typedef BOOST_SIGNALS2_EXTENDED_SLOT_TYPE(BOOST_SIGNALS2_NUM_ARGS) extended_slot_type; - typedef typename nonvoid<typename slot_function_type::result_type>::type nonvoid_slot_result_type; - private: -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - class slot_invoker; -#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES - typedef variadic_slot_invoker<nonvoid_slot_result_type, Args...> slot_invoker; -#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES - typedef slot_call_iterator_cache<nonvoid_slot_result_type, slot_invoker> slot_call_iterator_cache_type; - typedef typename group_key<Group>::type group_key_type; - typedef shared_ptr<connection_body<group_key_type, slot_type, Mutex> > connection_body_type; - typedef grouped_list<Group, GroupCompare, connection_body_type> connection_list_type; - typedef BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(BOOST_SIGNALS2_NUM_ARGS)<extended_slot_function_type> - bound_extended_slot_function_type; - public: - typedef Combiner combiner_type; - typedef typename result_type_wrapper<typename combiner_type::result_type>::type result_type; - typedef Group group_type; - typedef GroupCompare group_compare_type; - typedef typename detail::slot_call_iterator_t<slot_invoker, - typename connection_list_type::iterator, connection_body<group_key_type, slot_type, Mutex> > slot_call_iterator; - - BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)(const combiner_type &combiner_arg, - const group_compare_type &group_compare): - _shared_state(new invocation_state(connection_list_type(group_compare), combiner_arg)), - _garbage_collector_it(_shared_state->connection_bodies().end()), - _mutex(new mutex_type()) - {} - // connect slot - connection connect(const slot_type &slot, connect_position position = at_back) - { - garbage_collecting_lock<mutex_type> lock(*_mutex); - return nolock_connect(lock, slot, position); - } - connection connect(const group_type &group, - const slot_type &slot, connect_position position = at_back) - { - garbage_collecting_lock<mutex_type> lock(*_mutex); - return nolock_connect(lock, group, slot, position); - } - // connect extended slot - connection connect_extended(const extended_slot_type &ext_slot, connect_position position = at_back) - { - garbage_collecting_lock<mutex_type> lock(*_mutex); - bound_extended_slot_function_type bound_slot(ext_slot.slot_function()); - slot_type slot = replace_slot_function<slot_type>(ext_slot, bound_slot); - connection conn = nolock_connect(lock, slot, position); - bound_slot.set_connection(conn); - return conn; - } - connection connect_extended(const group_type &group, - const extended_slot_type &ext_slot, connect_position position = at_back) - { - garbage_collecting_lock<Mutex> lock(*_mutex); - bound_extended_slot_function_type bound_slot(ext_slot.slot_function()); - slot_type slot = replace_slot_function<slot_type>(ext_slot, bound_slot); - connection conn = nolock_connect(lock, group, slot, position); - bound_slot.set_connection(conn); - return conn; - } - // disconnect slot(s) - void disconnect_all_slots() - { - shared_ptr<invocation_state> local_state = - get_readable_state(); - typename connection_list_type::iterator it; - for(it = local_state->connection_bodies().begin(); - it != local_state->connection_bodies().end(); ++it) - { - (*it)->disconnect(); - } - } - void disconnect(const group_type &group) - { - shared_ptr<invocation_state> local_state = - get_readable_state(); - group_key_type group_key(grouped_slots, group); - typename connection_list_type::iterator it; - typename connection_list_type::iterator end_it = - local_state->connection_bodies().upper_bound(group_key); - for(it = local_state->connection_bodies().lower_bound(group_key); - it != end_it; ++it) - { - (*it)->disconnect(); - } - } - template <typename T> - void disconnect(const T &slot) - { - typedef mpl::bool_<(is_convertible<T, group_type>::value)> is_group; - do_disconnect(slot, is_group()); - } - // emit signal - result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) - { - shared_ptr<invocation_state> local_state; - typename connection_list_type::iterator it; - { - garbage_collecting_lock<mutex_type> list_lock(*_mutex); - // only clean up if it is safe to do so - if(_shared_state.unique()) - nolock_cleanup_connections(list_lock, false, 1); - /* Make a local copy of _shared_state while holding mutex, so we are - thread safe against the combiner or connection list getting modified - during invocation. */ - local_state = _shared_state; - } - slot_invoker invoker = slot_invoker(BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - slot_call_iterator_cache_type cache(invoker); - invocation_janitor janitor(cache, *this, &local_state->connection_bodies()); - return detail::combiner_invoker<typename combiner_type::result_type>() - ( - local_state->combiner(), - slot_call_iterator(local_state->connection_bodies().begin(), local_state->connection_bodies().end(), cache), - slot_call_iterator(local_state->connection_bodies().end(), local_state->connection_bodies().end(), cache) - ); - } - result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const - { - shared_ptr<invocation_state> local_state; - typename connection_list_type::iterator it; - { - garbage_collecting_lock<mutex_type> list_lock(*_mutex); - // only clean up if it is safe to do so - if(_shared_state.unique()) - nolock_cleanup_connections(list_lock, false, 1); - /* Make a local copy of _shared_state while holding mutex, so we are - thread safe against the combiner or connection list getting modified - during invocation. */ - local_state = _shared_state; - } - slot_invoker invoker = slot_invoker(BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - slot_call_iterator_cache_type cache(invoker); - invocation_janitor janitor(cache, *this, &local_state->connection_bodies()); - return detail::combiner_invoker<typename combiner_type::result_type>() - ( - local_state->combiner(), - slot_call_iterator(local_state->connection_bodies().begin(), local_state->connection_bodies().end(), cache), - slot_call_iterator(local_state->connection_bodies().end(), local_state->connection_bodies().end(), cache) - ); - } - std::size_t num_slots() const - { - shared_ptr<invocation_state> local_state = - get_readable_state(); - typename connection_list_type::iterator it; - std::size_t count = 0; - for(it = local_state->connection_bodies().begin(); - it != local_state->connection_bodies().end(); ++it) - { - if((*it)->connected()) ++count; - } - return count; - } - bool empty() const - { - shared_ptr<invocation_state> local_state = - get_readable_state(); - typename connection_list_type::iterator it; - for(it = local_state->connection_bodies().begin(); - it != local_state->connection_bodies().end(); ++it) - { - if((*it)->connected()) return false; - } - return true; - } - combiner_type combiner() const - { - unique_lock<mutex_type> lock(*_mutex); - return _shared_state->combiner(); - } - void set_combiner(const combiner_type &combiner_arg) - { - unique_lock<mutex_type> lock(*_mutex); - if(_shared_state.unique()) - _shared_state->combiner() = combiner_arg; - else - _shared_state.reset(new invocation_state(*_shared_state, combiner_arg)); - } - private: - typedef Mutex mutex_type; - - // slot_invoker is passed to slot_call_iterator_t to run slots -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - class slot_invoker - { - public: - typedef nonvoid_slot_result_type result_type; -// typename add_reference<Tn>::type -#define BOOST_SIGNALS2_ADD_REF_TYPE(z, n, data) \ - typename add_reference<BOOST_PP_CAT(T, BOOST_PP_INC(n))>::type -// typename add_reference<Tn>::type argn -#define BOOST_SIGNALS2_ADD_REF_ARG(z, n, data) \ - BOOST_SIGNALS2_ADD_REF_TYPE(~, n, ~) \ - BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~) -// typename add_reference<T1>::type arg1, typename add_reference<T2>::type arg2, ..., typename add_reference<Tn>::type argn -#define BOOST_SIGNALS2_ADD_REF_ARGS(arity) \ - BOOST_PP_ENUM(arity, BOOST_SIGNALS2_ADD_REF_ARG, ~) - slot_invoker(BOOST_SIGNALS2_ADD_REF_ARGS(BOOST_SIGNALS2_NUM_ARGS)) BOOST_PP_EXPR_IF(BOOST_SIGNALS2_NUM_ARGS, :) -#undef BOOST_SIGNALS2_ADD_REF_ARGS - -// m_argn -#define BOOST_SIGNALS2_M_ARG_NAME(z, n, data) BOOST_PP_CAT(m_arg, BOOST_PP_INC(n)) -// m_argn ( argn ) -#define BOOST_SIGNALS2_MISC_STATEMENT(z, n, data) \ - BOOST_SIGNALS2_M_ARG_NAME(~, n, ~) ( BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~) ) -// m_arg1(arg1), m_arg2(arg2), ..., m_argn(argn) - BOOST_PP_ENUM(BOOST_SIGNALS2_NUM_ARGS, BOOST_SIGNALS2_MISC_STATEMENT, ~) -#undef BOOST_SIGNALS2_MISC_STATEMENT - {} - result_type operator ()(const connection_body_type &connectionBody) const - { - return m_invoke<typename slot_type::result_type>(connectionBody); - } - private: - // declare assignment operator private since this class might have reference or const members - slot_invoker & operator=(const slot_invoker &); - -#define BOOST_SIGNALS2_ADD_REF_M_ARG_STATEMENT(z, n, data) \ - BOOST_SIGNALS2_ADD_REF_TYPE(~, n, ~) BOOST_SIGNALS2_M_ARG_NAME(~, n, ~) ; - BOOST_PP_REPEAT(BOOST_SIGNALS2_NUM_ARGS, BOOST_SIGNALS2_ADD_REF_M_ARG_STATEMENT, ~) -#undef BOOST_SIGNALS2_ADD_REF_M_ARG_STATEMENT -#undef BOOST_SIGNALS2_ADD_REF_ARG -#undef BOOST_SIGNALS2_ADD_REF_TYPE - -// m_arg1, m_arg2, ..., m_argn -#define BOOST_SIGNALS2_M_ARG_NAMES(arity) BOOST_PP_ENUM(arity, BOOST_SIGNALS2_M_ARG_NAME, ~) - template<typename SlotResultType> - result_type m_invoke(const connection_body_type &connectionBody, - typename boost::enable_if<boost::is_void<SlotResultType> >::type * = 0) const - { - connectionBody->slot().slot_function()(BOOST_SIGNALS2_M_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - return void_type(); - } - template<typename SlotResultType> - result_type m_invoke(const connection_body_type &connectionBody, - typename boost::disable_if<boost::is_void<SlotResultType> >::type * = 0) const - { - return connectionBody->slot().slot_function()(BOOST_SIGNALS2_M_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - } - }; -#undef BOOST_SIGNALS2_M_ARG_NAMES -#undef BOOST_SIGNALS2_M_ARG_NAME - -#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES - // a struct used to optimize (minimize) the number of shared_ptrs that need to be created - // inside operator() - class invocation_state - { - public: - invocation_state(const connection_list_type &connections_in, - const combiner_type &combiner_in): _connection_bodies(new connection_list_type(connections_in)), - _combiner(new combiner_type(combiner_in)) - {} - invocation_state(const invocation_state &other, const connection_list_type &connections_in): - _connection_bodies(new connection_list_type(connections_in)), - _combiner(other._combiner) - {} - invocation_state(const invocation_state &other, const combiner_type &combiner_in): - _connection_bodies(other._connection_bodies), - _combiner(new combiner_type(combiner_in)) - {} - connection_list_type & connection_bodies() { return *_connection_bodies; } - const connection_list_type & connection_bodies() const { return *_connection_bodies; } - combiner_type & combiner() { return *_combiner; } - const combiner_type & combiner() const { return *_combiner; } - private: - invocation_state(const invocation_state &); - - shared_ptr<connection_list_type> _connection_bodies; - shared_ptr<combiner_type> _combiner; - }; - // Destructor of invocation_janitor does some cleanup when a signal invocation completes. - // Code can't be put directly in signal's operator() due to complications from void return types. - class invocation_janitor: noncopyable - { - public: - typedef BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) signal_type; - invocation_janitor - ( - const slot_call_iterator_cache_type &cache, - const signal_type &sig, - const connection_list_type *connection_bodies - ):_cache(cache), _sig(sig), _connection_bodies(connection_bodies) - {} - ~invocation_janitor() - { - // force a full cleanup of disconnected slots if there are too many - if(_cache.disconnected_slot_count > _cache.connected_slot_count) - { - _sig.force_cleanup_connections(_connection_bodies); - } - } - private: - const slot_call_iterator_cache_type &_cache; - const signal_type &_sig; - const connection_list_type *_connection_bodies; - }; - - // clean up disconnected connections - void nolock_cleanup_connections_from(garbage_collecting_lock<mutex_type> &lock, - bool grab_tracked, - const typename connection_list_type::iterator &begin, unsigned count = 0) const - { - BOOST_ASSERT(_shared_state.unique()); - typename connection_list_type::iterator it; - unsigned i; - for(it = begin, i = 0; - it != _shared_state->connection_bodies().end() && (count == 0 || i < count); - ++i) - { - bool connected; - if(grab_tracked) - (*it)->disconnect_expired_slot(lock); - connected = (*it)->nolock_nograb_connected(); - if(connected == false) - { - it = _shared_state->connection_bodies().erase((*it)->group_key(), it); - }else - { - ++it; - } - } - _garbage_collector_it = it; - } - // clean up a few connections in constant time - void nolock_cleanup_connections(garbage_collecting_lock<mutex_type> &lock, - bool grab_tracked, unsigned count) const - { - BOOST_ASSERT(_shared_state.unique()); - typename connection_list_type::iterator begin; - if(_garbage_collector_it == _shared_state->connection_bodies().end()) - { - begin = _shared_state->connection_bodies().begin(); - }else - { - begin = _garbage_collector_it; - } - nolock_cleanup_connections_from(lock, grab_tracked, begin, count); - } - /* Make a new copy of the slot list if it is currently being read somewhere else - */ - void nolock_force_unique_connection_list(garbage_collecting_lock<mutex_type> &lock) - { - if(_shared_state.unique() == false) - { - _shared_state.reset(new invocation_state(*_shared_state, _shared_state->connection_bodies())); - nolock_cleanup_connections_from(lock, true, _shared_state->connection_bodies().begin()); - }else - { - /* We need to try and check more than just 1 connection here to avoid corner - cases where certain repeated connect/disconnect patterns cause the slot - list to grow without limit. */ - nolock_cleanup_connections(lock, true, 2); - } - } - // force a full cleanup of the connection list - void force_cleanup_connections(const connection_list_type *connection_bodies) const - { - garbage_collecting_lock<mutex_type> list_lock(*_mutex); - // if the connection list passed in as a parameter is no longer in use, - // we don't need to do any cleanup. - if(&_shared_state->connection_bodies() != connection_bodies) - { - return; - } - if(_shared_state.unique() == false) - { - _shared_state.reset(new invocation_state(*_shared_state, _shared_state->connection_bodies())); - } - nolock_cleanup_connections_from(list_lock, false, _shared_state->connection_bodies().begin()); - } - shared_ptr<invocation_state> get_readable_state() const - { - unique_lock<mutex_type> list_lock(*_mutex); - return _shared_state; - } - connection_body_type create_new_connection(garbage_collecting_lock<mutex_type> &lock, - const slot_type &slot) - { - nolock_force_unique_connection_list(lock); - return connection_body_type(new connection_body<group_key_type, slot_type, Mutex>(slot, _mutex)); - } - void do_disconnect(const group_type &group, mpl::bool_<true> /* is_group */) - { - disconnect(group); - } - template<typename T> - void do_disconnect(const T &slot, mpl::bool_<false> /* is_group */) - { - shared_ptr<invocation_state> local_state = - get_readable_state(); - typename connection_list_type::iterator it; - for(it = local_state->connection_bodies().begin(); - it != local_state->connection_bodies().end(); ++it) - { - garbage_collecting_lock<connection_body_base> lock(**it); - if((*it)->nolock_nograb_connected() == false) continue; - if((*it)->slot().slot_function() == slot) - { - (*it)->nolock_disconnect(lock); - }else - { - // check for wrapped extended slot - bound_extended_slot_function_type *fp; - fp = (*it)->slot().slot_function().template target<bound_extended_slot_function_type>(); - if(fp && *fp == slot) - { - (*it)->nolock_disconnect(lock); - } - } - } - } - // connect slot - connection nolock_connect(garbage_collecting_lock<mutex_type> &lock, - const slot_type &slot, connect_position position) - { - connection_body_type newConnectionBody = - create_new_connection(lock, slot); - group_key_type group_key; - if(position == at_back) - { - group_key.first = back_ungrouped_slots; - _shared_state->connection_bodies().push_back(group_key, newConnectionBody); - }else - { - group_key.first = front_ungrouped_slots; - _shared_state->connection_bodies().push_front(group_key, newConnectionBody); - } - newConnectionBody->set_group_key(group_key); - return connection(newConnectionBody); - } - connection nolock_connect(garbage_collecting_lock<mutex_type> &lock, - const group_type &group, - const slot_type &slot, connect_position position) - { - connection_body_type newConnectionBody = - create_new_connection(lock, slot); - // update map to first connection body in group if needed - group_key_type group_key(grouped_slots, group); - newConnectionBody->set_group_key(group_key); - if(position == at_back) - { - _shared_state->connection_bodies().push_back(group_key, newConnectionBody); - }else // at_front - { - _shared_state->connection_bodies().push_front(group_key, newConnectionBody); - } - return connection(newConnectionBody); - } - - // _shared_state is mutable so we can do force_cleanup_connections during a const invocation - mutable shared_ptr<invocation_state> _shared_state; - mutable typename connection_list_type::iterator _garbage_collector_it; - // connection list mutex must never be locked when attempting a blocking lock on a slot, - // or you could deadlock. - const boost::shared_ptr<mutex_type> _mutex; - }; - - template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS); - } - - template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_DEFAULTED_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS); - - template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION: public signal_base, - public detail::BOOST_SIGNALS2_STD_FUNCTIONAL_BASE - { - typedef detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> impl_class; - public: - typedef detail::BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> weak_signal_type; - friend class detail::BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION>; - - typedef SlotFunction slot_function_type; - // typedef slotN<Signature, SlotFunction> slot_type; - typedef typename impl_class::slot_type slot_type; - typedef typename impl_class::extended_slot_function_type extended_slot_function_type; - typedef typename impl_class::extended_slot_type extended_slot_type; - typedef typename slot_function_type::result_type slot_result_type; - typedef Combiner combiner_type; - typedef typename impl_class::result_type result_type; - typedef Group group_type; - typedef GroupCompare group_compare_type; - typedef typename impl_class::slot_call_iterator - slot_call_iterator; - typedef typename mpl::identity<BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(BOOST_SIGNALS2_NUM_ARGS)>::type signature_type; - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - -// typedef Tn argn_type; -#define BOOST_SIGNALS2_MISC_STATEMENT(z, n, data) \ - typedef BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type); - BOOST_PP_REPEAT(BOOST_SIGNALS2_NUM_ARGS, BOOST_SIGNALS2_MISC_STATEMENT, ~) -#undef BOOST_SIGNALS2_MISC_STATEMENT -#if BOOST_SIGNALS2_NUM_ARGS == 1 - typedef arg1_type argument_type; -#elif BOOST_SIGNALS2_NUM_ARGS == 2 - typedef arg1_type first_argument_type; - typedef arg2_type second_argument_type; -#endif - - template<unsigned n> class arg : public - detail::BOOST_SIGNALS2_PREPROCESSED_ARG_N_TYPE_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <n BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(BOOST_SIGNALS2_NUM_ARGS)> - {}; - - BOOST_STATIC_CONSTANT(int, arity = BOOST_SIGNALS2_NUM_ARGS); - -#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES - - template<unsigned n> class arg - { - public: - typedef typename detail::variadic_arg_type<n, Args...>::type type; - }; - BOOST_STATIC_CONSTANT(int, arity = sizeof...(Args)); - -#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES - - BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)(const combiner_type &combiner_arg = combiner_type(), - const group_compare_type &group_compare = group_compare_type()): - _pimpl(new impl_class(combiner_arg, group_compare)) - {}; - virtual ~BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)() - { - } - - //move support -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)( - BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) && other) - { - using std::swap; - swap(_pimpl, other._pimpl); - }; - - BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) & - operator=(BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) && rhs) - { - if(this == &rhs) - { - return *this; - } - _pimpl.reset(); - using std::swap; - swap(_pimpl, rhs._pimpl); - return *this; - } -#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - - connection connect(const slot_type &slot, connect_position position = at_back) - { - return (*_pimpl).connect(slot, position); - } - connection connect(const group_type &group, - const slot_type &slot, connect_position position = at_back) - { - return (*_pimpl).connect(group, slot, position); - } - connection connect_extended(const extended_slot_type &slot, connect_position position = at_back) - { - return (*_pimpl).connect_extended(slot, position); - } - connection connect_extended(const group_type &group, - const extended_slot_type &slot, connect_position position = at_back) - { - return (*_pimpl).connect_extended(group, slot, position); - } - void disconnect_all_slots() - { - (*_pimpl).disconnect_all_slots(); - } - void disconnect(const group_type &group) - { - (*_pimpl).disconnect(group); - } - template <typename T> - void disconnect(const T &slot) - { - (*_pimpl).disconnect(slot); - } - result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) - { - return (*_pimpl)(BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - } - result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const - { - return (*_pimpl)(BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - } - std::size_t num_slots() const - { - return (*_pimpl).num_slots(); - } - bool empty() const - { - return (*_pimpl).empty(); - } - combiner_type combiner() const - { - return (*_pimpl).combiner(); - } - void set_combiner(const combiner_type &combiner_arg) - { - return (*_pimpl).set_combiner(combiner_arg); - } - void swap(BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) & other) - { - using std::swap; - swap(_pimpl, other._pimpl); - } - protected: - virtual shared_ptr<void> lock_pimpl() const - { - return _pimpl; - } - private: - shared_ptr<impl_class> - _pimpl; - }; - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - // free swap function for signalN classes, findable by ADL - template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> - void swap( - BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> &sig1, - BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> &sig2 ) - { - sig1.swap(sig2); - } -#endif - - namespace detail - { - // wrapper class for storing other signals as slots with automatic lifetime tracking - template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS); - - template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION - { - public: - typedef typename BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION>::result_type - result_type; - - BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - (const BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> - &signal): - _weak_pimpl(signal._pimpl) - {} - result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) - { - shared_ptr<detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> > - shared_pimpl(_weak_pimpl.lock()); - return (*shared_pimpl)(BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - } - result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const - { - shared_ptr<detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> > - shared_pimpl(_weak_pimpl.lock()); - return (*shared_pimpl)(BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - } - private: - boost::weak_ptr<detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> > _weak_pimpl; - }; - -#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES - template<int arity, typename Signature> - class extended_signature: public variadic_extended_signature<Signature> - {}; -#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES - template<int arity, typename Signature> - class extended_signature; - // partial template specialization - template<typename Signature> - class extended_signature<BOOST_SIGNALS2_NUM_ARGS, Signature> - { - public: -// typename function_traits<Signature>::result_type ( -// const boost::signals2::connection &, -// typename function_traits<Signature>::arg1_type, -// typename function_traits<Signature>::arg2_type, -// ..., -// typename function_traits<Signature>::argn_type) -#define BOOST_SIGNALS2_EXT_SIGNATURE(arity, Signature) \ - typename function_traits<Signature>::result_type ( \ - const boost::signals2::connection & BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) \ - BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_TO_ARGN_TYPE, Signature) ) - typedef function<BOOST_SIGNALS2_EXT_SIGNATURE(BOOST_SIGNALS2_NUM_ARGS, Signature)> function_type; -#undef BOOST_SIGNALS2_EXT_SIGNATURE - }; - - template<unsigned arity, typename Signature, typename Combiner, - typename Group, typename GroupCompare, typename SlotFunction, - typename ExtendedSlotFunction, typename Mutex> - class signalN; - // partial template specialization - template<typename Signature, typename Combiner, typename Group, - typename GroupCompare, typename SlotFunction, - typename ExtendedSlotFunction, typename Mutex> - class signalN<BOOST_SIGNALS2_NUM_ARGS, Signature, Combiner, Group, - GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex> - { - public: - typedef BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)< - BOOST_SIGNALS2_PORTABLE_SIGNATURE(BOOST_SIGNALS2_NUM_ARGS, Signature), - Combiner, Group, - GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex> type; - }; - -#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES - - } // namespace detail - } // namespace signals2 -} // namespace boost - -#undef BOOST_SIGNALS2_NUM_ARGS -#undef BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION diff --git a/contrib/restricted/boost/boost/signals2/detail/signals_common.hpp b/contrib/restricted/boost/boost/signals2/detail/signals_common.hpp deleted file mode 100644 index 8c4baf034f..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/signals_common.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// Boost.Signals library - -// Copyright Douglas Gregor 2001-2004. -// Copyright Frank Mori Hess 2007. 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SIGNALS_COMMON_HPP -#define BOOST_SIGNALS2_SIGNALS_COMMON_HPP - -#include <boost/mpl/bool.hpp> -#include <boost/mpl/if.hpp> -#include <boost/ref.hpp> -#include <boost/signals2/signal_base.hpp> -#include <boost/type_traits/is_base_of.hpp> - -namespace boost { - namespace signals2 { - namespace detail { - // Determine if the given type T is a signal - template<typename T> - class is_signal: public mpl::bool_<is_base_of<signal_base, T>::value> - {}; - - // A slot can be a signal, a reference to a function object, or a - // function object. - struct signal_tag {}; - struct reference_tag {}; - struct value_tag {}; - - // Classify the given slot as a signal, a reference-to-slot, or a - // standard slot - template<typename S> - class get_slot_tag { - typedef typename mpl::if_<is_signal<S>, - signal_tag, value_tag>::type signal_or_value; - public: - typedef typename mpl::if_<is_reference_wrapper<S>, - reference_tag, - signal_or_value>::type type; - }; - - // Get the slot so that it can be copied - template<typename F> - typename F::weak_signal_type - get_invocable_slot(const F &signal, signal_tag) - { return typename F::weak_signal_type(signal); } - - template<typename F> - const F& - get_invocable_slot(const F& f, reference_tag) - { return f; } - - template<typename F> - const F& - get_invocable_slot(const F& f, value_tag) - { return f; } - - // Determines the type of the slot - is it a signal, a reference to a - // slot or just a normal slot. - template<typename F> - typename get_slot_tag<F>::type - tag_type(const F&) - { - typedef typename get_slot_tag<F>::type - the_tag_type; - the_tag_type tag = the_tag_type(); - return tag; - } - } // end namespace detail - } // end namespace signals2 -} // end namespace boost - -#endif // BOOST_SIGNALS2_SIGNALS_COMMON_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/signals_common_macros.hpp b/contrib/restricted/boost/boost/signals2/detail/signals_common_macros.hpp deleted file mode 100644 index acc0936281..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/signals_common_macros.hpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - Author: Frank Mori Hess <fmhess@users.sourceforge.net> - Begin: 2007-01-23 -*/ -// Copyright Frank Mori Hess 2007-2008 -// Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP -#define BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP - -#include <boost/config.hpp> - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - -#ifndef BOOST_SIGNALS2_MAX_ARGS -#define BOOST_SIGNALS2_MAX_ARGS 9 -#endif - -// signaln -#define BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity) BOOST_PP_CAT(signal, arity) -// weak_signaln -#define BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(arity) BOOST_PP_CAT(weak_, BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity)) -// signaln_impl -#define BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(arity) BOOST_PP_CAT(BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity), _impl) -// argn -#define BOOST_SIGNALS2_SIGNATURE_ARG_NAME(z, n, data) BOOST_PP_CAT(arg, BOOST_PP_INC(n)) -// Tn argn -#define BOOST_SIGNALS2_SIGNATURE_FULL_ARG(z, n, data) \ - BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~) -// T1 arg1, T2 arg2, ..., Tn argn -#define BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(arity) \ - BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_FULL_ARG, ~) -// arg1, arg2, ..., argn -#define BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_ARG_NAME, ~) -// T1, T2, ..., TN -#define BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T) -// R (T1, T2, ..., TN) -#define BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(arity) \ - R ( BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) ) -// typename prefixR, typename prefixT1, typename prefixT2, ..., typename prefixTN -#define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(arity, prefix) \ - typename BOOST_PP_CAT(prefix, R) BOOST_PP_COMMA_IF(arity) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename BOOST_PP_CAT(prefix, T)) -// typename R, typename T1, typename T2, ..., typename TN -#define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity) \ - typename R BOOST_PP_COMMA_IF(arity) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename T) -// typename prefixT1, typename prefixT2, ..., typename prefixTN -#define BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(arity, prefix) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename BOOST_PP_CAT(prefix, T)) -// typename T1, typename T2, ..., typename TN -#define BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(arity) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename T) -// prefixR, prefixT1, prefixT2, ..., prefixTN -#define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(arity, prefix) \ - BOOST_PP_CAT(prefix, R) BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), BOOST_PP_CAT(prefix, T)) -// R, T1, T2, ..., TN -#define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) \ - R BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T) -// boost::functionN<R, T1, T2, ..., TN> -#define BOOST_SIGNALS2_FUNCTION_N_DECL(arity) BOOST_PP_CAT(boost::function, arity)<\ - BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) > -// R, const boost::signals2::connection&, T1, T2, ..., TN -#define BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity) \ - R, const boost::signals2::connection& BOOST_PP_COMMA_IF(arity) \ - BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T) -// boost::functionN<R, const boost::signals2::connection &, T1, T2, ..., TN> -#define BOOST_SIGNALS2_EXT_FUNCTION_N_DECL(arity) BOOST_PP_CAT(boost::function, BOOST_PP_INC(arity))<\ - BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity) > -// slotN -#define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) BOOST_PP_CAT(slot, arity) -// slotN+1<R, const connection &, T1, T2, ..., TN, extended_slot_function_type> -#define BOOST_SIGNALS2_EXTENDED_SLOT_TYPE(arity) \ - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_PP_INC(arity))< \ - BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity), \ - extended_slot_function_type> -// bound_extended_slot_functionN -#define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) BOOST_PP_CAT(bound_extended_slot_function, arity) -// bound_extended_slot_function_helperN -#define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) BOOST_PP_CAT(bound_extended_slot_function_invoker, arity) -// typename function_traits<Signature>::argn_type -#define BOOST_SIGNALS2_SIGNATURE_TO_ARGN_TYPE(z, n, Signature) \ - BOOST_PP_CAT(BOOST_PP_CAT(typename function_traits<Signature>::arg, BOOST_PP_INC(n)), _type) -// typename function_traits<Signature>::result_type, -// typename function_traits<Signature>::arg1_type, -// typename function_traits<Signature>::arg2_type, -// ..., -// typename function_traits<Signature>::argn_type -#define BOOST_SIGNALS2_PORTABLE_SIGNATURE(arity, Signature) \ - typename function_traits<Signature>::result_type \ - BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_TO_ARGN_TYPE, Signature) -// prefixTn & argn -#define BOOST_SIGNALS2_PREFIXED_FULL_REF_ARG(z, n, prefix) \ - BOOST_PP_CAT(BOOST_PP_CAT(prefix, T), BOOST_PP_INC(n)) & BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~) -// prefixT1 & arg1, prefixT2 & arg2, ..., prefixTn & argn -#define BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(arity, prefix) \ - BOOST_PP_ENUM(arity, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARG, prefix) -// Tn & argn -#define BOOST_SIGNALS2_FULL_CREF_ARG(z, n, data) \ - const BOOST_PP_CAT(T, BOOST_PP_INC(n)) & BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~) -// const T1 & arg1, const T2 & arg2, ..., const Tn & argn -#define BOOST_SIGNALS2_FULL_FORWARD_ARGS(arity) \ - BOOST_PP_ENUM(arity, BOOST_SIGNALS2_FULL_CREF_ARG, ~) -#define BOOST_SIGNALS2_FORWARDED_ARGS(arity) \ - BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) -// preprocessed_arg_typeN -#define BOOST_SIGNALS2_PREPROCESSED_ARG_N_TYPE_CLASS_NAME(arity) BOOST_PP_CAT(preprocessed_arg_type, arity) - -// typename R, typename T1, typename T2, ..., typename TN, typename SlotFunction -#define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(arity) \ - BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \ - typename SlotFunction -#define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION - -// typename R, typename T1, typename T2, ..., typename TN, typename Combiner, ... -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity) \ - BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \ - typename Combiner, \ - typename Group, \ - typename GroupCompare, \ - typename SlotFunction, \ - typename ExtendedSlotFunction, \ - typename Mutex -// typename R, typename T1, typename T2, ..., typename TN, typename Combiner = optional_last_value<R>, ... -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DEFAULTED_DECL(arity) \ - BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \ - typename Combiner = optional_last_value<R>, \ - typename Group = int, \ - typename GroupCompare = std::less<Group>, \ - typename SlotFunction = BOOST_SIGNALS2_FUNCTION_N_DECL(arity), \ - typename ExtendedSlotFunction = BOOST_SIGNALS2_EXT_FUNCTION_N_DECL(arity), \ - typename Mutex = signals2::mutex -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(arity) BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity) -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION - -#define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE std_functional_base - -#define BOOST_SIGNALS2_PP_COMMA_IF(arity) BOOST_PP_COMMA_IF(arity) - -#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES - -#define BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity) signal -#define BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(arity) weak_signal -#define BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(arity) signal_impl -#define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity) typename Signature -#define BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) Args... -#define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) R (Args...) -#define BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(arity) R (Args...) -#define BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(arity) typename ... Args -#define BOOST_SIGNALS2_FULL_FORWARD_ARGS(arity) Args && ... args -#define BOOST_SIGNALS2_FORWARDED_ARGS(arity) std::forward<Args>(args)... -#define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) slot -#define BOOST_SIGNALS2_EXTENDED_SLOT_TYPE(arity) slot<R (const connection &, Args...), extended_slot_function_type> -#define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) bound_extended_slot_function -#define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) bound_extended_slot_function_invoker -#define BOOST_SIGNALS2_FUNCTION_N_DECL(arity) boost::function<Signature> -#define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(arity, prefix) typename prefixSignature -#define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(arity, prefix) prefixSignature -#define BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(arity) Args ... args -#define BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) args... -#define BOOST_SIGNALS2_PORTABLE_SIGNATURE(arity, Signature) Signature - -#define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(arity) \ - typename SlotFunction, \ - typename R, \ - typename ... Args -#define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION \ - <R (Args...), SlotFunction> - -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity) \ - typename Signature, \ - typename Combiner, \ - typename Group, \ - typename GroupCompare, \ - typename SlotFunction, \ - typename ExtendedSlotFunction, \ - typename Mutex -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DEFAULTED_DECL(arity) \ - typename Signature, \ - typename Combiner = optional_last_value<typename boost::function_traits<Signature>::result_type>, \ - typename Group = int, \ - typename GroupCompare = std::less<Group>, \ - typename SlotFunction = boost::function<Signature>, \ - typename ExtendedSlotFunction = typename detail::variadic_extended_signature<Signature>::function_type, \ - typename Mutex = signals2::mutex -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(arity) \ - typename Combiner, \ - typename Group, \ - typename GroupCompare, \ - typename SlotFunction, \ - typename ExtendedSlotFunction, \ - typename Mutex, \ - typename R, \ - typename ... Args -#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION <\ - R (Args...), \ - Combiner, \ - Group, \ - GroupCompare, \ - SlotFunction, \ - ExtendedSlotFunction, \ - Mutex> - -#define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE \ - std_functional_base<Args...> - -#define BOOST_SIGNALS2_PP_COMMA_IF(arity) , - -#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES - -#endif // BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/slot_call_iterator.hpp b/contrib/restricted/boost/boost/signals2/detail/slot_call_iterator.hpp deleted file mode 100644 index 769f6c222d..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/slot_call_iterator.hpp +++ /dev/null @@ -1,196 +0,0 @@ -// Boost.Signals2 library - -// Copyright Douglas Gregor 2001-2004. -// Copyright Frank Mori Hess 2007-2008. -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SLOT_CALL_ITERATOR_HPP -#define BOOST_SIGNALS2_SLOT_CALL_ITERATOR_HPP - -#include <boost/assert.hpp> -#include <boost/aligned_storage.hpp> -#include <boost/core/no_exceptions_support.hpp> -#include <boost/iterator/iterator_facade.hpp> -#include <boost/optional.hpp> -#include <boost/scoped_ptr.hpp> -#include <boost/signals2/connection.hpp> -#include <boost/signals2/slot_base.hpp> -#include <boost/signals2/detail/auto_buffer.hpp> -#include <boost/signals2/detail/unique_lock.hpp> -#include <boost/type_traits/add_const.hpp> -#include <boost/type_traits/add_reference.hpp> -#include <boost/weak_ptr.hpp> - -namespace boost { - namespace signals2 { - namespace detail { - template<typename ResultType, typename Function> - class slot_call_iterator_cache - { - public: - slot_call_iterator_cache(const Function &f_arg): - f(f_arg), - connected_slot_count(0), - disconnected_slot_count(0), - m_active_slot(0) - {} - - ~slot_call_iterator_cache() - { - if(m_active_slot) - { - garbage_collecting_lock<connection_body_base> lock(*m_active_slot); - m_active_slot->dec_slot_refcount(lock); - } - } - - template<typename M> - void set_active_slot(garbage_collecting_lock<M> &lock, - connection_body_base *active_slot) - { - if(m_active_slot) - m_active_slot->dec_slot_refcount(lock); - m_active_slot = active_slot; - if(m_active_slot) - m_active_slot->inc_slot_refcount(lock); - } - - optional<ResultType> result; - typedef auto_buffer<void_shared_ptr_variant, store_n_objects<10> > tracked_ptrs_type; - tracked_ptrs_type tracked_ptrs; - Function f; - unsigned connected_slot_count; - unsigned disconnected_slot_count; - connection_body_base *m_active_slot; - }; - - // Generates a slot call iterator. Essentially, this is an iterator that: - // - skips over disconnected slots in the underlying list - // - calls the connected slots when dereferenced - // - caches the result of calling the slots - template<typename Function, typename Iterator, typename ConnectionBody> - class slot_call_iterator_t - : public boost::iterator_facade<slot_call_iterator_t<Function, Iterator, ConnectionBody>, - typename Function::result_type, - boost::single_pass_traversal_tag, - typename boost::add_reference<typename boost::add_const<typename Function::result_type>::type>::type > - { - typedef boost::iterator_facade<slot_call_iterator_t<Function, Iterator, ConnectionBody>, - typename Function::result_type, - boost::single_pass_traversal_tag, - typename boost::add_reference<typename boost::add_const<typename Function::result_type>::type>::type > - inherited; - - typedef typename Function::result_type result_type; - - typedef slot_call_iterator_cache<result_type, Function> cache_type; - - friend class boost::iterator_core_access; - - public: - slot_call_iterator_t(Iterator iter_in, Iterator end_in, - cache_type &c): - iter(iter_in), end(end_in), - cache(&c), callable_iter(end_in) - { - lock_next_callable(); - } - - typename inherited::reference - dereference() const - { - if (!cache->result) { - BOOST_TRY - { - cache->result.reset(cache->f(*iter)); - } - BOOST_CATCH(expired_slot &) - { - (*iter)->disconnect(); - BOOST_RETHROW - } - BOOST_CATCH_END - } - return cache->result.get(); - } - - void increment() - { - ++iter; - lock_next_callable(); - cache->result.reset(); - } - - bool equal(const slot_call_iterator_t& other) const - { - return iter == other.iter; - } - - private: - typedef garbage_collecting_lock<connection_body_base> lock_type; - - void set_callable_iter(lock_type &lock, Iterator newValue) const - { - callable_iter = newValue; - if(callable_iter == end) - cache->set_active_slot(lock, 0); - else - cache->set_active_slot(lock, (*callable_iter).get()); - } - - void lock_next_callable() const - { - if(iter == callable_iter) - { - return; - } - if(iter == end) - { - if(callable_iter != end) - { - lock_type lock(**callable_iter); - set_callable_iter(lock, end); - return; - } - } - // we're only locking the first connection body, - // but it doesn't matter they all use the same mutex - lock_type lock(**iter); - for(;iter != end; ++iter) - { - cache->tracked_ptrs.clear(); - (*iter)->nolock_grab_tracked_objects(lock, std::back_inserter(cache->tracked_ptrs)); - if((*iter)->nolock_nograb_connected()) - { - ++cache->connected_slot_count; - }else - { - ++cache->disconnected_slot_count; - } - if((*iter)->nolock_nograb_blocked() == false) - { - set_callable_iter(lock, iter); - break; - } - } - if(iter == end) - { - set_callable_iter(lock, end); - } - } - - mutable Iterator iter; - Iterator end; - cache_type *cache; - mutable Iterator callable_iter; - }; - } // end namespace detail - } // end namespace BOOST_SIGNALS_NAMESPACE -} // end namespace boost - -#endif // BOOST_SIGNALS2_SLOT_CALL_ITERATOR_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/slot_groups.hpp b/contrib/restricted/boost/boost/signals2/detail/slot_groups.hpp deleted file mode 100644 index 5e1853a518..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/slot_groups.hpp +++ /dev/null @@ -1,235 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2008. -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SLOT_GROUPS_HPP -#define BOOST_SIGNALS2_SLOT_GROUPS_HPP - -#include <boost/signals2/connection.hpp> -#include <boost/optional.hpp> -#include <list> -#include <map> -#include <utility> - -namespace boost { - namespace signals2 { - namespace detail { - enum slot_meta_group {front_ungrouped_slots, grouped_slots, back_ungrouped_slots}; - template<typename Group> - struct group_key - { - typedef std::pair<enum slot_meta_group, boost::optional<Group> > type; - }; - template<typename Group, typename GroupCompare> - class group_key_less - { - public: - group_key_less() - {} - group_key_less(const GroupCompare &group_compare): _group_compare(group_compare) - {} - bool operator ()(const typename group_key<Group>::type &key1, const typename group_key<Group>::type &key2) const - { - if(key1.first != key2.first) return key1.first < key2.first; - if(key1.first != grouped_slots) return false; - return _group_compare(key1.second.get(), key2.second.get()); - } - private: - GroupCompare _group_compare; - }; - template<typename Group, typename GroupCompare, typename ValueType> - class grouped_list - { - public: - typedef group_key_less<Group, GroupCompare> group_key_compare_type; - private: - typedef std::list<ValueType> list_type; - typedef std::map - < - typename group_key<Group>::type, - typename list_type::iterator, - group_key_compare_type - > map_type; - typedef typename map_type::iterator map_iterator; - typedef typename map_type::const_iterator const_map_iterator; - public: - typedef typename list_type::iterator iterator; - typedef typename list_type::const_iterator const_iterator; - typedef typename group_key<Group>::type group_key_type; - - grouped_list(const group_key_compare_type &group_key_compare): - _group_key_compare(group_key_compare) - {} - grouped_list(const grouped_list &other): _list(other._list), - _group_map(other._group_map), _group_key_compare(other._group_key_compare) - { - // fix up _group_map - typename map_type::const_iterator other_map_it; - typename list_type::iterator this_list_it = _list.begin(); - typename map_type::iterator this_map_it = _group_map.begin(); - for(other_map_it = other._group_map.begin(); - other_map_it != other._group_map.end(); - ++other_map_it, ++this_map_it) - { - BOOST_ASSERT(this_map_it != _group_map.end()); - this_map_it->second = this_list_it; - typename list_type::const_iterator other_list_it = other.get_list_iterator(other_map_it); - typename map_type::const_iterator other_next_map_it = other_map_it; - ++other_next_map_it; - typename list_type::const_iterator other_next_list_it = other.get_list_iterator(other_next_map_it); - while(other_list_it != other_next_list_it) - { - ++other_list_it; - ++this_list_it; - } - } - } - iterator begin() - { - return _list.begin(); - } - iterator end() - { - return _list.end(); - } - iterator lower_bound(const group_key_type &key) - { - map_iterator map_it = _group_map.lower_bound(key); - return get_list_iterator(map_it); - } - iterator upper_bound(const group_key_type &key) - { - map_iterator map_it = _group_map.upper_bound(key); - return get_list_iterator(map_it); - } - void push_front(const group_key_type &key, const ValueType &value) - { - map_iterator map_it; - if(key.first == front_ungrouped_slots) - {// optimization - map_it = _group_map.begin(); - }else - { - map_it = _group_map.lower_bound(key); - } - m_insert(map_it, key, value); - } - void push_back(const group_key_type &key, const ValueType &value) - { - map_iterator map_it; - if(key.first == back_ungrouped_slots) - {// optimization - map_it = _group_map.end(); - }else - { - map_it = _group_map.upper_bound(key); - } - m_insert(map_it, key, value); - } - void erase(const group_key_type &key) - { - map_iterator map_it = _group_map.lower_bound(key); - iterator begin_list_it = get_list_iterator(map_it); - iterator end_list_it = upper_bound(key); - if(begin_list_it != end_list_it) - { - _list.erase(begin_list_it, end_list_it); - _group_map.erase(map_it); - } - } - iterator erase(const group_key_type &key, const iterator &it) - { - BOOST_ASSERT(it != _list.end()); - map_iterator map_it = _group_map.lower_bound(key); - BOOST_ASSERT(map_it != _group_map.end()); - BOOST_ASSERT(weakly_equivalent(map_it->first, key)); - if(map_it->second == it) - { - iterator next = it; - ++next; - // if next is in same group - if(next != upper_bound(key)) - { - _group_map[key] = next; - }else - { - _group_map.erase(map_it); - } - } - return _list.erase(it); - } - void clear() - { - _list.clear(); - _group_map.clear(); - } - private: - /* Suppress default assignment operator, since it has the wrong semantics. */ - grouped_list& operator=(const grouped_list &other); - - bool weakly_equivalent(const group_key_type &arg1, const group_key_type &arg2) - { - if(_group_key_compare(arg1, arg2)) return false; - if(_group_key_compare(arg2, arg1)) return false; - return true; - } - void m_insert(const map_iterator &map_it, const group_key_type &key, const ValueType &value) - { - iterator list_it = get_list_iterator(map_it); - iterator new_it = _list.insert(list_it, value); - if(map_it != _group_map.end() && weakly_equivalent(key, map_it->first)) - { - _group_map.erase(map_it); - } - map_iterator lower_bound_it = _group_map.lower_bound(key); - if(lower_bound_it == _group_map.end() || - weakly_equivalent(lower_bound_it->first, key) == false) - { - /* doing the following instead of just - _group_map[key] = new_it; - to avoid bogus error when enabling checked iterators with g++ */ - _group_map.insert(typename map_type::value_type(key, new_it)); - } - } - iterator get_list_iterator(const const_map_iterator &map_it) - { - iterator list_it; - if(map_it == _group_map.end()) - { - list_it = _list.end(); - }else - { - list_it = map_it->second; - } - return list_it; - } - const_iterator get_list_iterator(const const_map_iterator &map_it) const - { - const_iterator list_it; - if(map_it == _group_map.end()) - { - list_it = _list.end(); - }else - { - list_it = map_it->second; - } - return list_it; - } - - list_type _list; - // holds iterators to first list item in each group - map_type _group_map; - group_key_compare_type _group_key_compare; - }; - } // end namespace detail - enum connect_position { at_back, at_front }; - } // end namespace signals2 -} // end namespace boost - -#endif // BOOST_SIGNALS2_SLOT_GROUPS_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/slot_template.hpp b/contrib/restricted/boost/boost/signals2/detail/slot_template.hpp deleted file mode 100644 index 1c17c5b76a..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/slot_template.hpp +++ /dev/null @@ -1,187 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2008. -// Copyright Timmo Stange 2007. -// Copyright Douglas Gregor 2001-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -// This file is included iteratively, and should not be protected from multiple inclusion - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES -#define BOOST_SIGNALS2_NUM_ARGS BOOST_PP_ITERATION() -#else -#define BOOST_SIGNALS2_NUM_ARGS 1 -#endif - - -namespace boost -{ - namespace signals2 - { -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - template<typename Signature, typename SlotFunction> class slot; -#else - template<typename Signature, typename SlotFunction = boost::function<Signature> > - class slot; - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1900) - template<typename Signature, typename SlotFunction> class slot{}; -#endif -#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES - - template<BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(BOOST_SIGNALS2_NUM_ARGS)> - class BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION - : public slot_base, public detail::BOOST_SIGNALS2_STD_FUNCTIONAL_BASE - - { - public: - template<BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS, Other), typename OtherSlotFunction> - friend class BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS); - - typedef SlotFunction slot_function_type; - typedef R result_type; - typedef typename mpl::identity<BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(BOOST_SIGNALS2_NUM_ARGS)>::type signature_type; - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - -// typedef Tn argn_type; -#define BOOST_SIGNALS2_MISC_STATEMENT(z, n, data) \ - typedef BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type); - BOOST_PP_REPEAT(BOOST_SIGNALS2_NUM_ARGS, BOOST_SIGNALS2_MISC_STATEMENT, ~) -#undef BOOST_SIGNALS2_MISC_STATEMENT -#if BOOST_SIGNALS2_NUM_ARGS == 1 - typedef arg1_type argument_type; -#elif BOOST_SIGNALS2_NUM_ARGS == 2 - typedef arg1_type first_argument_type; - typedef arg2_type second_argument_type; -#endif - - template<unsigned n> class arg : public - detail::BOOST_SIGNALS2_PREPROCESSED_ARG_N_TYPE_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <n BOOST_SIGNALS2_PP_COMMA_IF(BOOST_SIGNALS2_NUM_ARGS) - BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(BOOST_SIGNALS2_NUM_ARGS)> - {}; - - BOOST_STATIC_CONSTANT(int, arity = BOOST_SIGNALS2_NUM_ARGS); - -#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES - - template<unsigned n> class arg - { - public: - typedef typename detail::variadic_arg_type<n, Args...>::type type; - }; - BOOST_STATIC_CONSTANT(int, arity = sizeof...(Args)); - -#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES - - template<typename F> - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)(const F& f) - { - init_slot_function(f); - } - // copy constructors -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - template<BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS, Other), typename OtherSlotFunction> - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)(const BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) - <BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(BOOST_SIGNALS2_NUM_ARGS, Other), OtherSlotFunction> &other_slot): - slot_base(other_slot), _slot_function(other_slot._slot_function) - { - } -#endif - template<typename Signature, typename OtherSlotFunction> - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)(const slot<Signature, OtherSlotFunction> &other_slot): - slot_base(other_slot), _slot_function(other_slot._slot_function) - { - } - // bind syntactic sugar - BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTORS - // invocation - R operator()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) - { - locked_container_type locked_objects = lock(); - return _slot_function(BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - } - R operator()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const - { - locked_container_type locked_objects = lock(); - return _slot_function(BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(BOOST_SIGNALS2_NUM_ARGS)); - } - // tracking - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)& track(const weak_ptr<void> &tracked) { - _tracked_objects.push_back(tracked); - return *this; - } - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)& track(const signal_base &signal) - { - track_signal(signal); - return *this; - } - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)& track(const slot_base &slot) - { - tracked_container_type::const_iterator it; - for(it = slot.tracked_objects().begin(); it != slot.tracked_objects().end(); ++it) - { - _tracked_objects.push_back(*it); - } - return *this; - } - template<typename ForeignWeakPtr> - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)& track_foreign(const ForeignWeakPtr &tracked, - typename weak_ptr_traits<ForeignWeakPtr>::shared_type * /*SFINAE*/ = 0) - { - _tracked_objects.push_back(detail::foreign_void_weak_ptr(tracked)); - return *this; - } - template<typename ForeignSharedPtr> - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)& track_foreign(const ForeignSharedPtr &tracked, - typename shared_ptr_traits<ForeignSharedPtr>::weak_type * /*SFINAE*/ = 0) - { - _tracked_objects.push_back - ( - detail::foreign_void_weak_ptr - ( - typename shared_ptr_traits<ForeignSharedPtr>::weak_type(tracked) - ) - ); - return *this; - } - - const slot_function_type& slot_function() const {return _slot_function;} - slot_function_type& slot_function() {return _slot_function;} - private: - template<typename F> - void init_slot_function(const F& f) - { - _slot_function = detail::get_invocable_slot(f, detail::tag_type(f)); - signals2::detail::tracked_objects_visitor visitor(this); - boost::visit_each(visitor, f); - } - - SlotFunction _slot_function; - }; - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - namespace detail - { - template<unsigned arity, typename Signature, typename SlotFunction> - class slotN; - // partial template specialization - template<typename Signature, typename SlotFunction> - class slotN<BOOST_SIGNALS2_NUM_ARGS, Signature, SlotFunction> - { - public: - typedef BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)< - BOOST_SIGNALS2_PORTABLE_SIGNATURE(BOOST_SIGNALS2_NUM_ARGS, Signature), - SlotFunction> type; - }; - } -#endif - } // end namespace signals2 -} // end namespace boost - -#undef BOOST_SIGNALS2_NUM_ARGS diff --git a/contrib/restricted/boost/boost/signals2/detail/tracked_objects_visitor.hpp b/contrib/restricted/boost/boost/signals2/detail/tracked_objects_visitor.hpp deleted file mode 100644 index 9ff2191b87..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/tracked_objects_visitor.hpp +++ /dev/null @@ -1,98 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2008. -// Copyright Timmo Stange 2007. -// Copyright Douglas Gregor 2001-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_TRACKED_OBJECTS_VISITOR_HPP -#define BOOST_SIGNALS2_TRACKED_OBJECTS_VISITOR_HPP - -#include <boost/mpl/bool.hpp> -#include <boost/ref.hpp> -#include <boost/signals2/detail/signals_common.hpp> -#include <boost/signals2/slot_base.hpp> -#include <boost/signals2/trackable.hpp> -#include <boost/type_traits/is_function.hpp> -#include <boost/type_traits/is_pointer.hpp> -#include <boost/type_traits/remove_pointer.hpp> -#include <boost/utility/addressof.hpp> - -namespace boost -{ - namespace signals2 - { - namespace detail - { - // Visitor to collect tracked objects from a bound function. - class tracked_objects_visitor - { - public: - tracked_objects_visitor(slot_base *slot) : slot_(slot) - {} - template<typename T> - void operator()(const T& t) const - { - m_visit_reference_wrapper(t, mpl::bool_<is_reference_wrapper<T>::value>()); - } - private: - template<typename T> - void m_visit_reference_wrapper(const reference_wrapper<T> &t, const mpl::bool_<true> &) const - { - m_visit_pointer(t.get_pointer(), mpl::bool_<true>()); - } - template<typename T> - void m_visit_reference_wrapper(const T &t, const mpl::bool_<false> &) const - { - m_visit_pointer(t, mpl::bool_<is_pointer<T>::value>()); - } - template<typename T> - void m_visit_pointer(const T &t, const mpl::bool_<true> &) const - { - m_visit_not_function_pointer(t, mpl::bool_<!is_function<typename remove_pointer<T>::type>::value>()); - } - template<typename T> - void m_visit_pointer(const T &t, const mpl::bool_<false> &) const - { - m_visit_pointer(boost::addressof(t), mpl::bool_<true>()); - } - template<typename T> - void m_visit_not_function_pointer(const T *t, const mpl::bool_<true> &) const - { - m_visit_signal(t, mpl::bool_<is_signal<T>::value>()); - } - template<typename T> - void m_visit_not_function_pointer(const T &, const mpl::bool_<false> &) const - {} - template<typename T> - void m_visit_signal(const T *signal, const mpl::bool_<true> &) const - { - if(signal) - slot_->track_signal(*signal); - } - template<typename T> - void m_visit_signal(const T &t, const mpl::bool_<false> &) const - { - add_if_trackable(t); - } - void add_if_trackable(const trackable *trackable) const - { - if(trackable) - slot_->_tracked_objects.push_back(trackable->get_weak_ptr()); - } - void add_if_trackable(const void *) const {} - - mutable slot_base * slot_; - }; - - - } // end namespace detail - } // end namespace signals2 -} // end namespace boost - -#endif // BOOST_SIGNALS2_TRACKED_OBJECTS_VISITOR_HPP - diff --git a/contrib/restricted/boost/boost/signals2/detail/unique_lock.hpp b/contrib/restricted/boost/boost/signals2/detail/unique_lock.hpp deleted file mode 100644 index 13fecf295d..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/unique_lock.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - Provides a basic subset of boost::unique_lock functionality. Provided only because - including boost/thread/locks.hpp requires linking to thread library -*/ -// Copyright Frank Mori Hess 2008. -// Distributed under the 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/signals2 for library home page. - -#ifndef BOOST_SIGNALS2_UNIQUE_LOCK_HPP -#define BOOST_SIGNALS2_UNIQUE_LOCK_HPP - -#include <boost/noncopyable.hpp> - -namespace boost -{ - namespace signals2 - { - namespace detail - { - template<typename Mutex> - class unique_lock: public noncopyable - { - public: - unique_lock(Mutex &m): _mutex(m) - { - _mutex.lock(); - } - ~unique_lock() - { - _mutex.unlock(); - } - private: - Mutex &_mutex; - }; - } // namespace detail - } // namespace signals2 -} // namespace boost - -#endif // BOOST_SIGNALS2_UNIQUE_LOCK_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/variadic_arg_type.hpp b/contrib/restricted/boost/boost/signals2/detail/variadic_arg_type.hpp deleted file mode 100644 index 6079c16332..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/variadic_arg_type.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright Frank Mori Hess 2009 -// -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_DETAIL_VARIADIC_ARG_TYPE_HPP -#define BOOST_SIGNALS2_DETAIL_VARIADIC_ARG_TYPE_HPP - -#include <functional> - -namespace boost -{ - namespace signals2 - { - namespace detail - { - template<unsigned, typename ... Args> class variadic_arg_type; - - template<typename T, typename ... Args> class variadic_arg_type<0, T, Args...> - { - public: - typedef T type; - }; - - template<unsigned n, typename T, typename ... Args> class variadic_arg_type<n, T, Args...> - { - public: - typedef typename variadic_arg_type<n - 1, Args...>::type type; - }; - - template <typename ... Args> - struct std_functional_base - {}; - template <typename T1> - struct std_functional_base<T1> - { - typedef T1 argument_type; - }; - template <typename T1, typename T2> - struct std_functional_base<T1, T2> - { - typedef T1 first_argument_type; - typedef T2 second_argument_type; - }; - } // namespace detail - } // namespace signals2 -} // namespace boost - - -#endif // BOOST_SIGNALS2_DETAIL_VARIADIC_ARG_TYPE_HPP diff --git a/contrib/restricted/boost/boost/signals2/detail/variadic_slot_invoker.hpp b/contrib/restricted/boost/boost/signals2/detail/variadic_slot_invoker.hpp deleted file mode 100644 index 59739b3f36..0000000000 --- a/contrib/restricted/boost/boost/signals2/detail/variadic_slot_invoker.hpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - Helper class used by variadic implementation of variadic boost::signals2::signal. - - Author: Frank Mori Hess <fmhess@users.sourceforge.net> - Begin: 2009-05-27 -*/ -// Copyright Frank Mori Hess 2009 -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_DETAIL_VARIADIC_SLOT_INVOKER_HPP -#define BOOST_SIGNALS2_DETAIL_VARIADIC_SLOT_INVOKER_HPP - -#include <boost/mpl/size_t.hpp> -#include <boost/signals2/detail/variadic_arg_type.hpp> - -// if compiler has std::tuple use it instead of boost::tuple -// because boost::tuple does not have variadic template support at present. -#ifdef BOOST_NO_CXX11_HDR_TUPLE -#include <boost/tuple/tuple.hpp> -#define BOOST_SIGNALS2_TUPLE boost::tuple -#define BOOST_SIGNALS2_GET boost::get -#else -#include <tuple> -#define BOOST_SIGNALS2_TUPLE std::tuple -#define BOOST_SIGNALS2_GET std::get -#endif - -// vc12 seems to erroneously report formal parameters as unreferenced (warning C4100) -// if parameters of variadic template functions are only referenced by calling -// other varadic template functions. silence these warnings: -#if defined(BOOST_MSVC) -#pragma warning(push) -#if BOOST_MSVC >= 1800 -#pragma warning(disable:4100) -#endif -#endif - -namespace boost -{ - namespace signals2 - { - namespace detail - { - template<unsigned ... values> class unsigned_meta_array {}; - - template<typename UnsignedMetaArray, unsigned n> class unsigned_meta_array_appender; - - template<unsigned n, unsigned ... Args> - class unsigned_meta_array_appender<unsigned_meta_array<Args...>, n> - { - public: - typedef unsigned_meta_array<Args..., n> type; - }; - - template<unsigned n> class make_unsigned_meta_array; - - template<> class make_unsigned_meta_array<0> - { - public: - typedef unsigned_meta_array<> type; - }; - - template<> class make_unsigned_meta_array<1> - { - public: - typedef unsigned_meta_array<0> type; - }; - - template<unsigned n> class make_unsigned_meta_array - { - public: - typedef typename unsigned_meta_array_appender<typename make_unsigned_meta_array<n-1>::type, n - 1>::type type; - }; - - template<typename R> - class call_with_tuple_args - { - public: - typedef R result_type; - - template<typename Func, typename ... Args, std::size_t N> - R operator()(Func &func, const BOOST_SIGNALS2_TUPLE<Args...> & args, mpl::size_t<N>) const - { - typedef typename make_unsigned_meta_array<N>::type indices_type; - return m_invoke<Func>(func, indices_type(), args); - } - private: - template<typename Func, unsigned ... indices, typename ... Args> - R m_invoke(Func &func, unsigned_meta_array<indices...>, const BOOST_SIGNALS2_TUPLE<Args...> & args, - typename boost::disable_if<boost::is_void<typename Func::result_type> >::type * = 0 - ) const - { - return func(BOOST_SIGNALS2_GET<indices>(args)...); - } - template<typename Func, unsigned ... indices, typename ... Args> - R m_invoke(Func &func, unsigned_meta_array<indices...>, const BOOST_SIGNALS2_TUPLE<Args...> & args, - typename boost::enable_if<boost::is_void<typename Func::result_type> >::type * = 0 - ) const - { - func(BOOST_SIGNALS2_GET<indices>(args)...); - return R(); - } - // This overload is redundant, as it is the same as the previous variadic method when - // it has zero "indices" or "Args" variadic template parameters. This overload - // only exists to quiet some unused parameter warnings - // on certain compilers (some versions of gcc and msvc) - template<typename Func> - R m_invoke(Func &func, unsigned_meta_array<>, const BOOST_SIGNALS2_TUPLE<> &, - typename boost::enable_if<boost::is_void<typename Func::result_type> >::type * = 0 - ) const - { - func(); - return R(); - } - }; - - template<typename R, typename ... Args> - class variadic_slot_invoker - { - public: - typedef R result_type; - - variadic_slot_invoker(Args & ... args): _args(args...) - {} - template<typename ConnectionBodyType> - result_type operator ()(const ConnectionBodyType &connectionBody) const - { - return call_with_tuple_args<result_type>()(connectionBody->slot().slot_function(), - _args, mpl::size_t<sizeof...(Args)>()); - } - private: - BOOST_SIGNALS2_TUPLE<Args& ...> _args; - }; - } // namespace detail - } // namespace signals2 -} // namespace boost - -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif - - -#endif // BOOST_SIGNALS2_DETAIL_VARIADIC_SLOT_INVOKER_HPP diff --git a/contrib/restricted/boost/boost/signals2/dummy_mutex.hpp b/contrib/restricted/boost/boost/signals2/dummy_mutex.hpp deleted file mode 100644 index f2600f1d70..0000000000 --- a/contrib/restricted/boost/boost/signals2/dummy_mutex.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// A model of the Lockable concept from Boost.Thread which -// does nothing. It can be passed as the Mutex template parameter -// for a signal, if the user wishes to disable thread-safety -// (presumably for performance reasons). - -// Copyright Frank Mori Hess 2008. -// Distributed under the 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/signals2 for library home page. - -#ifndef BOOST_SIGNALS2_DUMMY_MUTEX_HPP -#define BOOST_SIGNALS2_DUMMY_MUTEX_HPP - -namespace boost { - namespace signals2 { - class dummy_mutex - { - public: - void lock() {} - bool try_lock() {return true;} - void unlock() {} - }; - } // end namespace signals2 -} // end namespace boost - -#endif // BOOST_SIGNALS2_DUMMY_MUTEX_HPP diff --git a/contrib/restricted/boost/boost/signals2/expired_slot.hpp b/contrib/restricted/boost/boost/signals2/expired_slot.hpp deleted file mode 100644 index 9a6d4da9a1..0000000000 --- a/contrib/restricted/boost/boost/signals2/expired_slot.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2010. -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_EXPIRED_SLOT_HPP -#define BOOST_SIGNALS2_EXPIRED_SLOT_HPP - -#include <boost/smart_ptr/bad_weak_ptr.hpp> - -namespace boost -{ - namespace signals2 - { - class expired_slot: public bad_weak_ptr - { - public: - virtual char const * what() const noexcept - { - return "boost::signals2::expired_slot"; - } - }; - } -} // end namespace boost - -#endif // BOOST_SIGNALS2_EXPIRED_SLOT_HPP diff --git a/contrib/restricted/boost/boost/signals2/last_value.hpp b/contrib/restricted/boost/boost/signals2/last_value.hpp deleted file mode 100644 index 90333c938c..0000000000 --- a/contrib/restricted/boost/boost/signals2/last_value.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// last_value function object (documented as part of Boost.Signals) - -// Copyright Frank Mori Hess 2007. -// Copyright Douglas Gregor 2001-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_LAST_VALUE_HPP -#define BOOST_SIGNALS2_LAST_VALUE_HPP - -#include <boost/core/no_exceptions_support.hpp> -#include <boost/optional.hpp> -#include <boost/signals2/expired_slot.hpp> -#include <boost/throw_exception.hpp> -#include <stdexcept> - -namespace boost { - namespace signals2 { - - // no_slots_error is thrown when we are unable to generate a return value - // due to no slots being connected to the signal. - class no_slots_error: public std::exception - { - public: - virtual const char* what() const noexcept {return "boost::signals2::no_slots_error";} - }; - - template<typename T> - class last_value { - public: - typedef T result_type; - - template<typename InputIterator> - T operator()(InputIterator first, InputIterator last) const - { - if(first == last) - { - boost::throw_exception(no_slots_error()); - } - optional<T> value; - while (first != last) - { - BOOST_TRY - { - value = *first; - } - BOOST_CATCH(const expired_slot &) {} - BOOST_CATCH_END - ++first; - } - if(value) return value.get(); - boost::throw_exception(no_slots_error()); - } - }; - - template<> - class last_value<void> { - public: - typedef void result_type; - template<typename InputIterator> - result_type operator()(InputIterator first, InputIterator last) const - { - while (first != last) - { - BOOST_TRY - { - *first; - } - BOOST_CATCH(const expired_slot &) {} - BOOST_CATCH_END - ++first; - } - return; - } - }; - } // namespace signals2 -} // namespace boost -#endif // BOOST_SIGNALS2_LAST_VALUE_HPP diff --git a/contrib/restricted/boost/boost/signals2/mutex.hpp b/contrib/restricted/boost/boost/signals2/mutex.hpp deleted file mode 100644 index e58aca1c96..0000000000 --- a/contrib/restricted/boost/boost/signals2/mutex.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// -// boost/signals2/mutex.hpp - header-only mutex -// -// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2008 Frank Mori Hess -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// boost::signals2::mutex is a modification of -// boost::detail::lightweight_mutex to follow the newer Lockable -// concept of Boost.Thread. -// - -#ifndef BOOST_SIGNALS2_MUTEX_HPP -#define BOOST_SIGNALS2_MUTEX_HPP - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) -# pragma once -#endif - -#include <boost/config.hpp> - -#if !defined(BOOST_HAS_THREADS) -# include <boost/signals2/detail/lwm_nop.hpp> -#elif defined(BOOST_HAS_PTHREADS) -# include <boost/signals2/detail/lwm_pthreads.hpp> -#elif defined(BOOST_HAS_WINTHREADS) -# include <boost/signals2/detail/lwm_win32_cs.hpp> -#else -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform -#endif - -#endif // #ifndef BOOST_SIGNALS2_MUTEX_HPP diff --git a/contrib/restricted/boost/boost/signals2/optional_last_value.hpp b/contrib/restricted/boost/boost/signals2/optional_last_value.hpp deleted file mode 100644 index 812d152c73..0000000000 --- a/contrib/restricted/boost/boost/signals2/optional_last_value.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// optional_last_value function object (documented as part of Boost.Signals2) - -// Copyright Frank Mori Hess 2007-2008. -// Copyright Douglas Gregor 2001-2003. -// Distributed under the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/signals2 for library home page. - -#ifndef BOOST_SIGNALS2_OPTIONAL_LAST_VALUE_HPP -#define BOOST_SIGNALS2_OPTIONAL_LAST_VALUE_HPP - -#include <boost/core/no_exceptions_support.hpp> -#include <boost/optional.hpp> -#include <boost/signals2/expired_slot.hpp> - -namespace boost { - namespace signals2 { - - template<typename T> - class optional_last_value - { - public: - typedef optional<T> result_type; - - template<typename InputIterator> - optional<T> operator()(InputIterator first, InputIterator last) const - { - optional<T> value; - while (first != last) - { - BOOST_TRY - { - value = *first; - } - BOOST_CATCH(const expired_slot &) {} - BOOST_CATCH_END - ++first; - } - return value; - } - }; - - template<> - class optional_last_value<void> - { - public: - typedef void result_type; - template<typename InputIterator> - result_type operator()(InputIterator first, InputIterator last) const - { - while (first != last) - { - BOOST_TRY - { - *first; - } - BOOST_CATCH(const expired_slot &) {} - BOOST_CATCH_END - ++first; - } - return; - } - }; - } // namespace signals2 -} // namespace boost -#endif // BOOST_SIGNALS2_OPTIONAL_LAST_VALUE_HPP diff --git a/contrib/restricted/boost/boost/signals2/postconstructible.hpp b/contrib/restricted/boost/boost/signals2/postconstructible.hpp deleted file mode 100644 index f6422302b1..0000000000 --- a/contrib/restricted/boost/boost/signals2/postconstructible.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// DEPRECATED in favor of adl_postconstruct with deconstruct<T>(). -// A simple framework for creating objects with postconstructors. -// The objects must inherit from boost::signals2::postconstructible, and -// have their lifetimes managed by -// boost::shared_ptr created with the boost::signals2::deconstruct_ptr() -// function. -// -// Copyright Frank Mori Hess 2007-2008. -// -// Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_SIGNALS2_POSTCONSTRUCTIBLE_HPP -#define BOOST_SIGNALS2_POSTCONSTRUCTIBLE_HPP - -namespace boost -{ - template<typename T> class shared_ptr; - - namespace signals2 - { - namespace postconstructible_adl_barrier - { - class postconstructible; - } - namespace detail - { - void do_postconstruct(const boost::signals2::postconstructible_adl_barrier::postconstructible *ptr); - } // namespace detail - - namespace postconstructible_adl_barrier - { - class postconstructible - { - public: - friend void detail::do_postconstruct(const postconstructible *ptr); - template<typename T> - friend void adl_postconstruct(const shared_ptr<T> &, postconstructible *p) - { - p->postconstruct(); - } - protected: - postconstructible() {} - virtual ~postconstructible() {} - virtual void postconstruct() = 0; - }; - } // namespace postconstructible_adl_barrier - using postconstructible_adl_barrier::postconstructible; - - } -} - -#endif // BOOST_SIGNALS2_POSTCONSTRUCTIBLE_HPP diff --git a/contrib/restricted/boost/boost/signals2/predestructible.hpp b/contrib/restricted/boost/boost/signals2/predestructible.hpp deleted file mode 100644 index 0f6806dc6e..0000000000 --- a/contrib/restricted/boost/boost/signals2/predestructible.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// DEPRECATED in favor of adl_predestruct with deconstruct<T>(). -// A simple framework for creating objects with predestructors. -// The objects must inherit from boost::signals2::predestructible, and -// have their lifetimes managed by -// boost::shared_ptr created with the boost::signals2::deconstruct_ptr() -// function. -// -// Copyright Frank Mori Hess 2007-2008. -// -//Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_SIGNALS2_PREDESTRUCTIBLE_HPP -#define BOOST_SIGNALS2_PREDESTRUCTIBLE_HPP - -namespace boost -{ - namespace signals2 - { - template<typename T> class predestructing_deleter; - - namespace predestructible_adl_barrier - { - class predestructible - { - protected: - predestructible() {} - public: - template<typename T> - friend void adl_postconstruct(const shared_ptr<T> &, ...) - {} - friend void adl_predestruct(predestructible *p) - { - p->predestruct(); - } - virtual ~predestructible() {} - virtual void predestruct() = 0; - }; - } // namespace predestructible_adl_barrier - using predestructible_adl_barrier::predestructible; - } -} - -#endif // BOOST_SIGNALS2_PREDESTRUCTIBLE_HPP diff --git a/contrib/restricted/boost/boost/signals2/preprocessed_signal.hpp b/contrib/restricted/boost/boost/signals2/preprocessed_signal.hpp deleted file mode 100644 index 794c1be67e..0000000000 --- a/contrib/restricted/boost/boost/signals2/preprocessed_signal.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - A thread-safe version of Boost.Signals. - - Author: Frank Mori Hess <fmhess@users.sourceforge.net> - Begin: 2007-01-23 -*/ -// Copyright Frank Mori Hess 2007-2008 -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP -#define BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP - -#include <boost/preprocessor/arithmetic.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/control/expr_if.hpp> -#include <boost/preprocessor/iteration.hpp> -#include <boost/preprocessor/repetition.hpp> -#include <boost/signals2/detail/preprocessed_arg_type.hpp> -#include <boost/type_traits/add_reference.hpp> -#include <boost/type_traits/is_void.hpp> -#include <boost/utility/enable_if.hpp> - -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_SIGNALS2_MAX_ARGS) -#define BOOST_PP_FILENAME_1 <boost/signals2/detail/signal_template.hpp> -#include BOOST_PP_ITERATE() - -namespace boost -{ - namespace signals2 - { - template<typename Signature, - typename Combiner = optional_last_value<typename boost::function_traits<Signature>::result_type>, - typename Group = int, - typename GroupCompare = std::less<Group>, - typename SlotFunction = function<Signature>, - typename ExtendedSlotFunction = typename detail::extended_signature<function_traits<Signature>::arity, Signature>::function_type, - typename Mutex = mutex > - class signal: public detail::signalN<function_traits<Signature>::arity, - Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::type - { - private: - typedef typename detail::signalN<boost::function_traits<Signature>::arity, - Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::type base_type; - public: - signal(const Combiner &combiner_arg = Combiner(), const GroupCompare &group_compare = GroupCompare()): - base_type(combiner_arg, group_compare) - {} -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_WORKAROUND(BOOST_MSVC, < 1800) - signal(signal && other) : base_type(std::move(other)) {} - signal & operator=(signal && other) { base_type::operator=(std::move(other)); return *this; } -#endif - }; - } -} - -#endif // BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP diff --git a/contrib/restricted/boost/boost/signals2/preprocessed_slot.hpp b/contrib/restricted/boost/boost/signals2/preprocessed_slot.hpp deleted file mode 100644 index 322b1a14c5..0000000000 --- a/contrib/restricted/boost/boost/signals2/preprocessed_slot.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2009. -// Copyright Timmo Stange 2007. -// Copyright Douglas Gregor 2001-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP -#define BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP - -#include <boost/preprocessor/repetition.hpp> -#include <boost/signals2/detail/preprocessed_arg_type.hpp> -#include <boost/type_traits/function_traits.hpp> - -#ifndef BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS -#define BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS 10 -#endif - - -// template<typename Func, typename BindArgT0, typename BindArgT1, ..., typename BindArgTN-1> slotN(... -#define BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR(z, n, data) \ - template<typename Func, BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(n, BindArg)> \ - BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)( \ - const Func &func, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(n, const BindArg)) \ - { \ - init_slot_function(boost::bind(func, BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(n))); \ - } -#define BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTORS \ - BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR, ~) - - -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_INC(BOOST_SIGNALS2_MAX_ARGS)) -#define BOOST_PP_FILENAME_1 <boost/signals2/detail/slot_template.hpp> -#include BOOST_PP_ITERATE() - -#undef BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR -#undef BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTORS - -namespace boost -{ - namespace signals2 - { - template<typename Signature, - typename SlotFunction = boost::function<Signature> > - class slot: public detail::slotN<function_traits<Signature>::arity, - Signature, SlotFunction>::type - { - private: - typedef typename detail::slotN<boost::function_traits<Signature>::arity, - Signature, SlotFunction>::type base_type; - public: - template<typename F> - slot(const F& f): base_type(f) - {} - // bind syntactic sugar -// template<typename F, typename BindArgT0, typename BindArgT1, ..., typename BindArgTn-1> slot(... -#define BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR(z, n, data) \ - template<typename Func, BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(n, BindArg)> \ - slot(const Func &func, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(n, const BindArg)): \ - base_type(func, BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(n)) \ - {} - BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR, ~) -#undef BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR - }; - } // namespace signals2 -} - -#endif // BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP diff --git a/contrib/restricted/boost/boost/signals2/shared_connection_block.hpp b/contrib/restricted/boost/boost/signals2/shared_connection_block.hpp deleted file mode 100644 index c16bf9b9c0..0000000000 --- a/contrib/restricted/boost/boost/signals2/shared_connection_block.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2008. -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SHARED_CONNECTION_BLOCK_HPP -#define BOOST_SIGNALS2_SHARED_CONNECTION_BLOCK_HPP - -#include <boost/shared_ptr.hpp> -#include <boost/signals2/connection.hpp> -#include <boost/weak_ptr.hpp> - -namespace boost -{ - namespace signals2 - { - class shared_connection_block - { - public: - shared_connection_block(const signals2::connection &conn = signals2::connection(), - bool initially_blocked = true): - _weak_connection_body(conn._weak_connection_body) - { - if(initially_blocked) block(); - } - void block() - { - if(blocking()) return; - boost::shared_ptr<detail::connection_body_base> connection_body(_weak_connection_body.lock()); - if(connection_body == 0) - { - // Make _blocker non-empty so the blocking() method still returns the correct value - // after the connection has expired. - _blocker.reset(static_cast<int*>(0)); - return; - } - _blocker = connection_body->get_blocker(); - } - void unblock() - { - _blocker.reset(); - } - bool blocking() const - { - shared_ptr<void> empty; - return _blocker < empty || empty < _blocker; - } - signals2::connection connection() const - { - return signals2::connection(_weak_connection_body); - } - private: - boost::weak_ptr<detail::connection_body_base> _weak_connection_body; - shared_ptr<void> _blocker; - }; - } -} // end namespace boost - -#endif // BOOST_SIGNALS2_SHARED_CONNECTION_BLOCK_HPP diff --git a/contrib/restricted/boost/boost/signals2/signal.hpp b/contrib/restricted/boost/boost/signals2/signal.hpp deleted file mode 100644 index afdfa66343..0000000000 --- a/contrib/restricted/boost/boost/signals2/signal.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// A thread-safe version of Boost.Signals. - -// Copyright Frank Mori Hess 2007-2009 -// -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SIGNAL_HPP -#define BOOST_SIGNALS2_SIGNAL_HPP - -#include <algorithm> -#include <boost/assert.hpp> -#include <boost/config.hpp> -#include <boost/function.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/signals2/connection.hpp> -#include <boost/signals2/detail/unique_lock.hpp> -#include <boost/signals2/detail/replace_slot_function.hpp> -#include <boost/signals2/detail/result_type_wrapper.hpp> -#include <boost/signals2/detail/signals_common.hpp> -#include <boost/signals2/detail/signals_common_macros.hpp> -#include <boost/signals2/detail/slot_groups.hpp> -#include <boost/signals2/detail/slot_call_iterator.hpp> -#include <boost/signals2/optional_last_value.hpp> -#include <boost/signals2/mutex.hpp> -#include <boost/signals2/slot.hpp> -#include <functional> - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES -#include <boost/signals2/preprocessed_signal.hpp> -#else -#include <boost/signals2/variadic_signal.hpp> -#endif - -namespace boost -{ - namespace signals2 - { - // free swap function, findable by ADL - template<typename Signature, - typename Combiner, - typename Group, - typename GroupCompare, - typename SlotFunction, - typename ExtendedSlotFunction, - typename Mutex> - void swap( - signal<Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex> &sig1, - signal<Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex> &sig2) - { - sig1.swap(sig2); - } - } -} - -#endif // BOOST_SIGNALS2_SIGNAL_HPP diff --git a/contrib/restricted/boost/boost/signals2/signal_base.hpp b/contrib/restricted/boost/boost/signals2/signal_base.hpp deleted file mode 100644 index 05b6b5fd6f..0000000000 --- a/contrib/restricted/boost/boost/signals2/signal_base.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2008. -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SIGNAL_BASE_HPP -#define BOOST_SIGNALS2_SIGNAL_BASE_HPP - -#include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> - -namespace boost { - namespace signals2 { - class slot_base; - - class signal_base : public noncopyable - { - public: - friend class slot_base; - - virtual ~signal_base() {} - protected: - virtual shared_ptr<void> lock_pimpl() const = 0; - }; - } // end namespace signals2 -} // end namespace boost - -#endif // BOOST_SIGNALS2_SIGNAL_BASE_HPP diff --git a/contrib/restricted/boost/boost/signals2/signal_type.hpp b/contrib/restricted/boost/boost/signals2/signal_type.hpp deleted file mode 100644 index 4de5396fe2..0000000000 --- a/contrib/restricted/boost/boost/signals2/signal_type.hpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - A meta function which supports using named template type parameters - via Boost.Parameter to specify the template type parameters for - the boost::signals2::signal class. - - Author: Frank Mori Hess <fmhess@users.sourceforge.net> - Begin: 2009-01-22 -*/ -// Copyright Frank Mori Hess 2009 -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SIGNAL_TYPE_HPP -#define BOOST_SIGNALS2_SIGNAL_TYPE_HPP - -// support for function types is currently broken in Boost.Parameter -// #define BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER - -#include <boost/signals2/signal.hpp> - -#if !defined(BOOST_PARAMETER_MAX_ARITY) -#define BOOST_PARAMETER_MAX_ARITY 7 -#else -#if BOOST_PARAMETER_MAX_ARITY < 7 -#error This header requires BOOST_PARAMETER_MAX_ARITY to be defined as 7 or greater prior to including Boost.Parameter headers -#endif // BOOST_PARAMETER_MAX_ARITY < 7 -#endif // !defined(BOOST_PARAMETER_MAX_ARITY) -#include <boost/parameter.hpp> - -#include <boost/type_traits/is_function.hpp> - -namespace boost -{ - namespace signals2 - { - namespace keywords - { -#ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER - BOOST_PARAMETER_TEMPLATE_KEYWORD(signature_type) -#endif - BOOST_PARAMETER_TEMPLATE_KEYWORD(combiner_type) - BOOST_PARAMETER_TEMPLATE_KEYWORD(group_type) - BOOST_PARAMETER_TEMPLATE_KEYWORD(group_compare_type) - BOOST_PARAMETER_TEMPLATE_KEYWORD(slot_function_type) - BOOST_PARAMETER_TEMPLATE_KEYWORD(extended_slot_function_type) - BOOST_PARAMETER_TEMPLATE_KEYWORD(mutex_type) - } // namespace keywords - - template < -#ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER - typename A0, -#else - typename Signature, -#endif - typename A1 = parameter::void_, - typename A2 = parameter::void_, - typename A3 = parameter::void_, - typename A4 = parameter::void_, - typename A5 = parameter::void_, - typename A6 = parameter::void_ - > - class signal_type - { - typedef parameter::parameters< -#ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER - parameter::required<keywords::tag::signature_type, is_function<boost::mpl::_> >, -#endif - parameter::optional<keywords::tag::combiner_type>, - parameter::optional<keywords::tag::group_type>, - parameter::optional<keywords::tag::group_compare_type>, - parameter::optional<keywords::tag::slot_function_type>, - parameter::optional<keywords::tag::extended_slot_function_type>, - parameter::optional<keywords::tag::mutex_type> - > parameter_spec; - - public: - // ArgumentPack - typedef typename - parameter_spec::bind< -#ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER - A0, -#endif - A1, A2, A3, A4, A5, A6>::type - args; - -#ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER - typedef typename parameter::value_type<args, keywords::tag::signature_type>::type - signature_type; -#else - typedef Signature signature_type; -#endif - - typedef typename parameter::value_type - < - args, - keywords::tag::combiner_type, - optional_last_value - < - typename boost::function_traits<signature_type>::result_type - > - >::type combiner_type; - - typedef typename - parameter::value_type<args, keywords::tag::group_type, int>::type group_type; - - typedef typename - parameter::value_type<args, keywords::tag::group_compare_type, std::less<group_type> >::type - group_compare_type; - - typedef typename - parameter::value_type<args, keywords::tag::slot_function_type, function<signature_type> >::type - slot_function_type; - - typedef typename - parameter::value_type - < - args, - keywords::tag::extended_slot_function_type, - typename detail::extended_signature<function_traits<signature_type>::arity, signature_type>::function_type - >::type - extended_slot_function_type; - - typedef typename - parameter::value_type<args, keywords::tag::mutex_type, mutex>::type mutex_type; - - typedef signal - < - signature_type, - combiner_type, - group_type, - group_compare_type, - slot_function_type, - extended_slot_function_type, - mutex_type - > type; - }; - } // namespace signals2 -} // namespace boost - -#endif // BOOST_SIGNALS2_SIGNAL_TYPE_HPP diff --git a/contrib/restricted/boost/boost/signals2/slot.hpp b/contrib/restricted/boost/boost/signals2/slot.hpp deleted file mode 100644 index b6ec4d7c8a..0000000000 --- a/contrib/restricted/boost/boost/signals2/slot.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2009. -// -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SLOT_HPP -#define BOOST_SIGNALS2_SLOT_HPP - -#include <boost/bind.hpp> -#include <boost/config.hpp> -#include <boost/function.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/ref.hpp> -#include <boost/signals2/detail/signals_common.hpp> -#include <boost/signals2/detail/signals_common_macros.hpp> -#include <boost/signals2/detail/tracked_objects_visitor.hpp> -#include <boost/signals2/slot_base.hpp> -#include <boost/visit_each.hpp> -#include <boost/weak_ptr.hpp> - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES -#include <boost/signals2/preprocessed_slot.hpp> -#else -#include <boost/signals2/variadic_slot.hpp> -#endif - -#endif // BOOST_SIGNALS2_SLOT_HPP diff --git a/contrib/restricted/boost/boost/signals2/slot_base.hpp b/contrib/restricted/boost/boost/signals2/slot_base.hpp deleted file mode 100644 index e297180e49..0000000000 --- a/contrib/restricted/boost/boost/signals2/slot_base.hpp +++ /dev/null @@ -1,107 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007-2008. -// Copyright Timmo Stange 2007. -// Copyright Douglas Gregor 2001-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_SLOT_BASE_HPP -#define BOOST_SIGNALS2_SLOT_BASE_HPP - -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> -#include <boost/signals2/detail/foreign_ptr.hpp> -#include <boost/signals2/expired_slot.hpp> -#include <boost/signals2/signal_base.hpp> -#include <boost/throw_exception.hpp> -#include <boost/variant/apply_visitor.hpp> -#include <boost/variant/variant.hpp> -#include <vector> - -namespace boost -{ - namespace signals2 - { - namespace detail - { - class tracked_objects_visitor; - class trackable_pointee; - - typedef boost::variant<boost::weak_ptr<trackable_pointee>, boost::weak_ptr<void>, detail::foreign_void_weak_ptr > void_weak_ptr_variant; - typedef boost::variant<boost::shared_ptr<void>, detail::foreign_void_shared_ptr > void_shared_ptr_variant; - class lock_weak_ptr_visitor - { - public: - typedef void_shared_ptr_variant result_type; - template<typename WeakPtr> - result_type operator()(const WeakPtr &wp) const - { - return wp.lock(); - } - // overload to prevent incrementing use count of shared_ptr associated - // with signals2::trackable objects - result_type operator()(const weak_ptr<trackable_pointee> &) const - { - return boost::shared_ptr<void>(); - } - }; - class expired_weak_ptr_visitor - { - public: - typedef bool result_type; - template<typename WeakPtr> - bool operator()(const WeakPtr &wp) const - { - return wp.expired(); - } - }; - } - - class slot_base - { - public: - typedef std::vector<detail::void_weak_ptr_variant> tracked_container_type; - typedef std::vector<detail::void_shared_ptr_variant> locked_container_type; - - const tracked_container_type& tracked_objects() const {return _tracked_objects;} - locked_container_type lock() const - { - locked_container_type locked_objects; - tracked_container_type::const_iterator it; - for(it = tracked_objects().begin(); it != tracked_objects().end(); ++it) - { - locked_objects.push_back(apply_visitor(detail::lock_weak_ptr_visitor(), *it)); - if(apply_visitor(detail::expired_weak_ptr_visitor(), *it)) - { - boost::throw_exception(expired_slot()); - } - } - return locked_objects; - } - bool expired() const - { - tracked_container_type::const_iterator it; - for(it = tracked_objects().begin(); it != tracked_objects().end(); ++it) - { - if(apply_visitor(detail::expired_weak_ptr_visitor(), *it)) return true; - } - return false; - } - protected: - friend class detail::tracked_objects_visitor; - - void track_signal(const signal_base &signal) - { - _tracked_objects.push_back(signal.lock_pimpl()); - } - - tracked_container_type _tracked_objects; - }; - } -} // end namespace boost - -#endif // BOOST_SIGNALS2_SLOT_BASE_HPP diff --git a/contrib/restricted/boost/boost/signals2/trackable.hpp b/contrib/restricted/boost/boost/signals2/trackable.hpp deleted file mode 100644 index 64e848921e..0000000000 --- a/contrib/restricted/boost/boost/signals2/trackable.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2007,2009. -// Copyright Timmo Stange 2007. -// Copyright Douglas Gregor 2001-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Compatibility class to ease porting from the original -// Boost.Signals library. However, -// boost::signals2::trackable is NOT thread-safe. - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_TRACKABLE_HPP -#define BOOST_SIGNALS2_TRACKABLE_HPP - -#include <boost/assert.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -namespace boost { - namespace signals2 { - namespace detail - { - class tracked_objects_visitor; - - // trackable_pointee is used to identify the tracked shared_ptr - // originating from the signals2::trackable class. These tracked - // shared_ptr are special in that we shouldn't bother to - // increment their use count during signal invocation, since - // they don't actually control the lifetime of the - // signals2::trackable object they are associated with. - class trackable_pointee - {}; - } - class trackable { - protected: - trackable(): _tracked_ptr(static_cast<detail::trackable_pointee*>(0)) {} - trackable(const trackable &): _tracked_ptr(static_cast<detail::trackable_pointee*>(0)) {} - trackable& operator=(const trackable &) - { - return *this; - } - ~trackable() {} - private: - friend class detail::tracked_objects_visitor; - weak_ptr<detail::trackable_pointee> get_weak_ptr() const - { - return _tracked_ptr; - } - - shared_ptr<detail::trackable_pointee> _tracked_ptr; - }; - } // end namespace signals2 -} // end namespace boost - -#endif // BOOST_SIGNALS2_TRACKABLE_HPP diff --git a/contrib/restricted/boost/boost/signals2/variadic_signal.hpp b/contrib/restricted/boost/boost/signals2/variadic_signal.hpp deleted file mode 100644 index 8cd81f7a59..0000000000 --- a/contrib/restricted/boost/boost/signals2/variadic_signal.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - A variadic implementation of variadic boost::signals2::signal, used when variadic - template support is detected in the compiler. - - Author: Frank Mori Hess <fmhess@users.sourceforge.net> - Begin: 2009-05-26 -*/ -// Copyright Frank Mori Hess 2009 -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_VARIADIC_SIGNAL_HPP -#define BOOST_SIGNALS2_VARIADIC_SIGNAL_HPP - -#include <boost/preprocessor/control/expr_if.hpp> -#include <boost/signals2/detail/variadic_arg_type.hpp> -#include <boost/signals2/detail/variadic_slot_invoker.hpp> -#include <boost/type_traits/function_traits.hpp> -#include <boost/type_traits/is_void.hpp> -#include <boost/utility/enable_if.hpp> - -namespace boost -{ - namespace signals2 - { - namespace detail - { - template<typename Signature> class variadic_extended_signature; - // partial template specialization - template<typename R, typename ... Args> - class variadic_extended_signature<R (Args...)> - { - public: - typedef boost::function<R (const boost::signals2::connection &, Args...)> function_type; - }; - } // namespace detail - } // namespace signals2 -} // namespace boost - -#include <boost/signals2/detail/signal_template.hpp> - -#endif // BOOST_SIGNALS2_VARIADIC_SIGNAL_HPP diff --git a/contrib/restricted/boost/boost/signals2/variadic_slot.hpp b/contrib/restricted/boost/boost/signals2/variadic_slot.hpp deleted file mode 100644 index 59ae17600d..0000000000 --- a/contrib/restricted/boost/boost/signals2/variadic_slot.hpp +++ /dev/null @@ -1,25 +0,0 @@ -// Boost.Signals2 library - -// Copyright Frank Mori Hess 2009. -// -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_SIGNALS2_VARIADIC_SLOT_HPP -#define BOOST_SIGNALS2_VARIADIC_SLOT_HPP - -#include <boost/signals2/detail/variadic_arg_type.hpp> - -#define BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTORS \ - template<typename A1, typename A2, typename ... BindArgs> \ - slot(const A1 &arg1, const A2 &arg2, const BindArgs & ... args) \ - { \ - init_slot_function(boost::bind(arg1, arg2, args...)); \ - } - - -#include <boost/signals2/detail/slot_template.hpp> -#endif // BOOST_SIGNALS2_VARIADIC_SLOT_HPP diff --git a/contrib/restricted/boost/property_tree/CMakeLists.txt b/contrib/restricted/boost/property_tree/CMakeLists.txt new file mode 100644 index 0000000000..78a8180134 --- /dev/null +++ b/contrib/restricted/boost/property_tree/CMakeLists.txt @@ -0,0 +1,32 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(restricted-boost-property_tree INTERFACE) +target_include_directories(restricted-boost-property_tree INTERFACE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/property_tree/include +) +target_link_libraries(restricted-boost-property_tree INTERFACE + contrib-libs-cxxsupp + yutil + restricted-boost-any + restricted-boost-assert + restricted-boost-bind + restricted-boost-config + restricted-boost-core + restricted-boost-format + restricted-boost-iterator + restricted-boost-mpl + restricted-boost-multi_index + restricted-boost-optional + restricted-boost-range + restricted-boost-serialization + restricted-boost-static_assert + restricted-boost-throw_exception + restricted-boost-type_traits +) diff --git a/contrib/restricted/boost/boost/property_tree/detail/exception_implementation.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/detail/exception_implementation.hpp index 1d6c48fe1e..1d6c48fe1e 100644 --- a/contrib/restricted/boost/boost/property_tree/detail/exception_implementation.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/detail/exception_implementation.hpp diff --git a/contrib/restricted/boost/boost/property_tree/detail/ptree_implementation.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/detail/ptree_implementation.hpp index dd9fd37e26..dd9fd37e26 100644 --- a/contrib/restricted/boost/boost/property_tree/detail/ptree_implementation.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/detail/ptree_implementation.hpp diff --git a/contrib/restricted/boost/boost/property_tree/detail/ptree_utils.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/detail/ptree_utils.hpp index c353e08ba8..c353e08ba8 100644 --- a/contrib/restricted/boost/boost/property_tree/detail/ptree_utils.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/detail/ptree_utils.hpp diff --git a/contrib/restricted/boost/boost/property_tree/exceptions.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/exceptions.hpp index 6435bff85a..6435bff85a 100644 --- a/contrib/restricted/boost/boost/property_tree/exceptions.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/exceptions.hpp diff --git a/contrib/restricted/boost/boost/property_tree/id_translator.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/id_translator.hpp index 02fdf441a8..02fdf441a8 100644 --- a/contrib/restricted/boost/boost/property_tree/id_translator.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/id_translator.hpp diff --git a/contrib/restricted/boost/boost/property_tree/ptree.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/ptree.hpp index 9e7b921659..9e7b921659 100644 --- a/contrib/restricted/boost/boost/property_tree/ptree.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/ptree.hpp diff --git a/contrib/restricted/boost/boost/property_tree/ptree_fwd.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/ptree_fwd.hpp index fe36741067..fe36741067 100644 --- a/contrib/restricted/boost/boost/property_tree/ptree_fwd.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/ptree_fwd.hpp diff --git a/contrib/restricted/boost/boost/property_tree/stream_translator.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/stream_translator.hpp index 6e16c63c76..6e16c63c76 100644 --- a/contrib/restricted/boost/boost/property_tree/stream_translator.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/stream_translator.hpp diff --git a/contrib/restricted/boost/boost/property_tree/string_path.hpp b/contrib/restricted/boost/property_tree/include/boost/property_tree/string_path.hpp index 3ddcfb2033..3ddcfb2033 100644 --- a/contrib/restricted/boost/boost/property_tree/string_path.hpp +++ b/contrib/restricted/boost/property_tree/include/boost/property_tree/string_path.hpp |