convex_hull_concept.hpp 1.9 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_CONVEX_HULL_CONCEPT_HPP
  11. #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CONVEX_HULL_CONCEPT_HPP
  12. #include <vector>
  13. #include <boost/concept_check.hpp>
  14. namespace boost { namespace geometry { namespace concept
  15. {
  16. /*!
  17. \brief Checks strategy for convex_hull
  18. \ingroup convex_hull
  19. */
  20. template <typename Strategy>
  21. class ConvexHullStrategy
  22. {
  23. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  24. // 1) must define state_type
  25. typedef typename Strategy::state_type state_type;
  26. // 2) must define point_type
  27. typedef typename Strategy::point_type point_type;
  28. // 3) must define geometry_type
  29. typedef typename Strategy::geometry_type geometry_type;
  30. struct check_methods
  31. {
  32. static void apply()
  33. {
  34. Strategy const* str;
  35. state_type* st;
  36. geometry_type* sp;
  37. std::vector<point_type> *v;
  38. // 4) must implement a method apply, iterating over a range
  39. str->apply(*sp, *st);
  40. // 5) must implement a method result, with an output iterator
  41. str->result(*st, std::back_inserter(*v), true);
  42. }
  43. };
  44. public :
  45. BOOST_CONCEPT_USAGE(ConvexHullStrategy)
  46. {
  47. check_methods::apply();
  48. }
  49. #endif
  50. };
  51. }}} // namespace boost::geometry::concept
  52. #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_CONVEX_HULL_CONCEPT_HPP