area_concept.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
  6. // This file was modified by Oracle on 2018.
  7. // Modifications copyright (c) 2018 Oracle and/or its affiliates.
  8. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  9. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  10. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  11. // Use, modification and distribution is subject to the Boost Software License,
  12. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  13. // http://www.boost.org/LICENSE_1_0.txt)
  14. #ifndef BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
  15. #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
  16. #include <boost/concept_check.hpp>
  17. #include <boost/core/ignore_unused.hpp>
  18. #include <boost/geometry/geometries/point.hpp>
  19. namespace boost { namespace geometry { namespace concepts
  20. {
  21. /*!
  22. \brief Checks strategy for area
  23. \ingroup area
  24. */
  25. template <typename Geometry, typename Strategy>
  26. class AreaStrategy
  27. {
  28. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  29. // 1) must define state template,
  30. typedef typename Strategy::template state<Geometry> state_type;
  31. // 2) must define result_type template,
  32. typedef typename Strategy::template result_type<Geometry>::type return_type;
  33. struct check_methods
  34. {
  35. static void apply()
  36. {
  37. Strategy const* str = 0;
  38. state_type *st = 0;
  39. // 3) must implement a method apply with the following signature
  40. typename geometry::point_type<Geometry>::type const* sp = 0;
  41. str->apply(*sp, *sp, *st);
  42. // 4) must implement a static method result with the following signature
  43. return_type r = str->result(*st);
  44. boost::ignore_unused(r, str);
  45. }
  46. };
  47. public :
  48. BOOST_CONCEPT_USAGE(AreaStrategy)
  49. {
  50. check_methods::apply();
  51. }
  52. #endif
  53. };
  54. }}} // namespace boost::geometry::concepts
  55. #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP