m2etis  0.4
TruePredicate.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_TRUEPREDICATE_H__
23 #define __M2ETIS_PUBSUB_FILTER_FILTEREXPRESSIONS_TRUEPREDICATE_H__
24 
26 
27 namespace m2etis {
28 namespace pubsub {
29 namespace filter {
30 
31  // class TruePredicate helpful if no static or dynamic predicate given
32  template<typename EventType>
33  class TruePredicate : public Predicate<EventType> {
34  public:
35  typedef EventType schema; // needed for operator overloading
36  // TODO: (Roland) probably not needed, remove:
37  virtual void Accept(FilterVisitor<EventType> & filter_visitor) const override {
38  filter_visitor.Visit(this);
39  }
40 
41  virtual bool match(const EventType &) const { return true; }
42  virtual bool overlaps(const Predicate<EventType> *) const { return true; } // other_predicate assumed to be satisfiable
43  virtual ~TruePredicate() {}
44 
45  virtual void getAttributeType(FilterVisitor<EventType> &) const override {
46  M2ETIS_THROW_API("TruePredicate", "getAttributeType not allowed in strategies with attribute types.");
47  }
48 
49  private:
50  friend class boost::serialization::access; // not sure if necessary
51  template<typename Archive>
52  void serialize(Archive & ar, const unsigned int) {
53  ar & boost::serialization::base_object<Predicate<EventType>>(*this);
54  }
55  }; // class TruePredicate
56 
57 } /* namespace filter */
58 } /* namespace pubsub */
59 } /* namespace m2etis */
60 
61 #endif /* __M2ETIS_PUBSUB_FILTER_FILTEREXPRESSIONS_TRUEPREDICATE_H__ */
62 
virtual void Accept(FilterVisitor< EventType > &filter_visitor) const override
Definition: TruePredicate.h:37
virtual bool overlaps(const Predicate< EventType > *) const
Definition: TruePredicate.h:42
virtual bool match(const EventType &) const
Definition: TruePredicate.h:41
virtual void Visit(const FilterExp< EventType > *)=0
virtual void getAttributeType(FilterVisitor< EventType > &) const override
Definition: TruePredicate.h:45
#define M2ETIS_THROW_API(module, message)
throws on wrong API usage
Definition: Exceptions.h:40
friend class boost::serialization::access
Definition: TruePredicate.h:50