hmbdc
simplify-high-performance-messaging-programming
Transport.hpp
1 #include "hmbdc/Copyright.hpp"
2 #pragma once
3 
4 #include "hmbdc/tips/TypeTagSet.hpp"
5 #include "hmbdc/app/Config.hpp"
6 #include "hmbdc/comm/inet/Misc.hpp"
7 #include "hmbdc/Compile.hpp"
8 
9 #include <memory>
10 #include <string>
11 
12 namespace hmbdc { namespace tips { namespace rmcast {
13 
14 namespace transport_detail {
15 struct Transport {
16  using ptr = std::shared_ptr<Transport>;
17 
18  Transport(app::Config const& cfg)
19  : config_(cfg)
20  , mtu_(config_.getExt<size_t>("mtu")) {
21  mtu_ -= (8u + 20u); // 8bytes udp header and 20bytes ip header
22  }
23 
24  bool operator == (Transport const& other ) const {
25  return &config_ == &other.config_;
26  }
27 
28  bool operator < (Transport const& other ) const {
29  return &config_ < &other.config_;
30  }
31 
32  virtual ~Transport(){}
33 
34 protected:
35  app::Config const config_;
36  size_t mtu_;
37 };
38 
40  EngineTransport(app::Config const& cfg)
41  : Transport(cfg) {
42  cfg (hmbdcName_, "hmbdcName")
43  (schedPolicy_, "schedPolicy")
44  (schedPriority_, "schedPriority")
45  ;
46  }
47 
48 protected:
49  char const* hmbdcName() const {
50  return this->hmbdcName_.c_str();
51  }
52  std::string hmbdcName_;
53  std::string schedPolicy_;
54  int schedPriority_;
55 };
56 } //transport_detail
57 
60 }}}
class to hold an hmbdc configuration
Definition: Config.hpp:44
Definition: Base.hpp:12