1 | // Boost.Polygon library interval_traits.hpp header file |
2 | |
3 | // Copyright (c) Intel Corporation 2008. |
4 | // Copyright (c) 2008-2012 Simonson Lucanus. |
5 | // Copyright (c) 2012-2012 Andrii Sydorchuk. |
6 | |
7 | // See http://www.boost.org for updates, documentation, and revision history. |
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 | |
12 | #ifndef BOOST_POLYGON_INTERVAL_TRAITS_HPP |
13 | #define BOOST_POLYGON_INTERVAL_TRAITS_HPP |
14 | |
15 | #include "isotropy.hpp" |
16 | |
17 | namespace boost { |
18 | namespace polygon { |
19 | |
20 | template <typename Interval> |
21 | struct interval_traits { |
22 | typedef Interval interval_type; |
23 | typedef typename interval_type::coordinate_type coordinate_type; |
24 | |
25 | static coordinate_type get(const interval_type& interval, direction_1d dir) { |
26 | return interval.get(dir); |
27 | } |
28 | }; |
29 | |
30 | template <typename Interval> |
31 | struct interval_mutable_traits { |
32 | typedef Interval interval_type; |
33 | typedef typename interval_type::coordinate_type coordinate_type; |
34 | |
35 | static void set( |
36 | interval_type& interval, direction_1d dir, coordinate_type value) { |
37 | interval.set(dir, value); |
38 | } |
39 | |
40 | static interval_type construct(coordinate_type low, coordinate_type high) { |
41 | return interval_type(low, high); |
42 | } |
43 | }; |
44 | } // polygon |
45 | } // boost |
46 | |
47 | #endif // BOOST_POLICY_INTERVAL_TRAITS_HPP |
48 | |