1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6 
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9 
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13 
14 #ifndef BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
15 #define BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
16 
17 
18 #include <boost/concept_check.hpp>
19 
20 
21 namespace boost { namespace geometry { namespace concepts
22 {
23 
24 
25 /*!
26     \brief Checks strategy for area
27     \ingroup area
28 */
29 template <typename Strategy>
30 class AreaStrategy
31 {
32 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
33 
34     // 1) must define state_type,
35     typedef typename Strategy::state_type state_type;
36 
37     // 2) must define return_type,
38     typedef typename Strategy::return_type return_type;
39 
40     // 3) must define point_type, of polygon (segments)
41     typedef typename Strategy::segment_point_type spoint_type;
42 
43     struct check_methods
44     {
applyboost::geometry::concepts::AreaStrategy::check_methods45         static void apply()
46         {
47             Strategy const* str = 0;
48             state_type *st = 0;
49 
50             // 4) must implement a method apply with the following signature
51             spoint_type const* sp = 0;
52             str->apply(*sp, *sp, *st);
53 
54             // 5) must implement a static method result with the following signature
55             return_type r = str->result(*st);
56 
57             boost::ignore_unused_variable_warning(r);
58             boost::ignore_unused_variable_warning(str);
59         }
60     };
61 
62 public :
BOOST_CONCEPT_USAGE(AreaStrategy)63     BOOST_CONCEPT_USAGE(AreaStrategy)
64     {
65         check_methods::apply();
66     }
67 
68 #endif
69 };
70 
71 
72 }}} // namespace boost::geometry::concepts
73 
74 
75 #endif // BOOST_GEOMETRY_STRATEGIES_CONCEPTS_AREA_CONCEPT_HPP
76