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 |
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 | |
mapping_iterator () | |
Build an uninitialized iterator. More... | |
mapping_iterator (const Ct &container, dimension_type mapping_dim, typename container_traits< Ct >::const_iterator iter) | |
The standard way to build this iterator: specify a mapping dimension, an iterator on a container, and that container. More... | |
mapping_iterator (const Ct &container, dimension_type mapping_dim, 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... | |
mapping_iterator (const mapping_iterator< Ct > &iter) | |
Convertion of mutable iterator into a constant iterator is permitted. More... | |
mapping_iterator< const Ct > & | operator++ () |
Increments the iterator and returns the incremented value. More... | |
mapping_iterator< const Ct > | operator++ (int) |
Increments the iterator but returns the value of the iterator before the increment. More... | |
mapping_iterator< const Ct > & | operator-- () |
Decrements the iterator and returns the decremented value. More... | |
mapping_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... | |
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::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_type > | Base |
Private Attributes | |
details::Mapping< Ct > | _data |
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... | |
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
.
Object deferenced by this iterator are always constant.
Definition at line 248 of file mapping_iterator.hpp.
|
private |
Definition at line 256 of file mapping_iterator.hpp.
typedef container_traits<Ct>::key_compare spatial::mapping_iterator< const Ct >::key_compare |
Alias for the key_compare type used by the iterator.
Definition at line 264 of file mapping_iterator.hpp.
spatial::mapping_iterator< const Ct >::mapping_iterator | ( | ) |
Build an uninitialized iterator.
Definition at line 267 of file mapping_iterator.hpp.
spatial::mapping_iterator< const Ct >::mapping_iterator | ( | const Ct & | container, |
dimension_type | mapping_dim, | ||
typename container_traits< Ct >::const_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 279 of file mapping_iterator.hpp.
spatial::mapping_iterator< const Ct >::mapping_iterator | ( | const Ct & | container, |
dimension_type | mapping_dim, | ||
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.
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 311 of file mapping_iterator.hpp.
spatial::mapping_iterator< const Ct >::mapping_iterator | ( | const mapping_iterator< Ct > & | iter | ) |
Convertion of mutable iterator into a constant iterator is permitted.
Definition at line 318 of file mapping_iterator.hpp.
key_compare spatial::mapping_iterator< const Ct >::key_comp | ( | ) | const |
Return the key_comparator used by the iterator.
Definition at line 366 of file mapping_iterator.hpp.
dimension_type spatial::mapping_iterator< const 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 386 of file mapping_iterator.hpp.
dimension_type& spatial::mapping_iterator< const 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 388 of file mapping_iterator.hpp.
mapping_iterator<const Ct>& spatial::mapping_iterator< const Ct >::operator++ | ( | ) |
Increments the iterator and returns the incremented value.
Prefer to use this form in for
loops.
Definition at line 324 of file mapping_iterator.hpp.
mapping_iterator<const Ct> spatial::mapping_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 334 of file mapping_iterator.hpp.
mapping_iterator<const Ct>& spatial::mapping_iterator< const Ct >::operator-- | ( | ) |
Decrements the iterator and returns the decremented value.
Prefer to use this form in for
loops.
Definition at line 345 of file mapping_iterator.hpp.
mapping_iterator<const Ct> spatial::mapping_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 355 of file mapping_iterator.hpp.
|
private |
The related data for the iterator.
Definition at line 393 of file mapping_iterator.hpp.