m2etis  0.4
PartitionFiltersChannel3.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_PartitionFiltersChannel3_h
23 #define m2etis_PartitionFiltersChannel3_h
24 
27 #include "m2etis/config/GeneratedEventTypes.h"
28 
30 
36 
41 
45 
53 };
54 
55 template <typename EventType>
57 public:
58  PartitionFiltersChannel3() : m2etis::pubsub::partition::BruteForcePartition<EventType>( {
59  // filter partition 0: x < 1 and y < 1 and (x > 0 or y > 0 or x = 0 or y = 0))
60  // (short notation with operator overloading and conversion operator to shared_ptr of AndExpr)
61  LessThan<Position, int>(POSITION_X, 1) && LessThan<Position, int>(POSITION_Y, 1) && (GreaterThan<Position, int>(POSITION_X, 0) || Equals<Position, int>(POSITION_X, 0) || GreaterThan<Position, int>(POSITION_Y, 0) || Equals<Position, int>(POSITION_Y, 0)),
62 
63  // partition 1:
64  // x = 1 or y = 1
65  // (extended notation)
66  boost::make_shared<OrExp<Position> >(boost::make_shared<EqualsAttributeFilter<Position, int> >(POSITION_X, 1), boost::make_shared<EqualsAttributeFilter<Position, int> >(POSITION_Y, 1)),
67 
68  // partition 2:
69  // x > 1 or y > 1
70  boost::make_shared<OrExp<Position> >(boost::make_shared<GreaterThanAttributeFilter<Position, int> >(POSITION_X, 1), boost::make_shared<GreaterThanAttributeFilter<Position, int> >(POSITION_Y, 1)),
71 
72  // partition3:
73  // (x < 0 and y < 0)
74  boost::make_shared<AndExp<Position> >(boost::make_shared<LessThanAttributeFilter<Position, int> >(POSITION_X, 0), boost::make_shared<LessThanAttributeFilter<Position, int> >(POSITION_Y, 0))
75  } ) {}
76 };
77 
78 #endif // m2etis_PartitionFiltersChannel3_h
79 
GreaterThanAttributeFilter< EventType, AttributeType > GreaterThan(AttributeName attribute_id, const AttributeType &constants)
NotEqualsAttributeFilter< EventType, AttributeType > NotEquals(AttributeName attribute_id, const AttributeType &constants)
LessThanAttributeFilter< EventType, AttributeType > LessThan(AttributeName attribute_id, const AttributeType &constants)
EqualsAttributeFilter< EventType, AttributeType > Equals(AttributeName attribute_id, const AttributeType &constants)