16 #ifndef SPATIAL_ENCLOSED_REGION_HPP
17 #define SPATIAL_ENCLOSED_REGION_HPP
19 #include "spatial_region.hpp"
56 template <
typename Key,
typename Compare,
57 typename Layout = llhh_layout_tag>
71 : Compare(compare),
_target(target)
93 return (dim < (rank >> 1))
94 ? (Compare::operator()(dim , key, _target)
95 ?
below : (Compare::operator()(dim + (rank >> 1), _target, dim, key)
97 : (Compare::operator()(dim, key, dim - (rank >> 1), _target)
98 ?
below : (Compare::operator()(dim, _target, key)
106 return ((dim % 2) == 0)
107 ? (Compare::operator()(dim , key, _target)
108 ?
below : (Compare::operator()(dim + 1, _target, dim, key)
110 : (Compare::operator()(dim, key, dim - 1, _target)
111 ?
below : (Compare::operator()(dim, _target, key)
119 return (dim < (rank >> 1))
120 ? (Compare::operator()(dim , _target, key)
121 ?
above : (Compare::operator()(dim, key, dim + (rank >> 1), _target)
123 : (Compare::operator()(dim - (rank >> 1), _target, dim, key)
124 ?
above : (Compare::operator()(dim, key, _target)
132 return ((dim % 2) == 0)
133 ? (Compare::operator()(dim , _target, key)
134 ?
above : (Compare::operator()(dim, key, dim + 1, _target)
136 : (Compare::operator()(dim - 1, _target, dim, key)
137 ?
above : (Compare::operator()(dim, key, _target)
149 template <
typename Tp,
typename Layout>
151 enclosed_bounds<typename container_traits<Tp>::key_type,
152 typename container_traits<Tp>::key_compare,
155 (
const Tp& container,
162 typename container_traits<Tp>::key_compare, Layout>
163 (container.key_comp(), target);
166 template <
typename Tp>
167 enclosed_bounds<typename container_traits<Tp>::key_type,
168 typename container_traits<Tp>::key_compare>
170 (
const Tp& container,
175 template<
typename Ct,
typename Layout = llhh_layout_tag>
178 <Ct, enclosed_bounds<typename container_traits<Ct>::key_type,
179 typename container_traits<Ct>::key_compare,
195 template<
typename Ct,
typename Layout>
198 <const Ct, enclosed_bounds<typename container_traits<Ct>::key_type,
199 typename container_traits<Ct>::key_compare,
218 typename container_traits<Ct>::key_compare,
221 <
const Ct, enclosed_bounds<typename container_traits<Ct>::key_type,
222 typename container_traits<Ct>::key_compare,
227 template<
typename Ct,
typename Layout = llhh_layout_tag>
230 <Ct, enclosed_bounds<typename container_traits<Ct>::key_type,
231 typename container_traits<Ct>::key_compare,
239 typename container_traits<Ct>::key_compare,
243 typename container_traits<Ct>::key_compare,
246 <Ct, enclosed_bounds<typename container_traits<Ct>::key_type,
247 typename container_traits<Ct>::key_compare,
252 template<
typename Ct,
typename Layout>
255 <const Ct, enclosed_bounds<typename container_traits<Ct>::key_type,
256 typename container_traits<Ct>::key_compare,
264 typename container_traits<Ct>::key_compare,
268 typename container_traits<Ct>::key_compare,
271 <
const Ct, enclosed_bounds<typename container_traits<Ct>::key_type,
272 typename container_traits<Ct>::key_compare,
279 <
const Ct, enclosed_bounds<typename container_traits<Ct>::key_type,
280 typename container_traits<Ct>::key_compare,
285 template <
typename Ct>
286 inline enclosed_region_iterator<Ct>
294 template <
typename Ct,
typename Layout>
295 inline enclosed_region_iterator<Ct, Layout>
298 const Layout& layout)
304 template <
typename Ct>
305 inline enclosed_region_iterator<const Ct>
313 template <
typename Ct,
typename Layout>
314 inline enclosed_region_iterator<const Ct, Layout>
317 const Layout& layout)
323 template <
typename Ct>
324 inline enclosed_region_iterator<const Ct>
332 template <
typename Ct,
typename Layout>
333 inline enclosed_region_iterator<const Ct, Layout>
336 const Layout& layout)
342 template <
typename Ct>
343 inline enclosed_region_iterator<Ct>
351 template <
typename Ct,
typename Layout>
352 inline enclosed_region_iterator<Ct, Layout>
355 const Layout& layout)
361 template <
typename Ct>
362 inline enclosed_region_iterator<const Ct>
370 template <
typename Ct,
typename Layout>
371 inline enclosed_region_iterator<const Ct, Layout>
374 const Layout& layout)
380 template <
typename Ct>
381 inline enclosed_region_iterator<const Ct>
389 template <
typename Ct,
typename Layout>
390 inline enclosed_region_iterator<const Ct, Layout>
393 const Layout& layout)
399 template <
typename Ct>
400 inline enclosed_region_iterator_pair<Ct>
408 template <
typename Ct,
typename Layout>
409 inline enclosed_region_iterator_pair<Ct, Layout>
412 const Layout& layout)
418 template <
typename Ct>
419 inline enclosed_region_iterator_pair<const Ct>
427 template <
typename Ct,
typename Layout>
428 inline enclosed_region_iterator_pair<const Ct, Layout>
431 const Layout& layout)
437 template <
typename Ct>
438 inline enclosed_region_iterator_pair<const Ct>
446 template <
typename Ct,
typename Layout>
447 inline enclosed_region_iterator_pair<const Ct, Layout>
450 const Layout& layout)
458 #endif // SPATIAL_ENCLOSED_REGION_HPP
This type provides both an iterator and a constant iterator to iterate through all elements of a tree...
enclosed_region_iterator< const Ct > enclosed_region_cbegin(const Ct &container, const typename container_traits< Ct >::key_type &target)
Represents a coordinate layout for the box.
enclosed_region_iterator_pair()
Key _target
The box value that will be used for the enclosing comparison.
enclosed_region_iterator< Ct > enclosed_region_end(Ct &container, const typename container_traits< Ct >::key_type &target)
enclosed_bounds< typename container_traits< Tp >::key_type, typename container_traits< Tp >::key_compare, Layout > make_enclosed_bounds(const Tp &container, const typename container_traits< Tp >::key_type &target, Layout tag)
Enclosed bounds factory that takes in a container, a key and returns an enclosed_bounds type...
Represents a coordinate layout for the box.
enclosed_region_iterator< Ct > enclosed_region_begin(Ct &container, const typename container_traits< Ct >::key_type &target)
region_iterator< const Ct, Predicate > region_cend(const Ct &container, const Predicate &pred)
This structure defines a pair of mutable region iterator.
Tp::key_type key_type
The type representing the key managed by the container.
This region predicate matches keys that are enclosed or equal to a target box.
relative_order operator()(dimension_type dim, dimension_type rank, const Key &key) const
The operator that tells wheather the point is in region or not.
void check_box(const Tp &container, const typename container_traits< Tp >::key_type &box, llhh_layout_tag)
Checks that all coordinates of a box are matching with the layout specified or else, raise an invalid_box exception.
region_iterator< Ct, Predicate > region_begin(Ct &container, const Predicate &pred)
enclosed_region_iterator_pair()
enclosed_region_iterator()
region_iterator_pair< Ct, Predicate > region_range(Ct &container, const Predicate &pred)
Returns a spatial::region_iterator_pair where first points to the first element matching the predicat...
enclosed_bounds(const Compare &compare, const Key &target)
Set the target box and the comparator to the appropriate value.
The traits type for all containers in the spatial namespace.
region_iterator< const Ct, Predicate > region_cbegin(const Ct &container, const Predicate &pred)
relative_order
Defines values for relative ordering.
std::size_t dimension_type
Defines the type for the dimension as being a size.
region_iterator< Ct, Predicate > region_end(Ct &container, const Predicate &pred)
Represents a coordinate layout for the box.
enclosed_region_iterator< const Ct > enclosed_region_cend(const Ct &container, const typename container_traits< Ct >::key_type &target)
enclosed_bounds()
The default constructor leaves everything un-initialized.
The main namespace used in the library.
enclosed_region_iterator_pair< Ct > enclosed_region_range(Ct &container, const typename container_traits< Ct >::key_type &target)
region_iterator_pair< const Ct, Predicate > region_crange(const Ct &container, const Predicate &pred)
This overload works only on constant containers and will return a set of constant iterators...
enclosed_region_iterator_pair< const Ct > enclosed_region_crange(const Ct &container, const typename container_traits< Ct >::key_type &target)
Represents a coordinate layout for the box.
relative_order enclose_bounds_impl(dimension_type dim, dimension_type rank, const Key &key, llhh_layout_tag) const
enclosed_region_iterator()