graph_analysis
VertexIterator.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_VERTEX_ITERATOR_HPP
2 #define GRAPH_ANALYSIS_VERTEX_ITERATOR_HPP
3 
4 #include "Vertex.hpp"
5 #include "SharedPtr.hpp"
6 
7 
8 namespace graph_analysis {
9 
16 {
17  // Allow for usage of skip function
18  friend class SubGraph;
19 
20 public:
21  typedef shared_ptr<VertexIterator> Ptr;
22  typedef function1<bool, const Vertex::Ptr&> SkipFunction;
23 
24  virtual ~VertexIterator() {}
25 
31  virtual bool next() { return false; }
32 
36  const Vertex::Ptr& current() { return mVertex; }
37 
38 protected:
43  bool skip(const Vertex::Ptr& vertex) const;
44 
49  void setNext(const Vertex::Ptr& vertex) { mVertex = vertex; }
50 
54  void setSkipFunction(SkipFunction skipFunction) { mSkipFunction = skipFunction; }
55 
56 private:
57  Vertex::Ptr mVertex;
58  SkipFunction mSkipFunction;
59 };
60 
61 } // end namespace graph_analysis
62 #endif // GRAPH_ANALYSIS_VERTEX_ITERATOR_HPP
graph_analysis::VertexIterator::current
const Vertex::Ptr & current()
Definition: VertexIterator.hpp:36
graph_analysis::VertexIterator::~VertexIterator
virtual ~VertexIterator()
Definition: VertexIterator.hpp:24
SharedPtr.hpp
graph_analysis::VertexIterator::next
virtual bool next()
Test if there is a next item and if it is then updates the current to next.
Definition: VertexIterator.hpp:31
Vertex.hpp
graph_analysis
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
graph_analysis::SubGraph
A subgraph represent a particular filtered 'view' on a BaseGraph.
Definition: SubGraph.hpp:32
graph_analysis::Vertex::Ptr
shared_ptr< Vertex > Ptr
Definition: Vertex.hpp:22
graph_analysis::VertexIterator::skip
bool skip(const Vertex::Ptr &vertex) const
Definition: VertexIterator.cpp:5
graph_analysis::VertexIterator::SkipFunction
function1< bool, const Vertex::Ptr & > SkipFunction
Definition: VertexIterator.hpp:22
graph_analysis::VertexIterator::setNext
void setNext(const Vertex::Ptr &vertex)
Set next vertex Should be applied by class implementing next()
Definition: VertexIterator.hpp:49
graph_analysis::VertexIterator::Ptr
shared_ptr< VertexIterator > Ptr
Definition: VertexIterator.hpp:21
graph_analysis::VertexIterator::setSkipFunction
void setSkipFunction(SkipFunction skipFunction)
Definition: VertexIterator.hpp:54
graph_analysis::VertexIterator
VertexIterator interface Allows to access all vertices of a graph. Requires implementation to wrap th...
Definition: VertexIterator.hpp:15