m2etis  0.4
PredicateIndex.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_GENERALBOOLEANALGEBRA_PREDICATEINDEX_H__
23 #define __M2ETIS_PUBSUB_FILTER_GENERALBOOLEANALGEBRA_PREDICATEINDEX_H__
24 
25 namespace m2etis {
26 namespace pubsub {
27 namespace filter {
28 
29  enum OperatorName {
34  }; // TODO: (Roland) already defined in FilterPredicate
35 
36  typedef int AttributeName; // TODO: (Roland) already defined in AttributeTypeInformation
37 
38  // per attribute_id and constraint (=attribute filter) one PredicateIndex
39  template <typename EventType>
40  class PredicateIndex {
41  public:
42  PredicateIndex(AttributeName attribute_id, OperatorName _operator, PredicateIdentifierFactory * predicate_identifier_factory) : attribute_id_(attribute_id), operator_(_operator), predicate_identifier_factory_(predicate_identifier_factory) {}
43 
44  // addPredicate function cannot be virtual because of AttributeType template parameter
45 
46  virtual void removePredicate(std::vector<bool>::size_type predicate_id) = 0;
47 
48  // TODO: (Roland) check, why vector cannnot be passed by reference
49  virtual void determineMatchingPredicates(const EventType & event, std::vector<bool> & fulfilled_predicate_vector) = 0;
50 
51  virtual ~PredicateIndex() {}
52 
53  AttributeName get_attribute_id() const {
54  return attribute_id_;
55  }
56 
58  return operator_;
59  }
60 
61  private:
62  AttributeName attribute_id_;
63 
64  protected:
67  };
68 
69 } /* namespace filter */
70 } /* namespace pubsub */
71 } /* namespace m2etis */
72 
73 #endif /* __M2ETIS_PUBSUB_FILTER_GENERALBOOLEANALGEBRA_PREDICATEINDEX_H__ */
74 
virtual void determineMatchingPredicates(const EventType &event, std::vector< bool > &fulfilled_predicate_vector)=0
PredicateIndex(AttributeName attribute_id, OperatorName _operator, PredicateIdentifierFactory *predicate_identifier_factory)
virtual void removePredicate(std::vector< bool >::size_type predicate_id)=0
AttributeName get_attribute_id() const
PredicateIdentifierFactory * predicate_identifier_factory_