22 #ifndef __M2ETIS_PUBSUB_FILTER_MATCHVISITOR_H__
23 #define __M2ETIS_PUBSUB_FILTER_MATCHVISITOR_H__
33 template <
typename EventType>
44 bool operand1 = operand_stack_.top();
46 bool operand2 = operand_stack_.top();
48 operand_stack_.push(operand1 && operand2);
53 bool operand1 = operand_stack_.top();
55 bool operand2 = operand_stack_.top();
57 operand_stack_.push(operand1 || operand2);
61 operand_stack_.push(predicate->
match(event_));
66 return operand_stack_.empty() ? 0 : operand_stack_.top();
69 void set_event(
const EventType & event) { event_ = event; }
72 std::stack<bool> operand_stack_;
virtual void Visit(const Predicate< EventType > *predicate) override
virtual void Visit(const AndExp< EventType > *) override
MatchVisitor(const EventType &event)
virtual void Visit(const OrExp< EventType > *) override
virtual void Visit(const FilterExp< EventType > *) override
virtual bool match(const EventType &) const =0
void set_event(const EventType &event)