Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial::ordered_iterator< const Ct > Class Template Reference

All elements returned by this iterator are ordered from the smallest to the largest value of their key's coordinate along a single dimension, called the ordered dimension. More...

#include <spatial_ordered.hpp>

Inherits spatial::details::Const_bidirectional_iterator< container_traits< Ct >::mode_type, container_traits< Ct >::rank_type >.

Public Types

typedef container_traits< Ct >::key_compare key_compare
 Alias for the key_compare type used by the iterator. More...
 
- Public Types inherited from spatial::details::Const_bidirectional_iterator< container_traits< Ct >::mode_type, container_traits< Ct >::rank_type >
typedef mutate< typename container_traits< Ct >::mode_type::value_type >::type value_type
 The value_type can receive a copy of the reference pointed to be the iterator. More...
 
typedef const container_traits< Ct >::mode_type::value_type & reference
 The reference type of the object pointed to by the iterator. More...
 
typedef const container_traits< Ct >::mode_type::value_type * pointer
 The pointer type of the object pointed to by the iterator. More...
 
typedef std::ptrdiff_t difference_type
 The difference_type returned by the distance between 2 iterators. More...
 
typedef std::bidirectional_iterator_tag iterator_category
 The iterator category that is always Bidirectional_iterator_tag. More...
 
typedef container_traits< Ct >::mode_type::const_node_ptr node_ptr
 The type for the node pointed to by the iterator. More...
 
typedef container_traits< Ct >::rank_type rank_type
 The type of rank used by the iterator. More...
 
typedef container_traits< Ct >::mode_type::invariant_category invariant_category
 The invariant category of the the iterator. More...
 

Public Member Functions

 ordered_iterator ()
 Build an uninitialized iterator. More...
 
 ordered_iterator (const Ct &container, typename container_traits< Ct >::const_iterator iter)
 The standard way to build this iterator: specify a ordered dimension, an iterator on a container, and that container. More...
 
 ordered_iterator (const Ct &container, dimension_type dim, typename container_traits< Ct >::mode_type::const_node_ptr ptr)
 When the information of the dimension for the current node being pointed to by the iterator is known, this function saves some CPU cycle, by comparison to the other. More...
 
 ordered_iterator (const ordered_iterator< Ct > &iter)
 Convertion of mutable iterator into a constant iterator is permitted. More...
 
ordered_iterator< const Ct > & operator++ ()
 Increments the iterator and returns the incremented value. More...
 
ordered_iterator< const Ct > operator++ (int)
 Increments the iterator but returns the value of the iterator before the increment. More...
 
ordered_iterator< const Ct > & operator-- ()
 Decrements the iterator and returns the decremented value. More...
 
ordered_iterator< const Ct > operator-- (int)
 Decrements the iterator but returns the value of the iterator before the decrement. More...
 
key_compare key_comp () const
 Return the key_comparator used by the iterator. More...
 
- Public Member Functions inherited from spatial::details::Const_bidirectional_iterator< container_traits< Ct >::mode_type, container_traits< Ct >::rank_type >
 Const_bidirectional_iterator ()
 Build an uninitialized iterator. More...
 
 Const_bidirectional_iterator (const container_traits< Ct >::rank_type &rank_, node_ptr node_, dimension_type node_dim_)
 Initialize the node at construction time. More...
 
reference operator* ()
 Returns the reference to the value pointed to by the iterator. More...
 
pointer operator-> ()
 Returns a pointer to the value pointed to by the iterator. More...
 
bool operator== (const Const_node_iterator< container_traits< Ct >::mode_type > &x) const
 A bidirectional iterator can be compared with a node iterator if they work on identical linking modes. More...
 
bool operator!= (const Const_node_iterator< container_traits< Ct >::mode_type > &x) const
 A bidirectional iterator can be compared for inequality with a node iterator if they work on identical linkingmodes". More...
 
 operator Const_node_iterator< container_traits< Ct >::mode_type > () const
 Children of this iterator can be casted silently into a container iterator. More...
 
