Chris@102: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@102: Chris@102: // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. Chris@102: // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. Chris@102: // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. Chris@102: // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland. Chris@102: // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France. Chris@102: Chris@102: // This file was modified by Oracle on 2014, 2015. Chris@102: // Modifications copyright (c) 2014-2015, Oracle and/or its affiliates. Chris@102: Chris@102: // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle Chris@102: Chris@102: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@102: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@102: Chris@102: // Use, modification and distribution is subject to the Boost Software License, Chris@102: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@102: // http://www.boost.org/LICENSE_1_0.txt) Chris@102: Chris@102: #ifndef BOOST_GEOMETRY_STRATEGIES_DISTANCE_RESULT_HPP Chris@102: #define BOOST_GEOMETRY_STRATEGIES_DISTANCE_RESULT_HPP Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: #include Chris@102: Chris@102: Chris@102: namespace boost { namespace geometry Chris@102: { Chris@102: Chris@102: Chris@102: namespace resolve_strategy Chris@102: { Chris@102: Chris@102: template Chris@102: struct distance_result Chris@102: : strategy::distance::services::return_type Chris@102: < Chris@102: Strategy, Chris@102: typename point_type::type, Chris@102: typename point_type::type Chris@102: > Chris@102: {}; Chris@102: Chris@102: template Chris@102: struct distance_result Chris@102: : distance_result Chris@102: < Chris@102: Geometry1, Chris@102: Geometry2, Chris@102: typename detail::distance::default_strategy Chris@102: < Chris@102: Geometry1, Geometry2 Chris@102: >::type Chris@102: > Chris@102: {}; Chris@102: Chris@102: } // namespace resolve_strategy Chris@102: Chris@102: Chris@102: namespace resolve_variant Chris@102: { Chris@102: Chris@102: template Chris@102: struct distance_result Chris@102: : resolve_strategy::distance_result Chris@102: < Chris@102: Geometry1, Chris@102: Geometry2, Chris@102: Strategy Chris@102: > Chris@102: {}; Chris@102: Chris@102: Chris@102: template Chris@102: < Chris@102: typename Geometry1, Chris@102: BOOST_VARIANT_ENUM_PARAMS(typename T), Chris@102: typename Strategy Chris@102: > Chris@102: struct distance_result Chris@102: < Chris@102: Geometry1, boost::variant, Strategy Chris@102: > Chris@102: { Chris@102: // A set of all variant type combinations that are compatible and Chris@102: // implemented Chris@102: typedef typename util::combine_if< Chris@102: typename boost::mpl::vector1, Chris@102: typename boost::variant::types, Chris@102: // Here we want should remove most of the combinations that Chris@102: // are not valid, mostly to limit the size of the resulting MPL set. Chris@102: // But is_implementedn is not ready for prime time Chris@102: // Chris@102: // util::is_implemented2 > Chris@102: boost::mpl::always Chris@102: >::type possible_input_types; Chris@102: Chris@102: // The (possibly variant) result type resulting from these combinations Chris@102: typedef typename compress_variant< Chris@102: typename transform_variant< Chris@102: possible_input_types, Chris@102: resolve_strategy::distance_result< Chris@102: boost::mpl::first, Chris@102: boost::mpl::second, Chris@102: Strategy Chris@102: >, Chris@102: boost::mpl::back_inserter > Chris@102: >::type Chris@102: >::type type; Chris@102: }; Chris@102: Chris@102: Chris@102: // Distance arguments are commutative Chris@102: template Chris@102: < Chris@102: BOOST_VARIANT_ENUM_PARAMS(typename T), Chris@102: typename Geometry2, Chris@102: typename Strategy Chris@102: > Chris@102: struct distance_result Chris@102: < Chris@102: boost::variant, Chris@102: Geometry2, Chris@102: Strategy Chris@102: > : public distance_result Chris@102: < Chris@102: Geometry2, boost::variant, Strategy Chris@102: > Chris@102: {}; Chris@102: Chris@102: Chris@102: template Chris@102: struct distance_result Chris@102: < Chris@102: boost::variant, Chris@102: boost::variant, Chris@102: Strategy Chris@102: > Chris@102: { Chris@102: // A set of all variant type combinations that are compatible and Chris@102: // implemented Chris@102: typedef typename util::combine_if Chris@102: < Chris@102: typename boost::variant::types, Chris@102: typename boost::variant::types, Chris@102: // Here we want to try to remove most of the combinations Chris@102: // that are not valid, mostly to limit the size of the Chris@102: // resulting MPL vector. Chris@102: // But is_implemented is not ready for prime time Chris@102: // Chris@102: // util::is_implemented2 > Chris@102: boost::mpl::always Chris@102: >::type possible_input_types; Chris@102: Chris@102: // The (possibly variant) result type resulting from these combinations Chris@102: typedef typename compress_variant< Chris@102: typename transform_variant< Chris@102: possible_input_types, Chris@102: resolve_strategy::distance_result< Chris@102: boost::mpl::first, Chris@102: boost::mpl::second, Chris@102: Strategy Chris@102: >, Chris@102: boost::mpl::back_inserter > Chris@102: >::type Chris@102: >::type type; Chris@102: }; Chris@102: Chris@102: } // namespace resolve_variant Chris@102: Chris@102: Chris@102: /*! Chris@102: \brief Meta-function defining return type of distance function Chris@102: \ingroup distance Chris@102: \note The strategy defines the return-type (so this situation is different Chris@102: from length, where distance is sqr/sqrt, but length always squared) Chris@102: */ Chris@102: template Chris@102: < Chris@102: typename Geometry1, Chris@102: typename Geometry2 = Geometry1, Chris@102: typename Strategy = void Chris@102: > Chris@102: struct distance_result Chris@102: : resolve_variant::distance_result Chris@102: {}; Chris@102: Chris@102: Chris@102: template Chris@102: struct distance_result Chris@102: : distance_result Chris@102: {}; Chris@102: Chris@102: Chris@102: }} // namespace boost::geometry Chris@102: Chris@102: Chris@102: #endif // BOOST_GEOMETRY_STRATEGIES_DISTANCE_RESULT_HPP