Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
|
This iterator walks through all items in the container in order from the lowest to the highest value along a particular dimension. More...
#include <mapping_iterator.hpp>
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 | |
mapping_iterator () | |
Uninitialized iterator. More... | |
mapping_iterator (Ct &container, dimension_type mapping_dim, typename container_traits< Ct >::iterator iter) | |
The standard way to build this iterator: specify a mapping dimension, an iterator on a container, and that container. More... | |
mapping_iterator (Ct &container, dimension_type mapping_dim, 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... | |
mapping_iterator< Ct > & | operator++ () |
Increments the iterator and returns the incremented value. More... | |
mapping_iterator< Ct > | operator++ (int) |
Increments the iterator but returns the value of the iterator before the increment. More... | |
mapping_iterator< Ct > & | operator-- () |
Decrements the iterator and returns the decremented value. More... | |
mapping_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... | |
dimension_type | mapping_dimension () const |
Accessor to the mapping dimension used by the iterator. More... | |
dimension_type & | mapping_dimension () |
Accessor to the mapping dimension 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_type & | rank () 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_type > | Base |
Private Attributes | |
details::Mapping< Ct > | _data |
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... | |
This iterator walks through all items in the container in order from the lowest to the highest value along a particular dimension.
The key_comp
comparator of the container is used for comparision.
In effect, that makes any container of the library behave as a std::set
or std::map
. Through this iterator, a spatial container with 3 dimensions can provide the same features as 3 std::set(s)
or std::map(s)
containing the same elements and ordered on each of these dimensions. Beware that iteration through the tree is very efficient when the dimension k-d tree is very small by comparison to the number of objects, but pretty inefficient otherwise, by comparison to a std::set
.
Definition at line 93 of file mapping_iterator.hpp.
|
private |
Definition at line 101 of file mapping_iterator.hpp.
typedef container_traits<Ct>::key_compare spatial::mapping_iterator< Ct >::key_compare |
Definition at line 108 of file mapping_iterator.hpp.
spatial::mapping_iterator< Ct >::mapping_iterator | ( | ) |
Uninitialized iterator.
Definition at line 111 of file mapping_iterator.hpp.
spatial::mapping_iterator< Ct >::mapping_iterator | ( | Ct & | container, |
dimension_type | mapping_dim, | ||
typename container_traits< Ct >::iterator | iter | ||
) |
The standard way to build this iterator: specify a mapping dimension, an iterator on a container, and that container.
container | The container to iterate. |
mapping_dim | The dimension used to order all nodes during the iteration. |
iter | Use the value of iter as the start point for the iteration. |
Definition at line 123 of file mapping_iterator.hpp.
spatial::mapping_iterator< Ct >::mapping_iterator | ( | Ct & | container, |
dimension_type | mapping_dim, | ||
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().
container | The container to iterate. |
mapping_dim | The dimension used to order all nodes during the iteration. |
dim | The dimension of the node pointed to by iterator. |
ptr | Use the value of node as the start point for the iteration. |
Definition at line 151 of file mapping_iterator.hpp.
key_compare spatial::mapping_iterator< Ct >::key_comp | ( | ) | const |
Return the key_comparator used by the iterator.
Definition at line 202 of file mapping_iterator.hpp.
dimension_type spatial::mapping_iterator< Ct >::mapping_dimension | ( | ) | const |
Accessor to the mapping dimension used by the iterator.
No check is performed on this accessor if a new mapping dimension is given. If you need to check that the mapping dimension given does not exceed the rank use the function spatial::mapping_dimension() instead:
Definition at line 222 of file mapping_iterator.hpp.
dimension_type& spatial::mapping_iterator< Ct >::mapping_dimension | ( | ) |
Accessor to the mapping dimension used by the iterator.
No check is performed on this accessor if a new mapping dimension is given. If you need to check that the mapping dimension given does not exceed the rank use the function spatial::mapping_dimension() instead:
Definition at line 224 of file mapping_iterator.hpp.
mapping_iterator<Ct>& spatial::mapping_iterator< Ct >::operator++ | ( | ) |
Increments the iterator and returns the incremented value.
Prefer to use this form in for
loops.
Definition at line 160 of file mapping_iterator.hpp.
mapping_iterator<Ct> spatial::mapping_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 170 of file mapping_iterator.hpp.
mapping_iterator<Ct>& spatial::mapping_iterator< Ct >::operator-- | ( | ) |
Decrements the iterator and returns the decremented value.
Prefer to use this form in for
loops.
Definition at line 181 of file mapping_iterator.hpp.
mapping_iterator<Ct> spatial::mapping_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 191 of file mapping_iterator.hpp.
|
private |
The related data for the iterator.
Definition at line 229 of file mapping_iterator.hpp.