PageRenderTime 64ms CodeModel.GetById 55ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/test/point_concept/concept_checker.cpp

http://hadesmem.googlecode.com/
C++ | 76 lines | 43 code | 23 blank | 10 comment | 0 complexity | 6eae76f2ca304d4c0762da33a9d72413 MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2// Unit Test
 3
 4// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
 5// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
 6// Copyright (c) 2009-2011 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
16#include <boost/geometry/core/cs.hpp>
17#include <boost/geometry/geometries/concepts/check.hpp>
18
19struct ro_point
20{
21    float x, y;
22};
23
24
25struct rw_point
26{
27    float x, y;
28};
29
30
31namespace boost { namespace geometry { namespace traits {
32
33template <> struct tag<ro_point> { typedef point_tag type; };
34template <> struct coordinate_type<ro_point> { typedef float type; };
35template <> struct coordinate_system<ro_point> { typedef cs::cartesian type; };
36template <> struct dimension<ro_point> { enum { value = 2 }; };
37
38template <> struct access<ro_point, 0>
39{
40    static float get(ro_point const& p) { return p.x; }
41};
42
43template <> struct access<ro_point, 1>
44{
45    static float get(ro_point const& p) { return p.y; }
46};
47
48
49
50
51template <> struct tag<rw_point> { typedef point_tag type; };
52template <> struct coordinate_type<rw_point> { typedef float type; };
53template <> struct coordinate_system<rw_point> { typedef cs::cartesian type; };
54template <> struct dimension<rw_point> { enum { value = 2 }; };
55
56template <> struct access<rw_point, 0>
57{
58    static float get(rw_point const& p) { return p.x; }
59    static void set(rw_point& p, float value) { p.x = value; }
60};
61
62template <> struct access<rw_point, 1>
63{
64    static float get(rw_point const& p) { return p.y; }
65    static void set(rw_point& p, float value) { p.y = value; }
66};
67
68
69}}} // namespace bg::traits
70
71
72int main()
73{
74    boost::geometry::concept::check<const ro_point>();
75    boost::geometry::concept::check<rw_point>();
76}