From 549bdcbed83fda8c1976aa118e553451ef24fac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Apitzsch?= Date: Mon, 25 Mar 2024 16:12:23 +0100 Subject: [PATCH] lte: Convert BearerRequirements tuple to struct --- src/lte/model/eps-bearer.h | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/lte/model/eps-bearer.h b/src/lte/model/eps-bearer.h index fa0da3bded..d98162805c 100644 --- a/src/lte/model/eps-bearer.h +++ b/src/lte/model/eps-bearer.h @@ -231,14 +231,23 @@ class EpsBearer : public ObjectBase double GetPacketErrorLossRate() const; private: + /** + * @brief Struct containing bearer requirements + */ + struct BearerRequirements + { + uint8_t resourceType{0}; //!< resource type + uint8_t priority{0}; //!< priority + uint16_t packetDelayBudgetMs{0}; //!< packet delay budget in ms + double packetErrorLossRate{0.0}; //!< packet error rate + uint32_t maxDataBurst{0}; //!< default maximum data burst + uint32_t avgWindow{0}; //!< default averaging window (0 when does not apply) + }; + /** * @brief Map between QCI and requirements - * - * The tuple is formed by: resource type, priority, packet delay budget, packet error rate, - * default maximum data burst, default averaging window (0 when does not apply) */ - using BearerRequirementsMap = - std::unordered_map>; + using BearerRequirementsMap = std::unordered_map; /** * @brief Get the resource type (NON-GBR, GBR, DC-GBR) of the selected QCI @@ -248,7 +257,7 @@ class EpsBearer : public ObjectBase */ static uint8_t GetResourceType(const BearerRequirementsMap& map, Qci qci) { - return std::get<0>(map.at(qci)); + return map.at(qci).resourceType; } /** @@ -259,7 +268,7 @@ class EpsBearer : public ObjectBase */ static uint8_t GetPriority(const BearerRequirementsMap& map, Qci qci) { - return std::get<1>(map.at(qci)); + return map.at(qci).priority; } /** @@ -270,7 +279,7 @@ class EpsBearer : public ObjectBase */ static uint16_t GetPacketDelayBudgetMs(const BearerRequirementsMap& map, Qci qci) { - return std::get<2>(map.at(qci)); + return map.at(qci).packetDelayBudgetMs; } /** @@ -281,7 +290,7 @@ class EpsBearer : public ObjectBase */ static double GetPacketErrorLossRate(const BearerRequirementsMap& map, Qci qci) { - return std::get<3>(map.at(qci)); + return map.at(qci).packetErrorLossRate; } /** @@ -292,7 +301,7 @@ class EpsBearer : public ObjectBase */ static uint32_t GetMaxDataBurst(const BearerRequirementsMap& map, Qci qci) { - return std::get<4>(map.at(qci)); + return map.at(qci).maxDataBurst; } /** @@ -303,7 +312,7 @@ class EpsBearer : public ObjectBase */ static uint32_t GetAvgWindow(const BearerRequirementsMap& map, Qci qci) { - return std::get<5>(map.at(qci)); + return map.at(qci).avgWindow; } /**