Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial::region_iterator< const 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 Const_bidirectional_iterator < container_traits< Ct >::mode_type, container_traits< Ct >::rank_type >.

Public Member Functions

 region_iterator ()
 Constructs an empty, uninitialized object. More...
 
 region_iterator (const Ct &container, const Predicate &pred, typename container_traits< Ct >::const_iterator iter)
 Build a region iterator from a container's iterator type. More...
 
 region_iterator (const Ct &container, const Predicate &pred, dimension_type dim, typename container_traits< Ct >::mode_type::const_node_ptr ptr)
 Build a region iterator from the node and current dimension of a container's element. More...
 
 region_iterator (const region_iterator< Ct, Predicate > &iter)
 Convertion of an iterator into a const_iterator is permitted. More...
 
region_iterator< const Ct, Predicate > & operator++ ()
 Increments the iterator and returns the incremented value. More...
 
region_iterator< const Ct, Predicate > operator++ (int)
 Increments the iterator but returns the value of the iterator before the increment. More...
 
region_iterator< const Ct, Predicate > & operator-- ()
 Decrements the iterator and returns the decremented value. More...
 
region_iterator< const 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::Const_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>
class spatial::region_iterator< const 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 246 of file spatial_region.hpp.

Member Typedef Documentation

template<typename Ct , typename Predicate >
typedef details::Const_bidirectional_iterator<typename container_traits<Ct>::mode_type, typename container_traits<Ct>::rank_type> spatial::region_iterator< const Ct, Predicate >::Base
private

Definition at line 254 of file spatial_region.hpp.

Constructor & Destructor Documentation

template<typename Ct , typename Predicate >
spatial::region_iterator< const Ct, Predicate >::region_iterator ( )

Constructs an empty, uninitialized object.

Definition at line 258 of file spatial_region.hpp.

template<typename Ct , typename Predicate >
spatial::region_iterator< const Ct, Predicate >::region_iterator ( const Ct &  container,
const Predicate &  pred,
typename container_traits< Ct >::const_iterator  iter 
)

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

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

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.

Definition at line 274 of file spatial_region.hpp.

template<typename Ct , typename Predicate >
spatial::region_iterator< const Ct, Predicate >::region_iterator ( const Ct &  container,
const Predicate &  pred,
dimension_type  dim,
typename container_traits< Ct >::mode_type::const_node_ptr  ptr 
)

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

Parameters
containerThe container being iterated.
predA model of the Region Predicate concept.
dimThe dimension associated with ptr when checking the invariant in container.
ptrA pointer to a node belonging to container.

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.

Definition at line 298 of file spatial_region.hpp.

template<typename Ct , typename Predicate >
spatial::region_iterator< const Ct, Predicate >::region_iterator ( const region_iterator< Ct, Predicate > &  iter)

Convertion of an iterator into a const_iterator is permitted.

Definition at line 303 of file spatial_region.hpp.

Member Function Documentation

template<typename Ct , typename Predicate >
region_iterator<const Ct, Predicate>& spatial::region_iterator< const Ct, Predicate >::operator++ ( )

Increments the iterator and returns the incremented value.

Prefer to use this form in for loops.

Definition at line 308 of file spatial_region.hpp.

template<typename Ct , typename Predicate >
region_iterator<const Ct, Predicate> spatial::region_iterator< const 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 313 of file spatial_region.hpp.

template<typename Ct , typename Predicate >
region_iterator<const Ct, Predicate>& spatial::region_iterator< const Ct, Predicate >::operator-- ( )

Decrements the iterator and returns the decremented value.

Prefer to use this form in for loops.

Definition at line 322 of file spatial_region.hpp.

template<typename Ct , typename Predicate >
region_iterator<const Ct, Predicate> spatial::region_iterator< const 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 327 of file spatial_region.hpp.

template<typename Ct , typename Predicate >
Predicate spatial::region_iterator< const Ct, Predicate >::predicate ( ) const

Return the key_comparator used by the iterator.

Definition at line 335 of file spatial_region.hpp.

Member Data Documentation

template<typename Ct , typename Predicate >
Predicate spatial::region_iterator< const Ct, Predicate >::_pred
private

The related data for the iterator.

Definition at line 339 of file spatial_region.hpp.


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