From 8fb0649c2bd4061a3ff88abd32fe6e8dd1f37476 Mon Sep 17 00:00:00 2001 From: Natale Patriciello Date: Wed, 24 Oct 2018 15:00:48 +0200 Subject: [PATCH] lte: LteMacSap constructors for ReceivePduParameters and TxOpportunityParameters created Thanks to constructors, it is easier to create these structs. In particular, code like this MyAwesomeStruct x; x.value = 10; x.another = 200; ... AMethod (x); can be replaced with AMethod (MyAwesomeStruct (10, 200)); Reducing the amount of needed lines. --- src/lte/model/lte-mac-sap.h | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/lte/model/lte-mac-sap.h b/src/lte/model/lte-mac-sap.h index c4ebd3bb6..ed0bd1057 100644 --- a/src/lte/model/lte-mac-sap.h +++ b/src/lte/model/lte-mac-sap.h @@ -102,6 +102,30 @@ public: */ struct TxOpportunityParameters { + /** + * \brief TxOpportunityParameters constructor + * \param bytes Bytes + * \param layer Layer + * \param harqId HarqID + * \param ccId Component carrier ID + * \param rnti RNTI + * \param lcId Logical Channel ID + */ + TxOpportunityParameters (uint32_t bytes, uint8_t layer, uint8_t harqId, + uint8_t ccId, uint16_t rnti, uint8_t lcId) + { + this->bytes = bytes; + this->layer = layer; + this->harqId = harqId; + this->componentCarrierId = ccId; + this->rnti = rnti; + this->lcid = lcId; + } + /** + * \brief TxOpportunityParameters default constructor (DEPRECATED) + */ + TxOpportunityParameters () { } + uint32_t bytes; /**< the number of bytes to transmit */ uint8_t layer; /**< the layer of transmission (MIMO) */ uint8_t harqId; /**< the HARQ ID */ @@ -131,6 +155,23 @@ public: */ struct ReceivePduParameters { + /** + * \brief ReceivePduParameters default constructor (DEPRECATED) + */ + ReceivePduParameters () { } + + /** + * \brief ReceivePduParameters constructor + * \param p Packet + * \param rnti RNTI + * \param lcid Logical Channel ID + */ + ReceivePduParameters (const Ptr &p, uint16_t rnti, uint8_t lcid) + { + this->p = p; + this->rnti = rnti; + this->lcid = lcid; + } Ptr p; /**< the RLC PDU to be received */ uint16_t rnti; /**< the C-RNTI identifying the UE */ uint8_t lcid; /**< the logical channel id */