area_concept.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  7. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  8. // Use, modification and distribution is subject to the Boost Software License,
  9. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. #ifndef BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
  12. #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
  13. #include <boost/concept_check.hpp>
  14. namespace boost { namespace geometry { namespace concepts
  15. {
  16. /*!
  17. \brief Checks strategy for area
  18. \ingroup area
  19. */
  20. template <typename Geometry, typename Strategy>
  21. class AreaStrategy
  22. {
  23. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  24. // 1) must define state template,
  25. typedef typename Strategy::template state<Geometry> state_type;
  26. // 2) must define result_type template,
  27. typedef typename Strategy::template result_type<Geometry>::type return_type;
  28. struct check_methods
  29. {
  30. static void apply()
  31. {
  32. Strategy const* str = 0;
  33. state_type *st = 0;
  34. // 3) must implement a method apply with the following signature
  35. typename geometry::point_type<Geometry>::type const* sp = 0;
  36. str->apply(*sp, *sp, *st);
  37. // 4) must implement a static method result with the following signature
  38. return_type r = str->result(*st);
  39. boost::ignore_unused_variable_warning(r);
  40. boost::ignore_unused_variable_warning(str);
  41. }
  42. };
  43. public :
  44. BOOST_CONCEPT_USAGE(AreaStrategy)
  45. {
  46. check_methods::apply();
  47. }
  48. #endif
  49. };
  50. }}} // namespace boost::geometry::concepts
  51. #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP