Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial::ordered_iterator< 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. More...

#include <spatial_ordered.hpp>

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

Public Types

typedef container_traits< Ct >::key_compare key_compare
 
- Public Types inherited from spatial::details::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 container_traits< Ct >::mode_type::value_type & reference
 The reference type of the object pointed to by the iterator. More...
 
typedef 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::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 ()
 Uninitialized iterator. More...
 
 ordered_iterator (Ct &container, typename container_traits< Ct >::iterator iter)
 The standard way to build this iterator: specify a ordered dimension, an iterator on a container, and that container. More...
 
 ordered_iterator (Ct &container, dimension_type dim, typename container_traits< Ct >::mode_type::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< Ct > & operator++ ()
 Increments the iterator and returns the incremented value. More...
 
ordered_iterator< Ct > operator++ (int)
 Increments the iterator but returns the value of the iterator before the increment. More...
 
ordered_iterator< Ct > & operator-- ()
 Decrements the iterator and returns the decremented value. More...
 
ordered_iterator< 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::Bidirectional_iterator< container_traits< Ct >::mode_type, container_traits< Ct >::rank_type >
 Bidirectional_iterator ()
 Build an uninitialized iterator. More...
 
 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 linking modes. More...
 
const rank_typerank () const
 Return the current Rank type used by the iterator. More...
 
dimension_type dimension () const
 Return the number of dimensions stored by the Rank of the iterator. More...
 
 operator Node_iterator< container_traits< Ct >::mode_type > () const
 This iterator can be casted silently into a container iterator. More...
 
 operator Const_node_iterator< container_traits< Ct >::mode_type > () const
 This iterator can be casted silently into a container iterator. More...
 

Private Types

typedef details::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::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< 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.

These iterators walk through all items in the container in order from the lowest to the highest value along a particular dimension. The key comparator of the container is used for comparision.

Definition at line 32 of file spatial_ordered.hpp.

Member Typedef Documentation

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

Definition at line 40 of file spatial_ordered.hpp.

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

Definition at line 43 of file spatial_ordered.hpp.

Constructor & Destructor Documentation

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

Uninitialized iterator.

Definition at line 46 of file spatial_ordered.hpp.

template<typename Ct>
spatial::ordered_iterator< Ct >::ordered_iterator ( Ct &  container,
typename container_traits< Ct >::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 value of iter as the start point for the iteration.

Definition at line 56 of file spatial_ordered.hpp.

template<typename Ct>
spatial::ordered_iterator< Ct >::ordered_iterator ( Ct &  container,
dimension_type  dim,
typename container_traits< Ct >::mode_type::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.

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.
Parameters
containerThe container to iterate.
dimThe dimension of the node pointed to by iterator.
ptrUse the value of node as the start point for the iteration.

Definition at line 82 of file spatial_ordered.hpp.

Member Function Documentation

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

Return the key_comparator used by the iterator.

Definition at line 117 of file spatial_ordered.hpp.

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

Increments the iterator and returns the incremented value.

Prefer to use this form in for loops.

Definition at line 89 of file spatial_ordered.hpp.

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

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

Decrements the iterator and returns the decremented value.

Prefer to use this form in for loops.

Definition at line 103 of file spatial_ordered.hpp.

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

Member Data Documentation

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

The related data for the iterator.

Definition at line 121 of file spatial_ordered.hpp.


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