@@ -192,8 +192,8 @@ void LteMacEnb::initialize(int stage)
192192
193193 const CarrierInfoMap& carriers = cellInfo_->getCarrierInfoMap ();
194194 int i = 0 ;
195- for (const auto & item : carriers) {
196- GHz carrierFrequency = item. second .carrierFrequency ;
195+ for (const auto & [carrierKey, carrierInfo] : carriers) {
196+ GHz carrierFrequency = carrierInfo .carrierFrequency ;
197197 bgTrafficManager_[carrierFrequency] = check_and_cast<IBackgroundTrafficManager *>(getParentModule ()->getSubmodule (" bgTrafficGenerator" , i)->getSubmodule (" manager" ));
198198 bgTrafficManager_[carrierFrequency]->setCarrierFrequency (carrierFrequency);
199199 ++i;
@@ -208,12 +208,12 @@ void LteMacEnb::initialize(int stage)
208208 scheduleAt (NOW + ttiPeriod_, ttiTick_);
209209
210210 const CarrierInfoMap& carriers = cellInfo_->getCarrierInfoMap ();
211- for (const auto & item : carriers) {
211+ for (const auto & [carrierKey, carrierInfo] : carriers) {
212212 // set periodicity for this carrier according to its numerology
213213 NumerologyPeriodCounter info;
214- info.max = 1 << (cellInfo_->getMaxNumerologyIndex () - item. second .numerologyIndex ); // 2^(maxNumerologyIndex - numerologyIndex)
214+ info.max = 1 << (cellInfo_->getMaxNumerologyIndex () - carrierInfo .numerologyIndex ); // 2^(maxNumerologyIndex - numerologyIndex)
215215 info.current = info.max - 1 ;
216- numerologyPeriodCounter_[item. second .numerologyIndex ] = info;
216+ numerologyPeriodCounter_[carrierInfo .numerologyIndex ] = info;
217217 }
218218
219219 // set the periodicity for each scheduler
@@ -239,10 +239,9 @@ void LteMacEnb::macSduRequest()
239239 EV << " ----- START LteMacEnb::macSduRequest -----\n " ;
240240
241241 // Ask for a MAC SDU for each scheduled user on each carrier and each codeword
242- std::map<GHz, LteMacScheduleList>::iterator cit;
243- for (const auto & cit : *scheduleListDl_) { // loop on carriers
242+ for (const auto & [carrierFreq, scheduleList] : *scheduleListDl_) { // loop on carriers
244243
245- for (const auto & item : cit. second ) { // loop on CIDs
244+ for (const auto & item : scheduleList ) { // loop on CIDs
246245 MacCid destCid = item.first .first ;
247246 // Codeword cw = item.first.second;
248247 MacNodeId destId = destCid.getNodeId ();
@@ -335,8 +334,7 @@ void LteMacEnb::sendGrants(std::map<GHz, LteMacScheduleList> *scheduleList)
335334{
336335 EV << NOW << " LteMacEnb::sendGrants " << endl;
337336
338- for (auto & citem : *scheduleList) {
339- LteMacScheduleList& carrierScheduleList = citem.second ;
337+ for (auto & [carrierFreq, carrierScheduleList] : *scheduleList) {
340338 while (!carrierScheduleList.empty ()) {
341339 LteMacScheduleList::iterator it, ot;
342340 it = carrierScheduleList.begin ();
@@ -385,7 +383,7 @@ void LteMacEnb::sendGrants(std::map<GHz, LteMacScheduleList> *scheduleList)
385383
386384 EV << NOW << " LteMacEnb::sendGrants Node[" << getMacNodeId () << " ] - "
387385 << granted << " blocks to grant for user " << nodeId << " on "
388- << codewords << " codewords. CW[" << cw << " \\ " << otherCw << " ] carrier[" << citem. first << " ]" << endl;
386+ << codewords << " codewords. CW[" << cw << " \\ " << otherCw << " ] carrier[" << carrierFreq << " ]" << endl;
389387
390388 // TODO: change to tag instead of chunk
391389 // TODO: Grant is set as aperiodic by default
@@ -401,19 +399,19 @@ void LteMacEnb::sendGrants(std::map<GHz, LteMacScheduleList> *scheduleList)
401399 pkt->addTagIfAbsent <UserControlInfo>()->setSourceId (getMacNodeId ());
402400 pkt->addTagIfAbsent <UserControlInfo>()->setDestId (nodeId);
403401 pkt->addTagIfAbsent <UserControlInfo>()->setFrameType (GRANTPKT);
404- pkt->addTagIfAbsent <UserControlInfo>()->setCarrierFrequency (citem. first );
402+ pkt->addTagIfAbsent <UserControlInfo>()->setCarrierFrequency (carrierFreq );
405403
406404 // Get and set the user's UserTxParams
407- const UserTxParams& ui = getAmc ()->computeTxParams (nodeId, UL, citem. first );
405+ const UserTxParams& ui = getAmc ()->computeTxParams (nodeId, UL, carrierFreq );
408406 UserTxParams *txPara = new UserTxParams (ui);
409407 grant->setUserTxParams (txPara);
410408
411409 // Acquiring remote antennas set from user info
412410 const std::set<Remote>& antennas = ui.readAntennaSet ();
413411
414412 // Get bands for this carrier
415- const unsigned int firstBand = cellInfo_->getCarrierStartingBand (citem. first );
416- const unsigned int lastBand = cellInfo_->getCarrierLastBand (citem. first );
413+ const unsigned int firstBand = cellInfo_->getCarrierStartingBand (carrierFreq );
414+ const unsigned int lastBand = cellInfo_->getCarrierLastBand (carrierFreq );
417415
418416 // HANDLE MULTICW
419417 for ( ; cw < codewords; ++cw) {
@@ -427,7 +425,7 @@ void LteMacEnb::sendGrants(std::map<GHz, LteMacScheduleList> *scheduleList)
427425 }
428426
429427 grantedBytes += amc_->computeBytesOnNRbs (nodeId, b, cw,
430- bandAllocatedBlocks, UL, citem. first );
428+ bandAllocatedBlocks, UL, carrierFreq );
431429 }
432430
433431 grant->setGrantedCwBytes (cw, grantedBytes);
@@ -436,7 +434,7 @@ void LteMacEnb::sendGrants(std::map<GHz, LteMacScheduleList> *scheduleList)
436434
437435 RbMap map;
438436
439- enbSchedulerUl_->readRbOccupation (nodeId, citem. first , map);
437+ enbSchedulerUl_->readRbOccupation (nodeId, carrierFreq , map);
440438
441439 grant->setGrantedBlocks (map);
442440 pkt->insertAtFront (grant);
@@ -488,9 +486,8 @@ void LteMacEnb::macPduMake(MacCid cid)
488486 macPduList_.clear ();
489487
490488 // Build a MAC PDU for each scheduled user on each codeword
491- for (auto & cit : *scheduleListDl_) {
492- GHz carrierFreq = cit.first ;
493- for (auto & it : cit.second ) {
489+ for (auto & [carrierFreq, scheduleList] : *scheduleListDl_) {
490+ for (auto & it : scheduleList) {
494491 Packet *macPacket = nullptr ;
495492 MacCid destCid = it.first .first ;
496493
@@ -571,16 +568,14 @@ void LteMacEnb::macPduMake(MacCid cid)
571568 }
572569 }
573570
574- std::map<GHz, MacPduList>::iterator lit;
575- for (const auto & lit : macPduList_) {
576- GHz carrierFreq = lit.first ;
571+ for (const auto & [carrierFreq, macPduListPerCarrier] : macPduList_) {
577572 if (harqTxBuffers_.find (carrierFreq) == harqTxBuffers_.end ()) {
578573 HarqTxBuffers newHarqTxBuffers;
579574 harqTxBuffers_[carrierFreq] = newHarqTxBuffers;
580575 }
581576 HarqTxBuffers& harqTxBuffers = harqTxBuffers_[carrierFreq];
582577
583- for (const auto & pit : lit. second ) {
578+ for (const auto & pit : macPduListPerCarrier ) {
584579 MacNodeId destId = pit.first .first ;
585580 Codeword cw = pit.first .second ;
586581
@@ -749,11 +744,11 @@ void LteMacEnb::handleSelfMessage()
749744 // Reception
750745
751746 // extract PDUs from all HARQ RX buffers and pass them to unmaker
752- for (auto & mit : harqRxBuffers_) {
753- if (getNumerologyPeriodCounter (binder_->getNumerologyIndexFromCarrierFreq ((mit. first ) )) > 0 )
747+ for (auto & [carrierFreq, harqRxBuffer] : harqRxBuffers_) {
748+ if (getNumerologyPeriodCounter (binder_->getNumerologyIndexFromCarrierFreq (carrierFreq )) > 0 )
754749 continue ;
755750
756- for (auto & hit : mit. second ) {
751+ for (auto & hit : harqRxBuffer ) {
757752 auto pduList = hit.second ->extractCorrectPdus ();
758753 while (!pduList.empty ()) {
759754 auto pdu = pduList.front ();
@@ -785,8 +780,8 @@ void LteMacEnb::handleSelfMessage()
785780 if (activation) {
786781 // clear previous schedule list
787782 if (scheduleListDl_ != nullptr ) {
788- for (auto & cit : *scheduleListDl_)
789- cit. second .clear ();
783+ for (auto & [carrierFreq, scheduleList] : *scheduleListDl_)
784+ scheduleList .clear ();
790785 scheduleListDl_->clear ();
791786 }
792787
@@ -799,11 +794,11 @@ void LteMacEnb::handleSelfMessage()
799794 EV << " ========================================== END DOWNLINK ============================================" << endl;
800795
801796 // purge from corrupted PDUs all RX HARQ buffers for all users
802- for (auto & mit : harqRxBuffers_) {
803- if (getNumerologyPeriodCounter (binder_->getNumerologyIndexFromCarrierFreq ((mit. first ) )) > 0 )
797+ for (auto & [carrierFreq, harqRxBuffer] : harqRxBuffers_) {
798+ if (getNumerologyPeriodCounter (binder_->getNumerologyIndexFromCarrierFreq (carrierFreq )) > 0 )
804799 continue ;
805800
806- for (auto & hit : mit. second )
801+ for (auto & hit : harqRxBuffer )
807802 hit.second ->purgeCorruptedPdus ();
808803 }
809804
@@ -848,9 +843,9 @@ int LteMacEnb::getProcessForRtx(GHz carrierFrequency, Direction dir)
848843
849844void LteMacEnb::flushHarqBuffers ()
850845{
851- for (auto & mit : harqTxBuffers_) {
852- for (auto & it : mit. second )
853- it. second ->sendSelectedDown ();
846+ for (auto & [carrierFreq, harqTxBuffer] : harqTxBuffers_) {
847+ for (auto & [nodeId, harqBuffer] : harqTxBuffer )
848+ harqBuffer ->sendSelectedDown ();
854849 }
855850}
856851
@@ -965,28 +960,27 @@ int LteMacEnb::getActiveUesNumber(Direction dir)
965960
966961 std::map<GHz, HarqTxBuffers> *harqBuffers = getHarqTxBuffers ();
967962
968- for (const auto & it1 : *harqBuffers) {
969- const HarqTxBuffers& harqBuffer = it1.second ;
970- for (const auto & itHarq : harqBuffer) {
971- if (itHarq.second ->isHarqBufferActive ()) {
972- activeUeSet.insert (itHarq.first ); // active users in HARQ
963+ for (const auto & [carrierFreq, harqBuffer] : *harqBuffers) {
964+ for (const auto & [nodeId, harqBufferPtr] : harqBuffer) {
965+ if (harqBufferPtr->isHarqBufferActive ()) {
966+ activeUeSet.insert (nodeId); // active users in HARQ
973967 }
974968 }
975969 }
976970
977971 // every time an RLC SDU enters the layer, a newPktData is sent to
978972 // mac to inform the presence of data in RLC.
979- for (const auto & vit : connDescOut_) {
980- if (!vit. second .buffer ->isEmpty ())
981- activeUeSet.insert (vit. first .getNodeId ()); // active users in RLC
973+ for (const auto & [cid, connInfo] : connDescOut_) {
974+ if (!connInfo .buffer ->isEmpty ())
975+ activeUeSet.insert (cid .getNodeId ()); // active users in RLC
982976 }
983977 }
984978 else if (dir == UL) {
985979 // extract PDUs from all harqRxBuffers and pass them to unmaker
986- for (const auto & mit : harqRxBuffers_) {
987- for (const auto & elem : mit. second ) {
988- if (elem. second ->isHarqBufferActive ()) {
989- activeUeSet.insert (elem. first ); // active users in HARQ
980+ for (const auto & [carrierFreq, harqRxBuffer] : harqRxBuffers_) {
981+ for (const auto & [nodeId, harqBufferPtr] : harqRxBuffer ) {
982+ if (harqBufferPtr ->isHarqBufferActive ()) {
983+ activeUeSet.insert (nodeId ); // active users in HARQ
990984 }
991985 }
992986 }
0 commit comments