~ai.tron/armagetronad/0.4-winlibs-updated

« back to all changes in this revision

Viewing changes to boost/includes/boost/geometry/index/detail/algorithms/is_valid.hpp

  • Committer: Nik K.
  • Date: 2013-11-07 16:58:35 UTC
  • Revision ID: nik.karbaum@gmail.com-20131107165835-kq99jz23drfj4dkh
Forgot to add some files; here they are

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Boost.Geometry Index
 
2
//
 
3
// n-dimensional box's / point validity check
 
4
//
 
5
// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
 
6
//
 
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
 
 
11
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
 
12
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
 
13
 
 
14
namespace boost { namespace geometry { namespace index { namespace detail {
 
15
 
 
16
namespace dispatch {
 
17
 
 
18
template <typename Box, size_t Dimension>
 
19
struct is_valid_box
 
20
{
 
21
    BOOST_MPL_ASSERT_MSG(
 
22
        (0 < Dimension && Dimension <= dimension<Box>::value),
 
23
        INVALID_DIMENSION_PARAMETER,
 
24
        (is_valid_box));
 
25
 
 
26
    static inline bool apply(Box const& b)
 
27
    {
 
28
        return is_valid_box<Box, Dimension - 1>::apply(b) &&
 
29
            ( get<min_corner, Dimension - 1>(b) <= get<max_corner, Dimension - 1>(b) );
 
30
    }
 
31
};
 
32
 
 
33
template <typename Box>
 
34
struct is_valid_box<Box, 1>
 
35
{
 
36
    static inline bool apply(Box const& b)
 
37
    {
 
38
        return get<min_corner, 0>(b) <= get<max_corner, 0>(b);
 
39
    }
 
40
};
 
41
 
 
42
template <typename Indexable, typename Tag>
 
43
struct is_valid
 
44
{
 
45
    BOOST_MPL_ASSERT_MSG(
 
46
        (false),
 
47
        NOT_IMPLEMENTED_FOR_THIS_INDEXABLE,
 
48
        (is_valid));
 
49
};
 
50
 
 
51
template <typename Indexable>
 
52
struct is_valid<Indexable, point_tag>
 
53
{
 
54
    static inline bool apply(Indexable const&)
 
55
    {
 
56
        return true;
 
57
    }
 
58
};
 
59
 
 
60
template <typename Indexable>
 
61
struct is_valid<Indexable, box_tag>
 
62
{
 
63
    static inline bool apply(Indexable const& b)
 
64
    {
 
65
        return dispatch::is_valid_box<Indexable, dimension<Indexable>::value>::apply(b);
 
66
    }
 
67
};
 
68
 
 
69
} // namespace dispatch
 
70
 
 
71
template <typename Indexable>
 
72
inline bool is_valid(Indexable const& b)
 
73
{
 
74
    return dispatch::is_valid<Indexable, typename tag<Indexable>::type>::apply(b);
 
75
}
 
76
 
 
77
}}}} // namespace boost::geometry::index::detail
 
78
 
 
79
#endif // BOOST_GEOMETRY_DETAIL_INDEX_ALGORITHMS_IS_VALID_HPP