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 using namespace std;
16 using namespace hmbdc::time;
17 
18 struct Transport {
19  using ptr = std::shared_ptr<Transport>;
20 
21  Transport(app::Config const& cfg)
22  : config_(cfg)
23  , mtu_(config_.getExt<size_t>("mtu")) {
24  mtu_ -= (8u + 20u); // 8bytes udp header and 20bytes ip header
25  }
26 
27  bool operator == (Transport const& other ) const {
28  return &config_ == &other.config_;
29  }
30 
31  bool operator < (Transport const& other ) const {
32  return &config_ < &other.config_;
33  }
34 
35  virtual ~Transport(){}
36 
37 protected:
38  app::Config const config_;
39  size_t mtu_;
40 };
41 
43  EngineTransport(app::Config const& cfg)
44  : Transport(cfg) {
45  cfg (hmbdcName_, "hmbdcName")
46  (schedPolicy_, "schedPolicy")
47  (schedPriority_, "schedPriority")
48  ;
49  }
50 
51 protected:
52  char const* hmbdcName() const {
53  return this->hmbdcName_.c_str();
54  }
55  string hmbdcName_;
56  string schedPolicy_;
57  int schedPriority_;
58 };
59 } //transport_detail
60 
63 }}}
class to hold an hmbdc configuration
Definition: Config.hpp:45
Definition: TypedString.hpp:84
Definition: Rater.hpp:10
Definition: Base.hpp:12