area_concept.hpp 2.0 KB

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