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