client-cpp  0.8.1
AbstractKaaTransport.hpp
Go to the documentation of this file.
1 
17 #ifndef ABSTRACTKAATRANSPORT_HPP_
18 #define ABSTRACTKAATRANSPORT_HPP_
19 
25 
26 namespace kaa {
27 
28 template <TransportType Type>
30 {
31 public:
32  virtual ~AbstractKaaTransport() {}
33 
35  : type_(Type), channelManager_(channelManager), context_(context) {}
36 
37 private:
38  IDataChannelPtr getChannel(TransportType transportType = Type)
39  {
41  if (channel) {
42  return channel;
43  }
44  throw KaaException("Cannot find appropriate channel");
45  }
46 
47 protected:
48  void syncByType(TransportType transportType = Type)
49  {
50  getChannel(transportType)->sync(transportType);
51  }
52 
53  void syncAll()
54  {
55  getChannel()->syncAll();
56  }
57 
58  void syncAck(TransportType transportType = Type)
59  {
60  getChannel(transportType)->syncAck(transportType);
61  }
62 
63 protected:
67 };
68 
69 } // namespace kaa
70 
71 
72 #endif /* ABSTRACTKAATRANSPORT_HPP_ */
virtual void syncAck(TransportType type)=0
virtual void syncAll()=0
AbstractKaaTransport(IKaaChannelManager &channelManager, IKaaClientContext &context)
virtual void sync(TransportType type)=0
virtual IDataChannelPtr getChannelByTransportType(TransportType type)=0
void syncAck(TransportType transportType=Type)
IKaaChannelManager & channelManager_
void syncByType(TransportType transportType=Type)