m2etis  0.4
NetworkInterface.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_NET_NETWORKINTERFACE_H__
23 #define __M2ETIS_NET_NETWORKINTERFACE_H__
24 
26 
29 #include "m2etis/net/NodeHandle.h"
30 
31 namespace m2etis {
32 namespace net {
33 
34  template<class Network>
35  class NetworkCallbackInterface;
36 
44  template<class NetworkType>
46  public:
47  virtual ~NetworkInterface() {
48  }
49 
55  _callback = cb;
56  }
57 
63  virtual void send(const typename message::NetworkMessage<NetworkType>::Ptr msg, typename NodeHandle<NetworkType>::Ptr_const hint) = 0;
64 
69  virtual typename NodeHandle<NetworkType>::Ptr getSelfNodeHandle() const = 0;
70 
76  virtual void registerMessageType(const typename NetworkType::MessageType type, const bool ack) const = 0;
77 
78  // virtual typename NetworkType::Message::Ptr createNetMessage() = 0;
79 
80  // virtual typename NetworkType::Message::Ptr deserializeMessage(const std::vector<unsigned char>& serialized_message) = 0;
81 
86  // virtual NodeHandleList neighborSet(const int num) const = 0;
87 
88  // virtual NodeHandleList replicaSet(const std::string& key, const int maxRank) const = 0;
89 
90  // virtual bool range(const NodeHandle& node, const int rank, const std::string& lkey, const std::string& rkey) const = 0;
91 
92  protected:
94  };
95 
96 } /* namespace net */
97 } /* namespace m2etis */
98 
99 #endif /* __M2ETIS_NET_NETWORKINTERFACE_H__ */
100 
virtual void send(const typename message::NetworkMessage< NetworkType >::Ptr msg, typename NodeHandle< NetworkType >::Ptr_const hint)=0
Sends a message to the node which is responsible for the given key. Provide a hint for better routing...
net::NetworkCallbackInterface< NetworkType > * _callback
returns an array of count neighbor nodes with priority to closer nodes.
void setCallback(NetworkCallbackInterface< NetworkType > *cb)
Sets the callback-object on which the defined callbacks will be called.
Generic interface for the callback-class used for the network.
virtual void registerMessageType(const typename NetworkType::MessageType type, const bool ack) const =0
register a messagetype. Only registered types are sent.
boost::shared_ptr< const NodeHandle< NetworkType > > Ptr_const
Definition: NodeHandle.h:61
message::MessageType MessageType
Definition: NetworkType.h:75
boost::shared_ptr< NetworkMessage > Ptr
boost::shared_ptr< NodeHandle< NetworkType > > Ptr
Definition: NodeHandle.h:62
virtual NodeHandle< NetworkType >::Ptr getSelfNodeHandle() const =0
query your NodeHandle. You may query that for it's key.