Go to the documentation of this file. 1 #ifndef GRAPH_ANALYSIS_FILTER_HPP
2 #define GRAPH_ANALYSIS_FILTER_HPP
18 extern std::map<Type, std::string>
TypeTxt;
19 extern std::map<std::string, Type>
TxtType;
54 template<
typename FilterObject>
59 typedef shared_ptr<FilterType>
Ptr;
72 virtual std::string
getName()
const {
return "graph_analysis::Filter"; }
96 return add(filter, position);
126 throw std::runtime_error(
"Filter: cannot add a null object as filter");
134 throw std::runtime_error(
"Filter: cannot remove filter. Position outside of current list");
137 for(
int i = 0; i <
mFilters.size(); ++i)
159 bool result =
apply(o);
161 typename FilterList::const_iterator cit =
mFilters.begin();
174 if(filter->matches(o))
194 if(!filter->matches(o))
208 virtual bool apply(FilterObject o)
const { (void)o;
return false; }
220 #endif // GRAPH_ANALYSIS_FILTER_HPP
int add(FilterType::Ptr filter, int position=-1)
Definition: Filter.hpp:113
@ CLASS
Definition: Filter.hpp:17
@ CONTENT
Definition: Filter.hpp:17
static Ptr Null()
Definition: Filter.hpp:213
std::map< Type, std::string > TypeTxt
Definition: Filter.cpp:7
virtual ~Filter()
Definition: Filter.hpp:66
@ OR
Definition: Filter.hpp:15
virtual std::string toString() const
Get string representation of filter.
Definition: Filter.hpp:78
shared_ptr< FilterType > Ptr
Definition: Filter.hpp:59
virtual std::string getName() const
Get Name of the filter.
Definition: Filter.hpp:72
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
Filter< FilterObject > FilterType
Definition: Filter.hpp:58
bool matches(FilterObject o, filters::Operator op=filters::OR) const
Apply all filters, i.e. root filter and children to the filter object, i.e., test whether filter matc...
Definition: Filter.hpp:156
virtual bool apply(FilterObject o) const
Apply only the main filter(!) to the target object.
Definition: Filter.hpp:208
void removeAt(int position)
Definition: Filter.hpp:130
FilterList mFilters
Definition: Filter.hpp:216
@ AND
Definition: Filter.hpp:15
Filter for a graph.
Definition: Filter.hpp:55
void clear()
Definition: Filter.hpp:102
std::vector< FilterType::Ptr > FilterList
Definition: Filter.hpp:61
int replace(FilterType::Ptr filter, int position=-1)
Definition: Filter.hpp:88
std::map< std::string, Type > TxtType
Definition: Filter.cpp:11
Type
Filters can operator on content or class information.
Definition: Filter.hpp:17
Operator
Operator.
Definition: Filter.hpp:15