QuISP
Loading...
Searching...
No Matches
QNIC.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <omnetpp.h>
11#include <nlohmann/json.hpp>
12
13using namespace omnetpp;
14
15namespace quisp::modules {
16
17using json = nlohmann::json;
18typedef enum : int {
23} QNIC_type;
24
26 {QNIC_E, "QNIC_E"},
27 {QNIC_R, "QNIC_R"},
28 {QNIC_RP, "QNIC_RP"},
29 })
30
31static const char* QNIC_names[QNIC_N] = {
32 "qnic",
33 "qnic_r",
34 "qnic_rp",
35};
36
37struct QNIC {
39 int index;
40 // QNIC's self_qnic_address
42 // Pointer to that particular QNIC.
43 cModule* pointer = nullptr;
44};
45
46using QNicPairInfo = std::pair<QNIC, QNIC>;
47} // namespace quisp::modules
48
49namespace std {
50template <>
51class hash<pair<quisp::modules::QNIC_type, int>> {
52 public:
58 std::size_t operator()(pair<quisp::modules::QNIC_type, int> const& key) const noexcept { return std::hash<int>()((int)key.first * 10000 + key.second); }
59};
60} // namespace std
std::size_t operator()(pair< quisp::modules::QNIC_type, int > const &key) const noexcept
hash function for pair<QNIC_type, int> this only work assuming each node won't have more than 10,...
Definition QNIC.h:58
Definition Application.cc:16
nlohmann::json json
Definition QNIC.h:17
NLOHMANN_JSON_SERIALIZE_ENUM(QNIC_type, { {QNIC_E, "QNIC_E"}, {QNIC_R, "QNIC_R"}, {QNIC_RP, "QNIC_RP"}, }) static const char *QNIC_names[QNIC_N]
std::pair< QNIC, QNIC > QNicPairInfo
Definition QNIC.h:46
QNIC_type
Definition QNIC.h:18
@ QNIC_E
Definition QNIC.h:19
@ QNIC_RP
Definition QNIC.h:21
@ QNIC_N
Definition QNIC.h:22
@ QNIC_R
Definition QNIC.h:20
Definition Backends.h:10
Definition QNIC.h:49
Definition QNIC.h:37
int address
Definition QNIC.h:41
cModule * pointer
Definition QNIC.h:43
int index
Definition QNIC.h:39
QNIC_type type
Definition QNIC.h:38