hmbdc
simplify-high-performance-messaging-programming
Transport.hpp
1 #include "hmbdc/Copyright.hpp"
2 #pragma once
3 
4 #include "hmbdc/app/Config.hpp"
5 
6 #include <memory>
7 #include <string>
8 
9 namespace hmbdc { namespace tips { namespace rnetmap {
10 
11 namespace transport_detail {
12 using namespace std;
13 using namespace hmbdc::app;
14 
15 struct Transport {
16  using ptr = std::shared_ptr<Transport>;
17 
18  Transport(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  Config const config_;
36  size_t mtu_;
37 };
38 
40  EngineTransport(Config const& cfg)
41  : Transport(cfg) {
42  cfg (hmbdcName_, "hmbdcName")
43  (schedPolicy_, "schedPolicy")
44  (schedPriority_, "schedPriority")
45  ;
46  }
47 
48  char const* hmbdcName() const {
49  return this->hmbdcName_.c_str();
50  }
51 protected:
52  string hmbdcName_;
53  string schedPolicy_;
54  int schedPriority_;
55 };
56 
57 } //transport_detail
58 
61 }}}
Definition: Base.hpp:12
class to hold an hmbdc configuration
Definition: Config.hpp:45
Definition: TypedString.hpp:84
Definition: Base.hpp:12