Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial::region_iterator< Ct, Predicate > Class Template Reference

This type provides both an iterator and a constant iterator to iterate through all elements of a tree that match an orthogonal region defined by a predicate. More...

#include <spatial_region.hpp>

Inherits Bidirectional_iterator < container_traits< Ct >::mode_type, container_traits< Ct >::rank_type >.

Public Member Functions

 region_iterator ()
 Uninitialized iterator. More...
 
 region_iterator (Ct &container, const Predicate &pred, typename container_traits< Ct >::iterator iter)
 Build a region iterator from a container's iterator type. More...
 
 region_iterator (Ct &container, const Predicate &pred, dimension_type dim, typename container_traits< Ct >::mode_type::node_ptr ptr)
 Build a region iterator from the node and current dimension of a container's element. More...
 
region_iterator< Ct, Predicate > & operator++ ()
 Increments the iterator and returns the incremented value. More...
 
region_iterator< Ct, Predicate > operator++ (int)
 Increments the iterator but returns the value of the iterator before the increment. More...
 
region_iterator< Ct, Predicate > & operator-- ()
 Decrements the iterator and returns the decremented value. More...
 
region_iterator< Ct, Predicate > operator-- (int)
 Decrements the iterator but returns the value of the iterator before the decrement. More...
 
Predicate predicate () const
 Return the key_comparator used by the iterator. More...
 

Private Types

typedef details::Bidirectional_iterator< typename container_traits< Ct >::mode_type, typename container_traits< Ct >::rank_type > Base
 

Private Attributes

Predicate _pred
 The related data for the iterator. More...
 

Detailed Description

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
class spatial::region_iterator< Ct, Predicate >

This type provides both an iterator and a constant iterator to iterate through all elements of a tree that match an orthogonal region defined by a predicate.

If no predicate is provided, the orthogonal region search default to a bounds predicate, which matches all points contained within an orthogonal region of space formed by 2 points, inclusive of lower values, but exclusive of upper values.

Template Parameters
CtThe container upon which these iterator relate to.
PredicateA model of Region Predicate, defaults to bounds
See also
region_query<>::iterator
region_query<>::const_iterator

Definition at line 140 of file spatial_region.hpp.

Member Typedef Documentation

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
typedef details::Bidirectional_iterator<typename container_traits<Ct>::mode_type, typename container_traits<Ct>::rank_type> spatial::region_iterator< Ct, Predicate >::Base
private

Definition at line 148 of file spatial_region.hpp.

Constructor & Destructor Documentation

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
spatial::region_iterator< Ct, Predicate >::region_iterator ( )

Uninitialized iterator.

Definition at line 152 of file spatial_region.hpp.

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
spatial::region_iterator< Ct, Predicate >::region_iterator ( Ct &  container,
const Predicate &  pred,
typename container_traits< Ct >::iterator  iter 
)

Build a region iterator from a container's iterator type.

This constructor should be used in the general case where the dimension for the node pointed to by iter is not known. The dimension of the node will be recomputed from the given iterator by iterating through all parents until the header node has been reached. This iteration is bounded by $O(\log n)\,$ in case the tree is perfectly balanced.

Parameters
containerThe container being iterated.
predA model of the Region Predicate concept.
iterAn iterator on the type Ct.

Definition at line 168 of file spatial_region.hpp.

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
spatial::region_iterator< Ct, Predicate >::region_iterator ( Ct &  container,
const Predicate &  pred,
dimension_type  dim,
typename container_traits< Ct >::mode_type::node_ptr  ptr 
)

Build a region iterator from the node and current dimension of a container's element.

This constructor should be used only when the dimension of the node pointed to by iter is known. If in doubt, use the other constructor. This constructor perform slightly faster than the other, since the dimension does not have to be calculated. Note however that the calculation of the dimension in the other iterator takes slightly longer than $O(\log n)\,$ in general, and so it is not likely to affect the performance of your application in any major way.

Parameters
predA model of the Region Predicate concept.
ptrAn iterator on the type Ct.
dimThe node's dimension for the node pointed to by node.
containerThe container being iterated.

Definition at line 191 of file spatial_region.hpp.

Member Function Documentation

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
region_iterator<Ct, Predicate>& spatial::region_iterator< Ct, Predicate >::operator++ ( )

Increments the iterator and returns the incremented value.

Prefer to use this form in for loops.

Definition at line 197 of file spatial_region.hpp.

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
region_iterator<Ct, Predicate> spatial::region_iterator< Ct, Predicate >::operator++ ( int  )

Increments the iterator but returns the value of the iterator before the increment.

Prefer to use the other form in for loops.

Definition at line 202 of file spatial_region.hpp.

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
region_iterator<Ct, Predicate>& spatial::region_iterator< Ct, Predicate >::operator-- ( )

Decrements the iterator and returns the decremented value.

Prefer to use this form in for loops.

Definition at line 211 of file spatial_region.hpp.

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
region_iterator<Ct, Predicate> spatial::region_iterator< Ct, Predicate >::operator-- ( int  )

Decrements the iterator but returns the value of the iterator before the decrement.

Prefer to use the other form in for loops.

Definition at line 216 of file spatial_region.hpp.

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
Predicate spatial::region_iterator< Ct, Predicate >::predicate ( ) const

Return the key_comparator used by the iterator.

Definition at line 224 of file spatial_region.hpp.

Member Data Documentation

template<typename Ct, typename Predicate = bounds<typename container_traits<Ct>::key_type, typename container_traits<Ct>::key_compare>>
Predicate spatial::region_iterator< Ct, Predicate >::_pred
private

The related data for the iterator.

Definition at line 228 of file spatial_region.hpp.


The documentation for this class was generated from the following file: