Skip to content

Commit

Permalink
lte: Convert BearerRequirements tuple to struct
Browse files Browse the repository at this point in the history
  • Loading branch information
a-andre authored and Gabrielcarvfer committed Nov 19, 2024
1 parent 427b7d7 commit 549bdcb
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/lte/model/eps-bearer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Qci, std::tuple<uint8_t, uint8_t, uint16_t, double, uint32_t, uint32_t>>;
using BearerRequirementsMap = std::unordered_map<Qci, BearerRequirements>;

/**
* @brief Get the resource type (NON-GBR, GBR, DC-GBR) of the selected QCI
Expand All @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand Down

0 comments on commit 549bdcb

Please sign in to comment.