22 #ifndef __M2ETIS_PUBSUB_FILTER_DECISIONTREE_DECISIONTREELEAF_H__
23 #define __M2ETIS_PUBSUB_FILTER_DECISIONTREE_DECISIONTREELEAF_H__
28 #include "boost/shared_ptr.hpp"
34 template<
typename EventType,
typename NetworkType>
44 virtual void visit(
const EventType &, std::set<typename NetworkType::Key> & matching_subscribers)
override {
45 matching_subscribers.insert(subscribers_.begin(), subscribers_.end());
55 subscribers_.insert(subscriber);
59 virtual void addSubscriber(
const typename NetworkType::Key & subscriber)
override {
60 subscribers_.insert(subscriber);
65 subscribers_.erase(subscriber);
69 if (subscribers_.size() == 0) {
77 if (subscribers_.find(subscriber) != subscribers_.end()) {
84 virtual operator std::string()
const {
85 return "leaf node with first subscriber: " + (*(subscribers_.begin())).toStr();
91 std::set<typename NetworkType::Key> subscribers_;
94 template <
typename Archive>
95 void serialize(Archive & ar,
const unsigned int version) {
96 ar & boost::serialization::base_object<DecisionTreeNode<EventType, NetworkType> >(*this);
virtual void changeSubscriber(typename NetworkType::Key subscriber) override
virtual void addSubscriber(const typename NetworkType::Key &subscriber) override
virtual bool hasSubscriber() override
virtual void visit(const EventType &, std::set< typename NetworkType::Key > &matching_subscribers) override
friend class boost::serialization::access
virtual void merge(boost::shared_ptr< DecisionTreeNode< EventType, NetworkType >> &, typename NetworkType::Key subscriber) override
virtual ~DecisionTreeLeaf()
virtual void removeSubscriber(const typename NetworkType::Key &subscriber) override
DecisionTreeLeaf()=default
virtual bool hasSubscription(typename NetworkType::Key subscriber) override
DecisionTreeLeaf(const typename NetworkType::Key &subscriber)