OpenWalnut
1.5.0dev
|
An iterator for fibers of a fiber dataset. More...
#include <WDataSetFibers.h>
Public Member Functions | |
WFiberIterator () | |
Constructor. More... | |
WFiberIterator (WDataSetFibers const *fibers, std::size_t idx) | |
Constructor. More... | |
WFiberIterator (WFiberIterator const &iter) | |
Copy constructor. More... | |
~WFiberIterator () | |
Destructor. More... | |
WFiberIterator & | operator= (WFiberIterator const &iter) |
Copy operator. More... | |
WFiberIterator & | operator++ () |
Increment operator. More... | |
WFiberIterator & | operator-- () |
Decrement operator. More... | |
WFiberIterator | operator++ (int) |
Increment operator. More... | |
WFiberIterator | operator-- (int) |
Decrement operator. More... | |
WFiberIterator | operator+ (size_t n) const |
Plus operator. More... | |
WFiberIterator | operator- (size_t n) const |
Minus operator. More... | |
bool | operator== (WFiberIterator const &rhs) const |
Compare to another fiber iterator. More... | |
bool | operator!= (WFiberIterator const &rhs) const |
Compare to another fiber iterator. More... | |
WIteratorRangeUnpacker< WFiberIterator > | operator, (WFiberIterator &other) |
Creates a temporary object that is used to unpack an iterator range to two iterators. More... | |
operator bool () const | |
Converts to a bool that indicates whether the current iterator is valid, i.e. More... | |
OW_API_DEPRECATED WFiberPointsIterator | begin () |
Creates a point iterator for forward iteration, pointing to the first point of the fiber. More... | |
OW_API_DEPRECATED WFiberPointsIterator | end () |
Creates a point iterator for forward iteration, pointing beyond the last point of the fiber. More... | |
OW_API_DEPRECATED WFiberPointsIterator | rbegin () |
Creates a point iterator for backward iteration, pointing to the last point of the fiber. More... | |
OW_API_DEPRECATED WFiberPointsIterator | rend () |
Creates a point iterator for backward iteration, pointing beyond the first point of the fiber. More... | |
WIteratorRange< WFiberPointsIterator > | points () const |
Creates a range of iterators that allows for forward iteration of the points of the fiber this iterator currently points to. More... | |
WIteratorRange< WFiberPointsIterator > | pointsReverse () const |
Creates a range of iterators that allows for reverse iteration of the points of the fiber this iterator currently points to. More... | |
OW_API_DEPRECATED WFiberSegmentsIterator | sbegin () |
Returns a forward iterator to the first segment. More... | |
OW_API_DEPRECATED WFiberSegmentsIterator | send () |
Returns a forward iterator to the invalid segment after the last (i.e. More... | |
OW_API_DEPRECATED WFiberSegmentsIterator | srbegin () |
Returns a backward iterator to the last segment. More... | |
OW_API_DEPRECATED WFiberSegmentsIterator | srend () |
Returns a backward iterator to the invalid segment before the first (i.e. More... | |
WIteratorRange< WFiberSegmentsIterator > | segments () const |
Creates a range of iterators that allows for forward iteration of the segments of the fiber this iterator currently points to. More... | |
WIteratorRange< WFiberSegmentsIterator > | segmentsReverse () const |
Creates a range of iterators that allows for reverse iteration of the segments of the fiber this iterator currently points to. More... | |
std::size_t | numPoints () const |
Returns the number of points of the current fiber. More... | |
std::size_t | getLineStartIndex () const |
Get the index in the point array where the points data starts for this line. More... | |
std::size_t | getIndex () const |
Get the index of the line. More... | |
double | getFiberLength () const |
The length of the line. More... | |
Private Attributes | |
WDataSetFibers const * | m_fibers |
The pointer to the fibers. More... | |
std::size_t | m_index |
The current index in the fiber data. More... | |
An iterator for fibers of a fiber dataset.
This class iterates fibers of a fiber dataset.
There are two ways to use the iterator. First:
Second:
Use the provided points() and segments() functions to iterate the points or segments of the current fiber. You can also check whether an iterator points to a valid fiber by:
Definition at line 609 of file WDataSetFibers.h.
WFiberIterator::WFiberIterator | ( | ) |
Constructor.
Creates an invalid iterator pointing nowhere.
Definition at line 456 of file WDataSetFibers.cpp.
Referenced by operator+(), and operator-().
WFiberIterator::WFiberIterator | ( | WDataSetFibers const * | fibers, |
std::size_t | idx | ||
) |
Constructor.
Creates an iterator for a specific fiber dataset.
fibers | A pointer to the fiber data. |
idx | The index of the fiber to point to. |
Definition at line 462 of file WDataSetFibers.cpp.
WFiberIterator::WFiberIterator | ( | WFiberIterator const & | iter | ) |
Copy constructor.
iter | The iterator to copy from. |
Definition at line 468 of file WDataSetFibers.cpp.
WFiberIterator::~WFiberIterator | ( | ) |
Destructor.
Definition at line 474 of file WDataSetFibers.cpp.
WFiberPointsIterator WFiberIterator::begin | ( | ) |
Creates a point iterator for forward iteration, pointing to the first point of the fiber.
DEPRECATED: Use the iterator range syntax instead.
Definition at line 554 of file WDataSetFibers.cpp.
WFiberPointsIterator WFiberIterator::end | ( | ) |
Creates a point iterator for forward iteration, pointing beyond the last point of the fiber.
DEPRECATED: Use the iterator range syntax instead.
Definition at line 559 of file WDataSetFibers.cpp.
References m_fibers, m_index, and numPoints().
double WFiberIterator::getFiberLength | ( | ) | const |
The length of the line.
Definition at line 644 of file WDataSetFibers.cpp.
References WFiberSegmentsIterator::length(), and segments().
std::size_t WFiberIterator::getIndex | ( | ) | const |
Get the index of the line.
Definition at line 639 of file WDataSetFibers.cpp.
References m_index.
std::size_t WFiberIterator::getLineStartIndex | ( | ) | const |
Get the index in the point array where the points data starts for this line.
You can use numPoints to know how much data to read from the vertex array.
Definition at line 634 of file WDataSetFibers.cpp.
References WDataSetFibers::getStartIndex(), m_fibers, and m_index.
std::size_t WFiberIterator::numPoints | ( | ) | const |
Returns the number of points of the current fiber.
Definition at line 547 of file WDataSetFibers.cpp.
References WDataSetFibers::getLengthOfLine(), m_fibers, and m_index.
Referenced by end(), points(), pointsReverse(), rend(), segments(), segmentsReverse(), send(), and srend().
WFiberIterator::operator bool | ( | ) | const |
Converts to a bool that indicates whether the current iterator is valid, i.e.
it points to a valid fiber and it is safe to access point or segments.
Definition at line 542 of file WDataSetFibers.cpp.
bool WFiberIterator::operator!= | ( | WFiberIterator const & | rhs | ) | const |
Compare to another fiber iterator.
rhs | The second fiber iterator. |
Definition at line 532 of file WDataSetFibers.cpp.
References operator==().
WFiberIterator WFiberIterator::operator+ | ( | size_t | n | ) | const |
Plus operator.
Increments the iterator
n | times. |
Definition at line 517 of file WDataSetFibers.cpp.
References m_fibers, m_index, and WFiberIterator().
WFiberIterator & WFiberIterator::operator++ | ( | ) |
Increment operator.
Makes the iterator point to the next fiber.
Definition at line 491 of file WDataSetFibers.cpp.
References m_index.
WFiberIterator WFiberIterator::operator++ | ( | int | ) |
Increment operator.
Makes the iterator point to the next fiber.
Definition at line 497 of file WDataSetFibers.cpp.
WIteratorRangeUnpacker< WFiberIterator > WFiberIterator::operator, | ( | WFiberIterator & | other | ) |
Creates a temporary object that is used to unpack an iterator range to two iterators.
The first of these target iterators is *this, the second is the parameter of the operator.
other | The iterator to assign the end iterator of the range to. |
Definition at line 537 of file WDataSetFibers.cpp.
WFiberIterator WFiberIterator::operator- | ( | size_t | n | ) | const |
Minus operator.
Decrements the iterator
n | times. |
Definition at line 522 of file WDataSetFibers.cpp.
References m_fibers, m_index, and WFiberIterator().
WFiberIterator & WFiberIterator::operator-- | ( | ) |
Decrement operator.
Makes the iterator point to the previous fiber.
Definition at line 504 of file WDataSetFibers.cpp.
References m_index.
WFiberIterator WFiberIterator::operator-- | ( | int | ) |
Decrement operator.
Makes the iterator point to the previous fiber.
Definition at line 510 of file WDataSetFibers.cpp.
WFiberIterator & WFiberIterator::operator= | ( | WFiberIterator const & | iter | ) |
Copy operator.
iter | The iterator to copy from. |
Definition at line 478 of file WDataSetFibers.cpp.
bool WFiberIterator::operator== | ( | WFiberIterator const & | rhs | ) | const |
Compare to another fiber iterator.
rhs | The second fiber iterator. |
Definition at line 527 of file WDataSetFibers.cpp.
References m_fibers, and m_index.
Referenced by operator!=().
WIteratorRange< WFiberPointsIterator > WFiberIterator::points | ( | ) | const |
Creates a range of iterators that allows for forward iteration of the points of the fiber this iterator currently points to.
If the current iterator is not valid, behaviour is undefined. The end iterator of the returned range is the first invalid iterator after the last point.
Definition at line 578 of file WDataSetFibers.cpp.
References m_fibers, m_index, and numPoints().
WIteratorRange< WFiberPointsIterator > WFiberIterator::pointsReverse | ( | ) | const |
Creates a range of iterators that allows for reverse iteration of the points of the fiber this iterator currently points to.
If the current iterator is not valid, behaviour is undefined. The end iterator of the returned range is the first invalid iterator before the first point.
Definition at line 586 of file WDataSetFibers.cpp.
References m_fibers, m_index, and numPoints().
WFiberPointsIterator WFiberIterator::rbegin | ( | ) |
Creates a point iterator for backward iteration, pointing to the last point of the fiber.
DEPRECATED: Use the iterator range syntax instead.
Definition at line 566 of file WDataSetFibers.cpp.
WFiberPointsIterator WFiberIterator::rend | ( | ) |
Creates a point iterator for backward iteration, pointing beyond the first point of the fiber.
DEPRECATED: Use the iterator range syntax instead.
Definition at line 571 of file WDataSetFibers.cpp.
References m_fibers, m_index, and numPoints().
WFiberSegmentsIterator WFiberIterator::sbegin | ( | ) |
Returns a forward iterator to the first segment.
DEPRECATED: Use the iterator range syntax instead.
Definition at line 594 of file WDataSetFibers.cpp.
WIteratorRange< WFiberSegmentsIterator > WFiberIterator::segments | ( | ) | const |
Creates a range of iterators that allows for forward iteration of the segments of the fiber this iterator currently points to.
If the current iterator is not valid, behaviour is undefined. The end iterator of the returned range is the first invalid iterator after the last segment. Note that there is one segment less than there are points.
Definition at line 618 of file WDataSetFibers.cpp.
References m_fibers, m_index, and numPoints().
Referenced by getFiberLength().
WIteratorRange< WFiberSegmentsIterator > WFiberIterator::segmentsReverse | ( | ) | const |
Creates a range of iterators that allows for reverse iteration of the segments of the fiber this iterator currently points to.
If the current iterator is not valid, behaviour is undefined. The end iterator of the returned range is the first invalid iterator before the first segments. Note that there is one segment less than there are points. Additionally, note that the points returned by the start() and end() methods are also reversed, i.e. not only are the segments traversed in reverse order, but they are also oriented in the opposite direction.
Definition at line 626 of file WDataSetFibers.cpp.
References m_fibers, m_index, and numPoints().
WFiberSegmentsIterator WFiberIterator::send | ( | ) |
Returns a forward iterator to the invalid segment after the last (i.e.
an end iterator). DEPRECATED: Use the iterator range syntax instead.
Definition at line 599 of file WDataSetFibers.cpp.
References m_fibers, m_index, and numPoints().
WFiberSegmentsIterator WFiberIterator::srbegin | ( | ) |
Returns a backward iterator to the last segment.
DEPRECATED: Use the iterator range syntax instead.
Definition at line 606 of file WDataSetFibers.cpp.
WFiberSegmentsIterator WFiberIterator::srend | ( | ) |
Returns a backward iterator to the invalid segment before the first (i.e.
an end iterator). DEPRECATED: Use the iterator range syntax instead.
Definition at line 611 of file WDataSetFibers.cpp.
References m_fibers, m_index, and numPoints().
|
private |
The pointer to the fibers.
Definition at line 866 of file WDataSetFibers.h.
Referenced by begin(), end(), getLineStartIndex(), numPoints(), operator+(), operator++(), operator-(), operator--(), operator=(), operator==(), points(), pointsReverse(), rbegin(), rend(), sbegin(), segments(), segmentsReverse(), send(), srbegin(), and srend().
|
private |
The current index in the fiber data.
Definition at line 869 of file WDataSetFibers.h.
Referenced by begin(), end(), getIndex(), getLineStartIndex(), numPoints(), operator+(), operator++(), operator-(), operator--(), operator=(), operator==(), points(), pointsReverse(), rbegin(), rend(), sbegin(), segments(), segmentsReverse(), send(), srbegin(), and srend().