m2etis  0.4
pubsub/filter/filterexpressions/Predicate.h
Go to the documentation of this file.
1 /*
2  Copyright (2016) Michael Baer, Daniel Bonrath, All rights reserved.
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16 
22 #ifndef __M2ETIS_PUBSUB_FILTER_FILTEREXPRESSIONS_PREDICATE_H__
23 #define __M2ETIS_PUBSUB_FILTER_FILTEREXPRESSIONS_PREDICATE_H__
24 
26 
27 namespace m2etis {
28 namespace pubsub {
29 namespace filter {
30 
31  template<typename EventType, typename NetworkType> class AttributeTypeInformation;
32  template<typename EventType, typename NetworkType> class DecisionTreeFilter;
33  template<typename EventType, typename NetworkType> class GeneralBooleanExpressionsFilter;
34 
35  template<typename EventType>
36  class Predicate : public FilterExp<EventType> {
37  public:
38  virtual ~Predicate() {}
39  virtual void Accept(FilterVisitor<EventType> & filter_visitor) const override {
40  filter_visitor.Visit(this);
41  }
42  // function needed to determine the attribute type, e.g. in DecisionTreePreProcessVisitor
43 
44  virtual void getAttributeType(FilterVisitor<EventType> & visitor) const = 0;
45 
46  virtual bool match(const EventType &) const = 0; // TODO: (Roland) make abstract
47  virtual bool overlaps(const Predicate<EventType> *) const { return true; } // implemented for serialization= 0;
48 
49  private:
51  template<typename Archive>
52  void serialize(Archive & ar, const unsigned int) {
53  ar & boost::serialization::base_object<FilterExp<EventType>>(*this);
54  }
55  }; // class Predicate
56 
57 } /* namespace filter */
58 } /* namespace pubsub */
59 } /* namespace m2etis */
60 
61 #endif /* __M2ETIS_PUBSUB_FILTER_FILTEREXPRESSIONS_PREDICATE_H__ */
62 
virtual bool overlaps(const Predicate< EventType > *) const
virtual void Visit(const FilterExp< EventType > *)=0
virtual bool match(const EventType &) const =0
virtual void Accept(FilterVisitor< EventType > &filter_visitor) const override
virtual void getAttributeType(FilterVisitor< EventType > &visitor) const =0