Tulip  5.5.1
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;

Definition at line 43 of file Graph.h.

Member Function Documentation

◆ hasNext()

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

◆ next()

template<typename T >
virtual T tlp::Iterator< T >::next ( )
pure virtual
tlp::Iterator
Interface for Tulip iterators. Allows basic iteration operations only.
Definition: Graph.h:43
tlp::Iterator::hasNext
virtual bool hasNext()=0
Tells if the sequence is at its end.
tlp::node
The node struct represents a node in a Graph object.
Definition: Node.h:40