graph_analysis
EdgeIterator.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_EDGE_ITERATOR_HPP
2 #define GRAPH_ANALYSIS_EDGE_ITERATOR_HPP
3 
4 #include "SharedPtr.hpp"
5 #include "Edge.hpp"
6 
7 namespace graph_analysis {
8 
15 {
16  // Allow for usage of skip function
17  friend class SubGraph;
18 
19 public:
20  typedef shared_ptr<EdgeIterator> Ptr;
21  typedef function1<bool, const Edge::Ptr&> SkipFunction;
22 
23  virtual ~EdgeIterator() {}
24 
30  virtual bool next() { throw std::runtime_error("EdgeIterator: next() has not been implemented"); }
31 
35  const Edge::Ptr& current() { return mEdge; }
36 
37 protected:
42  bool skip(const Edge::Ptr& edge) const;
43 
48  void setNext(const Edge::Ptr& edge) { mEdge = edge; }
49 
54  void setSkipFunction(SkipFunction skipFunction) { mSkipFunction = skipFunction; }
55 
56 private:
57  Edge::Ptr mEdge;
58  SkipFunction mSkipFunction;
59 };
60 
61 } // end namespace graph_analysis
62 #endif // GRAPH_ANALYSIS_EDGE_ITERATOR_HPP
graph_analysis::EdgeIterator::skip
bool skip(const Edge::Ptr &edge) const
Check if edge should be skipped.
Definition: EdgeIterator.cpp:5
SharedPtr.hpp
graph_analysis
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
graph_analysis::EdgeIterator::next
virtual bool next()
Test if there is a next item and if it is then updates the current to next.
Definition: EdgeIterator.hpp:30
graph_analysis::Edge::Ptr
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
Edge.hpp
graph_analysis::SubGraph
A subgraph represent a particular filtered 'view' on a BaseGraph.
Definition: SubGraph.hpp:32
graph_analysis::EdgeIterator
EdgeIterator interface Allows to access all edges of a graph. Requires implementation to wrap the und...
Definition: EdgeIterator.hpp:14
graph_analysis::EdgeIterator::SkipFunction
function1< bool, const Edge::Ptr & > SkipFunction
Definition: EdgeIterator.hpp:21
graph_analysis::EdgeIterator::setNext
void setNext(const Edge::Ptr &edge)
Set next edge Should be applied by class implementing next()
Definition: EdgeIterator.hpp:48
graph_analysis::EdgeIterator::Ptr
shared_ptr< EdgeIterator > Ptr
Definition: EdgeIterator.hpp:20
graph_analysis::EdgeIterator::current
const Edge::Ptr & current()
Definition: EdgeIterator.hpp:35
graph_analysis::EdgeIterator::~EdgeIterator
virtual ~EdgeIterator()
Definition: EdgeIterator.hpp:23
graph_analysis::EdgeIterator::setSkipFunction
void setSkipFunction(SkipFunction skipFunction)
Definition: EdgeIterator.hpp:54