SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
An iterator for array-indexed IDs. More...
#include <IndirectAssignedIds.h>
Public Types | |
using | value_type = IdType |
using | reference_type = IdType & |
using | index_type = vtkIdType |
Public Member Functions | |
Iterator (const Iterator< IsForward > &other)=default | |
Iterator< IsForward > & | operator= (const Iterator< IsForward > &other)=default |
Iterator< IsForward > | operator++ () |
Iterator< IsForward > & | operator++ (int) |
Iterator< IsForward > | operator-- () |
Iterator< IsForward > & | operator-- (int) |
Iterator & | operator+= (std::size_t count) |
Iterator & | operator-= (std::size_t count) |
Iterator< IsForward > | operator+ (std::size_t delta) const |
Iterator< IsForward > | operator- (std::size_t delta) const |
const value_type & | operator* () const |
const value_type & | operator-> () const |
index_type | index () const |
Return the index of the ID within this AssignedIds object. More... | |
bool | operator== (const Iterator &other) const |
bool | operator!= (const Iterator &other) const |
Static Public Attributes | |
static constexpr IdType | Invalid = ~0ull |
Protected Member Functions | |
Iterator (IdType value, std::shared_ptr< const IndirectAssignedIds > parent) | |
value_type | advance (value_type current, const std::shared_ptr< const IndirectAssignedIds > &parent, std::size_t count=1) const |
value_type | retreat (value_type current, const std::shared_ptr< const IndirectAssignedIds > &parent, std::size_t count=1) const |
Protected Attributes | |
value_type | m_value |
std::weak_ptr< const IndirectAssignedIds > | m_parent |
Friends | |
class | IndirectAssignedIds |
An iterator for array-indexed IDs.
We introduce a new type rather than using the underlying multimap iterator to harmonize the iterator API with SequentialAssignedIds, which has an index() method.
This iterator may provide multiple index values per ID (since the array may repeat an ID) but this use case is expected to be rare; an additional method is provided to fetch them all rather than the first occurrence.
|
inline |
Return the index of the ID within this AssignedIds object.
The index is the ID minus range()[0]. For example, if a 10×10×10 image has point IDs 100 through 1100, the iterator's value (the result of dereferencing the iterator using the '*' operator) might be 101 while the index would be 1. This is useful for translating from IDs to (i,j,k)-indices in the image.