Tulip  5.7.4
Large graphs analysis and drawing
tlp::Iterator< T > Struct Template Referenceabstract

#include <Iterator.h>

+ Inheritance diagram for tlp::Iterator< T >:

Public Member Functions

iterator_t begin ()
 
iterator_t end ()
 
virtual bool hasNext ()=0
 
virtual T next ()=0
 

Detailed Description

template<typename T>
struct tlp::Iterator< T >

Interface for Tulip iterators. Allows basic iteration operations only.

Below are some examples about how to use Tulip iterators in C++ code.

// graph is a pointer to a tlp::Graph instance
// shortest syntax using C++11 for range based loops
for (auto n : graph->getNodes()) {
// do something with n
}
// legacy syntax using Tulip forEach macro
#include <tulip/ForEach.h>
forEach(n, graph->getNodes()) {
// do something with n
}
// no syntactic sugar syntax (needs to explicitly delete the iterator
// after its use)
tlp::Iterator<tl::node> *nodesIt = graph->getNodes();
while (nodesIt->hasNext()) {
tlp::node n = nodes->next();
// do something with n
}
delete nodesIt;
Interface for Tulip iterators. Allows basic iteration operations only.
Definition: Iterator.h:74
virtual bool hasNext()=0
Tells if the sequence is at its end.
The node struct represents a node in a Graph object.
Definition: Node.h:40

Definition at line 74 of file Iterator.h.

Member Function Documentation

◆ hasNext()

template<typename T >
virtual bool tlp::Iterator< T >::hasNext ( )
pure virtual

Tells if the sequence is at its end.

Returns
bool Whether there are more elements to iterate.

Implemented in tlp::ConcatIterator< T >, tlp::StlIterator< T, ITERATOR >, tlp::StableIterator< T >, tlp::StableIterator< tlp::node >, tlp::StableIterator< tlp::edge >, tlp::FilterIterator< TYPE, FILTER >, tlp::ConversionIterator< TYPEIN, TYPEOUT, ConversionFunc >, and tlp::ConversionIterator< TIN, TOUT, ConversionFunc >.

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

◆ next()

template<typename T >
virtual T tlp::Iterator< T >::next ( )
pure virtual