1 #ifndef GRAPH_ANALYSIS_FILTERS_REGEX_FILTER_HPP 2 #define GRAPH_ANALYSIS_FILTERS_REGEX_FILTER_HPP 4 #include <boost/regex.hpp> 5 #include "../Vertex.hpp" 8 #include <base-logging/Logging.hpp> 32 virtual std::string
getName()
const {
return "graph_analysis::filters::RegexFilter: '" +
toString() +
"'"; }
36 std::string txt = mRegex.str() +
"/" +
TypeTxt[
mType] +
"/";
41 txt +=
"not-inverted";
46 virtual bool apply(T element)
const 52 result = regex_match(element->toString(),
mRegex);
55 result = regex_match(element->getClassName(),
mRegex);
58 throw std::runtime_error(
"graph_analysis::filters::RegexFilter unknown filter type provided");
79 virtual std::string
getName()
const;
91 virtual std::string
getName()
const;
104 virtual std::string
getName()
const;
105 virtual std::string
toString()
const;
118 #endif // GRAPH_ANALYSIS_FILTERS_REGEX_FILTER_HPP Filter for a graph.
Definition: Filter.hpp:55
Definition: Filter.hpp:17
RegexFilter(const std::string ®ex, Type type, bool invert)
Definition: RegexFilters.hpp:26
std::map< Type, std::string > TypeTxt
Definition: Filter.cpp:7
Type mType
Definition: RegexFilters.hpp:22
Filter to sort out vertices.
Definition: RegexFilters.hpp:74
shared_ptr< Edge > Ptr
Definition: Edge.hpp:21
Definition: Filter.hpp:17
Filter to sort out edges.
Definition: RegexFilters.hpp:86
Definition: EdgeContextFilter.hpp:12
bool mInverted
Definition: RegexFilters.hpp:23
virtual std::string getName() const
Get Name of the filter.
Definition: RegexFilters.hpp:32
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
virtual std::string toString() const
Get string representation of filter.
Definition: RegexFilters.hpp:34
Definition: RegexFilters.hpp:97
virtual bool apply(T element) const
Apply only the main filter(!) to the target object.
Definition: RegexFilters.hpp:46
Definition: RegexFilters.hpp:18
Type
Filters can operator on content or class information.
Definition: Filter.hpp:17
boost::regex mRegex
Definition: RegexFilters.hpp:21