m2etis  0.4
BaseRouting.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_ROUTING_BASEROUTING_H__
23 #define __M2ETIS_PUBSUB_ROUTING_BASEROUTING_H__
24 
27 
32 namespace m2etis {
33 namespace pubsub {
34 namespace routing {
35 
36  template<class NetworkType>
37  class BaseRouting {
38  typedef std::vector<typename NetworkType::Key> KeyList;
39 
40  public:
42  }
43 
44  virtual ~BaseRouting() {
45  }
46 
50  void configureSendCallback(const boost::function<void(typename message::RoutingInfo<NetworkType>::Ptr, const typename NetworkType::Key &, ControlTarget)> & func) {
51  sendCtrlMsg_ = func;
52  }
53 
62  virtual bool processSubscribePayload(typename message::RoutingInfo<NetworkType>::Ptr routingInfo, const typename NetworkType::Key & sender, typename NetworkType::Key & receiver, message::ActionType & msgType) = 0;
63 
72  virtual void processUnsubscribePayload(typename message::RoutingInfo<NetworkType>::Ptr routingInfo, const typename NetworkType::Key & sender, typename NetworkType::Key & receiver, message::ActionType & msgType) = 0;
73 
81  virtual void processPublishPayload(typename message::RoutingInfo<NetworkType>::Ptr routingInfo, const typename NetworkType::Key & sender, typename NetworkType::Key & receiver, message::ActionType & msgType) = 0;
82 
90  virtual void processNotifyPayload(typename message::RoutingInfo<NetworkType>::Ptr routingInfo, const typename NetworkType::Key & sender, typename NetworkType::Key & receiver, message::ActionType & msgType) = 0;
91 
100  virtual void processControlPayload(typename message::RoutingInfo<NetworkType>::Ptr routingInfo, const typename NetworkType::Key & sender, typename NetworkType::Key & receiver, message::ActionType & msgType) = 0;
101 
109  virtual KeyList getTargetNodes(const message::ActionType mtype, typename message::RoutingInfo<NetworkType>::Ptr routingInfo, typename NetworkType::Key & receiver) const = 0;
110 
119  virtual void configureRoutingInfo(message::ActionType & msgType, typename message::RoutingInfo<NetworkType>::Ptr routingInfo, typename NetworkType::Key & receiver) = 0;
120 
121  virtual void setUnsubscriptionListener(const boost::function<void(const typename NetworkType::Key)> & listener) = 0;
122 
123  protected:
124  boost::function<void(typename message::RoutingInfo<NetworkType>::Ptr, typename NetworkType::Key, ControlTarget)> sendCtrlMsg_;
125  };
126 
127 } /* namespace routing */
128 } /* namespace pubsub */
129 } /* namespace m2etis */
130 
131 #endif /* __M2ETIS_PUBSUB_ROUTING_BASEROUTING_H__ */
132 
virtual void processNotifyPayload(typename message::RoutingInfo< NetworkType >::Ptr routingInfo, const typename NetworkType::Key &sender, typename NetworkType::Key &receiver, message::ActionType &msgType)=0
virtual void setUnsubscriptionListener(const boost::function< void(const typename NetworkType::Key)> &listener)=0
virtual KeyList getTargetNodes(const message::ActionType mtype, typename message::RoutingInfo< NetworkType >::Ptr routingInfo, typename NetworkType::Key &receiver) const =0
virtual void processControlPayload(typename message::RoutingInfo< NetworkType >::Ptr routingInfo, const typename NetworkType::Key &sender, typename NetworkType::Key &receiver, message::ActionType &msgType)=0
virtual void processUnsubscribePayload(typename message::RoutingInfo< NetworkType >::Ptr routingInfo, const typename NetworkType::Key &sender, typename NetworkType::Key &receiver, message::ActionType &msgType)=0
boost::function< void(typename message::RoutingInfo< NetworkType >::Ptr, typename NetworkType::Key, ControlTarget)> sendCtrlMsg_
Definition: BaseRouting.h:124
BaseRouting(unsigned int, PubSubSystemEnvironment *)
Definition: BaseRouting.h:41
virtual void processPublishPayload(typename message::RoutingInfo< NetworkType >::Ptr routingInfo, const typename NetworkType::Key &sender, typename NetworkType::Key &receiver, message::ActionType &msgType)=0
boost::shared_ptr< RoutingInfo< NetworkType > > Ptr
Definition: RoutingInfo.h:32
void configureSendCallback(const boost::function< void(typename message::RoutingInfo< NetworkType >::Ptr, const typename NetworkType::Key &, ControlTarget)> &func)
with this function, new messages can be sent directly to nodes
Definition: BaseRouting.h:50
virtual void configureRoutingInfo(message::ActionType &msgType, typename message::RoutingInfo< NetworkType >::Ptr routingInfo, typename NetworkType::Key &receiver)=0
virtual bool processSubscribePayload(typename message::RoutingInfo< NetworkType >::Ptr routingInfo, const typename NetworkType::Key &sender, typename NetworkType::Key &receiver, message::ActionType &msgType)=0