GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
invert_filter.h
1 #ifndef INVERT_FILTER_H_
2 #define INVERT_FILTER_H_
3 
4 #include "graph_filter.h"
5 
9 template<typename GraphType>
10 class InvertFilter : public GraphFilter<GraphType> {
11  public:
12  typedef typename GraphType::node_value_type V_type;
13  typedef typename GraphType::edge_value_type E_type;
14 
16  InvertFilter(GraphFilter<GraphType>& inverted_filter) :
17  GraphFilter<GraphType>(inverted_filter.name() + " (Inverted)", inverted_filter.type()),
18  inverted_filter_(inverted_filter) {
19  }
20 
24  return clone;
25  }
26 
28  virtual bool operator() (V_type m) {
29  if(this->enabled_)
30  return !inverted_filter_(m);
31  return true;
32  }
33 
35  virtual bool operator() (E_type e) {
36  if(this->enabled_)
37  return !inverted_filter_(e);
38  return true;
39  }
40 
42  template<typename P1, typename P2>
43  bool operator() (std::pair<P1, P2>& m) {
44  return operator()(m.second);
45  }
46 
47  private:
48  GraphFilter<GraphType>& inverted_filter_;
49 };
50 
51 #endif
Forward declarations for functors.
Definition: defines.h:32
virtual bool operator()(V_type m)
Returns true if the given node should be included, or false if it is to be filtered out...
Definition: invert_filter.h:28
std::string name() const
Definition: graph_filter.h:64
Definition: graph_filter.h:15
Definition: swu.h:27
std::string type() const
Definition: graph_filter.h:68
virtual GraphFilter< GraphType > * clone()
Clone the filter.
Definition: invert_filter.h:22
InvertFilter(GraphFilter< GraphType > &inverted_filter)
Provide the filter to be invereted as an argument.
Definition: invert_filter.h:16
Definition: invert_filter.h:10