-
July 18th, 2022, 03:43 AM
#1
stl holder
Hi ,
There is a map,
std::map<int, RepeaterInfo> m_mapLoadingID_to_RepeaterInfo;
Currently, lets say we have antenna key and it gets converted to many Loading ids.. ( Almost all of loading ids, have all the info common)
Lets say repeater key 101, the current function, creates 2 loading id , and populates same repeater info in both of them (if passive). If switched beam antenna, it creates , n loading ids, (n is no of patterns on switch beam), and loads each load id with the same repeater info.
The current code for this is as follows. (may need some optimisation )
Code:
HRESULT STDMETHODCALLTYPE
EnterpriseAPI_5gCell::GetListOfWBRepeaterLoadindgIds(INT* pLoadingIDs, INT* repeaterKeys)
{
if ( !m_attached ) return ENTAPIERR_OBJECT_NOT_ATTACHED;
if ( !repeaterKeys ) return E_INVALIDARG;
if ( m_pFilter && strcmp(m_pFilter->GetID(), "All") )
m_pFilter->LockFilter(true);
std::set<int> setRepLoadingIDs;
// if switched beam fake up antennas
m_mapLoadingID_to_RepeaterInfo.clear();
m_mapRepKeyToLoadIds.clear();
size_t nCount = 0;
auto& lstGenericRepeater = m_pCell->GetGenericRepeaterList();
for (auto iter = lstGenericRepeater.begin(); iter != lstGenericRepeater.end(); ++iter)
{
const GenericRepeater* pGenericRepeater = *iter;
if ( m_pFilter && !m_pFilter->isActive(*pGenericRepeater) ) continue; // Ignore repeater if not in the filter
if (!pGenericRepeater->IsRepeating(TgNetType::TGNETWORK_5G))
continue;
const GenericRepeaterFeeder* pTxAntenna = pGenericRepeater->GetTxAntenna();
const GenericRepeaterFeeder* pRxAntenna = pGenericRepeater->GetRxAntenna();
const LogicalAntenna * pRepeaterRxLogicalAntenna(pRxAntenna->GetLogicalAntenna());
const LogicalAntenna* pRepeaterTxLogicalAntenna(pTxAntenna->GetLogicalAntenna());
const AntennaType* pRepeaterRxAntennaType = pRepeaterRxLogicalAntenna->GetAntennaType(); ASSERT_ONCE(pRepeaterRxAntennaType);
const AntennaType* pRepeaterTxAntennaType = pRepeaterTxLogicalAntenna->GetAntennaType(); ASSERT_ONCE(pRepeaterTxAntennaType);
const bool bIsRepeaterRxSBA = pRepeaterRxAntennaType->GetParentDevice().IsSwitchedBeamType() && pRepeaterRxLogicalAntenna->IsMultiBeam() ;
const bool bIsRepeaterTxSBA = pRepeaterTxAntennaType->GetParentDevice().IsSwitchedBeamType() && pRepeaterTxLogicalAntenna->IsMultiBeam();
if (pTxAntenna && pRxAntenna && pTxAntenna->GetLogicalAntenna() && pRxAntenna->GetLogicalAntenna()
&& !bIsRepeaterRxSBA && !bIsRepeaterTxSBA )
{
int nLoadingID = pGenericRepeater->GetKey();
setRepLoadingIDs.insert(nLoadingID); // Always put genuine DB keys in the set
}
}
auto& lGenericRepeater = m_pCell->GetGenericRepeaterList();
for (auto iter = lGenericRepeater.begin(); iter != lGenericRepeater.end(); ++iter)
{
const GenericRepeater* pGenericRepeater = *iter;
if ( m_pFilter && !m_pFilter->isActive(*pGenericRepeater) ) continue; // Ignore repeater if not in the filter
if (!pGenericRepeater->IsRepeating(TgNetType::TGNETWORK_5G))
continue;
const GenericRepeaterFeeder* pTxAntenna = pGenericRepeater->GetTxAntenna();
const GenericRepeaterFeeder* pRxAntenna = pGenericRepeater->GetRxAntenna();
const LogicalAntenna* pRepeaterRxLogicalAntenna(pRxAntenna->GetLogicalAntenna());
const LogicalAntenna* pRepeaterTxLogicalAntenna(pTxAntenna->GetLogicalAntenna());
const AntennaType* pRepeaterRxAntennaType = pRepeaterRxLogicalAntenna->GetAntennaType(); ASSERT_ONCE(pRepeaterRxAntennaType);
const AntennaType* pRepeaterTxAntennaType = pRepeaterTxLogicalAntenna->GetAntennaType(); ASSERT_ONCE(pRepeaterTxAntennaType);
const bool bIsRepeaterRxSBA = pRepeaterRxAntennaType->GetParentDevice().IsSwitchedBeamType() && pRepeaterRxLogicalAntenna->IsMultiBeam() ;
const bool bIsRepeaterTxSBA = pRepeaterTxAntennaType->GetParentDevice().IsSwitchedBeamType() && pRepeaterTxLogicalAntenna->IsMultiBeam();
if (pTxAntenna && pRxAntenna && pTxAntenna->GetLogicalAntenna() && pRxAntenna->GetLogicalAntenna()
&& ( bIsRepeaterRxSBA || bIsRepeaterTxSBA ) )
continue;
const int nOrigRepKey = pGenericRepeater->GetKey();
int nRepeaterLoadingID = nOrigRepKey;
nRepeaterLoadingID++;
while (setRepLoadingIDs.find(nRepeaterLoadingID) != setRepLoadingIDs.end())
{
nRepeaterLoadingID++;
}
setRepLoadingIDs.insert(nRepeaterLoadingID);
RepeaterInfo repInfoCtrl(pGenericRepeater, true);
m_mapLoadingID_to_RepeaterInfo[nRepeaterLoadingID] = repInfoCtrl;
pLoadingIDs[nCount] = nRepeaterLoadingID;
repeaterKeys[nCount] = nOrigRepKey;
nCount++;
nRepeaterLoadingID++;
while (setRepLoadingIDs.find(nRepeaterLoadingID) != setRepLoadingIDs.end())
{
nRepeaterLoadingID++;
}
setRepLoadingIDs.insert(nRepeaterLoadingID);
RepeaterInfo repInfoTraf(pGenericRepeater, false);
m_mapLoadingID_to_RepeaterInfo[nRepeaterLoadingID] = repInfoTraf;
pLoadingIDs[nCount] = nRepeaterLoadingID;
repeaterKeys[nCount] = nOrigRepKey;
std::set<int> setRepLoadingIDsWithoutRepKey = setRepLoadingIDs;
setRepLoadingIDsWithoutRepKey.erase(nOrigRepKey);
m_mapRepKeyToLoadIds[nOrigRepKey] = setRepLoadingIDsWithoutRepKey;
nCount++;
}
if ( m_pFilter ) m_pFilter->LockFilter(false);
return S_OK;
}
I added a map, to store the repeater key to load ids, m_mapRepKeyToLoadIds, which needs to store the Repeater keys and their load ids. Is tthis erase ok (setRepLoadingIDsWithoutRepKey.erase(nOrigRepKey); ? Or is there a better way ?
thanks a lot
pdk
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
|