m2etis  0.4
ChannelInterface.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_CHANNELINTERFACE_H__
23 #define __M2ETIS_PUBSUB_CHANNELINTERFACE_H__
24 
27 #include "m2etis/net/NetworkType.h"
29 
30 namespace m2etis {
31 namespace pubsub {
32 namespace filter {
33  template <typename EventType> class FilterExp;
34 } /* namespace filter */
35 
36  template<class T>
37  class BasicDeliverCallbackInterface;
38 
46  template<class EventType>
52 
58  virtual void publish(const typename message::M2Message<EventType>::Ptr msg) = 0;
59 
66  virtual void subscribe(BasicDeliverCallbackInterface<EventType> & callback, boost::shared_ptr<filter::FilterExp<EventType> >) = 0;
67 
68  virtual void unsubscribe() = 0;
69 
75  virtual void unsubscribe(boost::shared_ptr<filter::FilterExp<EventType> >) = 0;
76 
82  virtual ChannelName getChannel() const = 0;
83 
84  virtual std::string getSelf() const = 0;
85 
86  virtual typename message::M2Message<EventType>::Ptr createMessage() const = 0;
87 
88  virtual typename message::M2Message<EventType>::Ptr createMessage(const EventType & payload) const = 0;
89 
90 #ifdef WITH_SIM
91  virtual typename message::NetworkMessage<net::NetworkType<net::OMNET> >::Ptr transformToNetworkMessage(typename message::M2Message<EventType>::Ptr msg) const = 0;
92 
93  virtual typename message::M2Message<EventType>::Ptr transformToM2Message(typename message::NetworkMessage<net::NetworkType<net::OMNET> >::Ptr msg) const = 0;
94 #endif /* WITH_SIM */
95  };
96 
98 
99 } /* namespace pubsub */
100 } /* namespace m2etis */
101 
102 #endif /* __M2ETIS_PUBSUB_CHANNELINTERFACE_H__ */
103 
virtual void subscribe(BasicDeliverCallbackInterface< EventType > &callback, boost::shared_ptr< filter::FilterExp< EventType > >)=0
subscribes to the channel
boost::shared_ptr< M2Message< EventType > > Ptr
Definition: M2Message.h:42
virtual ~BasicChannelInterface()
Destructor.
virtual ChannelName getChannel() const =0
Gets a identification of the channel.
virtual message::M2Message< EventType >::Ptr createMessage() const =0
virtual std::string getSelf() const =0
BasicChannelInterface< std::vector< unsigned char > > ChannelInterface
virtual void publish(const typename message::M2Message< EventType >::Ptr msg)=0
publishes a message on the channel