Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial::equal_iterator< const 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 <spatial_equal.hpp>

Inherits Const_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 (const Container &container, const key_type &value_, typename container_traits< Container >::const_iterator iter)
 Build an equal iterator from a container's iterator type. More...
 
 equal_iterator (const Container &container, const key_type &value_, dimension_type dim, typename container_traits< Container >::mode_type::const_node_ptr ptr)
 Build an equal iterator from the node and current dimension of a container's element. More...
 
 equal_iterator (const equal_iterator< Container > &iter)
 Convertion of an iterator into a const_iterator is permitted. More...
 
equal_iterator< const Container > & operator++ ()
 Increments the iterator and returns the incremented value. More...
 
equal_iterator< const Container > operator++ (int)
 Increments the iterator but returns the value of the iterator before the increment. More...
 
equal_iterator< const Container > & operator-- ()
 Decrements the iterator and returns the decremented value. More...
 
equal_iterator< const Container > operator-- (int)
 Decrements the iterator but returns the value of the iterator before the decrement. More...
 
key_type value () const
 Returns the value used to find equivalent keys in the container. More...
 
key_compare key_comp () const
 Returns the functor used to compare keys in this iterator. More...
 

Private Types

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

The values returned by this iterator will not be mutable.

Template Parameters
CtThe container upon which these iterator relate to.

Definition at line 249 of file spatial_equal.hpp.

Member Typedef Documentation

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

The preorder iterator without its criterion.

Definition at line 258 of file spatial_equal.hpp.

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

The comparison functor used to compare keys.

Definition at line 269 of file spatial_equal.hpp.

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

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

Definition at line 266 of file spatial_equal.hpp.

Constructor & Destructor Documentation

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

Constructs an empty, uninitialized object.

Definition at line 272 of file spatial_equal.hpp.

template<typename Container >
spatial::equal_iterator< const Container >::equal_iterator ( const Container &  container,
const key_type value_,
typename container_traits< Container >::const_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 from the container.

Definition at line 287 of file spatial_equal.hpp.

template<typename Container >
spatial::equal_iterator< const Container >::equal_iterator ( const Container &  container,
const key_type value_,
dimension_type  dim,
typename container_traits< Container >::mode_type::const_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 since the dimension does not have to be calculated.

Parameters
containerThe container being iterated.
value_The key to look for.
dimThe dimension associated with ptr when checking the invariant in container.
ptrA pointer to a node belonging to container.

Definition at line 308 of file spatial_equal.hpp.

template<typename Container >
spatial::equal_iterator< const Container >::equal_iterator ( const equal_iterator< Container > &  iter)

Convertion of an iterator into a const_iterator is permitted.

Definition at line 314 of file spatial_equal.hpp.

Member Function Documentation

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

Returns the functor used to compare keys in this iterator.

Definition at line 360 of file spatial_equal.hpp.

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

Increments the iterator and returns the incremented value.

Prefer to use this form in for loops.

Definition at line 320 of file spatial_equal.hpp.

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

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

Decrements the iterator and returns the decremented value.

Prefer to use this form in for loops.

Definition at line 339 of file spatial_equal.hpp.

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

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

Returns the value used to find equivalent keys in the container.

Definition at line 357 of file spatial_equal.hpp.

Member Data Documentation

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

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

Definition at line 364 of file spatial_equal.hpp.


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