GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
graph_action.h
1 #ifndef GRAPH_ACTION_H_
2 #define GRAPH_ACTION_H_
3 
4 #include "graph_filter.h"
5 #include "assert.h"
6 
12 template<typename GraphType>
13 class GraphAction {
14  public:
15  typedef typename GraphType::node_value_type V_type;
16  typedef typename GraphType::edge_value_type E_type;
17  typedef typename GraphType::index_type_t index_type_t;
18 
24  filter_(filter) {
25  assert(filter != 0);
26  }
27 
32  filter_(copy.filter()->clone()) {
33  }
34 
38  virtual ~GraphAction() {
39  delete filter_;
40  }
41 
46  return filter_;
47  }
48 
53  virtual bool operator() (E_type edge) = 0;
54 
59  virtual bool operator() (V_type node) = 0;
60 
62  template<typename P1, typename P2>
63  bool operator() (std::pair<P1, P2>& m) {
64  return operator()(m.second);
65  }
66 
69  template<typename P>
70  bool run_filter(P arg) {
71  if(filter_->enabled())
72  return (*filter_)(arg);
73  else
74  return true;
75  }
76 
77  protected:
80 };
81 
82 #endif
GraphAction(GraphFilter< GraphType > *filter)
Definition: graph_action.h:23
GraphAction(GraphAction< GraphType > &copy)
Definition: graph_action.h:31
Forward declarations for functors.
Definition: defines.h:32
virtual bool operator()(E_type edge)=0
virtual ~GraphAction()
Definition: graph_action.h:38
GraphFilter< GraphType > * filter()
Definition: graph_action.h:45
Definition: graph_action.h:13
Definition: graph_filter.h:15
Definition: swu.h:27
bool run_filter(P arg)
Definition: graph_action.h:70
GraphFilter< GraphType > * filter_
The filter is used to indicate whether the action should be taken or not.
Definition: graph_action.h:79
unsigned int index_type_t
The type of index used for the nodes in the graph.
Definition: grapher.h:52