m2etis  0.4
NullPartition.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_PARTITION_NULLPARTITION_H__
23 #define __M2ETIS_PUBSUB_PARTITION_NULLPARTITION_H__
24 
26 
27 #include "boost/assign/list_of.hpp"
28 
29 namespace m2etis {
30 namespace pubsub {
31 namespace partition {
32 
33  template<typename NetworkType, typename EventType>
34  class NullPartition : public BasePartition<NetworkType, EventType> {
35  public:
36  typedef boost::shared_ptr<EventType> PayloadPtr;
37 
38  static const bool DYNAMIC_PARTITION = false;
39 
40  enum TreeName {
42  };
43 
45  }
46 
47  virtual ~NullPartition() {}
48 
49  void createRendezvousPartition(const typename NetworkType::Key &) {
50  }
51 
52  std::vector<int> getTreeNames() {
53  std::vector<int> ret(1);
54  return ret;
55  }
56 
57  std::vector<int>::size_type getPublishTree(const PayloadPtr, const typename NetworkType::Key &) {
58  return ALL;
59  }
60 
61  std::vector<unsigned int> getSubscribeTrees(boost::shared_ptr<filter::FilterExp<EventType>>) {
62  std::vector<unsigned int> overlapping_trees;
63  overlapping_trees.push_back(ALL);
64  return overlapping_trees;
65  }
66 
67  boost::shared_ptr<filter::FilterExp<EventType>> getPredicate(size_t) {
68  return boost::shared_ptr<filter::FilterExp<EventType>>();
69  }
70 
71  bool createPartition(const typename NetworkType::Key &) {
72  return false;
73  }
74 
75  void addPartition(boost::shared_ptr<filter::FilterExp<EventType>>, const typename NetworkType::Key &) {
76  }
77 
78  void removePartition(size_t) {
79  }
80 
81  void changePredicate(size_t, boost::shared_ptr<filter::FilterExp<EventType>>) {
82  }
83 
84  void changeRoot(size_t, typename NetworkType::Key &) {
85  }
86  };
87 
88 } /* namespace partition */
89 } /* namespace pubsub */
90 } /* namespace m2etis */
91 
92 #endif /* __M2ETIS_PUBSUB_PARTITION_NULLPARTITION_H__ */
93 
std::vector< unsigned int > getSubscribeTrees(boost::shared_ptr< filter::FilterExp< EventType >>)
returns the tree indices of all trees matching the predicate to subscribe on (static & dynamic) ...
Definition: NullPartition.h:61
boost::shared_ptr< filter::FilterExp< EventType > > getPredicate(size_t)
returns the predicate for the given partition id (dynamic)
Definition: NullPartition.h:67
void createRendezvousPartition(const typename NetworkType::Key &)
creates a base partition for the RP (dynamic)
Definition: NullPartition.h:49
void changeRoot(size_t, typename NetworkType::Key &)
Definition: NullPartition.h:84
bool createPartition(const typename NetworkType::Key &)
can create a new partition for this channel if a new node (root) joins, return true, if a new partition was created, otherwise false (dynamic)
Definition: NullPartition.h:71
std::vector< int > getTreeNames()
returns amount of partitions this strategy contains (static & dynamic)
Definition: NullPartition.h:52
std::vector< int >::size_type getPublishTree(const PayloadPtr, const typename NetworkType::Key &)
returns the tree index the given node with the given payload should publish on (static & dynamic) ...
Definition: NullPartition.h:57
boost::shared_ptr< EventType > PayloadPtr
Definition: NullPartition.h:36
void addPartition(boost::shared_ptr< filter::FilterExp< EventType >>, const typename NetworkType::Key &)
Definition: NullPartition.h:75
void removePartition(size_t)
removes the partition with the given id (dynamic)
Definition: NullPartition.h:78
void changePredicate(size_t, boost::shared_ptr< filter::FilterExp< EventType >>)
changes the filter predicate for the partition with the given id (dynamic)
Definition: NullPartition.h:81