]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/concepts/point_well_formed_traits.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / concepts / point_well_formed_traits.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
7
8 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
9 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10
11 // Use, modification and distribution is subject to the Boost Software License,
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
14
15 #include <boost/geometry/core/cs.hpp>
16
17 #include "function_requiring_a_point.hpp"
18
19 struct point
20 {
21 point(): x(), y() {}
22 float x, y;
23 };
24
25 namespace boost { namespace geometry { namespace traits {
26
27 template <>
28 struct tag<point>
29 {
30 typedef point_tag type;
31 };
32
33 template <>
34 struct coordinate_type<point>
35 {
36 typedef float type;
37 };
38
39 template <>
40 struct coordinate_system<point>
41 {
42 typedef bg::cs::cartesian type;
43 };
44
45 template <>
46 struct dimension<point>
47 {
48 enum { value = 2 };
49 };
50
51 template <>
52 struct access<point, 0>
53 {
54 static float get(point const& p)
55 {
56 return p.x;
57 }
58
59 static void set(point& p, float value)
60 {
61 p.x = value;
62 }
63 };
64
65 template <>
66 struct access<point, 1>
67 {
68 static float get(point const& p)
69 {
70 return p.y;
71 }
72
73 static void set(point& p, float value)
74 {
75 p.y = value;
76 }
77 };
78
79
80 }}} // namespace bg::traits
81
82 int main()
83 {
84 point p1;
85 const point p2;
86 test::function_requiring_a_point(p1, p2);
87 return 0;
88 }