UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
spatial.hpp
1
42#ifndef UFO_CONTAINER_TREE_PREDICATE_SPATIAL_HPP
43#define UFO_CONTAINER_TREE_PREDICATE_SPATIAL_HPP
44
45// UFO
46#include <ufo/container/tree/predicate/and.hpp>
47#include <ufo/container/tree/predicate/filter.hpp>
48#include <ufo/container/tree/predicate/if_and_only_if.hpp>
49#include <ufo/container/tree/predicate/if_then.hpp>
50#include <ufo/container/tree/predicate/or.hpp>
51#include <ufo/container/tree/predicate/xor.hpp>
52#include <ufo/utility/type_traits.hpp>
53
54// STL
55#include <type_traits>
56
57namespace ufo::pred
58{
59//
60// Is spatial predicate
61//
62
63namespace detail
64{
65template <Filterable>
66struct is_spatial_pred : std::false_type {
67};
68} // namespace detail
69
70template <Filterable T>
71struct is_spatial_pred : detail::is_spatial_pred<std::decay_t<T>> {
72};
73
74// Helper variable template
75template <Filterable T>
76constexpr inline bool is_spatial_pred_v = is_spatial_pred<T>::value;
77
78//
79// Contains spatial predicate
80//
81
82namespace detail
83{
84template <Filterable Pred>
87
88template <Filterable... Preds>
89struct contains_spatial_pred<And<Preds...>>
90 : std::disjunction<contains_spatial_pred<Preds>...> {
91};
92
93template <Filterable L, Filterable R>
95 : std::disjunction<contains_spatial_pred<L>, contains_spatial_pred<R>> {
96};
97
98template <Filterable L, Filterable R>
100 : std::disjunction<contains_spatial_pred<L>, contains_spatial_pred<R>> {
101};
102
103template <Filterable... Preds>
104struct contains_spatial_pred<Or<Preds...>>
105 : std::disjunction<contains_spatial_pred<Preds>...> {
106};
107
108template <Filterable L, Filterable R>
110 : std::disjunction<contains_spatial_pred<L>, contains_spatial_pred<R>> {
111};
112
113} // namespace detail
114
115template <Filterable T>
117
118template <Filterable T>
119constexpr inline bool contains_spatial_pred_v = contains_spatial_pred<T>::value;
120
121//
122// Contains always spatial predicate
123//
124
125namespace detail
126{
127template <Filterable Pred>
130
131template <Filterable... Preds>
133 : std::disjunction<contains_always_spatial_pred<Preds>...> {
134};
135
136template <Filterable L, Filterable R>
137struct contains_always_spatial_pred<Iff<L, R>> : std::false_type {
138};
139
140template <Filterable L, Filterable R>
141struct contains_always_spatial_pred<IfThen<L, R>> : std::false_type {
142};
143
144template <Filterable... Preds>
146 : std::conjunction<contains_always_spatial_pred<Preds>...> {
147};
148
149template <Filterable... Preds>
150struct contains_always_spatial_pred<Xor<Preds...>> : std::false_type {
151};
152} // namespace detail
153
154template <Filterable T>
156
157template <class T>
158constexpr inline bool contains_always_spatial_pred_v =
160
161} // namespace ufo::pred
162
163#endif // UFO_CONTAINER_TREE_PREDICATE_SPATIAL_HPP