OpenWalnut  1.5.0dev
Public Member Functions | Private Attributes | List of all members
WFiberIterator Class Reference

An iterator for fibers of a fiber dataset. More...

#include <WDataSetFibers.h>

+ Collaboration diagram for WFiberIterator:

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...
 
WFiberIteratoroperator= (WFiberIterator const &iter)
 Copy operator. More...
 
WFiberIteratoroperator++ ()
 Increment operator. More...
 
WFiberIteratoroperator-- ()
 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< WFiberIteratoroperator, (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< WFiberPointsIteratorpoints () const
 Creates a range of iterators that allows for forward iteration of the points of the fiber this iterator currently points to. More...
 
WIteratorRange< WFiberPointsIteratorpointsReverse () 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< WFiberSegmentsIteratorsegments () const
 Creates a range of iterators that allows for forward iteration of the segments of the fiber this iterator currently points to. More...
 
WIteratorRange< WFiberSegmentsIteratorsegmentsReverse () 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...
 

Detailed Description

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:

for( WFiberIterator fi = some_fiber_data_set_pointer->fibers().begin();
fi != some_fiber_data_set_pointer->fibers().end(); ++fi )
{
...
}
An iterator for fibers of a fiber dataset.
OW_API_DEPRECATED WFiberPointsIterator begin()
Creates a point iterator for forward iteration, pointing to the first point of the fiber.

Second:

for( ( fi, fe ) = some_fiber_data_set_pointer->fibers(); fi != fe; ++fi )
{
...
}

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:

if( iterator )
{
...
}

Definition at line 609 of file WDataSetFibers.h.

Constructor & Destructor Documentation

◆ WFiberIterator() [1/3]

WFiberIterator::WFiberIterator ( )

Constructor.

Creates an invalid iterator pointing nowhere.

Definition at line 456 of file WDataSetFibers.cpp.

Referenced by operator+(), and operator-().

+ Here is the caller graph for this function:

◆ WFiberIterator() [2/3]

WFiberIterator::WFiberIterator ( WDataSetFibers const *  fibers,
std::size_t  idx 
)

Constructor.

Creates an iterator for a specific fiber dataset.

Parameters
fibersA pointer to the fiber data.
idxThe index of the fiber to point to.

Definition at line 462 of file WDataSetFibers.cpp.

◆ WFiberIterator() [3/3]

WFiberIterator::WFiberIterator ( WFiberIterator const &  iter)

Copy constructor.

Parameters
iterThe iterator to copy from.

Definition at line 468 of file WDataSetFibers.cpp.

◆ ~WFiberIterator()

WFiberIterator::~WFiberIterator ( )

Destructor.

Definition at line 474 of file WDataSetFibers.cpp.

Member Function Documentation

◆ begin()

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.

Returns
A point iterator pointing to the first point.

Definition at line 554 of file WDataSetFibers.cpp.

References m_fibers, and m_index.

◆ end()

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.

Returns
A point iterator pointing beyond the last point.

Definition at line 559 of file WDataSetFibers.cpp.

References m_fibers, m_index, and numPoints().

+ Here is the call graph for this function:

◆ getFiberLength()

double WFiberIterator::getFiberLength ( ) const

The length of the line.

Note
This is the actual length of the line, not the number of points.
The length is actually calculated. So it has O(n) running time.
Returns
line length.

Definition at line 644 of file WDataSetFibers.cpp.

References WFiberSegmentsIterator::length(), and segments().

+ Here is the call graph for this function:

◆ getIndex()

std::size_t WFiberIterator::getIndex ( ) const

Get the index of the line.

Note
You should avoid using these indices as can use the iterators to query the data. But it might get handy in some situations, where raw data processing is needed.
Returns
the index.

Definition at line 639 of file WDataSetFibers.cpp.

References m_index.

◆ getLineStartIndex()

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.

Note
You should avoid using these indices as can use the iterators to query the data. But it might get handy in some situations, where raw data processing is needed.
Returns
the start index.

Definition at line 634 of file WDataSetFibers.cpp.

References WDataSetFibers::getStartIndex(), m_fibers, and m_index.

+ Here is the call graph for this function:

◆ numPoints()

std::size_t WFiberIterator::numPoints ( ) const

Returns the number of points of the current fiber.

Returns
The number of points.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator bool()

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.

◆ operator!=()

bool WFiberIterator::operator!= ( WFiberIterator const &  rhs) const

Compare to another fiber iterator.

Parameters
rhsThe second fiber iterator.
Returns
false, iff the two iterators point to the same fiber of the same fiber dataset.

Definition at line 532 of file WDataSetFibers.cpp.

References operator==().

+ Here is the call graph for this function:

◆ operator+()

WFiberIterator WFiberIterator::operator+ ( size_t  n) const

Plus operator.

Increments the iterator

Parameters
ntimes.
Returns
The iterator on the new place.

Definition at line 517 of file WDataSetFibers.cpp.

References m_fibers, m_index, and WFiberIterator().

+ Here is the call graph for this function:

◆ operator++() [1/2]

WFiberIterator & WFiberIterator::operator++ ( )

Increment operator.

Makes the iterator point to the next fiber.

Returns
The incremented iterator.

Definition at line 491 of file WDataSetFibers.cpp.

References m_index.

◆ operator++() [2/2]

WFiberIterator WFiberIterator::operator++ ( int  )

Increment operator.

Makes the iterator point to the next fiber.

Returns
The iterator before incrementing.

Definition at line 497 of file WDataSetFibers.cpp.

References m_fibers, and m_index.

◆ operator,()

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.

Parameters
otherThe iterator to assign the end iterator of the range to.
Returns
The unpacker to assign a range to.

Definition at line 537 of file WDataSetFibers.cpp.

◆ operator-()

WFiberIterator WFiberIterator::operator- ( size_t  n) const

Minus operator.

Decrements the iterator

Parameters
ntimes.
Returns
The iterator on the new place.

Definition at line 522 of file WDataSetFibers.cpp.

References m_fibers, m_index, and WFiberIterator().

+ Here is the call graph for this function:

◆ operator--() [1/2]

WFiberIterator & WFiberIterator::operator-- ( )

Decrement operator.

Makes the iterator point to the previous fiber.

Returns
The decremented iterator.

Definition at line 504 of file WDataSetFibers.cpp.

References m_index.

◆ operator--() [2/2]

WFiberIterator WFiberIterator::operator-- ( int  )

Decrement operator.

Makes the iterator point to the previous fiber.

Returns
The iterator before decrementing.

Definition at line 510 of file WDataSetFibers.cpp.

References m_fibers, and m_index.

◆ operator=()

WFiberIterator & WFiberIterator::operator= ( WFiberIterator const &  iter)

Copy operator.

Parameters
iterThe iterator to copy from.
Returns
*this

Definition at line 478 of file WDataSetFibers.cpp.

References m_fibers, and m_index.

◆ operator==()

bool WFiberIterator::operator== ( WFiberIterator const &  rhs) const

Compare to another fiber iterator.

Parameters
rhsThe second fiber iterator.
Returns
true, iff the two iterators point to the same fiber of the same fiber dataset.

Definition at line 527 of file WDataSetFibers.cpp.

References m_fibers, and m_index.

Referenced by operator!=().

+ Here is the caller graph for this function:

◆ points()

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.

Returns
The full range from begin to end.

Definition at line 578 of file WDataSetFibers.cpp.

References m_fibers, m_index, and numPoints().

+ Here is the call graph for this function:

◆ pointsReverse()

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.

Returns
The full range from begin to end, points in reverse order starting with the last.

Definition at line 586 of file WDataSetFibers.cpp.

References m_fibers, m_index, and numPoints().

+ Here is the call graph for this function:

◆ rbegin()

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.

Returns
A point iterator pointing to the last point.

Definition at line 566 of file WDataSetFibers.cpp.

References m_fibers, and m_index.

◆ rend()

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.

Returns
A point iterator pointing beyond the first point.

Definition at line 571 of file WDataSetFibers.cpp.

References m_fibers, m_index, and numPoints().

+ Here is the call graph for this function:

◆ sbegin()

WFiberSegmentsIterator WFiberIterator::sbegin ( )

Returns a forward iterator to the first segment.

DEPRECATED: Use the iterator range syntax instead.

Returns
A forward iterator to the first segment.

Definition at line 594 of file WDataSetFibers.cpp.

References m_fibers, and m_index.

◆ segments()

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.

Returns
The full range from begin to end.

Definition at line 618 of file WDataSetFibers.cpp.

References m_fibers, m_index, and numPoints().

Referenced by getFiberLength().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ segmentsReverse()

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.

Returns
The full range from begin to end, segments in reverse order starting with the last.

Definition at line 626 of file WDataSetFibers.cpp.

References m_fibers, m_index, and numPoints().

+ Here is the call graph for this function:

◆ send()

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.

Returns
A forward end iterator.

Definition at line 599 of file WDataSetFibers.cpp.

References m_fibers, m_index, and numPoints().

+ Here is the call graph for this function:

◆ srbegin()

WFiberSegmentsIterator WFiberIterator::srbegin ( )

Returns a backward iterator to the last segment.

DEPRECATED: Use the iterator range syntax instead.

Returns
A backward iterator to the last segment.

Definition at line 606 of file WDataSetFibers.cpp.

References m_fibers, and m_index.

◆ srend()

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.

Returns
A backward end iterator.

Definition at line 611 of file WDataSetFibers.cpp.

References m_fibers, m_index, and numPoints().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_fibers

WDataSetFibers const* WFiberIterator::m_fibers
private

◆ m_index

std::size_t WFiberIterator::m_index
private

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