internet, lte, spectrum, wifi: Pre-allocate memory when initializing vectors
This commit is contained in:
@@ -220,11 +220,7 @@ Ipv6InterfaceContainer
|
||||
Ipv6AddressHelper::Assign(const NetDeviceContainer& c)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
std::vector<bool> withConfiguration;
|
||||
for (uint32_t i = 0; i < c.GetN(); ++i)
|
||||
{
|
||||
withConfiguration.push_back(true);
|
||||
}
|
||||
std::vector<bool> withConfiguration(c.GetN(), true);
|
||||
return Assign(c, withConfiguration);
|
||||
}
|
||||
|
||||
@@ -232,11 +228,7 @@ Ipv6InterfaceContainer
|
||||
Ipv6AddressHelper::Assign(const NetDeviceContainer& c, std::vector<bool> withConfiguration)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
std::vector<bool> onLink;
|
||||
for (uint32_t i = 0; i < c.GetN(); ++i)
|
||||
{
|
||||
onLink.push_back(true);
|
||||
}
|
||||
std::vector<bool> onLink(c.GetN(), true);
|
||||
return Assign(c, withConfiguration, onLink);
|
||||
}
|
||||
|
||||
@@ -312,11 +304,7 @@ Ipv6InterfaceContainer
|
||||
Ipv6AddressHelper::AssignWithoutAddress(const NetDeviceContainer& c)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
std::vector<bool> withConfiguration;
|
||||
for (uint32_t i = 0; i < c.GetN(); ++i)
|
||||
{
|
||||
withConfiguration.push_back(false);
|
||||
}
|
||||
std::vector<bool> withConfiguration(c.GetN(), false);
|
||||
return Assign(c, withConfiguration);
|
||||
}
|
||||
|
||||
@@ -324,13 +312,10 @@ Ipv6InterfaceContainer
|
||||
Ipv6AddressHelper::AssignWithoutOnLink(const NetDeviceContainer& c)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
std::vector<bool> withConfiguration;
|
||||
std::vector<bool> onLink;
|
||||
for (uint32_t i = 0; i < c.GetN(); ++i)
|
||||
{
|
||||
withConfiguration.push_back(true);
|
||||
onLink.push_back(false);
|
||||
}
|
||||
|
||||
std::vector<bool> withConfiguration(c.GetN(), true);
|
||||
std::vector<bool> onLink(c.GetN(), false);
|
||||
|
||||
return Assign(c, withConfiguration, onLink);
|
||||
}
|
||||
|
||||
|
||||
@@ -1282,10 +1282,7 @@ CqaFfMacScheduler::DoSchedDlTriggerReq(
|
||||
std::vector<uint8_t> sbCqis;
|
||||
if (itCqi == m_a30CqiRxed.end())
|
||||
{
|
||||
for (uint8_t k = 0; k < nLayer; k++)
|
||||
{
|
||||
sbCqis.push_back(1); // start with lowest value
|
||||
}
|
||||
sbCqis = std::vector<uint8_t>(nLayer, 1); // start with lowest value
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -917,10 +917,7 @@ FdMtFfMacScheduler::DoSchedDlTriggerReq(
|
||||
std::vector<uint8_t> sbCqi;
|
||||
if (itCqi == m_a30CqiRxed.end())
|
||||
{
|
||||
for (uint8_t k = 0; k < nLayer; k++)
|
||||
{
|
||||
sbCqi.push_back(1); // start with lowest value
|
||||
}
|
||||
sbCqi = std::vector<uint8_t>(nLayer, 1); // start with lowest value
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1207,10 +1207,7 @@ FdTbfqFfMacScheduler::DoSchedDlTriggerReq(
|
||||
std::vector<uint8_t> sbCqi;
|
||||
if (itCqi == m_a30CqiRxed.end())
|
||||
{
|
||||
for (uint8_t k = 0; k < nLayer; k++)
|
||||
{
|
||||
sbCqi.push_back(1); // start with lowest value
|
||||
}
|
||||
sbCqi = std::vector<uint8_t>(nLayer, 1); // start with lowest value
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -984,10 +984,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq(
|
||||
std::vector<uint8_t> sbCqi;
|
||||
if (itCqi == m_a30CqiRxed.end())
|
||||
{
|
||||
for (uint8_t k = 0; k < nLayer; k++)
|
||||
{
|
||||
sbCqi.push_back(1); // start with lowest value
|
||||
}
|
||||
sbCqi = std::vector<uint8_t>(nLayer, 1); // start with lowest value
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1150,10 +1150,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq(
|
||||
std::vector<uint8_t> sbCqis;
|
||||
if (itCqi == m_a30CqiRxed.end())
|
||||
{
|
||||
for (uint8_t k = 0; k < nLayer; k++)
|
||||
{
|
||||
sbCqis.push_back(1); // start with lowest value
|
||||
}
|
||||
sbCqis = std::vector<uint8_t>(nLayer, 1); // start with lowest value
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1230,10 +1227,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq(
|
||||
std::vector<uint8_t> sbCqis;
|
||||
if (itCqi == m_a30CqiRxed.end())
|
||||
{
|
||||
for (uint8_t k = 0; k < nLayer; k++)
|
||||
{
|
||||
sbCqis.push_back(1); // start with lowest value
|
||||
}
|
||||
sbCqis = std::vector<uint8_t>(nLayer, 1); // start with lowest value
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1336,10 +1330,7 @@ PssFfMacScheduler::DoSchedDlTriggerReq(
|
||||
std::vector<uint8_t> sbCqis;
|
||||
if (itCqi == m_a30CqiRxed.end())
|
||||
{
|
||||
for (uint8_t k = 0; k < nLayer; k++)
|
||||
{
|
||||
sbCqis.push_back(1); // start with lowest value
|
||||
}
|
||||
sbCqis = std::vector<uint8_t>(nLayer, 1); // start with lowest value
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -921,10 +921,7 @@ TtaFfMacScheduler::DoSchedDlTriggerReq(
|
||||
std::vector<uint8_t> sbCqi;
|
||||
if (itSbCqi == m_a30CqiRxed.end())
|
||||
{
|
||||
for (uint8_t k = 0; k < nLayer; k++)
|
||||
{
|
||||
sbCqi.push_back(1); // start with lowest value
|
||||
}
|
||||
sbCqi = std::vector<uint8_t>(nLayer, 1); // start with lowest value
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2197,12 +2197,11 @@ ThreeGppChannelModel::CalcAttenuationOfBlockage(
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
|
||||
DoubleVector powerAttenuation;
|
||||
uint8_t clusterNum = clusterAOA.size();
|
||||
for (uint8_t cInd = 0; cInd < clusterNum; cInd++)
|
||||
{
|
||||
powerAttenuation.push_back(0); // Initial power attenuation for all clusters to be 0 dB;
|
||||
}
|
||||
auto clusterNum = clusterAOA.size();
|
||||
|
||||
// Initial power attenuation for all clusters to be 0 dB
|
||||
DoubleVector powerAttenuation(clusterNum, 0);
|
||||
|
||||
// step a: the number of non-self blocking blockers is stored in m_numNonSelfBlocking.
|
||||
|
||||
// step b:Generate the size and location of each blocker
|
||||
|
||||
@@ -2229,33 +2229,24 @@ MinstrelHtWifiManager::GetLowestIndex(MinstrelHtWifiRemoteStation* station, uint
|
||||
WifiModeList
|
||||
MinstrelHtWifiManager::GetHeDeviceMcsList() const
|
||||
{
|
||||
WifiModeList heMcsList;
|
||||
for (const auto& mode : GetPhy()->GetMcsList(WIFI_MOD_CLASS_HE))
|
||||
{
|
||||
heMcsList.push_back(mode);
|
||||
}
|
||||
const auto& mcsList = GetPhy()->GetMcsList(WIFI_MOD_CLASS_HE);
|
||||
WifiModeList heMcsList(mcsList.begin(), mcsList.end());
|
||||
return heMcsList;
|
||||
}
|
||||
|
||||
WifiModeList
|
||||
MinstrelHtWifiManager::GetVhtDeviceMcsList() const
|
||||
{
|
||||
WifiModeList vhtMcsList;
|
||||
for (const auto& mode : GetPhy()->GetMcsList(WIFI_MOD_CLASS_VHT))
|
||||
{
|
||||
vhtMcsList.push_back(mode);
|
||||
}
|
||||
const auto& mcsList = GetPhy()->GetMcsList(WIFI_MOD_CLASS_VHT);
|
||||
WifiModeList vhtMcsList(mcsList.begin(), mcsList.end());
|
||||
return vhtMcsList;
|
||||
}
|
||||
|
||||
WifiModeList
|
||||
MinstrelHtWifiManager::GetHtDeviceMcsList() const
|
||||
{
|
||||
WifiModeList htMcsList;
|
||||
for (const auto& mode : GetPhy()->GetMcsList(WIFI_MOD_CLASS_HT))
|
||||
{
|
||||
htMcsList.push_back(mode);
|
||||
}
|
||||
const auto& mcsList = GetPhy()->GetMcsList(WIFI_MOD_CLASS_HT);
|
||||
WifiModeList htMcsList(mcsList.begin(), mcsList.end());
|
||||
return htMcsList;
|
||||
}
|
||||
|
||||
|
||||
@@ -390,11 +390,9 @@ WifiRemoteStationManager::AddAllSupportedMcs(Mac48Address address)
|
||||
NS_LOG_FUNCTION(this << address);
|
||||
NS_ASSERT(!address.IsGroup());
|
||||
auto state = LookupState(address);
|
||||
state->m_operationalMcsSet.clear();
|
||||
for (const auto& mcs : m_wifiPhy->GetMcsList())
|
||||
{
|
||||
state->m_operationalMcsSet.push_back(mcs);
|
||||
}
|
||||
|
||||
const auto& mcsList = m_wifiPhy->GetMcsList();
|
||||
state->m_operationalMcsSet = WifiModeList(mcsList.begin(), mcsList.end());
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user