Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:19

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
0007 
0008 // This file was modified by Oracle on 2015.
0009 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
0010 
0011 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0012 
0013 // Use, modification and distribution is subject to the Boost Software License,
0014 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
0018 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
0019 
0020 
0021 #include <boost/geometry/core/exception.hpp>
0022 #include <boost/geometry/algorithms/is_empty.hpp>
0023 
0024 #include <boost/throw_exception.hpp>
0025 
0026 
0027 // BSG 2012-02-06: we use this currently only for distance.
0028 // For other scalar results area,length,perimeter it is commented on purpose.
0029 // Reason is that for distance there is no other choice. distance of two
0030 // empty geometries (or one empty) should NOT return any value.
0031 // But for area it is no problem to be 0.
0032 // Suppose: area(intersection(a,b)). We (probably) don't want a throw there...
0033 
0034 // So decided that at least for Boost 1.49 this is commented for
0035 // scalar results, except distance.
0036 
0037 #if defined(BOOST_GEOMETRY_EMPTY_INPUT_NO_THROW)
0038 #include <boost/core/ignore_unused.hpp>
0039 #endif
0040 
0041 namespace boost { namespace geometry
0042 {
0043 
0044 #ifndef DOXYGEN_NO_DETAIL
0045 namespace detail
0046 {
0047 
0048 template <typename Geometry>
0049 inline void throw_on_empty_input(Geometry const& geometry)
0050 {
0051 #if ! defined(BOOST_GEOMETRY_EMPTY_INPUT_NO_THROW)
0052     if (geometry::is_empty(geometry))
0053     {
0054         BOOST_THROW_EXCEPTION(empty_input_exception());
0055     }
0056 #else
0057     boost::ignore_unused(geometry);
0058 #endif
0059 }
0060 
0061 } // namespace detail
0062 #endif // DOXYGEN_NO_DETAIL
0063 
0064 
0065 }} // namespace boost::geometry
0066 
0067 
0068 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
0069