|
-
June 6th, 2020, 04:35 AM
#1
Exception when the second list element size =1
Hi,
I have the following piece of function. Under the node, there are sul and tdd cells. I try to move them to another node, with two lists, one with sul cells and another with tdd cells.
Now based on some condition is met, each sul is paired with only one tdd cell.
I put the following code, but in the second for loop, the exception is thrown. (The scenario i tested is , 2 sul cells and one tdd cell).
I have shown the line in red. Error is "Cannot decrement begin list iterator"
Code:
void UlDlDecoupCellIdentityPlanner::PopulateMultiTechNodePtr2SulTddCellListMap()
{
ILogicalLayerManager& rLogLayManager = DataManager::GetInstance().GetLogicalLayer();
UserGroupManager& rUserGrpManager = UserGroupInstance::instance().GetManager();
ASSERT_ONCE(m_MultiTechNodePtr2SulTddCellListMap.size() == 0);
// TODO_PRIYA@ SUL to 5g
const safemap<int, LP5GCELL>& rCellList = m_rUlDlDecoupCellIdPlannerData.GetSulCellList();
m_pProgressDlg->SetCurrentRangeMax((ULONG)rCellList.size() - 1);
// Make a list of SUL and TDD cells.
// for (auto& mapObj : rCellList)
for(auto& mapObj = rCellList.begin(); mapObj != rCellList.end(); ++mapObj)
{
const int iCellKey = mapObj->first;
const MultiTechCell* pCell = dynamic_cast<const MultiTechCell*>(rLogLayManager.Find(OT_MULTI_TECH_CELL, iCellKey));
TgNetType eTgNetType = pCell->GetActiveTechnologyMode();
const TechCellParams* pFiveGTechCellParams = pCell->GetTechnologyParameters(eTgNetType);
const FiveGCellParams* pFiveGParams = dynamic_cast<const FiveGCellParams*>(pFiveGTechCellParams); ASSERT_ONCE(pFiveGParams);
const FiveGCellCarrier* pFiveGCellCarrier = pFiveGParams->GetSingleCarrier(); ASSERT_ONCE(pFiveGCellCarrier);
const FiveGCarrier* pFiveGCarrier = pFiveGCellCarrier->Get5GCarrier();
IDataManager* pDataManager = IDataManager::Interface(); ASSERT_ONCE(pDataManager);
const FiveGFrame* pFiveGFrame = (pFiveGCarrier) ? pFiveGCarrier->Get5gFramePointer(pDataManager) : nullptr;
//if (!rUserGrpManager.CanModifyObject(*pCell)) continue;
const auto* pNode = static_cast<const MultiTechNode*>(pCell->GetParent());
MultiTechNodePtr2SulTddCellListMapIter iterNode = m_MultiTechNodePtr2SulTddCellListMap.find(pNode);
if (iterNode == m_MultiTechNodePtr2SulTddCellListMap.end()) // If not seen the node before ...
{
SulTddCellListMap rSulTddCellList;
MultiTechCellConstPtrList rSulCellList;
MultiTechCellConstPtrList rTddCellList;
if (pFiveGFrame->GetDuplexMode() == FiveGEnums::FiveGDuplexMode::SUL)
{
rSulTddCellList.sulCellList.push_back(pCell);
m_MultiTechNodePtr2SulTddCellListMap.insert((std::make_pair(pNode, rSulTddCellList)));
}
else if (pFiveGFrame->GetDuplexMode() == FiveGEnums::FiveGDuplexMode::TDD)
{
rSulTddCellList.tddCellList.push_back(pCell);
m_MultiTechNodePtr2SulTddCellListMap.insert((std::make_pair(pNode, rSulTddCellList)));
}
}
else
{
SulTddCellListMap& rLsit = iterNode->second; // .. else update the list of child cells for the node
if (pFiveGFrame->GetDuplexMode() == FiveGEnums::FiveGDuplexMode::SUL)
{
rLsit.sulCellList.push_back(pCell);
}
else if (pFiveGFrame->GetDuplexMode() == FiveGEnums::FiveGDuplexMode::TDD)
{
rLsit.tddCellList.push_back(pCell);
}
else
{
// NOT HANDLED
}
}
m_pProgressDlg->IncrementCurrentProgress();
}
for (auto& mapObj : m_MultiTechNodePtr2SulTddCellListMap)
{
auto nNode = mapObj.first;
auto nCellList = mapObj.second;
for (auto& sulCell : nCellList.sulCellList)
{
bool bFirstMatch = false;
bool bCanbePaired = false;
// for (auto& tddCell : nCellList.tddCellList)
for (auto &tddCell = nCellList.tddCellList.begin(); tddCell != nCellList.tddCellList.end(); ++tddCell)
{
// If can be paired, add the new list and erase TDD cell
// if (CanbePairedBasedOnAzimuth(sulCell,*tddCell))
{
auto iterNode = m_MultiTechNodePtr2SulTddGUlDlDecoupCellListMap.find(nNode);
if (iterNode == m_MultiTechNodePtr2SulTddGUlDlDecoupCellListMap.end())
{
SulTddCellList sulTddCellList;
SulTddCellListPairMap pairMap;
pairMap.m_pSulCell = const_cast<MultiTechCell*>(sulCell);
pairMap.m_pTddCell = const_cast<MultiTechCell*>(*tddCell);
sulTddCellList.push_back(pairMap);
m_MultiTechNodePtr2SulTddGUlDlDecoupCellListMap.insert(make_pair(nNode, sulTddCellList));
}
else
{
// else update the list of child cells for the node
SulTddCellList& rLsit = iterNode->second;
SulTddCellListPairMap pairMap;
pairMap.m_pSulCell = const_cast<MultiTechCell*>(sulCell);
pairMap.m_pTddCell = const_cast<MultiTechCell*>(*tddCell);
rLsit.push_back(pairMap);
}
bCanbePaired = true;
// Erase the TDD cell as it cannot be paired again
tddCell = nCellList.tddCellList.erase(tddCell); //eraseand go to next(erase will return the next iterator)
{
--tddCell; // as it will be add again in for, so we go back one step
}
}
}
// skip this sul cell.
if (bCanbePaired)
break;
}
}
}
It will be very helpful, if you can suggest improvements also 
Thank a lot
pdk
Last edited by pdk5; June 6th, 2020 at 06:22 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|