rank_type rank () const
 Return the current Rank type used by the iterator. More...
 
dimension_type dimension () const
 Return the current number of dimensions given by the Rank of the iterator. More...
 

Private Types

typedef details::Const_bidirectional_iterator< typename container_traits< Ct >::mode_type, typename container_traits< Ct >::rank_typeBase
 

Private Attributes

key_compare _cmp
 The related data for the iterator. More...
 

Additional Inherited Members

- Public Attributes inherited from spatial::details::Const_bidirectional_iterator< container_traits< Ct >::mode_type, container_traits< Ct >::rank_type >
node_ptr node
 The pointer to the current node. More...
 
dimension_type node_dim
 The dimension of the current node. More...
 

Detailed Description

template<typename Ct>
class spatial::ordered_iterator< const Ct >

All elements returned by this iterator are ordered from the smallest to the largest value of their key's coordinate along a single dimension, called the ordered dimension.

Object deferenced by this iterator are always constant.

Definition at line 132 of file spatial_ordered.hpp.

Member Typedef Documentation

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

Definition at line 140 of file spatial_ordered.hpp.

template<typename Ct >
typedef container_traits<Ct>::key_compare spatial::ordered_iterator< const Ct >::key_compare

Alias for the key_compare type used by the iterator.

Definition at line 144 of file spatial_ordered.hpp.

Constructor & Destructor Documentation

template<typename Ct >
spatial::ordered_iterator< const Ct >::ordered_iterator ( )

Build an uninitialized iterator.

Definition at line 147 of file spatial_ordered.hpp.

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

The standard way to build this iterator: specify a ordered dimension, an iterator on a container, and that container.

Parameters
containerThe container to iterate.
iterUse the iterator iter as the start point for the iteration.

Definition at line 157 of file spatial_ordered.hpp.

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

When the information of the dimension for the current node being pointed to by the iterator is known, this function saves some CPU cycle, by comparison to the other.

Parameters
containerThe container to iterate.
dimThe dimension of the node pointed to by iterator.
ptrUse node as the start point for the iteration.

In order to iterate through nodes in the k-d tree built in the container, the algorithm must know at each node which dimension is used to partition the space. Some algorithms will provide this dimension, such as the function spatial::details::modulo().

Attention
Specifying the incorrect dimension value for the node will result in unknown behavior. It is recommended that you do not use this constructor if you are not sure about this dimension, and use the other constructors instead.

Definition at line 183 of file spatial_ordered.hpp.

template<typename Ct >
spatial::ordered_iterator< const Ct >::ordered_iterator ( const ordered_iterator< Ct > &  iter)

Convertion of mutable iterator into a constant iterator is permitted.

Definition at line 189 of file spatial_ordered.hpp.

Member Function Documentation

template<typename Ct >
key_compare spatial::ordered_iterator< const Ct >::key_comp ( ) const

Return the key_comparator used by the iterator.

Definition at line 223 of file spatial_ordered.hpp.

template<typename Ct >
ordered_iterator<const Ct>& spatial::ordered_iterator< const Ct >::operator++ ( )

Increments the iterator and returns the incremented value.

Prefer to use this form in for loops.

Definition at line 195 of file spatial_ordered.hpp.

template<typename Ct >
ordered_iterator<const Ct> spatial::ordered_iterator< const Ct >::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 200 of file spatial_ordered.hpp.

template<typename Ct >
ordered_iterator<const Ct>& spatial::ordered_iterator< const Ct >::operator-- ( )

Decrements the iterator and returns the decremented value.

Prefer to use this form in for loops.

Definition at line 209 of file spatial_ordered.hpp.

template<typename Ct >
ordered_iterator<const Ct> spatial::ordered_iterator< const Ct >::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 214 of file spatial_ordered.hpp.

Member Data Documentation

template<typename Ct >
key_compare spatial::ordered_iterator< const Ct >::_cmp
private

The related data for the iterator.

Definition at line 227 of file spatial_ordered.hpp.


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