Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial::equal_iterator< Container > Class Template Reference

This type provides an iterator to iterate through all elements of a container that match a given key, passed as a parameter to the constructor. More...

#include <equal_iterator.hpp>

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

Public Types

typedef container_traits< Container >::key_type key_type
 The type used to store the model key to be looked up in the container. More...
 
typedef container_traits< Container >::key_compare key_compare
 The comparison functor used to compare keys. More...
 

Public Member Functions

 equal_iterator ()
 Constructs an empty, uninitialized object. More...
 
 equal_iterator (Container &container, const key_type &value_, typename container_traits< Container >::iterator iter)
 Build an equal iterator from a container's iterator type. More...
 
 equal_iterator (Container &container, const key_type &value_, dimension_type dim, typename container_traits< Container >::mode_type::node_ptr ptr)
 Build an equal iterator from the node and current dimension of a container's element. More...
 
equal_iterator< Container > & operator++ ()
 Increments the iterator and returns the incremented value. More...
 
equal_iterator< Container > operator++ (int)
 Increments the iterator but returns the value of the iterator before the increment. More...
 
equal_iterator< Container > & operator-- ()
 Decrements the iterator and returns the decremented value. More...
 
equal_iterator< Container > operator-- (int)
 Decrements the iterator but returns the value of the iterator before the decrement. More...
 
key_type value () const
 Return the value of key used to find equal keys in the container. More...
 
key_compare key_comp () const
 Return the functor used to compare keys in this iterator. More...
 

Private Types

typedef details::Bidirectional_iterator< typename container_traits< Container >::mode_type, typename container_traits< Container >::rank_type > Base
 The preorder iterator without its criterion. More...
 

Private Attributes

details::Equal< Container > _query
 The model key used to find equal keys in the container. More...
 

Detailed Description

template<typename Container>
class spatial::equal_iterator< Container >

This type provides an iterator to iterate through all elements of a container that match a given key, passed as a parameter to the constructor.

The given key is called the model.

Template Parameters
ContainerThe container upon which these iterator relate to.

Definition at line 123 of file spatial_equal.hpp.

Member Typedef Documentation

template<typename Container>
typedef details::Bidirectional_iterator<typename container_traits<Container>::mode_type, typename container_traits<Container>::rank_type> spatial::equal_iterator< Container >::Base
private

The preorder iterator without its criterion.

Definition at line 132 of file spatial_equal.hpp.

template<typename Container>
typedef container_traits<Container>::key_compare spatial::equal_iterator< Container >::key_compare

The comparison functor used to compare keys.

Definition at line 143 of file spatial_equal.hpp.

template<typename Container>
typedef container_traits<Container>::key_type spatial::equal_iterator< Container >::key_type

The type used to store the model key to be looked up in the container.

Definition at line 140 of file spatial_equal.hpp.

Constructor & Destructor Documentation

template<typename Container>
spatial::equal_iterator< Container >::equal_iterator ( )

Constructs an empty, uninitialized object.

Definition at line 146 of file spatial_equal.hpp.

template<typename Container>
spatial::equal_iterator< Container >::equal_iterator ( Container &  container,
const key_type value_,
typename container_traits< Container >::iterator  iter 
)

Build an equal 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)\,$ when the container is perfectly balanced.

Parameters
containerThe container being iterated.
value_The key to look for.
iterAn iterator on the type Ct.

Definition at line 161 of file spatial_equal.hpp.

template<typename Container>
spatial::equal_iterator< Container >::equal_iterator ( Container &  container,
const key_type value_,
dimension_type  dim,
typename container_traits< Container >::mode_type::node_ptr  ptr 
)

Build an equal 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
containerThe container being iterated.
value_The key to look for.
ptrAn iterator on the type Ct.
dimThe node's dimension for the node pointed to by node.
containerThe container being iterated.

Definition at line 185 of file spatial_equal.hpp.

Member Function Documentation

template<typename Container>
key_compare spatial::equal_iterator< Container >::key_comp ( ) const

Return the functor used to compare keys in this iterator.

Definition at line 232 of file spatial_equal.hpp.

template<typename Container>
equal_iterator<Container>& spatial::equal_iterator< Container >::operator++ ( )

Increments the iterator and returns the incremented value.

Prefer to use this form in for loops.

Definition at line 192 of file spatial_equal.hpp.

template<typename Container>
equal_iterator<Container> spatial::equal_iterator< Container >::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 201 of file spatial_equal.hpp.

template<typename Container>
equal_iterator<Container>& spatial::equal_iterator< Container >::operator-- ( )

Decrements the iterator and returns the decremented value.

Prefer to use this form in for loops.

Definition at line 211 of file spatial_equal.hpp.

template<typename Container>
equal_iterator<Container> spatial::equal_iterator< Container >::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 220 of file spatial_equal.hpp.

template<typename Container>
key_type spatial::equal_iterator< Container >::value ( ) const

Return the value of key used to find equal keys in the container.

Definition at line 229 of file spatial_equal.hpp.

Member Data Documentation

template<typename Container>
details::Equal<Container> spatial::equal_iterator< Container >::_query
private

The model key used to find equal keys in the container.

Definition at line 236 of file spatial_equal.hpp.


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