hmbdc
simplify-high-performance-messaging-programming
Transport.hpp
1 #include "hmbdc/Copyright.hpp"
2 #pragma once
3 
4 #include "hmbdc/app/Config.hpp"
5 #include "hmbdc/text/StringTrieSet.hpp"
6 #include "hmbdc/comm/Topic.hpp"
7 #include "hmbdc/comm/inet/Misc.hpp"
8 #include "hmbdc/time/Timers.hpp"
9 #include "hmbdc/pattern/LockFreeBufferT.hpp"
10 #include "hmbdc/Compile.hpp"
11 
12 #include <boost/regex.hpp>
13 #include <boost/asio.hpp>
14 
15 #include <memory>
16 
17 extern thread_local std::shared_ptr<boost::asio::io_service> gtIos;
18 
19 namespace hmbdc { namespace app { namespace mcast {
20 
21 using namespace hmbdc;
22 using namespace hmbdc::time;
23 using namespace hmbdc::comm;
24 using namespace boost::asio;
25 struct Transport {
26  using ptr = std::shared_ptr<Transport>;
27 
28  Transport(Config const& cfg)
29  : config_(cfg)
30  , pIos_(nullptr) {
31  cfg (hmbdcName_, "hmbdcName")
32  (schedPolicy_, "schedPolicy")
33  (schedPriority_, "schedPriority")
34  ;
35  }
36 
37  void initInThread() {
38  if (!::gtIos) {
39  ::gtIos.reset(new io_service(1u));
40  }
41  pIos_ = ::gtIos;
42  }
43 
44  bool operator == (Transport const& other ) const {
45  return &config_ == &other.config_;
46  }
47 
48  bool operator < (Transport const& other ) const {
49  return &config_ < &other.config_;
50  }
51 
52  virtual ~Transport(){
53  }
54 
55 protected:
56  string hmbdcName_;
57  string schedPolicy_;
58  int schedPriority_;
60  Config const config_;
61  std::shared_ptr<io_service> pIos_;
62 };
63 }}}
class to hold an hmbdc configuration
Definition: Config.hpp:35
Definition: LockFreeBufferT.hpp:18
Definition: Misc.h:9
Definition: Rater.hpp:10
Definition: Transport.hpp:25
Definition: Client.hpp:11