Fix clang-tidy modernize-use-auto warnings
This commit is contained in:
@@ -161,7 +161,7 @@ PrintGnuplottableBuildingListToFile(std::string filename)
|
||||
return;
|
||||
}
|
||||
uint32_t index = 0;
|
||||
for (BuildingList::Iterator it = BuildingList::Begin(); it != BuildingList::End(); ++it)
|
||||
for (auto it = BuildingList::Begin(); it != BuildingList::End(); ++it)
|
||||
{
|
||||
++index;
|
||||
Box box = (*it)->GetBoundaries();
|
||||
|
||||
@@ -289,9 +289,7 @@ main(int argc, char* argv[])
|
||||
Simulator::Stop(Seconds(10.0));
|
||||
Simulator::Run();
|
||||
|
||||
for (DeviceEnergyModelContainer::Iterator iter = deviceModels.Begin();
|
||||
iter != deviceModels.End();
|
||||
iter++)
|
||||
for (auto iter = deviceModels.Begin(); iter != deviceModels.End(); iter++)
|
||||
{
|
||||
double energyConsumed = (*iter)->GetTotalEnergyConsumption();
|
||||
NS_LOG_UNCOND("End of simulation ("
|
||||
|
||||
@@ -354,9 +354,7 @@ main(int argc, char* argv[])
|
||||
Simulator::Stop(Seconds(10.0));
|
||||
Simulator::Run();
|
||||
|
||||
for (DeviceEnergyModelContainer::Iterator iter = deviceModels.Begin();
|
||||
iter != deviceModels.End();
|
||||
iter++)
|
||||
for (auto iter = deviceModels.Begin(); iter != deviceModels.End(); iter++)
|
||||
{
|
||||
double energyConsumed = (*iter)->GetTotalEnergyConsumption();
|
||||
NS_LOG_UNCOND("End of simulation ("
|
||||
|
||||
@@ -164,8 +164,7 @@ main(int argc, char** argv)
|
||||
routerInterface->SetMaxRtrAdvInterval(2000);
|
||||
routerInterface->SetMinRtrAdvInterval(1000);
|
||||
RadvdInterface::RadvdPrefixList prefixList = routerInterface->GetPrefixes();
|
||||
for (RadvdInterface::RadvdPrefixListI iter = prefixList.begin(); iter != prefixList.end();
|
||||
iter++)
|
||||
for (auto iter = prefixList.begin(); iter != prefixList.end(); iter++)
|
||||
{
|
||||
(*iter)->SetPreferredLifeTime(3);
|
||||
(*iter)->SetValidLifeTime(5);
|
||||
@@ -179,8 +178,7 @@ main(int argc, char** argv)
|
||||
routerInterface->SetMaxRtrAdvInterval(2000);
|
||||
routerInterface->SetMinRtrAdvInterval(1000);
|
||||
prefixList = routerInterface->GetPrefixes();
|
||||
for (RadvdInterface::RadvdPrefixListI iter = prefixList.begin(); iter != prefixList.end();
|
||||
iter++)
|
||||
for (auto iter = prefixList.begin(); iter != prefixList.end(); iter++)
|
||||
{
|
||||
(*iter)->SetPreferredLifeTime(3);
|
||||
(*iter)->SetValidLifeTime(5);
|
||||
|
||||
@@ -350,9 +350,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::const_iterator ploc = pcapLocationVec.begin();
|
||||
ploc != pcapLocationVec.end();
|
||||
++ploc)
|
||||
for (auto ploc = pcapLocationVec.begin(); ploc != pcapLocationVec.end(); ++ploc)
|
||||
{
|
||||
NS_LOG_INFO("PCAP capture at: <" + *ploc + ">");
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ main(int argc, char* argv[])
|
||||
Time simulationEndTime = Seconds(5);
|
||||
DataRate bottleneckBandwidth("10Mbps"); // value of x as shown in the above network topology
|
||||
Time bottleneckDelay = MilliSeconds(40);
|
||||
DataRate regLinkBandwidth = DataRate(4 * bottleneckBandwidth.GetBitRate());
|
||||
DataRate regLinkBandwidth(4 * bottleneckBandwidth.GetBitRate());
|
||||
Time regLinkDelay = MilliSeconds(5);
|
||||
DataRate maxPacingRate("4Gbps");
|
||||
|
||||
@@ -324,9 +324,7 @@ main(int argc, char* argv[])
|
||||
monitor->CheckForLostPackets();
|
||||
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmon.GetClassifier());
|
||||
FlowMonitor::FlowStatsContainer stats = monitor->GetFlowStats();
|
||||
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin();
|
||||
i != stats.end();
|
||||
++i)
|
||||
for (auto i = stats.begin(); i != stats.end(); ++i)
|
||||
{
|
||||
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(i->first);
|
||||
|
||||
|
||||
@@ -163,9 +163,7 @@ experiment(bool enableCtsRts, std::string wifiManager)
|
||||
monitor->CheckForLostPackets();
|
||||
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmon.GetClassifier());
|
||||
FlowMonitor::FlowStatsContainer stats = monitor->GetFlowStats();
|
||||
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin();
|
||||
i != stats.end();
|
||||
++i)
|
||||
for (auto i = stats.begin(); i != stats.end(); ++i)
|
||||
{
|
||||
// first 2 FlowIds are for ECHO apps, we don't want to display them
|
||||
//
|
||||
|
||||
@@ -253,7 +253,7 @@ NodeStatistics::SetupPhy(Ptr<WifiPhy> phy)
|
||||
txVector.SetMode(mode);
|
||||
txVector.SetPreambleType(WIFI_PREAMBLE_LONG);
|
||||
txVector.SetChannelWidth(phy->GetChannelWidth());
|
||||
DataRate dataRate = DataRate(mode.GetDataRate(phy->GetChannelWidth()));
|
||||
DataRate dataRate(mode.GetDataRate(phy->GetChannelWidth()));
|
||||
Time time = phy->CalculateTxDuration(packetSize, txVector, phy->GetPhyBand());
|
||||
NS_LOG_DEBUG(mode.GetUniqueName() << " " << time.GetSeconds() << " " << dataRate);
|
||||
m_timeTable.emplace_back(time, dataRate);
|
||||
@@ -263,7 +263,7 @@ NodeStatistics::SetupPhy(Ptr<WifiPhy> phy)
|
||||
Time
|
||||
NodeStatistics::GetCalcTxTime(DataRate rate)
|
||||
{
|
||||
for (TxTime::const_iterator i = m_timeTable.begin(); i != m_timeTable.end(); i++)
|
||||
for (auto i = m_timeTable.begin(); i != m_timeTable.end(); i++)
|
||||
{
|
||||
if (rate == i->second)
|
||||
{
|
||||
|
||||
@@ -274,7 +274,7 @@ NodeStatistics::SetupPhy(Ptr<WifiPhy> phy)
|
||||
txVector.SetMode(mode);
|
||||
txVector.SetPreambleType(WIFI_PREAMBLE_LONG);
|
||||
txVector.SetChannelWidth(phy->GetChannelWidth());
|
||||
DataRate dataRate = DataRate(mode.GetDataRate(phy->GetChannelWidth()));
|
||||
DataRate dataRate(mode.GetDataRate(phy->GetChannelWidth()));
|
||||
Time time = phy->CalculateTxDuration(packetSize, txVector, phy->GetPhyBand());
|
||||
NS_LOG_DEBUG(mode.GetUniqueName() << " " << time.GetSeconds() << " " << dataRate);
|
||||
m_timeTable.emplace_back(time, dataRate);
|
||||
@@ -284,7 +284,7 @@ NodeStatistics::SetupPhy(Ptr<WifiPhy> phy)
|
||||
Time
|
||||
NodeStatistics::GetCalcTxTime(DataRate rate)
|
||||
{
|
||||
for (TxTime::const_iterator i = m_timeTable.begin(); i != m_timeTable.end(); i++)
|
||||
for (auto i = m_timeTable.begin(); i != m_timeTable.end(); i++)
|
||||
{
|
||||
if (rate == i->second)
|
||||
{
|
||||
@@ -667,9 +667,7 @@ main(int argc, char* argv[])
|
||||
|
||||
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmon.GetClassifier());
|
||||
std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats();
|
||||
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin();
|
||||
i != stats.end();
|
||||
++i)
|
||||
for (auto i = stats.begin(); i != stats.end(); ++i)
|
||||
{
|
||||
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(i->first);
|
||||
if ((t.sourceAddress == "10.1.1.3" && t.destinationAddress == "10.1.1.1"))
|
||||
|
||||
@@ -228,7 +228,7 @@ main(int argc, char* argv[])
|
||||
DoubleValue(eta));
|
||||
|
||||
// install an energy source on each node
|
||||
for (NodeContainer::Iterator n = c.Begin(); n != c.End(); n++)
|
||||
for (auto n = c.Begin(); n != c.End(); n++)
|
||||
{
|
||||
eSources.Add(basicSourceHelper.Install(*n));
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ AodvHelper::AssignStreams(NodeContainer c, int64_t stream)
|
||||
{
|
||||
int64_t currentStream = stream;
|
||||
Ptr<Node> node;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
node = (*i);
|
||||
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4>();
|
||||
|
||||
@@ -36,7 +36,7 @@ bool
|
||||
IdCache::IsDuplicate(Ipv4Address addr, uint32_t id)
|
||||
{
|
||||
Purge();
|
||||
for (std::vector<UniqueId>::const_iterator i = m_idCache.begin(); i != m_idCache.end(); ++i)
|
||||
for (auto i = m_idCache.begin(); i != m_idCache.end(); ++i)
|
||||
{
|
||||
if (i->m_context == addr && i->m_id == id)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ bool
|
||||
Neighbors::IsNeighbor(Ipv4Address addr)
|
||||
{
|
||||
Purge();
|
||||
for (std::vector<Neighbor>::const_iterator i = m_nb.begin(); i != m_nb.end(); ++i)
|
||||
for (auto i = m_nb.begin(); i != m_nb.end(); ++i)
|
||||
{
|
||||
if (i->m_neighborAddress == addr)
|
||||
{
|
||||
@@ -65,7 +65,7 @@ Time
|
||||
Neighbors::GetExpireTime(Ipv4Address addr)
|
||||
{
|
||||
Purge();
|
||||
for (std::vector<Neighbor>::const_iterator i = m_nb.begin(); i != m_nb.end(); ++i)
|
||||
for (auto i = m_nb.begin(); i != m_nb.end(); ++i)
|
||||
{
|
||||
if (i->m_neighborAddress == addr)
|
||||
{
|
||||
@@ -78,7 +78,7 @@ Neighbors::GetExpireTime(Ipv4Address addr)
|
||||
void
|
||||
Neighbors::Update(Ipv4Address addr, Time expire)
|
||||
{
|
||||
for (std::vector<Neighbor>::iterator i = m_nb.begin(); i != m_nb.end(); ++i)
|
||||
for (auto i = m_nb.begin(); i != m_nb.end(); ++i)
|
||||
{
|
||||
if (i->m_neighborAddress == addr)
|
||||
{
|
||||
@@ -125,7 +125,7 @@ Neighbors::Purge()
|
||||
CloseNeighbor pred;
|
||||
if (!m_handleLinkFailure.IsNull())
|
||||
{
|
||||
for (std::vector<Neighbor>::iterator j = m_nb.begin(); j != m_nb.end(); ++j)
|
||||
for (auto j = m_nb.begin(); j != m_nb.end(); ++j)
|
||||
{
|
||||
if (pred(*j))
|
||||
{
|
||||
@@ -162,7 +162,7 @@ Mac48Address
|
||||
Neighbors::LookupMacAddress(Ipv4Address addr)
|
||||
{
|
||||
Mac48Address hwaddr;
|
||||
for (std::vector<Ptr<ArpCache>>::const_iterator i = m_arp.begin(); i != m_arp.end(); ++i)
|
||||
for (auto i = m_arp.begin(); i != m_arp.end(); ++i)
|
||||
{
|
||||
ArpCache::Entry* entry = (*i)->Lookup(addr);
|
||||
if (entry != nullptr && (entry->IsAlive() || entry->IsPermanent()) && !entry->IsExpired())
|
||||
@@ -179,7 +179,7 @@ Neighbors::ProcessTxError(const WifiMacHeader& hdr)
|
||||
{
|
||||
Mac48Address addr = hdr.GetAddr1();
|
||||
|
||||
for (std::vector<Neighbor>::iterator i = m_nb.begin(); i != m_nb.end(); ++i)
|
||||
for (auto i = m_nb.begin(); i != m_nb.end(); ++i)
|
||||
{
|
||||
if (i->m_hardwareAddress == addr)
|
||||
{
|
||||
|
||||
@@ -554,8 +554,7 @@ RerrHeader::Serialize(Buffer::Iterator i) const
|
||||
i.WriteU8(m_flag);
|
||||
i.WriteU8(m_reserved);
|
||||
i.WriteU8(GetDestCount());
|
||||
std::map<Ipv4Address, uint32_t>::const_iterator j;
|
||||
for (j = m_unreachableDstSeqNo.begin(); j != m_unreachableDstSeqNo.end(); ++j)
|
||||
for (auto j = m_unreachableDstSeqNo.begin(); j != m_unreachableDstSeqNo.end(); ++j)
|
||||
{
|
||||
WriteTo(i, (*j).first);
|
||||
i.WriteHtonU32((*j).second);
|
||||
@@ -588,8 +587,7 @@ void
|
||||
RerrHeader::Print(std::ostream& os) const
|
||||
{
|
||||
os << "Unreachable destination (ipv4 address, seq. number):";
|
||||
std::map<Ipv4Address, uint32_t>::const_iterator j;
|
||||
for (j = m_unreachableDstSeqNo.begin(); j != m_unreachableDstSeqNo.end(); ++j)
|
||||
for (auto j = m_unreachableDstSeqNo.begin(); j != m_unreachableDstSeqNo.end(); ++j)
|
||||
{
|
||||
os << (*j).first << ", " << (*j).second;
|
||||
}
|
||||
@@ -635,7 +633,7 @@ RerrHeader::RemoveUnDestination(std::pair<Ipv4Address, uint32_t>& un)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::map<Ipv4Address, uint32_t>::iterator i = m_unreachableDstSeqNo.begin();
|
||||
auto i = m_unreachableDstSeqNo.begin();
|
||||
un = *i;
|
||||
m_unreachableDstSeqNo.erase(i);
|
||||
return true;
|
||||
@@ -657,8 +655,8 @@ RerrHeader::operator==(const RerrHeader& o) const
|
||||
return false;
|
||||
}
|
||||
|
||||
std::map<Ipv4Address, uint32_t>::const_iterator j = m_unreachableDstSeqNo.begin();
|
||||
std::map<Ipv4Address, uint32_t>::const_iterator k = o.m_unreachableDstSeqNo.begin();
|
||||
auto j = m_unreachableDstSeqNo.begin();
|
||||
auto k = o.m_unreachableDstSeqNo.begin();
|
||||
for (uint8_t i = 0; i < GetDestCount(); ++i)
|
||||
{
|
||||
if ((j->first != k->first) || (j->second != k->second))
|
||||
|
||||
@@ -362,15 +362,12 @@ void
|
||||
RoutingProtocol::DoDispose()
|
||||
{
|
||||
m_ipv4 = nullptr;
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::iterator iter = m_socketAddresses.begin();
|
||||
iter != m_socketAddresses.end();
|
||||
iter++)
|
||||
for (auto iter = m_socketAddresses.begin(); iter != m_socketAddresses.end(); iter++)
|
||||
{
|
||||
iter->first->Close();
|
||||
}
|
||||
m_socketAddresses.clear();
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::iterator iter =
|
||||
m_socketSubnetBroadcastAddresses.begin();
|
||||
for (auto iter = m_socketSubnetBroadcastAddresses.begin();
|
||||
iter != m_socketSubnetBroadcastAddresses.end();
|
||||
iter++)
|
||||
{
|
||||
@@ -541,9 +538,7 @@ RoutingProtocol::RouteInput(Ptr<const Packet> p,
|
||||
}
|
||||
|
||||
// Broadcast local delivery/forwarding
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
if (m_ipv4->GetInterfaceForAddress(iface.GetLocal()) == iif)
|
||||
@@ -984,9 +979,7 @@ bool
|
||||
RoutingProtocol::IsMyOwnAddress(Ipv4Address src)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << src);
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
if (src == iface.GetLocal())
|
||||
@@ -1020,7 +1013,7 @@ RoutingProtocol::LoopbackRoute(const Ipv4Header& hdr, Ptr<NetDevice> oif) const
|
||||
// If RouteOutput() caller specified an outgoing interface, that
|
||||
// further constrains the selection of source address
|
||||
//
|
||||
std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
auto j = m_socketAddresses.begin();
|
||||
if (oif)
|
||||
{
|
||||
// Iterate to find an address on the oif device
|
||||
@@ -1136,9 +1129,7 @@ RoutingProtocol::SendRequest(Ipv4Address dst)
|
||||
rreqHeader.SetId(m_requestId);
|
||||
|
||||
// Send RREQ as subnet directed broadcast from each interface used by aodv
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ptr<Socket> socket = j->first;
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
@@ -1505,9 +1496,7 @@ RoutingProtocol::RecvRequest(Ptr<Packet> p, Ipv4Address receiver, Ipv4Address sr
|
||||
return;
|
||||
}
|
||||
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ptr<Socket> socket = j->first;
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
@@ -1868,9 +1857,7 @@ RoutingProtocol::RecvError(Ptr<Packet> p, Ipv4Address src)
|
||||
std::pair<Ipv4Address, uint32_t> un;
|
||||
while (rerrHeader.RemoveUnDestination(un))
|
||||
{
|
||||
for (std::map<Ipv4Address, uint32_t>::const_iterator i = dstWithNextHopSrc.begin();
|
||||
i != dstWithNextHopSrc.end();
|
||||
++i)
|
||||
for (auto i = dstWithNextHopSrc.begin(); i != dstWithNextHopSrc.end(); ++i)
|
||||
{
|
||||
if (i->first == un.first)
|
||||
{
|
||||
@@ -1880,8 +1867,7 @@ RoutingProtocol::RecvError(Ptr<Packet> p, Ipv4Address src)
|
||||
}
|
||||
|
||||
std::vector<Ipv4Address> precursors;
|
||||
for (std::map<Ipv4Address, uint32_t>::const_iterator i = unreachable.begin();
|
||||
i != unreachable.end();)
|
||||
for (auto i = unreachable.begin(); i != unreachable.end();)
|
||||
{
|
||||
if (!rerrHeader.AddUnDestination(i->first, i->second))
|
||||
{
|
||||
@@ -2013,9 +1999,7 @@ RoutingProtocol::SendHello()
|
||||
* Hop Count 0
|
||||
* Lifetime AllowedHelloLoss * HelloInterval
|
||||
*/
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ptr<Socket> socket = j->first;
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
@@ -2087,8 +2071,7 @@ RoutingProtocol::SendRerrWhenBreaksLinkToNextHop(Ipv4Address nextHop)
|
||||
toNextHop.GetPrecursors(precursors);
|
||||
rerrHeader.AddUnDestination(nextHop, toNextHop.GetSeqNo());
|
||||
m_routingTable.GetListOfDestinationWithNextHop(nextHop, unreachable);
|
||||
for (std::map<Ipv4Address, uint32_t>::const_iterator i = unreachable.begin();
|
||||
i != unreachable.end();)
|
||||
for (auto i = unreachable.begin(); i != unreachable.end();)
|
||||
{
|
||||
if (!rerrHeader.AddUnDestination(i->first, i->second))
|
||||
{
|
||||
@@ -2161,10 +2144,7 @@ RoutingProtocol::SendRerrWhenNoRouteToForward(Ipv4Address dst,
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator i =
|
||||
m_socketAddresses.begin();
|
||||
i != m_socketAddresses.end();
|
||||
++i)
|
||||
for (auto i = m_socketAddresses.begin(); i != m_socketAddresses.end(); ++i)
|
||||
{
|
||||
Ptr<Socket> socket = i->first;
|
||||
Ipv4InterfaceAddress iface = i->second;
|
||||
@@ -2232,8 +2212,7 @@ RoutingProtocol::SendRerrMessage(Ptr<Packet> packet, std::vector<Ipv4Address> pr
|
||||
// route
|
||||
std::vector<Ipv4InterfaceAddress> ifaces;
|
||||
RoutingTableEntry toPrecursor;
|
||||
for (std::vector<Ipv4Address>::const_iterator i = precursors.begin(); i != precursors.end();
|
||||
++i)
|
||||
for (auto i = precursors.begin(); i != precursors.end(); ++i)
|
||||
{
|
||||
if (m_routingTable.LookupValidRoute(*i, toPrecursor) &&
|
||||
std::find(ifaces.begin(), ifaces.end(), toPrecursor.GetInterface()) == ifaces.end())
|
||||
@@ -2242,8 +2221,7 @@ RoutingProtocol::SendRerrMessage(Ptr<Packet> packet, std::vector<Ipv4Address> pr
|
||||
}
|
||||
}
|
||||
|
||||
for (std::vector<Ipv4InterfaceAddress>::const_iterator i = ifaces.begin(); i != ifaces.end();
|
||||
++i)
|
||||
for (auto i = ifaces.begin(); i != ifaces.end(); ++i)
|
||||
{
|
||||
Ptr<Socket> socket = FindSocketWithInterfaceAddress(*i);
|
||||
NS_ASSERT(socket);
|
||||
@@ -2273,9 +2251,7 @@ Ptr<Socket>
|
||||
RoutingProtocol::FindSocketWithInterfaceAddress(Ipv4InterfaceAddress addr) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << addr);
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ptr<Socket> socket = j->first;
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
@@ -2292,8 +2268,7 @@ Ptr<Socket>
|
||||
RoutingProtocol::FindSubnetBroadcastSocketWithInterfaceAddress(Ipv4InterfaceAddress addr) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << addr);
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j =
|
||||
m_socketSubnetBroadcastAddresses.begin();
|
||||
for (auto j = m_socketSubnetBroadcastAddresses.begin();
|
||||
j != m_socketSubnetBroadcastAddresses.end();
|
||||
++j)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ bool
|
||||
RequestQueue::Enqueue(QueueEntry& entry)
|
||||
{
|
||||
Purge();
|
||||
for (std::vector<QueueEntry>::const_iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if ((i->GetPacket()->GetUid() == entry.GetPacket()->GetUid()) &&
|
||||
(i->GetIpv4Header().GetDestination() == entry.GetIpv4Header().GetDestination()))
|
||||
@@ -74,7 +74,7 @@ RequestQueue::DropPacketWithDst(Ipv4Address dst)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << dst);
|
||||
Purge();
|
||||
for (std::vector<QueueEntry>::iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (i->GetIpv4Header().GetDestination() == dst)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ bool
|
||||
RequestQueue::Dequeue(Ipv4Address dst, QueueEntry& entry)
|
||||
{
|
||||
Purge();
|
||||
for (std::vector<QueueEntry>::iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (i->GetIpv4Header().GetDestination() == dst)
|
||||
{
|
||||
@@ -106,7 +106,7 @@ RequestQueue::Dequeue(Ipv4Address dst, QueueEntry& entry)
|
||||
bool
|
||||
RequestQueue::Find(Ipv4Address dst)
|
||||
{
|
||||
for (std::vector<QueueEntry>::const_iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (i->GetIpv4Header().GetDestination() == dst)
|
||||
{
|
||||
@@ -138,7 +138,7 @@ void
|
||||
RequestQueue::Purge()
|
||||
{
|
||||
IsExpired pred;
|
||||
for (std::vector<QueueEntry>::iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (pred(*i))
|
||||
{
|
||||
|
||||
@@ -94,9 +94,7 @@ bool
|
||||
RoutingTableEntry::LookupPrecursor(Ipv4Address id)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << id);
|
||||
for (std::vector<Ipv4Address>::const_iterator i = m_precursorList.begin();
|
||||
i != m_precursorList.end();
|
||||
++i)
|
||||
for (auto i = m_precursorList.begin(); i != m_precursorList.end(); ++i)
|
||||
{
|
||||
if (*i == id)
|
||||
{
|
||||
@@ -112,8 +110,7 @@ bool
|
||||
RoutingTableEntry::DeletePrecursor(Ipv4Address id)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << id);
|
||||
std::vector<Ipv4Address>::iterator i =
|
||||
std::remove(m_precursorList.begin(), m_precursorList.end(), id);
|
||||
auto i = std::remove(m_precursorList.begin(), m_precursorList.end(), id);
|
||||
if (i == m_precursorList.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Precursor " << id << " not found");
|
||||
@@ -148,12 +145,10 @@ RoutingTableEntry::GetPrecursors(std::vector<Ipv4Address>& prec) const
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (std::vector<Ipv4Address>::const_iterator i = m_precursorList.begin();
|
||||
i != m_precursorList.end();
|
||||
++i)
|
||||
for (auto i = m_precursorList.begin(); i != m_precursorList.end(); ++i)
|
||||
{
|
||||
bool result = true;
|
||||
for (std::vector<Ipv4Address>::const_iterator j = prec.begin(); j != prec.end(); ++j)
|
||||
for (auto j = prec.begin(); j != prec.end(); ++j)
|
||||
{
|
||||
if (*j == *i)
|
||||
{
|
||||
@@ -244,7 +239,7 @@ RoutingTable::LookupRoute(Ipv4Address id, RoutingTableEntry& rt)
|
||||
NS_LOG_LOGIC("Route to " << id << " not found; m_ipv4AddressEntry is empty");
|
||||
return false;
|
||||
}
|
||||
std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = m_ipv4AddressEntry.find(id);
|
||||
auto i = m_ipv4AddressEntry.find(id);
|
||||
if (i == m_ipv4AddressEntry.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Route to " << id << " not found");
|
||||
@@ -292,8 +287,7 @@ RoutingTable::AddRoute(RoutingTableEntry& rt)
|
||||
{
|
||||
rt.SetRreqCnt(0);
|
||||
}
|
||||
std::pair<std::map<Ipv4Address, RoutingTableEntry>::iterator, bool> result =
|
||||
m_ipv4AddressEntry.insert(std::make_pair(rt.GetDestination(), rt));
|
||||
auto result = m_ipv4AddressEntry.insert(std::make_pair(rt.GetDestination(), rt));
|
||||
return result.second;
|
||||
}
|
||||
|
||||
@@ -301,8 +295,7 @@ bool
|
||||
RoutingTable::Update(RoutingTableEntry& rt)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator i =
|
||||
m_ipv4AddressEntry.find(rt.GetDestination());
|
||||
auto i = m_ipv4AddressEntry.find(rt.GetDestination());
|
||||
if (i == m_ipv4AddressEntry.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Route update to " << rt.GetDestination() << " fails; not found");
|
||||
@@ -321,7 +314,7 @@ bool
|
||||
RoutingTable::SetEntryState(Ipv4Address id, RouteFlags state)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator i = m_ipv4AddressEntry.find(id);
|
||||
auto i = m_ipv4AddressEntry.find(id);
|
||||
if (i == m_ipv4AddressEntry.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Route set entry state to " << id << " fails; not found");
|
||||
@@ -340,9 +333,7 @@ RoutingTable::GetListOfDestinationWithNextHop(Ipv4Address nextHop,
|
||||
NS_LOG_FUNCTION(this);
|
||||
Purge();
|
||||
unreachable.clear();
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();
|
||||
++i)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end(); ++i)
|
||||
{
|
||||
if (i->second.GetNextHop() == nextHop)
|
||||
{
|
||||
@@ -357,13 +348,9 @@ RoutingTable::InvalidateRoutesWithDst(const std::map<Ipv4Address, uint32_t>& unr
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
Purge();
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();
|
||||
++i)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end(); ++i)
|
||||
{
|
||||
for (std::map<Ipv4Address, uint32_t>::const_iterator j = unreachable.begin();
|
||||
j != unreachable.end();
|
||||
++j)
|
||||
for (auto j = unreachable.begin(); j != unreachable.end(); ++j)
|
||||
{
|
||||
if ((i->first == j->first) && (i->second.GetFlag() == VALID))
|
||||
{
|
||||
@@ -382,12 +369,11 @@ RoutingTable::DeleteAllRoutesFromInterface(Ipv4InterfaceAddress iface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end();)
|
||||
{
|
||||
if (i->second.GetInterface() == iface)
|
||||
{
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
|
||||
auto tmp = i;
|
||||
++i;
|
||||
m_ipv4AddressEntry.erase(tmp);
|
||||
}
|
||||
@@ -406,14 +392,13 @@ RoutingTable::Purge()
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end();)
|
||||
{
|
||||
if (i->second.GetLifeTime() < Seconds(0))
|
||||
{
|
||||
if (i->second.GetFlag() == INVALID)
|
||||
{
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
|
||||
auto tmp = i;
|
||||
++i;
|
||||
m_ipv4AddressEntry.erase(tmp);
|
||||
}
|
||||
@@ -443,13 +428,13 @@ RoutingTable::Purge(std::map<Ipv4Address, RoutingTableEntry>& table) const
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator i = table.begin(); i != table.end();)
|
||||
for (auto i = table.begin(); i != table.end();)
|
||||
{
|
||||
if (i->second.GetLifeTime() < Seconds(0))
|
||||
{
|
||||
if (i->second.GetFlag() == INVALID)
|
||||
{
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
|
||||
auto tmp = i;
|
||||
++i;
|
||||
table.erase(tmp);
|
||||
}
|
||||
@@ -475,7 +460,7 @@ bool
|
||||
RoutingTable::MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << neighbor << blacklistTimeout.As(Time::S));
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator i = m_ipv4AddressEntry.find(neighbor);
|
||||
auto i = m_ipv4AddressEntry.find(neighbor);
|
||||
if (i == m_ipv4AddressEntry.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Mark link unidirectional to " << neighbor << " fails; not found");
|
||||
@@ -506,9 +491,7 @@ RoutingTable::Print(Ptr<OutputStreamWrapper> stream, Time::Unit unit /* = Time::
|
||||
*os << std::setw(16) << "Flag";
|
||||
*os << std::setw(16) << "Expire";
|
||||
*os << "Hops" << std::endl;
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = table.begin();
|
||||
i != table.end();
|
||||
++i)
|
||||
for (auto i = table.begin(); i != table.end(); ++i)
|
||||
{
|
||||
i->second.Print(stream, unit);
|
||||
}
|
||||
|
||||
@@ -317,11 +317,11 @@ struct RerrHeaderTest : public TestCase
|
||||
RerrHeader h;
|
||||
h.SetNoDelete(true);
|
||||
NS_TEST_EXPECT_MSG_EQ(h.GetNoDelete(), true, "trivial");
|
||||
Ipv4Address dst = Ipv4Address("1.2.3.4");
|
||||
Ipv4Address dst("1.2.3.4");
|
||||
NS_TEST_EXPECT_MSG_EQ(h.AddUnDestination(dst, 12), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ(h.GetDestCount(), 1, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ(h.AddUnDestination(dst, 13), true, "trivial");
|
||||
Ipv4Address dst2 = Ipv4Address("4.3.2.1");
|
||||
Ipv4Address dst2("4.3.2.1");
|
||||
NS_TEST_EXPECT_MSG_EQ(h.AddUnDestination(dst2, 12), true, "trivial");
|
||||
NS_TEST_EXPECT_MSG_EQ(h.GetDestCount(), 2, "trivial");
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ ApplicationContainer
|
||||
BulkSendHelper::Install(NodeContainer c) const
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
apps.Add(InstallPriv(*i));
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ ApplicationContainer
|
||||
OnOffHelper::Install(NodeContainer c) const
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
apps.Add(InstallPriv(*i));
|
||||
}
|
||||
@@ -82,7 +82,7 @@ OnOffHelper::AssignStreams(NodeContainer c, int64_t stream)
|
||||
{
|
||||
int64_t currentStream = stream;
|
||||
Ptr<Node> node;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
node = (*i);
|
||||
for (uint32_t j = 0; j < node->GetNApplications(); j++)
|
||||
|
||||
@@ -56,7 +56,7 @@ ApplicationContainer
|
||||
PacketSinkHelper::Install(NodeContainer c) const
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
apps.Add(InstallPriv(*i));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ ApplicationContainer
|
||||
ThreeGppHttpClientHelper::Install(NodeContainer c) const
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
apps.Add(InstallPriv(*i));
|
||||
}
|
||||
@@ -109,7 +109,7 @@ ApplicationContainer
|
||||
ThreeGppHttpServerHelper::Install(NodeContainer c) const
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
apps.Add(InstallPriv(*i));
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ ApplicationContainer
|
||||
UdpServerHelper::Install(NodeContainer c)
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
|
||||
@@ -93,7 +93,7 @@ ApplicationContainer
|
||||
UdpClientHelper::Install(NodeContainer c)
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
Ptr<UdpClient> client = m_factory.Create<UdpClient>();
|
||||
@@ -133,7 +133,7 @@ ApplicationContainer
|
||||
UdpTraceClientHelper::Install(NodeContainer c)
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
Ptr<UdpTraceClient> client = m_factory.Create<UdpTraceClient>();
|
||||
|
||||
@@ -55,7 +55,7 @@ ApplicationContainer
|
||||
UdpEchoServerHelper::Install(NodeContainer c) const
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
apps.Add(InstallPriv(*i));
|
||||
}
|
||||
@@ -129,7 +129,7 @@ ApplicationContainer
|
||||
UdpEchoClientHelper::Install(NodeContainer c) const
|
||||
{
|
||||
ApplicationContainer apps;
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
apps.Add(InstallPriv(*i));
|
||||
}
|
||||
|
||||
@@ -633,8 +633,7 @@ ThreeGppHttpServerTxBuffer::ThreeGppHttpServerTxBuffer()
|
||||
bool
|
||||
ThreeGppHttpServerTxBuffer::IsSocketAvailable(Ptr<Socket> socket) const
|
||||
{
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::const_iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
return (it != m_txBuffer.end());
|
||||
}
|
||||
|
||||
@@ -660,8 +659,7 @@ ThreeGppHttpServerTxBuffer::RemoveSocket(Ptr<Socket> socket)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << socket);
|
||||
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
|
||||
if (!Simulator::IsExpired(it->second.nextServe))
|
||||
@@ -684,8 +682,7 @@ ThreeGppHttpServerTxBuffer::CloseSocket(Ptr<Socket> socket)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << socket);
|
||||
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
|
||||
if (!Simulator::IsExpired(it->second.nextServe))
|
||||
@@ -716,8 +713,7 @@ ThreeGppHttpServerTxBuffer::CloseAllSockets()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::iterator it;
|
||||
for (it = m_txBuffer.begin(); it != m_txBuffer.end(); ++it)
|
||||
for (auto it = m_txBuffer.begin(); it != m_txBuffer.end(); ++it)
|
||||
{
|
||||
if (!Simulator::IsExpired(it->second.nextServe))
|
||||
{
|
||||
@@ -739,8 +735,7 @@ ThreeGppHttpServerTxBuffer::CloseAllSockets()
|
||||
bool
|
||||
ThreeGppHttpServerTxBuffer::IsBufferEmpty(Ptr<Socket> socket) const
|
||||
{
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::const_iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
return (it->second.txBufferSize == 0);
|
||||
}
|
||||
@@ -748,8 +743,7 @@ ThreeGppHttpServerTxBuffer::IsBufferEmpty(Ptr<Socket> socket) const
|
||||
Time
|
||||
ThreeGppHttpServerTxBuffer::GetClientTs(Ptr<Socket> socket) const
|
||||
{
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::const_iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
return it->second.clientTs;
|
||||
}
|
||||
@@ -757,8 +751,7 @@ ThreeGppHttpServerTxBuffer::GetClientTs(Ptr<Socket> socket) const
|
||||
ThreeGppHttpHeader::ContentType_t
|
||||
ThreeGppHttpServerTxBuffer::GetBufferContentType(Ptr<Socket> socket) const
|
||||
{
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::const_iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
return it->second.txBufferContentType;
|
||||
}
|
||||
@@ -766,8 +759,7 @@ ThreeGppHttpServerTxBuffer::GetBufferContentType(Ptr<Socket> socket) const
|
||||
uint32_t
|
||||
ThreeGppHttpServerTxBuffer::GetBufferSize(Ptr<Socket> socket) const
|
||||
{
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::const_iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
return it->second.txBufferSize;
|
||||
}
|
||||
@@ -775,8 +767,7 @@ ThreeGppHttpServerTxBuffer::GetBufferSize(Ptr<Socket> socket) const
|
||||
bool
|
||||
ThreeGppHttpServerTxBuffer::HasTxedPartOfObject(Ptr<Socket> socket) const
|
||||
{
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::const_iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found");
|
||||
return it->second.hasTxedPartOfObject;
|
||||
}
|
||||
@@ -792,8 +783,7 @@ ThreeGppHttpServerTxBuffer::WriteNewObject(Ptr<Socket> socket,
|
||||
"Unable to write an object without a proper Content-Type.");
|
||||
NS_ASSERT_MSG(objectSize > 0, "Unable to write a zero-sized object.");
|
||||
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
NS_ASSERT_MSG(it->second.txBufferSize == 0,
|
||||
"Cannot write to Tx buffer of socket "
|
||||
@@ -810,8 +800,7 @@ ThreeGppHttpServerTxBuffer::RecordNextServe(Ptr<Socket> socket,
|
||||
{
|
||||
NS_LOG_FUNCTION(this << socket << clientTs.As(Time::S));
|
||||
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
it->second.nextServe = eventId;
|
||||
it->second.clientTs = clientTs;
|
||||
@@ -824,8 +813,7 @@ ThreeGppHttpServerTxBuffer::DepleteBufferSize(Ptr<Socket> socket, uint32_t amoun
|
||||
|
||||
NS_ASSERT_MSG(amount > 0, "Unable to consume zero bytes.");
|
||||
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
NS_ASSERT_MSG(it->second.txBufferSize >= amount,
|
||||
"The requested amount is larger than the current buffer size.");
|
||||
@@ -847,8 +835,7 @@ void
|
||||
ThreeGppHttpServerTxBuffer::PrepareClose(Ptr<Socket> socket)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << socket);
|
||||
std::map<Ptr<Socket>, TxBuffer_t>::iterator it;
|
||||
it = m_txBuffer.find(socket);
|
||||
auto it = m_txBuffer.find(socket);
|
||||
NS_ASSERT_MSG(it != m_txBuffer.end(), "Socket " << socket << " cannot be found.");
|
||||
it->second.isClosing = true;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ uint32_t
|
||||
ThreeGppHttpVariables::GetNumOfEmbeddedObjects()
|
||||
{
|
||||
// Validate parameters.
|
||||
const uint32_t upperBound = static_cast<uint32_t>(m_numOfEmbeddedObjectsRng->GetBound());
|
||||
const auto upperBound = static_cast<uint32_t>(m_numOfEmbeddedObjectsRng->GetBound());
|
||||
if (upperBound <= m_numOfEmbeddedObjectsScale)
|
||||
{
|
||||
NS_FATAL_ERROR("`NumOfEmbeddedObjectsMax` attribute "
|
||||
|
||||
@@ -57,7 +57,7 @@ BridgeHelper::Install(Ptr<Node> node, NetDeviceContainer c)
|
||||
devs.Add(dev);
|
||||
node->AddDevice(dev);
|
||||
|
||||
for (NetDeviceContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
NS_LOG_LOGIC("**** Add BridgePort " << *i);
|
||||
dev->AddBridgePort(*i);
|
||||
|
||||
@@ -52,9 +52,7 @@ BridgeChannel::~BridgeChannel()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS();
|
||||
|
||||
for (std::vector<Ptr<Channel>>::iterator iter = m_bridgedChannels.begin();
|
||||
iter != m_bridgedChannels.end();
|
||||
iter++)
|
||||
for (auto iter = m_bridgedChannels.begin(); iter != m_bridgedChannels.end(); iter++)
|
||||
{
|
||||
*iter = nullptr;
|
||||
}
|
||||
@@ -71,9 +69,7 @@ std::size_t
|
||||
BridgeChannel::GetNDevices() const
|
||||
{
|
||||
uint32_t ndevices = 0;
|
||||
for (std::vector<Ptr<Channel>>::const_iterator iter = m_bridgedChannels.begin();
|
||||
iter != m_bridgedChannels.end();
|
||||
iter++)
|
||||
for (auto iter = m_bridgedChannels.begin(); iter != m_bridgedChannels.end(); iter++)
|
||||
{
|
||||
ndevices += (*iter)->GetNDevices();
|
||||
}
|
||||
@@ -84,9 +80,7 @@ Ptr<NetDevice>
|
||||
BridgeChannel::GetDevice(std::size_t i) const
|
||||
{
|
||||
std::size_t ndevices = 0;
|
||||
for (std::vector<Ptr<Channel>>::const_iterator iter = m_bridgedChannels.begin();
|
||||
iter != m_bridgedChannels.end();
|
||||
iter++)
|
||||
for (auto iter = m_bridgedChannels.begin(); iter != m_bridgedChannels.end(); iter++)
|
||||
{
|
||||
if ((i - ndevices) < (*iter)->GetNDevices())
|
||||
{
|
||||
|
||||
@@ -80,8 +80,7 @@ void
|
||||
BridgeNetDevice::DoDispose()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS();
|
||||
for (std::vector<Ptr<NetDevice>>::iterator iter = m_ports.begin(); iter != m_ports.end();
|
||||
iter++)
|
||||
for (auto iter = m_ports.begin(); iter != m_ports.end(); iter++)
|
||||
{
|
||||
*iter = nullptr;
|
||||
}
|
||||
@@ -163,8 +162,7 @@ BridgeNetDevice::ForwardUnicast(Ptr<NetDevice> incomingPort,
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC("No learned state: send through all ports");
|
||||
for (std::vector<Ptr<NetDevice>>::iterator iter = m_ports.begin(); iter != m_ports.end();
|
||||
iter++)
|
||||
for (auto iter = m_ports.begin(); iter != m_ports.end(); iter++)
|
||||
{
|
||||
Ptr<NetDevice> port = *iter;
|
||||
if (port != incomingPort)
|
||||
@@ -193,8 +191,7 @@ BridgeNetDevice::ForwardBroadcast(Ptr<NetDevice> incomingPort,
|
||||
<< ", protocol=" << protocol << ", src=" << src << ", dst=" << dst << ")");
|
||||
Learn(src, incomingPort);
|
||||
|
||||
for (std::vector<Ptr<NetDevice>>::iterator iter = m_ports.begin(); iter != m_ports.end();
|
||||
iter++)
|
||||
for (auto iter = m_ports.begin(); iter != m_ports.end(); iter++)
|
||||
{
|
||||
Ptr<NetDevice> port = *iter;
|
||||
if (port != incomingPort)
|
||||
@@ -227,7 +224,7 @@ BridgeNetDevice::GetLearnedState(Mac48Address source)
|
||||
if (m_enableLearning)
|
||||
{
|
||||
Time now = Simulator::Now();
|
||||
std::map<Mac48Address, LearnedState>::iterator iter = m_learnState.find(source);
|
||||
auto iter = m_learnState.find(source);
|
||||
if (iter != m_learnState.end())
|
||||
{
|
||||
LearnedState& state = iter->second;
|
||||
@@ -420,8 +417,7 @@ BridgeNetDevice::SendFrom(Ptr<Packet> packet,
|
||||
// data was not unicast or no state has been learned for that mac
|
||||
// address => flood through all ports.
|
||||
Ptr<Packet> pktCopy;
|
||||
for (std::vector<Ptr<NetDevice>>::iterator iter = m_ports.begin(); iter != m_ports.end();
|
||||
iter++)
|
||||
for (auto iter = m_ports.begin(); iter != m_ports.end(); iter++)
|
||||
{
|
||||
pktCopy = packet->Copy();
|
||||
Ptr<NetDevice> port = *iter;
|
||||
|
||||
@@ -186,10 +186,9 @@ BriteTopologyHelper::BuildBriteEdgeInfoList()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
brite::Graph* g = m_topology->GetGraph();
|
||||
std::list<brite::Edge*>::iterator el;
|
||||
std::list<brite::Edge*> edgeList = g->GetEdges();
|
||||
|
||||
for (el = edgeList.begin(); el != edgeList.end(); el++)
|
||||
for (auto el = edgeList.begin(); el != edgeList.end(); el++)
|
||||
{
|
||||
BriteEdgeInfo edgeInfo;
|
||||
edgeInfo.edgeId = (*el)->GetId();
|
||||
@@ -418,9 +417,7 @@ BriteTopologyHelper::BuildBriteTopology(InternetStackHelper& stack, const uint32
|
||||
}
|
||||
|
||||
// create nodes
|
||||
for (BriteTopologyHelper::BriteNodeInfoList::iterator it = m_briteNodeInfoList.begin();
|
||||
it != m_briteNodeInfoList.end();
|
||||
++it)
|
||||
for (auto it = m_briteNodeInfoList.begin(); it != m_briteNodeInfoList.end(); ++it)
|
||||
{
|
||||
m_nodes.Add(CreateObject<Node>(GetSystemNumberForAs((*it).asId)));
|
||||
m_numNodes++;
|
||||
@@ -468,9 +465,7 @@ BriteTopologyHelper::ConstructTopology()
|
||||
m_nodesByAs.push_back(new NodeContainer());
|
||||
}
|
||||
|
||||
for (BriteTopologyHelper::BriteEdgeInfoList::iterator it = m_briteEdgeInfoList.begin();
|
||||
it != m_briteEdgeInfoList.end();
|
||||
++it)
|
||||
for (auto it = m_briteEdgeInfoList.begin(); it != m_briteEdgeInfoList.end(); ++it)
|
||||
{
|
||||
// Set the link delay
|
||||
// The brite value for delay is given in milliseconds
|
||||
@@ -492,9 +487,7 @@ BriteTopologyHelper::ConstructTopology()
|
||||
NS_LOG_INFO("Created " << m_numEdges << " edges in BRITE topology");
|
||||
|
||||
// iterate through all nodes and add leaf nodes for each AS
|
||||
for (BriteTopologyHelper::BriteNodeInfoList::iterator it = m_briteNodeInfoList.begin();
|
||||
it != m_briteNodeInfoList.end();
|
||||
++it)
|
||||
for (auto it = m_briteNodeInfoList.begin(); it != m_briteNodeInfoList.end(); ++it)
|
||||
{
|
||||
m_nodesByAs[(*it).asId]->Add(m_nodes.Get((*it).nodeId));
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ PrintGnuplottableBuildingListToFile(std::string filename)
|
||||
return;
|
||||
}
|
||||
uint32_t index = 1;
|
||||
for (BuildingList::Iterator it = BuildingList::Begin(); it != BuildingList::End(); ++it)
|
||||
for (auto it = BuildingList::Begin(); it != BuildingList::End(); ++it)
|
||||
{
|
||||
++index;
|
||||
Box box = (*it)->GetBoundaries();
|
||||
|
||||
@@ -44,7 +44,7 @@ PrintGnuplottableBuildingListToFile(std::string filename)
|
||||
return;
|
||||
}
|
||||
uint32_t index = 0;
|
||||
for (BuildingList::Iterator it = BuildingList::Begin(); it != BuildingList::End(); ++it)
|
||||
for (auto it = BuildingList::Begin(); it != BuildingList::End(); ++it)
|
||||
{
|
||||
++index;
|
||||
Box box = (*it)->GetBoundaries();
|
||||
|
||||
@@ -77,7 +77,7 @@ BuildingContainer::Create(uint32_t n)
|
||||
void
|
||||
BuildingContainer::Add(BuildingContainer other)
|
||||
{
|
||||
for (Iterator i = other.Begin(); i != other.End(); i++)
|
||||
for (auto i = other.Begin(); i != other.End(); i++)
|
||||
{
|
||||
m_buildings.push_back(*i);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ BuildingContainer
|
||||
BuildingContainer::GetGlobal()
|
||||
{
|
||||
BuildingContainer c;
|
||||
for (BuildingList::Iterator i = BuildingList::Begin(); i != BuildingList::End(); ++i)
|
||||
for (auto i = BuildingList::Begin(); i != BuildingList::End(); ++i)
|
||||
{
|
||||
c.Add(*i);
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ RandomBuildingPositionAllocator::GetNext() const
|
||||
{
|
||||
if (m_buildingListWithoutReplacement.empty())
|
||||
{
|
||||
for (BuildingList::Iterator bit = BuildingList::Begin(); bit != BuildingList::End();
|
||||
++bit)
|
||||
for (auto bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
{
|
||||
m_buildingListWithoutReplacement.push_back(*bit);
|
||||
}
|
||||
@@ -189,7 +188,7 @@ OutdoorPositionAllocator::GetNext() const
|
||||
NS_LOG_INFO("Position " << position);
|
||||
|
||||
bool inside = false;
|
||||
for (BuildingList::Iterator bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
for (auto bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
{
|
||||
if ((*bit)->IsInside(position))
|
||||
{
|
||||
@@ -255,7 +254,7 @@ RandomRoomPositionAllocator::GetNext() const
|
||||
|
||||
if (m_roomListWithoutReplacement.empty())
|
||||
{
|
||||
for (BuildingList::Iterator bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
for (auto bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
{
|
||||
NS_LOG_LOGIC("building " << (*bit)->GetId());
|
||||
for (uint32_t rx = 1; rx <= (*bit)->GetNRoomsX(); ++rx)
|
||||
@@ -327,7 +326,7 @@ SameRoomPositionAllocator::SameRoomPositionAllocator(NodeContainer c)
|
||||
m_rand = CreateObject<UniformRandomVariable>();
|
||||
m_nodeIt = m_nodes.Begin();
|
||||
// this is needed to make sure the building models associated with c have been initialized
|
||||
for (NodeContainer::Iterator it = m_nodes.Begin(); it != m_nodes.End(); ++it)
|
||||
for (auto it = m_nodes.Begin(); it != m_nodes.End(); ++it)
|
||||
{
|
||||
Ptr<MobilityModel> mm = (*it)->GetObject<MobilityModel>();
|
||||
NS_ASSERT_MSG(mm, "no mobility model aggregated to this node");
|
||||
|
||||
@@ -35,7 +35,7 @@ NS_LOG_COMPONENT_DEFINE("BuildingsHelper");
|
||||
void
|
||||
BuildingsHelper::Install(NodeContainer c)
|
||||
{
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
Install(*i);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ void
|
||||
BuildingListPriv::DoDispose()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS();
|
||||
for (std::vector<Ptr<Building>>::iterator i = m_buildings.begin(); i != m_buildings.end(); i++)
|
||||
for (auto i = m_buildings.begin(); i != m_buildings.end(); i++)
|
||||
{
|
||||
Ptr<Building> building = *i;
|
||||
building->Dispose();
|
||||
|
||||
@@ -171,7 +171,7 @@ bool
|
||||
BuildingsChannelConditionModel::IsLineOfSightBlocked(const ns3::Vector& l1,
|
||||
const ns3::Vector& l2) const
|
||||
{
|
||||
for (BuildingList::Iterator bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
for (auto bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
{
|
||||
if ((*bit)->IsIntersect(l1, l2))
|
||||
{
|
||||
|
||||
@@ -160,11 +160,10 @@ BuildingsPropagationLossModel::GetShadowing(Ptr<MobilityModel> a, Ptr<MobilityMo
|
||||
Ptr<MobilityBuildingInfo> b1 = b->GetObject<MobilityBuildingInfo>();
|
||||
NS_ASSERT_MSG(a1 && b1, "BuildingsPropagationLossModel only works with MobilityBuildingInfo");
|
||||
|
||||
std::map<Ptr<MobilityModel>, std::map<Ptr<MobilityModel>, ShadowingLoss>>::iterator ait =
|
||||
m_shadowingLossMap.find(a);
|
||||
auto ait = m_shadowingLossMap.find(a);
|
||||
if (ait != m_shadowingLossMap.end())
|
||||
{
|
||||
std::map<Ptr<MobilityModel>, ShadowingLoss>::iterator bit = ait->second.find(b);
|
||||
auto bit = ait->second.find(b);
|
||||
if (bit != ait->second.end())
|
||||
{
|
||||
return (bit->second.GetLoss());
|
||||
|
||||
@@ -168,7 +168,7 @@ MobilityBuildingInfo::MakeConsistent(Ptr<MobilityModel> mm)
|
||||
{
|
||||
bool found = false;
|
||||
Vector pos = mm->GetPosition();
|
||||
for (BuildingList::Iterator bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
for (auto bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
{
|
||||
NS_LOG_LOGIC("checking building " << (*bit)->GetId() << " with boundaries "
|
||||
<< (*bit)->GetBoundaries());
|
||||
|
||||
@@ -271,7 +271,7 @@ RandomWalk2dOutdoorMobilityModel::IsLineClearOfBuildings(Vector currentPosition,
|
||||
double minIntersectionDistance = std::numeric_limits<double>::max();
|
||||
Ptr<Building> minIntersectionDistanceBuilding;
|
||||
|
||||
for (BuildingList::Iterator bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
for (auto bit = BuildingList::Begin(); bit != BuildingList::End(); ++bit)
|
||||
{
|
||||
// check if this building intersects the line between the current and next positions
|
||||
// this checks also if the next position is inside the building
|
||||
|
||||
@@ -117,7 +117,7 @@ RandomRoomPositionAllocatorTestCase::DoRun()
|
||||
|
||||
std::map<Room, uint32_t> roomCounter;
|
||||
|
||||
for (NodeContainer::Iterator it = nodes.Begin(); it != nodes.End(); ++it)
|
||||
for (auto it = nodes.Begin(); it != nodes.End(); ++it)
|
||||
{
|
||||
Ptr<MobilityModel> mm = (*it)->GetObject<MobilityModel>();
|
||||
NS_ASSERT_MSG(mm, "no mobility model aggregated to this node");
|
||||
@@ -138,7 +138,7 @@ RandomRoomPositionAllocatorTestCase::DoRun()
|
||||
NS_TEST_ASSERT_MSG_LT(p.z, bmm->GetFloorNumber() + 1, "wrong z value");
|
||||
}
|
||||
|
||||
for (std::map<Room, uint32_t>::iterator it = roomCounter.begin(); it != roomCounter.end(); ++it)
|
||||
for (auto it = roomCounter.begin(); it != roomCounter.end(); ++it)
|
||||
{
|
||||
// random selection is done without replacement until the set of
|
||||
// eligible room is empty, at which point the set is filled
|
||||
@@ -202,7 +202,7 @@ SameRoomPositionAllocatorTestCase::DoRun()
|
||||
|
||||
std::map<Room, uint32_t> roomCounter;
|
||||
|
||||
for (NodeContainer::Iterator it = copyNodes.Begin(); it != copyNodes.End(); ++it)
|
||||
for (auto it = copyNodes.Begin(); it != copyNodes.End(); ++it)
|
||||
{
|
||||
Ptr<MobilityModel> mm = (*it)->GetObject<MobilityModel>();
|
||||
NS_ASSERT_MSG(mm, "no mobility model aggregated to this node");
|
||||
@@ -215,7 +215,7 @@ SameRoomPositionAllocatorTestCase::DoRun()
|
||||
++(roomCounter[r]);
|
||||
}
|
||||
|
||||
for (std::map<Room, uint32_t>::iterator it = roomCounter.begin(); it != roomCounter.end(); ++it)
|
||||
for (auto it = roomCounter.begin(); it != roomCounter.end(); ++it)
|
||||
{
|
||||
NS_TEST_ASSERT_MSG_EQ(it->second, 4, "expected 4 nodes per room");
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ ClickInternetStackHelper::Reset()
|
||||
void
|
||||
ClickInternetStackHelper::SetClickFile(NodeContainer c, std::string clickfile)
|
||||
{
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
SetClickFile(*i, clickfile);
|
||||
}
|
||||
@@ -222,7 +222,7 @@ ClickInternetStackHelper::SetClickFile(Ptr<Node> node, std::string clickfile)
|
||||
void
|
||||
ClickInternetStackHelper::SetDefines(NodeContainer c, std::map<std::string, std::string> defines)
|
||||
{
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
SetDefines(*i, defines);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ ClickInternetStackHelper::SetDefines(Ptr<Node> node, std::map<std::string, std::
|
||||
void
|
||||
ClickInternetStackHelper::SetRoutingTableElement(NodeContainer c, std::string rt)
|
||||
{
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
SetRoutingTableElement(*i, rt);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ ClickInternetStackHelper::SetRoutingTableElement(Ptr<Node> node, std::string rt)
|
||||
void
|
||||
ClickInternetStackHelper::Install(NodeContainer c) const
|
||||
{
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
Install(*i);
|
||||
}
|
||||
@@ -296,16 +296,14 @@ ClickInternetStackHelper::Install(Ptr<Node> node) const
|
||||
// Set routing
|
||||
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4>();
|
||||
Ptr<Ipv4ClickRouting> ipv4Routing = CreateObject<Ipv4ClickRouting>();
|
||||
std::map<Ptr<Node>, std::string>::const_iterator it;
|
||||
it = m_nodeToClickFileMap.find(node);
|
||||
auto it = m_nodeToClickFileMap.find(node);
|
||||
|
||||
if (it != m_nodeToClickFileMap.end())
|
||||
{
|
||||
ipv4Routing->SetClickFile(it->second);
|
||||
}
|
||||
|
||||
std::map<Ptr<Node>, std::map<std::string, std::string>>::const_iterator definesIt;
|
||||
definesIt = m_nodeToDefinesMap.find(node);
|
||||
auto definesIt = m_nodeToDefinesMap.find(node);
|
||||
if (definesIt != m_nodeToDefinesMap.end())
|
||||
{
|
||||
ipv4Routing->SetDefines(definesIt->second);
|
||||
@@ -331,9 +329,7 @@ ClickInternetStackHelper::Install(std::string nodeName) const
|
||||
bool
|
||||
ClickInternetStackHelper::PcapHooked(Ptr<Ipv4> ipv4)
|
||||
{
|
||||
for (InterfaceFileMapIpv4::const_iterator i = g_interfaceFileMapIpv4.begin();
|
||||
i != g_interfaceFileMapIpv4.end();
|
||||
++i)
|
||||
for (auto i = g_interfaceFileMapIpv4.begin(); i != g_interfaceFileMapIpv4.end(); ++i)
|
||||
{
|
||||
if ((*i).first.first == ipv4)
|
||||
{
|
||||
@@ -409,9 +405,7 @@ ClickInternetStackHelper::EnablePcapIpv4Internal(std::string prefix,
|
||||
bool
|
||||
ClickInternetStackHelper::AsciiHooked(Ptr<Ipv4> ipv4)
|
||||
{
|
||||
for (InterfaceStreamMapIpv4::const_iterator i = g_interfaceStreamMapIpv4.begin();
|
||||
i != g_interfaceStreamMapIpv4.end();
|
||||
++i)
|
||||
for (auto i = g_interfaceStreamMapIpv4.begin(); i != g_interfaceStreamMapIpv4.end(); ++i)
|
||||
{
|
||||
if ((*i).first.first == ipv4)
|
||||
{
|
||||
|
||||
@@ -396,7 +396,7 @@ Ipv4ClickRouting::Send(Ptr<Packet> p, Ipv4Address src, Ipv4Address dst)
|
||||
}
|
||||
|
||||
int len = p->GetSize();
|
||||
uint8_t* buf = new uint8_t[len];
|
||||
auto buf = new uint8_t[len];
|
||||
p->CopyData(buf, len);
|
||||
|
||||
// ... and send the packet on the corresponding Click interface.
|
||||
@@ -424,7 +424,7 @@ Ipv4ClickRouting::Receive(Ptr<Packet> p, Mac48Address receiverAddr, Mac48Address
|
||||
}
|
||||
|
||||
int len = p->GetSize();
|
||||
uint8_t* buf = new uint8_t[len];
|
||||
auto buf = new uint8_t[len];
|
||||
p->CopyData(buf, len);
|
||||
|
||||
// ... and send the packet to the corresponding Click interface
|
||||
@@ -816,8 +816,8 @@ simclick_sim_command(simclick_node_t* simnode, int cmd, ...)
|
||||
|
||||
// Append key/value pair, separated by \0.
|
||||
std::map<std::string, std::string> defines = clickInstance->GetDefines();
|
||||
std::map<std::string, std::string>::const_iterator it = defines.begin();
|
||||
while (it != defines.end())
|
||||
|
||||
for (auto it = defines.begin(); it != defines.end(); it++)
|
||||
{
|
||||
size_t available = *size - required;
|
||||
if (it->first.length() + it->second.length() + 2 <= available)
|
||||
@@ -832,7 +832,6 @@ simclick_sim_command(simclick_node_t* simnode, int cmd, ...)
|
||||
{
|
||||
required += it->first.length() + it->second.length() + 2;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
if (required > *size)
|
||||
{
|
||||
|
||||
@@ -79,13 +79,13 @@ void
|
||||
Ipv4L3ClickProtocol::DoDispose()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
|
||||
for (auto i = m_protocols.begin(); i != m_protocols.end(); ++i)
|
||||
{
|
||||
i->second = nullptr;
|
||||
}
|
||||
m_protocols.clear();
|
||||
|
||||
for (Ipv4InterfaceList::iterator i = m_interfaces.begin(); i != m_interfaces.end(); ++i)
|
||||
for (auto i = m_interfaces.begin(); i != m_interfaces.end(); ++i)
|
||||
{
|
||||
*i = nullptr;
|
||||
}
|
||||
@@ -152,8 +152,7 @@ Ipv4L3ClickProtocol::GetInterfaceForAddress(Ipv4Address address) const
|
||||
NS_LOG_FUNCTION(this << address);
|
||||
|
||||
int32_t interface = 0;
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin(); i != m_interfaces.end();
|
||||
i++, interface++)
|
||||
for (auto i = m_interfaces.begin(); i != m_interfaces.end(); i++, interface++)
|
||||
{
|
||||
for (uint32_t j = 0; j < (*i)->GetNAddresses(); j++)
|
||||
{
|
||||
@@ -173,8 +172,7 @@ Ipv4L3ClickProtocol::GetInterfaceForPrefix(Ipv4Address address, Ipv4Mask mask) c
|
||||
NS_LOG_FUNCTION(this << address << mask);
|
||||
|
||||
int32_t interface = 0;
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin(); i != m_interfaces.end();
|
||||
i++, interface++)
|
||||
for (auto i = m_interfaces.begin(); i != m_interfaces.end(); i++, interface++)
|
||||
{
|
||||
for (uint32_t j = 0; j < (*i)->GetNAddresses(); j++)
|
||||
{
|
||||
@@ -193,7 +191,7 @@ Ipv4L3ClickProtocol::GetInterfaceForDevice(Ptr<const NetDevice> device) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << device->GetIfIndex());
|
||||
|
||||
Ipv4InterfaceReverseContainer::const_iterator iter = m_reverseInterfacesContainer.find(device);
|
||||
auto iter = m_reverseInterfacesContainer.find(device);
|
||||
if (iter != m_reverseInterfacesContainer.end())
|
||||
{
|
||||
return (*iter).second;
|
||||
@@ -274,7 +272,7 @@ Ipv4L3ClickProtocol::SetIpForward(bool forward)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << forward);
|
||||
m_ipForward = forward;
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin(); i != m_interfaces.end(); i++)
|
||||
for (auto i = m_interfaces.begin(); i != m_interfaces.end(); i++)
|
||||
{
|
||||
(*i)->SetForwarding(forward);
|
||||
}
|
||||
@@ -363,7 +361,7 @@ void
|
||||
Ipv4L3ClickProtocol::DeleteRawSocket(Ptr<Socket> socket)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << socket);
|
||||
for (SocketList::iterator i = m_sockets.begin(); i != m_sockets.end(); ++i)
|
||||
for (auto i = m_sockets.begin(); i != m_sockets.end(); ++i)
|
||||
{
|
||||
if ((*i) == socket)
|
||||
{
|
||||
@@ -804,7 +802,7 @@ Ipv4L3ClickProtocol::Receive(Ptr<NetDevice> device,
|
||||
}
|
||||
packetForRawSocket->RemoveHeader(ipHeader);
|
||||
|
||||
for (SocketList::iterator i = m_sockets.begin(); i != m_sockets.end(); ++i)
|
||||
for (auto i = m_sockets.begin(); i != m_sockets.end(); ++i)
|
||||
{
|
||||
NS_LOG_LOGIC("Forwarding to raw socket");
|
||||
Ptr<Ipv4RawSocketImpl> socket = *i;
|
||||
@@ -922,7 +920,7 @@ Ipv4L3ClickProtocol::Remove(Ptr<IpL4Protocol> protocol)
|
||||
NS_LOG_FUNCTION(this << protocol);
|
||||
|
||||
L4ListKey_t key = std::make_pair(protocol->GetProtocolNumber(), -1);
|
||||
L4List_t::iterator iter = m_protocols.find(key);
|
||||
auto iter = m_protocols.find(key);
|
||||
if (iter == m_protocols.end())
|
||||
{
|
||||
NS_LOG_WARN("Trying to remove an non-existent default protocol "
|
||||
@@ -940,7 +938,7 @@ Ipv4L3ClickProtocol::Remove(Ptr<IpL4Protocol> protocol, uint32_t interfaceIndex)
|
||||
NS_LOG_FUNCTION(this << protocol << interfaceIndex);
|
||||
|
||||
L4ListKey_t key = std::make_pair(protocol->GetProtocolNumber(), interfaceIndex);
|
||||
L4List_t::iterator iter = m_protocols.find(key);
|
||||
auto iter = m_protocols.find(key);
|
||||
if (iter == m_protocols.end())
|
||||
{
|
||||
NS_LOG_WARN("Trying to remove an non-existent protocol "
|
||||
@@ -967,12 +965,11 @@ Ipv4L3ClickProtocol::GetProtocol(int protocolNumber, int32_t interfaceIndex) con
|
||||
NS_LOG_FUNCTION(this << protocolNumber << interfaceIndex);
|
||||
|
||||
L4ListKey_t key;
|
||||
L4List_t::const_iterator i;
|
||||
if (interfaceIndex >= 0)
|
||||
{
|
||||
// try the interface-specific protocol.
|
||||
key = std::make_pair(protocolNumber, interfaceIndex);
|
||||
i = m_protocols.find(key);
|
||||
auto i = m_protocols.find(key);
|
||||
if (i != m_protocols.end())
|
||||
{
|
||||
return i->second;
|
||||
@@ -980,7 +977,7 @@ Ipv4L3ClickProtocol::GetProtocol(int protocolNumber, int32_t interfaceIndex) con
|
||||
}
|
||||
// try the generic protocol.
|
||||
key = std::make_pair(protocolNumber, -1);
|
||||
i = m_protocols.find(key);
|
||||
auto i = m_protocols.find(key);
|
||||
if (i != m_protocols.end())
|
||||
{
|
||||
return i->second;
|
||||
|
||||
@@ -227,8 +227,7 @@ AttributeIterator::DoIterate(Ptr<Object> object)
|
||||
for (uint32_t i = 0; i < tid.GetAttributeN(); ++i)
|
||||
{
|
||||
TypeId::AttributeInformation info = tid.GetAttribute(i);
|
||||
const PointerChecker* ptrChecker =
|
||||
dynamic_cast<const PointerChecker*>(PeekPointer(info.checker));
|
||||
const auto ptrChecker = dynamic_cast<const PointerChecker*>(PeekPointer(info.checker));
|
||||
if (ptrChecker != nullptr)
|
||||
{
|
||||
NS_LOG_DEBUG("pointer attribute " << info.name);
|
||||
@@ -246,7 +245,7 @@ AttributeIterator::DoIterate(Ptr<Object> object)
|
||||
continue;
|
||||
}
|
||||
// attempt to cast to an object container
|
||||
const ObjectPtrContainerChecker* vectorChecker =
|
||||
const auto vectorChecker =
|
||||
dynamic_cast<const ObjectPtrContainerChecker*>(PeekPointer(info.checker));
|
||||
if (vectorChecker != nullptr)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ void
|
||||
ModelCreator::Add(ModelNode* node)
|
||||
{
|
||||
GtkTreeIter* parent = m_iters.back();
|
||||
GtkTreeIter* current = g_new(GtkTreeIter, 1);
|
||||
auto current = g_new(GtkTreeIter, 1);
|
||||
gtk_tree_store_append(m_treestore, current, parent);
|
||||
gtk_tree_store_set(m_treestore, current, COL_NODE, node, -1);
|
||||
m_iters.push_back(current);
|
||||
@@ -58,7 +58,7 @@ ModelCreator::Remove()
|
||||
void
|
||||
ModelCreator::DoVisitAttribute(Ptr<Object> object, std::string name)
|
||||
{
|
||||
ModelNode* node = new ModelNode();
|
||||
auto node = new ModelNode();
|
||||
node->type = ModelNode::NODE_ATTRIBUTE;
|
||||
node->object = object;
|
||||
node->name = name;
|
||||
@@ -69,7 +69,7 @@ ModelCreator::DoVisitAttribute(Ptr<Object> object, std::string name)
|
||||
void
|
||||
ModelCreator::DoStartVisitObject(Ptr<Object> object)
|
||||
{
|
||||
ModelNode* node = new ModelNode();
|
||||
auto node = new ModelNode();
|
||||
node->type = ModelNode::NODE_OBJECT;
|
||||
node->object = object;
|
||||
Add(node);
|
||||
@@ -84,7 +84,7 @@ ModelCreator::DoEndVisitObject()
|
||||
void
|
||||
ModelCreator::DoStartVisitPointerAttribute(Ptr<Object> object, std::string name, Ptr<Object> value)
|
||||
{
|
||||
ModelNode* node = new ModelNode();
|
||||
auto node = new ModelNode();
|
||||
node->type = ModelNode::NODE_POINTER;
|
||||
node->object = object;
|
||||
node->name = name;
|
||||
@@ -102,7 +102,7 @@ ModelCreator::DoStartVisitArrayAttribute(Ptr<Object> object,
|
||||
std::string name,
|
||||
const ObjectPtrContainerValue& vector)
|
||||
{
|
||||
ModelNode* node = new ModelNode();
|
||||
auto node = new ModelNode();
|
||||
node->type = ModelNode::NODE_VECTOR;
|
||||
node->object = object;
|
||||
node->name = name;
|
||||
@@ -121,8 +121,8 @@ ModelCreator::DoStartVisitArrayItem(const ObjectPtrContainerValue& vector,
|
||||
Ptr<Object> item)
|
||||
{
|
||||
GtkTreeIter* parent = m_iters.back();
|
||||
GtkTreeIter* current = g_new(GtkTreeIter, 1);
|
||||
ModelNode* node = new ModelNode();
|
||||
auto current = g_new(GtkTreeIter, 1);
|
||||
auto node = new ModelNode();
|
||||
node->type = ModelNode::NODE_VECTOR_ITEM;
|
||||
node->object = item;
|
||||
node->index = index;
|
||||
|
||||
@@ -38,7 +38,7 @@ void
|
||||
ModelTypeidCreator::Add(ModelTypeid* node)
|
||||
{
|
||||
GtkTreeIter* parent = m_iters.back();
|
||||
GtkTreeIter* current = g_new(GtkTreeIter, 1);
|
||||
auto current = g_new(GtkTreeIter, 1);
|
||||
gtk_tree_store_append(m_treestore, current, parent);
|
||||
gtk_tree_store_set(m_treestore, current, COL_TYPEID, node, -1);
|
||||
m_iters.push_back(current);
|
||||
@@ -58,7 +58,7 @@ ModelTypeidCreator::VisitAttribute(TypeId tid,
|
||||
std::string defaultValue,
|
||||
uint32_t index)
|
||||
{
|
||||
ModelTypeid* node = new ModelTypeid();
|
||||
auto node = new ModelTypeid();
|
||||
node->type = ModelTypeid::NODE_ATTRIBUTE;
|
||||
node->tid = tid;
|
||||
node->name = name;
|
||||
@@ -71,7 +71,7 @@ ModelTypeidCreator::VisitAttribute(TypeId tid,
|
||||
void
|
||||
ModelTypeidCreator::StartVisitTypeId(std::string name)
|
||||
{
|
||||
ModelTypeid* node = new ModelTypeid();
|
||||
auto node = new ModelTypeid();
|
||||
node->type = ModelTypeid::NODE_TYPEID;
|
||||
node->tid = TypeId::LookupByName(name);
|
||||
Add(node);
|
||||
|
||||
@@ -131,7 +131,7 @@ void
|
||||
RawTextConfigSave::Global()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
for (GlobalValue::Iterator i = GlobalValue::Begin(); i != GlobalValue::End(); ++i)
|
||||
for (auto i = GlobalValue::Begin(); i != GlobalValue::End(); ++i)
|
||||
{
|
||||
StringValue value;
|
||||
(*i)->GetValue(value);
|
||||
|
||||
@@ -271,7 +271,7 @@ void
|
||||
XmlConfigSave::Global()
|
||||
{
|
||||
int rc;
|
||||
for (GlobalValue::Iterator i = GlobalValue::Begin(); i != GlobalValue::End(); ++i)
|
||||
for (auto i = GlobalValue::Begin(); i != GlobalValue::End(); ++i)
|
||||
{
|
||||
StringValue value;
|
||||
(*i)->GetValue(value);
|
||||
|
||||
@@ -352,7 +352,7 @@ class Dictionary
|
||||
//
|
||||
// Number of buckets = k = 2^bits
|
||||
long double k32 = 0xFFFFFFFF;
|
||||
long double k64 = static_cast<long double>(0xFFFFFFFFFFFFFFFFULL);
|
||||
auto k64 = static_cast<long double>(0xFFFFFFFFFFFFFFFFULL);
|
||||
|
||||
long double n = m_nphrases;
|
||||
long double Ec32 = n * (n - 1) / (2 * k32) * (1 - (n - 2) / (3 * k32));
|
||||
|
||||
@@ -99,7 +99,7 @@ Histogram(Ptr<RandomVariableStream> rndvar,
|
||||
data.SetStyle(Gnuplot2dDataset::IMPULSES);
|
||||
}
|
||||
|
||||
for (histogram_maptype::const_iterator hi = histogram.begin(); hi != histogram.end(); ++hi)
|
||||
for (auto hi = histogram.begin(); hi != histogram.end(); ++hi)
|
||||
{
|
||||
data.Add(hi->first, (double)hi->second / (double)probes / precision);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ EventGarbageCollector::Shrink()
|
||||
void
|
||||
EventGarbageCollector::Cleanup()
|
||||
{
|
||||
for (EventList::iterator iter = m_events.begin(); iter != m_events.end();)
|
||||
for (auto iter = m_events.begin(); iter != m_events.end();)
|
||||
{
|
||||
if ((*iter).IsExpired())
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ AttributeConstructionList::Add(std::string name,
|
||||
// vector of values.
|
||||
NS_LOG_FUNCTION(this << name << checker << value);
|
||||
|
||||
for (std::list<Item>::iterator k = m_list.begin(); k != m_list.end(); k++)
|
||||
for (auto k = m_list.begin(); k != m_list.end(); k++)
|
||||
{
|
||||
if (k->checker == checker)
|
||||
{
|
||||
@@ -65,7 +65,7 @@ Ptr<AttributeValue>
|
||||
AttributeConstructionList::Find(Ptr<const AttributeChecker> checker) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << checker);
|
||||
for (CIterator k = m_list.begin(); k != m_list.end(); k++)
|
||||
for (auto k = m_list.begin(); k != m_list.end(); k++)
|
||||
{
|
||||
NS_LOG_DEBUG("Found " << k->name << " " << k->checker << " " << k->value);
|
||||
if (k->checker == checker)
|
||||
|
||||
@@ -69,7 +69,7 @@ AttributeChecker::CreateValidValue(const AttributeValue& value) const
|
||||
return value.Copy();
|
||||
}
|
||||
// attempt to convert to string.
|
||||
const StringValue* str = dynamic_cast<const StringValue*>(&value);
|
||||
const auto str = dynamic_cast<const StringValue*>(&value);
|
||||
if (str == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
|
||||
@@ -137,8 +137,8 @@ CalendarScheduler::DoInsert(const Event& ev)
|
||||
NS_LOG_LOGIC("insert in bucket=" << bucket);
|
||||
|
||||
// insert in bucket list.
|
||||
Bucket::iterator end = m_buckets[bucket].end();
|
||||
for (Bucket::iterator i = m_buckets[bucket].begin(); i != end; ++i)
|
||||
auto end = m_buckets[bucket].end();
|
||||
for (auto i = m_buckets[bucket].begin(); i != end; ++i)
|
||||
{
|
||||
if (Order(ev.key, i->key))
|
||||
{
|
||||
@@ -267,8 +267,8 @@ CalendarScheduler::Remove(const Event& ev)
|
||||
// bucket index of event
|
||||
uint32_t bucket = Hash(ev.key.m_ts);
|
||||
|
||||
Bucket::iterator end = m_buckets[bucket].end();
|
||||
for (Bucket::iterator i = m_buckets[bucket].begin(); i != end; ++i)
|
||||
auto end = m_buckets[bucket].end();
|
||||
for (auto i = m_buckets[bucket].begin(); i != end; ++i)
|
||||
{
|
||||
if (i->key.m_uid == ev.key.m_uid)
|
||||
{
|
||||
@@ -341,7 +341,7 @@ CalendarScheduler::CalculateNewWidth()
|
||||
samples.push_back(DoRemoveNext());
|
||||
}
|
||||
// put them back
|
||||
for (std::list<Scheduler::Event>::const_iterator i = samples.begin(); i != samples.end(); ++i)
|
||||
for (auto i = samples.begin(); i != samples.end(); ++i)
|
||||
{
|
||||
DoInsert(*i);
|
||||
}
|
||||
@@ -353,9 +353,9 @@ CalendarScheduler::CalculateNewWidth()
|
||||
|
||||
// finally calculate inter-time average over samples.
|
||||
uint64_t totalSeparation = 0;
|
||||
std::list<Scheduler::Event>::const_iterator end = samples.end();
|
||||
std::list<Scheduler::Event>::const_iterator cur = samples.begin();
|
||||
std::list<Scheduler::Event>::const_iterator next = cur;
|
||||
auto end = samples.end();
|
||||
auto cur = samples.begin();
|
||||
auto next = cur;
|
||||
next++;
|
||||
while (next != end)
|
||||
{
|
||||
@@ -395,8 +395,8 @@ CalendarScheduler::DoResize(uint32_t newSize, uint64_t newWidth)
|
||||
|
||||
for (uint32_t i = 0; i < oldNBuckets; i++)
|
||||
{
|
||||
Bucket::iterator end = oldBuckets[i].end();
|
||||
for (Bucket::iterator j = oldBuckets[i].begin(); j != end; ++j)
|
||||
auto end = oldBuckets[i].end();
|
||||
for (auto j = oldBuckets[i].begin(); j != end; ++j)
|
||||
{
|
||||
DoInsert(*j);
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ class CallbackImpl : public CallbackImplBase
|
||||
|
||||
bool IsEqual(Ptr<const CallbackImplBase> other) const override
|
||||
{
|
||||
const CallbackImpl<R, UArgs...>* otherDerived =
|
||||
const auto otherDerived =
|
||||
dynamic_cast<const CallbackImpl<R, UArgs...>*>(PeekPointer(other));
|
||||
|
||||
if (otherDerived == nullptr)
|
||||
|
||||
@@ -103,7 +103,7 @@ void
|
||||
MatchContainer::Set(std::string name, const AttributeValue& value)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << name << &value);
|
||||
for (Iterator tmp = Begin(); tmp != End(); ++tmp)
|
||||
for (auto tmp = Begin(); tmp != End(); ++tmp)
|
||||
{
|
||||
Ptr<Object> object = *tmp;
|
||||
// Let ObjectBase::SetAttribute raise any errors
|
||||
@@ -116,7 +116,7 @@ MatchContainer::SetFailSafe(std::string name, const AttributeValue& value)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << name << &value);
|
||||
bool ok = false;
|
||||
for (Iterator tmp = Begin(); tmp != End(); ++tmp)
|
||||
for (auto tmp = Begin(); tmp != End(); ++tmp)
|
||||
{
|
||||
Ptr<Object> object = *tmp;
|
||||
ok |= object->SetAttributeFailSafe(name, value);
|
||||
@@ -162,7 +162,7 @@ MatchContainer::ConnectWithoutContextFailSafe(std::string name, const CallbackBa
|
||||
{
|
||||
NS_LOG_FUNCTION(this << name << &cb);
|
||||
bool ok = false;
|
||||
for (Iterator tmp = Begin(); tmp != End(); ++tmp)
|
||||
for (auto tmp = Begin(); tmp != End(); ++tmp)
|
||||
{
|
||||
Ptr<Object> object = *tmp;
|
||||
ok |= object->TraceConnectWithoutContext(name, cb);
|
||||
@@ -187,7 +187,7 @@ void
|
||||
MatchContainer::DisconnectWithoutContext(std::string name, const CallbackBase& cb)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << name << &cb);
|
||||
for (Iterator tmp = Begin(); tmp != End(); ++tmp)
|
||||
for (auto tmp = Begin(); tmp != End(); ++tmp)
|
||||
{
|
||||
Ptr<Object> object = *tmp;
|
||||
object->TraceDisconnectWithoutContext(name, cb);
|
||||
@@ -423,8 +423,7 @@ Resolver::GetResolvedPath() const
|
||||
NS_LOG_FUNCTION(this);
|
||||
|
||||
std::string fullPath = "/";
|
||||
for (std::vector<std::string>::const_iterator i = m_workStack.begin(); i != m_workStack.end();
|
||||
i++)
|
||||
for (auto i = m_workStack.begin(); i != m_workStack.end(); i++)
|
||||
{
|
||||
fullPath += *i + "/";
|
||||
}
|
||||
@@ -549,7 +548,7 @@ Resolver::DoResolve(std::string path, Ptr<Object> root)
|
||||
continue;
|
||||
}
|
||||
// attempt to cast to a pointer checker.
|
||||
const PointerChecker* pChecker =
|
||||
const auto pChecker =
|
||||
dynamic_cast<const PointerChecker*>(PeekPointer(info.checker));
|
||||
if (pChecker != nullptr)
|
||||
{
|
||||
@@ -572,7 +571,7 @@ Resolver::DoResolve(std::string path, Ptr<Object> root)
|
||||
m_workStack.pop_back();
|
||||
}
|
||||
// attempt to cast to an object vector.
|
||||
const ObjectPtrContainerChecker* vectorChecker =
|
||||
const auto vectorChecker =
|
||||
dynamic_cast<const ObjectPtrContainerChecker*>(PeekPointer(info.checker));
|
||||
if (vectorChecker != nullptr)
|
||||
{
|
||||
@@ -801,7 +800,7 @@ ConfigImpl::LookupMatches(std::string path)
|
||||
std::vector<std::string> m_contexts;
|
||||
} resolver = LookupMatchesResolver(path);
|
||||
|
||||
for (Roots::const_iterator i = m_roots.begin(); i != m_roots.end(); i++)
|
||||
for (auto i = m_roots.begin(); i != m_roots.end(); i++)
|
||||
{
|
||||
resolver.Resolve(*i);
|
||||
}
|
||||
@@ -828,7 +827,7 @@ ConfigImpl::UnregisterRootNamespaceObject(Ptr<Object> obj)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << obj);
|
||||
|
||||
for (std::vector<Ptr<Object>>::iterator i = m_roots.begin(); i != m_roots.end(); i++)
|
||||
for (auto i = m_roots.begin(); i != m_roots.end(); i++)
|
||||
{
|
||||
if (*i == obj)
|
||||
{
|
||||
@@ -867,7 +866,7 @@ Reset()
|
||||
}
|
||||
}
|
||||
// now, let's reset the initial value of every global value.
|
||||
for (GlobalValue::Iterator i = GlobalValue::Begin(); i != GlobalValue::End(); ++i)
|
||||
for (auto i = GlobalValue::Begin(); i != GlobalValue::End(); ++i)
|
||||
{
|
||||
(*i)->ResetInitialValue();
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ DefaultSimulatorImpl::Remove(const EventId& id)
|
||||
if (id.GetUid() == EventId::UID::DESTROY)
|
||||
{
|
||||
// destroy events.
|
||||
for (DestroyEvents::iterator i = m_destroyEvents.begin(); i != m_destroyEvents.end(); i++)
|
||||
for (auto i = m_destroyEvents.begin(); i != m_destroyEvents.end(); i++)
|
||||
{
|
||||
if (*i == id)
|
||||
{
|
||||
@@ -365,8 +365,7 @@ DefaultSimulatorImpl::IsExpired(const EventId& id) const
|
||||
return true;
|
||||
}
|
||||
// destroy events.
|
||||
for (DestroyEvents::const_iterator i = m_destroyEvents.begin(); i != m_destroyEvents.end();
|
||||
i++)
|
||||
for (auto i = m_destroyEvents.begin(); i != m_destroyEvents.end(); i++)
|
||||
{
|
||||
if (*i == id)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ MakeDoubleChecker(double min, double max, std::string name)
|
||||
bool Check(const AttributeValue& value) const override
|
||||
{
|
||||
NS_LOG_FUNCTION(&value);
|
||||
const DoubleValue* v = dynamic_cast<const DoubleValue*>(&value);
|
||||
const auto v = dynamic_cast<const DoubleValue*>(&value);
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@@ -103,8 +103,8 @@ MakeDoubleChecker(double min, double max, std::string name)
|
||||
bool Copy(const AttributeValue& source, AttributeValue& destination) const override
|
||||
{
|
||||
NS_LOG_FUNCTION(&source << &destination);
|
||||
const DoubleValue* src = dynamic_cast<const DoubleValue*>(&source);
|
||||
DoubleValue* dst = dynamic_cast<DoubleValue*>(&destination);
|
||||
const auto src = dynamic_cast<const DoubleValue*>(&source);
|
||||
auto dst = dynamic_cast<DoubleValue*>(&destination);
|
||||
if (src == nullptr || dst == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -73,7 +73,7 @@ std::string
|
||||
EnumValue::SerializeToString(Ptr<const AttributeChecker> checker) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << checker);
|
||||
const EnumChecker* p = dynamic_cast<const EnumChecker*>(PeekPointer(checker));
|
||||
const auto p = dynamic_cast<const EnumChecker*>(PeekPointer(checker));
|
||||
NS_ASSERT(p != nullptr);
|
||||
std::string name = p->GetName(m_value);
|
||||
return name;
|
||||
@@ -83,7 +83,7 @@ bool
|
||||
EnumValue::DeserializeFromString(std::string value, Ptr<const AttributeChecker> checker)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << value << checker);
|
||||
const EnumChecker* p = dynamic_cast<const EnumChecker*>(PeekPointer(checker));
|
||||
const auto p = dynamic_cast<const EnumChecker*>(PeekPointer(checker));
|
||||
NS_ASSERT(p != nullptr);
|
||||
m_value = p->GetValue(value);
|
||||
return true;
|
||||
@@ -150,7 +150,7 @@ bool
|
||||
EnumChecker::Check(const AttributeValue& value) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << &value);
|
||||
const EnumValue* p = dynamic_cast<const EnumValue*>(&value);
|
||||
const auto p = dynamic_cast<const EnumValue*>(&value);
|
||||
if (p == nullptr)
|
||||
{
|
||||
return false;
|
||||
@@ -201,8 +201,8 @@ bool
|
||||
EnumChecker::Copy(const AttributeValue& source, AttributeValue& destination) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << &source << &destination);
|
||||
const EnumValue* src = dynamic_cast<const EnumValue*>(&source);
|
||||
EnumValue* dst = dynamic_cast<EnumValue*>(&destination);
|
||||
const auto src = dynamic_cast<const EnumValue*>(&source);
|
||||
auto dst = dynamic_cast<EnumValue*>(&destination);
|
||||
if (src == nullptr || dst == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -103,7 +103,7 @@ GlobalValue::GetValue(AttributeValue& value) const
|
||||
{
|
||||
return;
|
||||
}
|
||||
StringValue* str = dynamic_cast<StringValue*>(&value);
|
||||
auto str = dynamic_cast<StringValue*>(&value);
|
||||
if (str == nullptr)
|
||||
{
|
||||
NS_FATAL_ERROR("GlobalValue name=" << m_name << ": input value is not a string");
|
||||
@@ -138,7 +138,7 @@ GlobalValue::Bind(std::string name, const AttributeValue& value)
|
||||
{
|
||||
NS_LOG_FUNCTION(name << &value);
|
||||
|
||||
for (Iterator i = Begin(); i != End(); i++)
|
||||
for (auto i = Begin(); i != End(); i++)
|
||||
{
|
||||
if ((*i)->GetName() == name)
|
||||
{
|
||||
@@ -157,7 +157,7 @@ GlobalValue::BindFailSafe(std::string name, const AttributeValue& value)
|
||||
{
|
||||
NS_LOG_FUNCTION(name << &value);
|
||||
|
||||
for (Iterator i = Begin(); i != End(); i++)
|
||||
for (auto i = Begin(); i != End(); i++)
|
||||
{
|
||||
if ((*i)->GetName() == name)
|
||||
{
|
||||
@@ -193,7 +193,7 @@ bool
|
||||
GlobalValue::GetValueByNameFailSafe(std::string name, AttributeValue& value)
|
||||
{
|
||||
NS_LOG_FUNCTION(name << &value);
|
||||
for (GlobalValue::Iterator gvit = GlobalValue::Begin(); gvit != GlobalValue::End(); ++gvit)
|
||||
for (auto gvit = GlobalValue::Begin(); gvit != GlobalValue::End(); ++gvit)
|
||||
{
|
||||
if ((*gvit)->GetName() == name)
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ operator<<(std::ostream& os, const int64x64_t& value)
|
||||
int64_t hi = absVal.GetHigh();
|
||||
|
||||
// Save stream format flags
|
||||
std::size_t precision = static_cast<std::size_t>(os.precision());
|
||||
auto precision = static_cast<std::size_t>(os.precision());
|
||||
std::ios_base::fmtflags ff = os.flags();
|
||||
const bool floatfield = os.flags() & std::ios_base::floatfield;
|
||||
os << std::setw(1) << std::noshowpos;
|
||||
|
||||
@@ -65,7 +65,7 @@ MakeIntegerChecker(int64_t min, int64_t max, std::string name)
|
||||
bool Check(const AttributeValue& value) const override
|
||||
{
|
||||
NS_LOG_FUNCTION(&value);
|
||||
const IntegerValue* v = dynamic_cast<const IntegerValue*>(&value);
|
||||
const auto v = dynamic_cast<const IntegerValue*>(&value);
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@@ -102,8 +102,8 @@ MakeIntegerChecker(int64_t min, int64_t max, std::string name)
|
||||
bool Copy(const AttributeValue& src, AttributeValue& dst) const override
|
||||
{
|
||||
NS_LOG_FUNCTION(&src << &dst);
|
||||
const IntegerValue* source = dynamic_cast<const IntegerValue*>(&src);
|
||||
IntegerValue* destination = dynamic_cast<IntegerValue*>(&dst);
|
||||
const auto source = dynamic_cast<const IntegerValue*>(&src);
|
||||
auto destination = dynamic_cast<IntegerValue*>(&dst);
|
||||
if (source == nullptr || destination == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -62,7 +62,7 @@ void
|
||||
ListScheduler::Insert(const Event& ev)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << &ev);
|
||||
for (EventsI i = m_events.begin(); i != m_events.end(); i++)
|
||||
for (auto i = m_events.begin(); i != m_events.end(); i++)
|
||||
{
|
||||
if (ev.key < i->key)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ void
|
||||
ListScheduler::Remove(const Event& ev)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << &ev);
|
||||
for (EventsI i = m_events.begin(); i != m_events.end(); i++)
|
||||
for (auto i = m_events.begin(); i != m_events.end(); i++)
|
||||
{
|
||||
if (i->key.m_uid == ev.key.m_uid)
|
||||
{
|
||||
|
||||
@@ -320,9 +320,7 @@ void
|
||||
LogComponentEnableAll(LogLevel level)
|
||||
{
|
||||
LogComponent::ComponentList* components = LogComponent::GetComponentList();
|
||||
for (LogComponent::ComponentList::const_iterator i = components->begin();
|
||||
i != components->end();
|
||||
i++)
|
||||
for (auto i = components->begin(); i != components->end(); i++)
|
||||
{
|
||||
i->second->Enable(level);
|
||||
}
|
||||
@@ -344,9 +342,7 @@ void
|
||||
LogComponentDisableAll(LogLevel level)
|
||||
{
|
||||
LogComponent::ComponentList* components = LogComponent::GetComponentList();
|
||||
for (LogComponent::ComponentList::const_iterator i = components->begin();
|
||||
i != components->end();
|
||||
i++)
|
||||
for (auto i = components->begin(); i != components->end(); i++)
|
||||
{
|
||||
i->second->Disable(level);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ Scheduler::Event
|
||||
MapScheduler::PeekNext() const
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
EventMapCI i = m_list.begin();
|
||||
auto i = m_list.begin();
|
||||
NS_ASSERT(i != m_list.end());
|
||||
|
||||
Event ev;
|
||||
@@ -93,7 +93,7 @@ Scheduler::Event
|
||||
MapScheduler::RemoveNext()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
EventMapI i = m_list.begin();
|
||||
auto i = m_list.begin();
|
||||
NS_ASSERT(i != m_list.end());
|
||||
Event ev;
|
||||
ev.impl = i->second;
|
||||
@@ -107,7 +107,7 @@ void
|
||||
MapScheduler::Remove(const Event& ev)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << ev.impl << ev.key.m_ts << ev.key.m_uid);
|
||||
EventMapI i = m_list.find(ev.key);
|
||||
auto i = m_list.find(ev.key);
|
||||
NS_ASSERT(i->second == ev.impl);
|
||||
m_list.erase(i);
|
||||
}
|
||||
|
||||
@@ -303,8 +303,7 @@ NamesPriv::Clear()
|
||||
// Every name is associated with an object in the object map, so freeing the
|
||||
// NameNodes in this map will free all of the memory allocated for the NameNodes
|
||||
//
|
||||
for (std::map<Ptr<Object>, NameNode*>::iterator i = m_objectMap.begin(); i != m_objectMap.end();
|
||||
++i)
|
||||
for (auto i = m_objectMap.begin(); i != m_objectMap.end(); ++i)
|
||||
{
|
||||
delete i->second;
|
||||
i->second = nullptr;
|
||||
@@ -420,7 +419,7 @@ NamesPriv::Add(Ptr<Object> context, std::string name, Ptr<Object> object)
|
||||
return false;
|
||||
}
|
||||
|
||||
NameNode* newNode = new NameNode(node, name, object);
|
||||
auto newNode = new NameNode(node, name, object);
|
||||
node->m_nameMap[name] = newNode;
|
||||
m_objectMap[object] = newNode;
|
||||
|
||||
@@ -525,7 +524,7 @@ NamesPriv::Rename(Ptr<Object> context, std::string oldname, std::string newname)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::map<std::string, NameNode*>::iterator i = node->m_nameMap.find(oldname);
|
||||
auto i = node->m_nameMap.find(oldname);
|
||||
if (i == node->m_nameMap.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Old name does not exist in name map");
|
||||
@@ -555,7 +554,7 @@ NamesPriv::FindName(Ptr<Object> object)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << object);
|
||||
|
||||
std::map<Ptr<Object>, NameNode*>::iterator i = m_objectMap.find(object);
|
||||
auto i = m_objectMap.find(object);
|
||||
if (i == m_objectMap.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Object does not exist in object map");
|
||||
@@ -573,7 +572,7 @@ NamesPriv::FindPath(Ptr<Object> object)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << object);
|
||||
|
||||
std::map<Ptr<Object>, NameNode*>::iterator i = m_objectMap.find(object);
|
||||
auto i = m_objectMap.find(object);
|
||||
if (i == m_objectMap.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Object does not exist in object map");
|
||||
@@ -648,7 +647,7 @@ NamesPriv::Find(std::string path)
|
||||
// There are no remaining slashes so this is the last segment of the
|
||||
// specified name. We're done when we find it
|
||||
//
|
||||
std::map<std::string, NameNode*>::iterator i = node->m_nameMap.find(remaining);
|
||||
auto i = node->m_nameMap.find(remaining);
|
||||
if (i == node->m_nameMap.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Name does not exist in name map");
|
||||
@@ -669,7 +668,7 @@ NamesPriv::Find(std::string path)
|
||||
offset = remaining.find('/');
|
||||
std::string segment = remaining.substr(0, offset);
|
||||
|
||||
std::map<std::string, NameNode*>::iterator i = node->m_nameMap.find(segment);
|
||||
auto i = node->m_nameMap.find(segment);
|
||||
if (i == node->m_nameMap.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Name does not exist in name map");
|
||||
@@ -723,7 +722,7 @@ NamesPriv::Find(Ptr<Object> context, std::string name)
|
||||
}
|
||||
}
|
||||
|
||||
std::map<std::string, NameNode*>::iterator i = node->m_nameMap.find(name);
|
||||
auto i = node->m_nameMap.find(name);
|
||||
if (i == node->m_nameMap.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Name does not exist in name map");
|
||||
@@ -741,7 +740,7 @@ NamesPriv::IsNamed(Ptr<Object> object)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << object);
|
||||
|
||||
std::map<Ptr<Object>, NameNode*>::iterator i = m_objectMap.find(object);
|
||||
auto i = m_objectMap.find(object);
|
||||
if (i == m_objectMap.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Object does not exist in object map, returning NameNode 0");
|
||||
@@ -759,7 +758,7 @@ NamesPriv::IsDuplicateName(NameNode* node, std::string name)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << node << name);
|
||||
|
||||
std::map<std::string, NameNode*>::iterator i = node->m_nameMap.find(name);
|
||||
auto i = node->m_nameMap.find(name);
|
||||
if (i == node->m_nameMap.end())
|
||||
{
|
||||
NS_LOG_LOGIC("Name does not exist in name map");
|
||||
|
||||
@@ -580,7 +580,7 @@ class Time
|
||||
|
||||
NS_ASSERT_MSG(info->isValid, "Attempted a conversion to an unavailable unit.");
|
||||
|
||||
int64x64_t retval = int64x64_t(m_data);
|
||||
int64x64_t retval(m_data);
|
||||
if (info->toMul)
|
||||
{
|
||||
retval *= info->timeTo;
|
||||
|
||||
@@ -261,7 +261,7 @@ ObjectBase::GetAttribute(std::string name, AttributeValue& value) const
|
||||
{
|
||||
return;
|
||||
}
|
||||
StringValue* str = dynamic_cast<StringValue*>(&value);
|
||||
auto str = dynamic_cast<StringValue*>(&value);
|
||||
if (str == nullptr)
|
||||
{
|
||||
NS_FATAL_ERROR("Attribute name=" << name << " tid=" << tid.GetName()
|
||||
@@ -296,7 +296,7 @@ ObjectBase::GetAttributeFailSafe(std::string name, AttributeValue& value) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
StringValue* str = dynamic_cast<StringValue*>(&value);
|
||||
auto str = dynamic_cast<StringValue*>(&value);
|
||||
if (str == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -95,7 +95,7 @@ ObjectFactory::Create() const
|
||||
NS_LOG_FUNCTION(this);
|
||||
Callback<ObjectBase*> cb = m_tid.GetConstructor();
|
||||
ObjectBase* base = cb();
|
||||
Object* derived = dynamic_cast<Object*>(base);
|
||||
auto derived = dynamic_cast<Object*>(base);
|
||||
NS_ASSERT(derived != nullptr);
|
||||
derived->SetTypeId(m_tid);
|
||||
derived->Construct(m_parameters);
|
||||
@@ -108,9 +108,7 @@ operator<<(std::ostream& os, const ObjectFactory& factory)
|
||||
{
|
||||
os << factory.m_tid.GetName() << "[";
|
||||
bool first = true;
|
||||
for (AttributeConstructionList::CIterator i = factory.m_parameters.Begin();
|
||||
i != factory.m_parameters.End();
|
||||
++i)
|
||||
for (auto i = factory.m_parameters.Begin(); i != factory.m_parameters.End(); ++i)
|
||||
{
|
||||
os << i->name << "=" << i->value->SerializeToString(i->checker);
|
||||
if (first)
|
||||
|
||||
@@ -93,10 +93,10 @@ MakeObjectMapAccessor(U T::*memberVector)
|
||||
std::size_t* index) const override
|
||||
{
|
||||
const T* obj = static_cast<const T*>(object);
|
||||
typename U::const_iterator begin = (obj->*m_memberVector).begin();
|
||||
typename U::const_iterator end = (obj->*m_memberVector).end();
|
||||
auto begin = (obj->*m_memberVector).begin();
|
||||
auto end = (obj->*m_memberVector).end();
|
||||
uint32_t k = 0;
|
||||
for (typename U::const_iterator j = begin; j != end; j++, k++)
|
||||
for (auto j = begin; j != end; j++, k++)
|
||||
{
|
||||
if (k == i)
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ Ptr<Object>
|
||||
ObjectPtrContainerValue::Get(std::size_t i) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << i);
|
||||
Iterator it = m_objects.find(i);
|
||||
auto it = m_objects.find(i);
|
||||
Ptr<Object> value = nullptr;
|
||||
if (it != m_objects.end())
|
||||
{
|
||||
@@ -115,7 +115,7 @@ bool
|
||||
ObjectPtrContainerAccessor::Get(const ObjectBase* object, AttributeValue& value) const
|
||||
{
|
||||
NS_LOG_FUNCTION(this << object << &value);
|
||||
ObjectPtrContainerValue* v = dynamic_cast<ObjectPtrContainerValue*>(&value);
|
||||
auto v = dynamic_cast<ObjectPtrContainerValue*>(&value);
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -208,8 +208,8 @@ class ObjectPtrContainerChecker : public ns3::ObjectPtrContainerChecker
|
||||
|
||||
bool Copy(const AttributeValue& source, AttributeValue& destination) const override
|
||||
{
|
||||
const ObjectPtrContainerValue* src = dynamic_cast<const ObjectPtrContainerValue*>(&source);
|
||||
ObjectPtrContainerValue* dst = dynamic_cast<ObjectPtrContainerValue*>(&destination);
|
||||
const auto src = dynamic_cast<const ObjectPtrContainerValue*>(&source);
|
||||
auto dst = dynamic_cast<ObjectPtrContainerValue*>(&destination);
|
||||
if (src == nullptr || dst == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -93,10 +93,10 @@ MakeObjectVectorAccessor(U T::*memberVector)
|
||||
std::size_t* index) const override
|
||||
{
|
||||
const T* obj = static_cast<const T*>(object);
|
||||
typename U::const_iterator begin = (obj->*m_memberVector).begin();
|
||||
typename U::const_iterator end = (obj->*m_memberVector).end();
|
||||
auto begin = (obj->*m_memberVector).begin();
|
||||
auto end = (obj->*m_memberVector).end();
|
||||
std::size_t k = 0;
|
||||
for (typename U::const_iterator j = begin; j != end; j++, k++)
|
||||
for (auto j = begin; j != end; j++, k++)
|
||||
{
|
||||
if (k == i)
|
||||
{
|
||||
|
||||
@@ -267,8 +267,7 @@ Object::AggregateObject(Ptr<Object> o)
|
||||
Object* other = PeekPointer(o);
|
||||
// first create the new aggregate buffer.
|
||||
uint32_t total = m_aggregates->n + other->m_aggregates->n;
|
||||
Aggregates* aggregates =
|
||||
(Aggregates*)std::malloc(sizeof(Aggregates) + (total - 1) * sizeof(Object*));
|
||||
auto aggregates = (Aggregates*)std::malloc(sizeof(Aggregates) + (total - 1) * sizeof(Object*));
|
||||
aggregates->n = total;
|
||||
|
||||
// copy our buffer to the new buffer
|
||||
|
||||
@@ -129,7 +129,7 @@ class PointerChecker : public ns3::PointerChecker
|
||||
{
|
||||
bool Check(const AttributeValue& val) const override
|
||||
{
|
||||
const PointerValue* value = dynamic_cast<const PointerValue*>(&val);
|
||||
const auto value = dynamic_cast<const PointerValue*>(&val);
|
||||
if (value == nullptr)
|
||||
{
|
||||
return false;
|
||||
@@ -166,8 +166,8 @@ class PointerChecker : public ns3::PointerChecker
|
||||
|
||||
bool Copy(const AttributeValue& source, AttributeValue& destination) const override
|
||||
{
|
||||
const PointerValue* src = dynamic_cast<const PointerValue*>(&source);
|
||||
PointerValue* dst = dynamic_cast<PointerValue*>(&destination);
|
||||
const auto src = dynamic_cast<const PointerValue*>(&source);
|
||||
auto dst = dynamic_cast<PointerValue*>(&destination);
|
||||
if (src == nullptr || dst == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -704,7 +704,7 @@ RealtimeSimulatorImpl::Remove(const EventId& id)
|
||||
if (id.GetUid() == EventId::UID::DESTROY)
|
||||
{
|
||||
// destroy events.
|
||||
for (DestroyEvents::iterator i = m_destroyEvents.begin(); i != m_destroyEvents.end(); i++)
|
||||
for (auto i = m_destroyEvents.begin(); i != m_destroyEvents.end(); i++)
|
||||
{
|
||||
if (*i == id)
|
||||
{
|
||||
@@ -754,8 +754,7 @@ RealtimeSimulatorImpl::IsExpired(const EventId& id) const
|
||||
return true;
|
||||
}
|
||||
// destroy events.
|
||||
for (DestroyEvents::const_iterator i = m_destroyEvents.begin(); i != m_destroyEvents.end();
|
||||
i++)
|
||||
for (auto i = m_destroyEvents.begin(); i != m_destroyEvents.end(); i++)
|
||||
{
|
||||
if (*i == id)
|
||||
{
|
||||
|
||||
@@ -141,7 +141,7 @@ Dirname(std::string path)
|
||||
{
|
||||
NS_LOG_FUNCTION(path);
|
||||
std::list<std::string> elements = Split(path);
|
||||
std::list<std::string>::const_iterator last = elements.end();
|
||||
auto last = elements.end();
|
||||
last--;
|
||||
return Join(elements.begin(), last);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ Join(std::list<std::string>::const_iterator begin, std::list<std::string>::const
|
||||
{
|
||||
NS_LOG_FUNCTION(*begin << *end);
|
||||
std::string retval = "";
|
||||
for (std::list<std::string>::const_iterator i = begin; i != end; i++)
|
||||
for (auto i = begin; i != end; i++)
|
||||
{
|
||||
if ((*i).empty())
|
||||
{
|
||||
|
||||
@@ -290,7 +290,7 @@ TestCase::~TestCase()
|
||||
NS_ASSERT(m_runner == nullptr);
|
||||
m_parent = nullptr;
|
||||
delete m_result;
|
||||
for (std::vector<TestCase*>::const_iterator i = m_children.begin(); i != m_children.end(); ++i)
|
||||
for (auto i = m_children.begin(); i != m_children.end(); ++i)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
@@ -353,7 +353,7 @@ TestCase::Run(TestRunnerImpl* runner)
|
||||
m_runner = runner;
|
||||
DoSetup();
|
||||
m_result->clock.Start();
|
||||
for (std::vector<TestCase*>::const_iterator i = m_children.begin(); i != m_children.end(); ++i)
|
||||
for (auto i = m_children.begin(); i != m_children.end(); ++i)
|
||||
{
|
||||
TestCase* test = *i;
|
||||
test->Run(runner);
|
||||
@@ -571,7 +571,7 @@ TestRunnerImpl::IsTopLevelSourceDir(std::string path) const
|
||||
//
|
||||
|
||||
std::list<std::string> files = SystemPath::ReadFiles(path);
|
||||
for (std::list<std::string>::const_iterator i = files.begin(); i != files.end(); ++i)
|
||||
for (auto i = files.begin(); i != files.end(); ++i)
|
||||
{
|
||||
if (*i == "VERSION")
|
||||
{
|
||||
@@ -629,7 +629,7 @@ TestRunnerImpl::ReplaceXmlSpecialCharacters(std::string xml) const
|
||||
{
|
||||
char character = xml[i];
|
||||
|
||||
specials_map::const_iterator it = specials.find(character);
|
||||
auto it = specials.find(character);
|
||||
|
||||
if (it == specials.end())
|
||||
{
|
||||
@@ -802,9 +802,9 @@ TestRunnerImpl::PrintTestNameList(std::list<TestCase*>::const_iterator begin,
|
||||
label[TestSuite::EXAMPLE] = "example ";
|
||||
label[TestSuite::PERFORMANCE] = "performance ";
|
||||
|
||||
for (std::list<TestCase*>::const_iterator i = begin; i != end; ++i)
|
||||
for (auto i = begin; i != end; ++i)
|
||||
{
|
||||
TestSuite* test = dynamic_cast<TestSuite*>(*i);
|
||||
auto test = dynamic_cast<TestSuite*>(*i);
|
||||
NS_ASSERT(test != nullptr);
|
||||
if (printTestType)
|
||||
{
|
||||
@@ -852,8 +852,7 @@ TestRunnerImpl::FilterTests(std::string testName,
|
||||
}
|
||||
|
||||
// Remove any test cases that should be skipped.
|
||||
std::vector<TestCase*>::iterator j;
|
||||
for (j = test->m_children.begin(); j != test->m_children.end();)
|
||||
for (auto j = test->m_children.begin(); j != test->m_children.end();)
|
||||
{
|
||||
TestCase* testCase = *j;
|
||||
|
||||
@@ -1090,7 +1089,7 @@ TestRunnerImpl::Run(int argc, char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (std::list<TestCase*>::const_iterator i = tests.begin(); i != tests.end(); ++i)
|
||||
for (auto i = tests.begin(); i != tests.end(); ++i)
|
||||
{
|
||||
TestCase* test = *i;
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ Time::SetResolution(Unit unit, Resolution* resolution, const bool convert /* = t
|
||||
info->isValid = false;
|
||||
continue;
|
||||
}
|
||||
int64_t factor = static_cast<int64_t>(std::pow(10, std::fabs(shift)) * quotient);
|
||||
auto factor = static_cast<int64_t>(std::pow(10, std::fabs(shift)) * quotient);
|
||||
double realFactor = std::pow(10, (double)shift) * static_cast<double>(UNIT_COEFF[i]) /
|
||||
UNIT_COEFF[(int)unit];
|
||||
NS_LOG_DEBUG("SetResolution factor " << factor << " real factor " << realFactor);
|
||||
@@ -333,9 +333,7 @@ Time::Mark(Time* const time)
|
||||
// since earlier test was outside and might be stale.
|
||||
if (g_markingTimes)
|
||||
{
|
||||
std::pair<MarkedTimes::iterator, bool> ret;
|
||||
|
||||
ret = g_markingTimes->insert(time);
|
||||
auto ret = g_markingTimes->insert(time);
|
||||
NS_LOG_LOGIC("\t[" << g_markingTimes->size() << "] recording " << time);
|
||||
|
||||
if (!ret.second)
|
||||
@@ -385,7 +383,7 @@ Time::ConvertTimes(const Unit unit)
|
||||
"No MarkedTimes registry. "
|
||||
"Time::SetResolution () called more than once?");
|
||||
|
||||
for (MarkedTimes::iterator it = g_markingTimes->begin(); it != g_markingTimes->end(); it++)
|
||||
for (auto it = g_markingTimes->begin(); it != g_markingTimes->end(); it++)
|
||||
{
|
||||
Time* const tp = *it;
|
||||
if (!(tp->m_data == std::numeric_limits<int64_t>::min() ||
|
||||
@@ -434,7 +432,7 @@ operator<<(std::ostream& os, const TimeWithUnit& timeU)
|
||||
|
||||
if (unit == Time::AUTO)
|
||||
{
|
||||
long double value = static_cast<long double>(timeU.m_time.GetTimeStep());
|
||||
auto value = static_cast<long double>(timeU.m_time.GetTimeStep());
|
||||
// convert to finest scale (fs)
|
||||
value *= Scale(Time::GetResolution());
|
||||
// find the best unit
|
||||
@@ -547,7 +545,7 @@ MakeTimeChecker(const Time min, const Time max)
|
||||
bool Check(const AttributeValue& value) const override
|
||||
{
|
||||
NS_LOG_FUNCTION(&value);
|
||||
const TimeValue* v = dynamic_cast<const TimeValue*>(&value);
|
||||
const auto v = dynamic_cast<const TimeValue*>(&value);
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@@ -585,8 +583,8 @@ MakeTimeChecker(const Time min, const Time max)
|
||||
bool Copy(const AttributeValue& source, AttributeValue& destination) const override
|
||||
{
|
||||
NS_LOG_FUNCTION(&source << &destination);
|
||||
const TimeValue* src = dynamic_cast<const TimeValue*>(&source);
|
||||
TimeValue* dst = dynamic_cast<TimeValue*>(&destination);
|
||||
const auto src = dynamic_cast<const TimeValue*>(&source);
|
||||
auto dst = dynamic_cast<TimeValue*>(&destination);
|
||||
if (src == nullptr || dst == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -1085,7 +1085,7 @@ void
|
||||
TimerImpl::SetArgs(T1 a1)
|
||||
{
|
||||
typedef TimerImplOne<typename TimerTraits<T1>::ParameterType> TimerImplBase;
|
||||
TimerImplBase* impl = dynamic_cast<TimerImplBase*>(this);
|
||||
auto impl = dynamic_cast<TimerImplBase*>(this);
|
||||
if (impl == nullptr)
|
||||
{
|
||||
NS_FATAL_ERROR("You tried to set Timer arguments incompatible with its function.");
|
||||
@@ -1101,7 +1101,7 @@ TimerImpl::SetArgs(T1 a1, T2 a2)
|
||||
typedef TimerImplTwo<typename TimerTraits<T1>::ParameterType,
|
||||
typename TimerTraits<T2>::ParameterType>
|
||||
TimerImplBase;
|
||||
TimerImplBase* impl = dynamic_cast<TimerImplBase*>(this);
|
||||
auto impl = dynamic_cast<TimerImplBase*>(this);
|
||||
if (impl == nullptr)
|
||||
{
|
||||
NS_FATAL_ERROR("You tried to set Timer arguments incompatible with its function.");
|
||||
@@ -1118,7 +1118,7 @@ TimerImpl::SetArgs(T1 a1, T2 a2, T3 a3)
|
||||
typename TimerTraits<T2>::ParameterType,
|
||||
typename TimerTraits<T3>::ParameterType>
|
||||
TimerImplBase;
|
||||
TimerImplBase* impl = dynamic_cast<TimerImplBase*>(this);
|
||||
auto impl = dynamic_cast<TimerImplBase*>(this);
|
||||
if (impl == nullptr)
|
||||
{
|
||||
NS_FATAL_ERROR("You tried to set Timer arguments incompatible with its function.");
|
||||
@@ -1136,7 +1136,7 @@ TimerImpl::SetArgs(T1 a1, T2 a2, T3 a3, T4 a4)
|
||||
typename TimerTraits<T3>::ParameterType,
|
||||
typename TimerTraits<T4>::ParameterType>
|
||||
TimerImplBase;
|
||||
TimerImplBase* impl = dynamic_cast<TimerImplBase*>(this);
|
||||
auto impl = dynamic_cast<TimerImplBase*>(this);
|
||||
if (impl == nullptr)
|
||||
{
|
||||
NS_FATAL_ERROR("You tried to set Timer arguments incompatible with its function.");
|
||||
@@ -1155,7 +1155,7 @@ TimerImpl::SetArgs(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
|
||||
typename TimerTraits<T4>::ParameterType,
|
||||
typename TimerTraits<T5>::ParameterType>
|
||||
TimerImplBase;
|
||||
TimerImplBase* impl = dynamic_cast<TimerImplBase*>(this);
|
||||
auto impl = dynamic_cast<TimerImplBase*>(this);
|
||||
if (impl == nullptr)
|
||||
{
|
||||
NS_FATAL_ERROR("You tried to set Timer arguments incompatible with its function.");
|
||||
@@ -1175,7 +1175,7 @@ TimerImpl::SetArgs(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
|
||||
typename TimerTraits<T5>::ParameterType,
|
||||
typename TimerTraits<T6>::ParameterType>
|
||||
TimerImplBase;
|
||||
TimerImplBase* impl = dynamic_cast<TimerImplBase*>(this);
|
||||
auto impl = dynamic_cast<TimerImplBase*>(this);
|
||||
if (impl == 0)
|
||||
{
|
||||
NS_FATAL_ERROR("You tried to set Timer arguments incompatible with its function.");
|
||||
|
||||
@@ -162,8 +162,7 @@ template <typename... Ts>
|
||||
void
|
||||
TracedCallback<Ts...>::DisconnectWithoutContext(const CallbackBase& callback)
|
||||
{
|
||||
for (typename CallbackList::iterator i = m_callbackList.begin(); i != m_callbackList.end();
|
||||
/* empty */)
|
||||
for (auto i = m_callbackList.begin(); i != m_callbackList.end(); /* empty */)
|
||||
{
|
||||
if ((*i).IsEqual(callback))
|
||||
{
|
||||
@@ -193,9 +192,7 @@ template <typename... Ts>
|
||||
void
|
||||
TracedCallback<Ts...>::operator()(Ts... args) const
|
||||
{
|
||||
for (typename CallbackList::const_iterator i = m_callbackList.begin();
|
||||
i != m_callbackList.end();
|
||||
i++)
|
||||
for (auto i = m_callbackList.begin(); i != m_callbackList.end(); i++)
|
||||
{
|
||||
(*i)(args...);
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ class TupleChecker : public ns3::TupleChecker
|
||||
|
||||
bool Check(const AttributeValue& value) const override
|
||||
{
|
||||
const TupleValue<Args...>* v = dynamic_cast<const TupleValue<Args...>*>(&value);
|
||||
const auto v = dynamic_cast<const TupleValue<Args...>*>(&value);
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@@ -403,8 +403,8 @@ class TupleChecker : public ns3::TupleChecker
|
||||
|
||||
bool Copy(const AttributeValue& source, AttributeValue& destination) const override
|
||||
{
|
||||
const TupleValue<Args...>* src = dynamic_cast<const TupleValue<Args...>*>(&source);
|
||||
TupleValue<Args...>* dst = dynamic_cast<TupleValue<Args...>*>(&destination);
|
||||
const auto src = dynamic_cast<const TupleValue<Args...>*>(&source);
|
||||
auto dst = dynamic_cast<TupleValue<Args...>*>(&destination);
|
||||
if (src == nullptr || dst == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -443,7 +443,7 @@ IidManager::AllocateUid(std::string name)
|
||||
m_information.push_back(information);
|
||||
std::size_t tuid = m_information.size();
|
||||
NS_ASSERT(tuid <= 0xffff);
|
||||
uint16_t uid = static_cast<uint16_t>(tuid);
|
||||
auto uid = static_cast<uint16_t>(tuid);
|
||||
|
||||
// Add to both maps:
|
||||
m_namemap.insert(std::make_pair(name, uid));
|
||||
@@ -512,7 +512,7 @@ IidManager::GetUid(std::string name) const
|
||||
{
|
||||
NS_LOG_FUNCTION(IID << name);
|
||||
uint16_t uid = 0;
|
||||
namemap_t::const_iterator it = m_namemap.find(name);
|
||||
auto it = m_namemap.find(name);
|
||||
if (it != m_namemap.end())
|
||||
{
|
||||
uid = it->second;
|
||||
@@ -525,7 +525,7 @@ uint16_t
|
||||
IidManager::GetUid(TypeId::hash_t hash) const
|
||||
{
|
||||
NS_LOG_FUNCTION(IID << hash);
|
||||
hashmap_t::const_iterator it = m_hashmap.find(hash);
|
||||
auto it = m_hashmap.find(hash);
|
||||
uint16_t uid = 0;
|
||||
if (it != m_hashmap.end())
|
||||
{
|
||||
@@ -627,10 +627,7 @@ IidManager::HasAttribute(uint16_t uid, std::string name)
|
||||
IidInformation* information = LookupInformation(uid);
|
||||
while (true)
|
||||
{
|
||||
for (std::vector<TypeId::AttributeInformation>::const_iterator i =
|
||||
information->attributes.begin();
|
||||
i != information->attributes.end();
|
||||
++i)
|
||||
for (auto i = information->attributes.begin(); i != information->attributes.end(); ++i)
|
||||
{
|
||||
if (i->name == name)
|
||||
{
|
||||
@@ -729,10 +726,7 @@ IidManager::HasTraceSource(uint16_t uid, std::string name)
|
||||
IidInformation* information = LookupInformation(uid);
|
||||
while (true)
|
||||
{
|
||||
for (std::vector<TypeId::TraceSourceInformation>::const_iterator i =
|
||||
information->traceSources.begin();
|
||||
i != information->traceSources.end();
|
||||
++i)
|
||||
for (auto i = information->traceSources.begin(); i != information->traceSources.end(); ++i)
|
||||
{
|
||||
if (i->name == name)
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ MakeUintegerChecker(uint64_t min, uint64_t max, std::string name)
|
||||
bool Check(const AttributeValue& value) const override
|
||||
{
|
||||
NS_LOG_FUNCTION(&value);
|
||||
const UintegerValue* v = dynamic_cast<const UintegerValue*>(&value);
|
||||
const auto v = dynamic_cast<const UintegerValue*>(&value);
|
||||
if (v == nullptr)
|
||||
{
|
||||
return false;
|
||||
@@ -102,8 +102,8 @@ MakeUintegerChecker(uint64_t min, uint64_t max, std::string name)
|
||||
bool Copy(const AttributeValue& source, AttributeValue& destination) const override
|
||||
{
|
||||
NS_LOG_FUNCTION(&source << &destination);
|
||||
const UintegerValue* src = dynamic_cast<const UintegerValue*>(&source);
|
||||
UintegerValue* dst = dynamic_cast<UintegerValue*>(&destination);
|
||||
const auto src = dynamic_cast<const UintegerValue*>(&source);
|
||||
auto dst = dynamic_cast<UintegerValue*>(&destination);
|
||||
if (src == nullptr || dst == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -363,7 +363,7 @@ WallClockSynchronizer::DriftCorrect(uint64_t nsNow, uint64_t nsDelay)
|
||||
// have more drift than delay, then we just play catch up as fast as possible
|
||||
// by not delaying at all.
|
||||
//
|
||||
uint64_t correction = (uint64_t)drift;
|
||||
auto correction = (uint64_t)drift;
|
||||
if (correction <= nsDelay)
|
||||
{
|
||||
return nsDelay - correction;
|
||||
|
||||
@@ -84,7 +84,7 @@ GlobalValueTestCase::DoRun()
|
||||
// Remove the global value for a valgrind clean run
|
||||
//
|
||||
GlobalValue::Vector* vector = GlobalValue::GetVector();
|
||||
for (GlobalValue::Vector::iterator i = vector->begin(); i != vector->end(); ++i)
|
||||
for (auto i = vector->begin(); i != vector->end(); ++i)
|
||||
{
|
||||
if ((*i) == &uint)
|
||||
{
|
||||
|
||||
@@ -620,7 +620,7 @@ Int64x64Bug455TestCase::DoRun()
|
||||
std::cout << std::endl;
|
||||
std::cout << GetParent()->GetName() << " Bug 455: " << GetName() << std::endl;
|
||||
|
||||
int64x64_t a = int64x64_t(0.1);
|
||||
int64x64_t a(0.1);
|
||||
a /= int64x64_t(1.25);
|
||||
Check(a.GetDouble(), 0.08, "The original testcase");
|
||||
|
||||
@@ -684,7 +684,7 @@ Int64x64Bug863TestCase::DoRun()
|
||||
std::cout << std::endl;
|
||||
std::cout << GetParent()->GetName() << " Bug 863: " << GetName() << std::endl;
|
||||
|
||||
int64x64_t a = int64x64_t(0.9);
|
||||
int64x64_t a(0.9);
|
||||
a /= int64x64_t(1);
|
||||
Check(a.GetDouble(), 0.9, "The original testcase");
|
||||
|
||||
@@ -1033,7 +1033,7 @@ Int64x64InvertTestCase::Check(const int64_t factor)
|
||||
const int64x64_t factorI = one / int64x64_t(factor);
|
||||
|
||||
const int64x64_t a = int64x64_t::Invert(factor);
|
||||
int64x64_t b = int64x64_t(factor);
|
||||
int64x64_t b(factor);
|
||||
|
||||
double tolerance = 0;
|
||||
if (int64x64_t::implementation == int64x64_t::ld_impl)
|
||||
@@ -1045,15 +1045,15 @@ Int64x64InvertTestCase::Check(const int64_t factor)
|
||||
b.MulByInvert(a);
|
||||
CheckCase(factor, b, one, "x * x^-1 == 1", tolerance);
|
||||
|
||||
int64x64_t c = int64x64_t(1);
|
||||
int64x64_t c(1);
|
||||
c.MulByInvert(a);
|
||||
CheckCase(factor, c, factorI, "1 * x^-1 == 1 / x");
|
||||
|
||||
int64x64_t d = int64x64_t(1);
|
||||
int64x64_t d(1);
|
||||
d /= (int64x64_t(factor));
|
||||
CheckCase(factor, d, c, "1/x == x^-1");
|
||||
|
||||
int64x64_t e = int64x64_t(-factor);
|
||||
int64x64_t e(-factor);
|
||||
e.MulByInvert(a);
|
||||
CheckCase(factor, e, -one, "-x * x^-1 == -1", tolerance);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ main(int argc, char* argv[])
|
||||
|
||||
NS_LOG_INFO("Create Source");
|
||||
Config::SetDefault("ns3::Ipv4RawSocketImpl::Protocol", StringValue("2"));
|
||||
InetSocketAddress dst = InetSocketAddress(addresses.GetAddress(3));
|
||||
InetSocketAddress dst(addresses.GetAddress(3));
|
||||
OnOffHelper onoff = OnOffHelper("ns3::Ipv4RawSocketFactory", dst);
|
||||
onoff.SetConstantRate(DataRate(15000));
|
||||
onoff.SetAttribute("PacketSize", UintegerValue(1200));
|
||||
|
||||
@@ -93,7 +93,7 @@ main(int argc, char* argv[])
|
||||
NS_LOG_INFO("Create Source");
|
||||
// IP protocol configuration
|
||||
Config::SetDefault("ns3::Ipv4RawSocketImpl::Protocol", StringValue("2"));
|
||||
InetSocketAddress dst = InetSocketAddress(addresses.GetAddress(3));
|
||||
InetSocketAddress dst(addresses.GetAddress(3));
|
||||
OnOffHelper onoff = OnOffHelper("ns3::Ipv4RawSocketFactory", dst);
|
||||
onoff.SetConstantRate(DataRate(dataRate * 1000));
|
||||
onoff.SetAttribute("PacketSize", UintegerValue(1250));
|
||||
|
||||
@@ -277,7 +277,7 @@ CsmaHelper::Install(const NodeContainer& c, Ptr<CsmaChannel> channel) const
|
||||
{
|
||||
NetDeviceContainer devs;
|
||||
|
||||
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); i++)
|
||||
for (auto i = c.Begin(); i != c.End(); i++)
|
||||
{
|
||||
devs.Add(InstallPriv(*i, channel));
|
||||
}
|
||||
@@ -297,7 +297,7 @@ CsmaHelper::AssignStreams(NetDeviceContainer c, int64_t stream)
|
||||
{
|
||||
int64_t currentStream = stream;
|
||||
Ptr<NetDevice> netDevice;
|
||||
for (NetDeviceContainer::Iterator i = c.Begin(); i != c.End(); ++i)
|
||||
for (auto i = c.Begin(); i != c.End(); ++i)
|
||||
{
|
||||
netDevice = (*i);
|
||||
Ptr<CsmaNetDevice> csma = DynamicCast<CsmaNetDevice>(netDevice);
|
||||
|
||||
@@ -75,7 +75,7 @@ Backoff::GetBackoffTime()
|
||||
maxSlot = m_maxSlots;
|
||||
}
|
||||
|
||||
uint32_t backoffSlots = (uint32_t)m_rng->GetValue(minSlot, maxSlot);
|
||||
auto backoffSlots = (uint32_t)m_rng->GetValue(minSlot, maxSlot);
|
||||
|
||||
Time backoff = Time(backoffSlots * m_slotTime);
|
||||
return backoff;
|
||||
|
||||
@@ -86,8 +86,7 @@ CsmaChannel::Reattach(Ptr<CsmaNetDevice> device)
|
||||
NS_LOG_FUNCTION(this << device);
|
||||
NS_ASSERT(device);
|
||||
|
||||
std::vector<CsmaDeviceRec>::iterator it;
|
||||
for (it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
for (auto it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
{
|
||||
if (it->devicePtr == device)
|
||||
{
|
||||
@@ -161,8 +160,7 @@ CsmaChannel::Detach(Ptr<CsmaNetDevice> device)
|
||||
NS_LOG_FUNCTION(this << device);
|
||||
NS_ASSERT(device);
|
||||
|
||||
std::vector<CsmaDeviceRec>::iterator it;
|
||||
for (it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
for (auto it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
{
|
||||
if ((it->devicePtr == device) && (it->active))
|
||||
{
|
||||
@@ -227,8 +225,7 @@ CsmaChannel::TransmitEnd()
|
||||
|
||||
NS_LOG_LOGIC("Receive");
|
||||
|
||||
std::vector<CsmaDeviceRec>::iterator it;
|
||||
for (it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
for (auto it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
{
|
||||
if (it->IsActive() && it->devicePtr != m_deviceList[m_currentSrc].devicePtr)
|
||||
{
|
||||
@@ -261,8 +258,7 @@ uint32_t
|
||||
CsmaChannel::GetNumActDevices()
|
||||
{
|
||||
int numActDevices = 0;
|
||||
std::vector<CsmaDeviceRec>::iterator it;
|
||||
for (it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
for (auto it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
{
|
||||
if (it->active)
|
||||
{
|
||||
@@ -287,9 +283,8 @@ CsmaChannel::GetCsmaDevice(std::size_t i) const
|
||||
int32_t
|
||||
CsmaChannel::GetDeviceNum(Ptr<CsmaNetDevice> device)
|
||||
{
|
||||
std::vector<CsmaDeviceRec>::iterator it;
|
||||
int i = 0;
|
||||
for (it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
for (auto it = m_deviceList.begin(); it < m_deviceList.end(); it++)
|
||||
{
|
||||
if (it->devicePtr == device)
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ PacketQueue::Enqueue(QueueEntry& entry)
|
||||
NS_LOG_FUNCTION("Enqueuing packet destined for" << entry.GetIpv4Header().GetDestination());
|
||||
Purge();
|
||||
uint32_t numPacketswithdst;
|
||||
for (std::vector<QueueEntry>::const_iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if ((i->GetPacket()->GetUid() == entry.GetPacket()->GetUid()) &&
|
||||
(i->GetIpv4Header().GetDestination() == entry.GetIpv4Header().GetDestination()))
|
||||
@@ -86,7 +86,7 @@ PacketQueue::DropPacketWithDst(Ipv4Address dst)
|
||||
{
|
||||
NS_LOG_FUNCTION("Dropping packet to " << dst);
|
||||
Purge();
|
||||
for (std::vector<QueueEntry>::iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (i->GetIpv4Header().GetDestination() == dst)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ PacketQueue::Dequeue(Ipv4Address dst, QueueEntry& entry)
|
||||
{
|
||||
NS_LOG_FUNCTION("Dequeueing packet destined for" << dst);
|
||||
Purge();
|
||||
for (std::vector<QueueEntry>::iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (i->GetIpv4Header().GetDestination() == dst)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ PacketQueue::Dequeue(Ipv4Address dst, QueueEntry& entry)
|
||||
bool
|
||||
PacketQueue::Find(Ipv4Address dst)
|
||||
{
|
||||
for (std::vector<QueueEntry>::const_iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (i->GetIpv4Header().GetDestination() == dst)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ uint32_t
|
||||
PacketQueue::GetCountForPacketsWithDst(Ipv4Address dst)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
for (std::vector<QueueEntry>::const_iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (i->GetIpv4Header().GetDestination() == dst)
|
||||
{
|
||||
@@ -166,7 +166,7 @@ PacketQueue::Purge()
|
||||
{
|
||||
// NS_LOG_DEBUG("Purging Queue");
|
||||
IsExpired pred;
|
||||
for (std::vector<QueueEntry>::iterator i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
for (auto i = m_queue.begin(); i != m_queue.end(); ++i)
|
||||
{
|
||||
if (pred(*i))
|
||||
{
|
||||
|
||||
@@ -241,9 +241,7 @@ void
|
||||
RoutingProtocol::DoDispose()
|
||||
{
|
||||
m_ipv4 = nullptr;
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::iterator iter = m_socketAddresses.begin();
|
||||
iter != m_socketAddresses.end();
|
||||
iter++)
|
||||
for (auto iter = m_socketAddresses.begin(); iter != m_socketAddresses.end(); iter++)
|
||||
{
|
||||
iter->first->Close();
|
||||
}
|
||||
@@ -304,9 +302,7 @@ RoutingProtocol::RouteOutput(Ptr<Packet> p,
|
||||
<< ", Destination address in Packet: " << dst);
|
||||
RoutingTableEntry rt;
|
||||
m_routingTable.Purge(removedAddresses);
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator rmItr = removedAddresses.begin();
|
||||
rmItr != removedAddresses.end();
|
||||
++rmItr)
|
||||
for (auto rmItr = removedAddresses.begin(); rmItr != removedAddresses.end(); ++rmItr)
|
||||
{
|
||||
rmItr->second.SetEntriesChanged(true);
|
||||
rmItr->second.SetSeqNo(rmItr->second.GetSeqNo() + 1);
|
||||
@@ -428,9 +424,7 @@ RoutingProtocol::RouteInput(Ptr<const Packet> p,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
if (origin == iface.GetLocal())
|
||||
@@ -439,9 +433,7 @@ RoutingProtocol::RouteInput(Ptr<const Packet> p,
|
||||
}
|
||||
}
|
||||
// LOCAL DELIVARY TO DSDV INTERFACES
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
if (m_ipv4->GetInterfaceForAddress(iface.GetLocal()) == iif)
|
||||
@@ -545,7 +537,7 @@ RoutingProtocol::LoopbackRoute(const Ipv4Header& hdr, Ptr<NetDevice> oif) const
|
||||
// If RouteOutput() caller specified an outgoing interface, that
|
||||
// further constrains the selection of source address
|
||||
//
|
||||
std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
auto j = m_socketAddresses.begin();
|
||||
if (oif)
|
||||
{
|
||||
// Iterate to find an address on the oif device
|
||||
@@ -592,10 +584,7 @@ RoutingProtocol::RecvDsdv(Ptr<Socket> socket)
|
||||
packet->RemoveHeader(dsdvHeader);
|
||||
NS_LOG_DEBUG("Processing new update for " << dsdvHeader.GetDst());
|
||||
/*Verifying if the packets sent by me were returned back to me. If yes, discarding them!*/
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j =
|
||||
m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ipv4InterfaceAddress interface = j->second;
|
||||
if (dsdvHeader.GetDst() == interface.GetLocal())
|
||||
@@ -661,9 +650,7 @@ RoutingProtocol::RecvDsdv(Ptr<Socket> socket)
|
||||
RoutingTableEntry tr;
|
||||
std::map<Ipv4Address, RoutingTableEntry> allRoutes;
|
||||
m_advRoutingTable.GetListOfAllRoutes(allRoutes);
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin();
|
||||
i != allRoutes.end();
|
||||
++i)
|
||||
for (auto i = allRoutes.begin(); i != allRoutes.end(); ++i)
|
||||
{
|
||||
NS_LOG_DEBUG("ADV table routes are:" << i->second.GetDestination());
|
||||
}
|
||||
@@ -800,10 +787,7 @@ RoutingProtocol::RecvDsdv(Ptr<Socket> socket)
|
||||
advTableEntry.SetSeqNo(dsdvHeader.GetDstSeqno());
|
||||
advTableEntry.SetEntriesChanged(true);
|
||||
m_advRoutingTable.Update(advTableEntry);
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator i =
|
||||
dstsWithNextHopSrc.begin();
|
||||
i != dstsWithNextHopSrc.end();
|
||||
++i)
|
||||
for (auto i = dstsWithNextHopSrc.begin(); i != dstsWithNextHopSrc.end(); ++i)
|
||||
{
|
||||
i->second.SetSeqNo(i->second.GetSeqNo() + 1);
|
||||
i->second.SetEntriesChanged(true);
|
||||
@@ -844,17 +828,13 @@ RoutingProtocol::SendTriggeredUpdate()
|
||||
NS_LOG_FUNCTION(m_mainAddress << " is sending a triggered update");
|
||||
std::map<Ipv4Address, RoutingTableEntry> allRoutes;
|
||||
m_advRoutingTable.GetListOfAllRoutes(allRoutes);
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
DsdvHeader dsdvHeader;
|
||||
Ptr<Socket> socket = j->first;
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
Ptr<Packet> packet = Create<Packet>();
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin();
|
||||
i != allRoutes.end();
|
||||
++i)
|
||||
for (auto i = allRoutes.begin(); i != allRoutes.end(); ++i)
|
||||
{
|
||||
NS_LOG_LOGIC("Destination: " << i->second.GetDestination()
|
||||
<< " SeqNo:" << i->second.GetSeqNo()
|
||||
@@ -930,16 +910,12 @@ RoutingProtocol::SendPeriodicUpdate()
|
||||
return;
|
||||
}
|
||||
NS_LOG_FUNCTION(m_mainAddress << " is sending out its periodic update");
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ptr<Socket> socket = j->first;
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
Ptr<Packet> packet = Create<Packet>();
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin();
|
||||
i != allRoutes.end();
|
||||
++i)
|
||||
for (auto i = allRoutes.begin(); i != allRoutes.end(); ++i)
|
||||
{
|
||||
DsdvHeader dsdvHeader;
|
||||
if (i->second.GetHop() == 0)
|
||||
@@ -966,10 +942,7 @@ RoutingProtocol::SendPeriodicUpdate()
|
||||
<< ", HopCount:" << dsdvHeader.GetHopCount()
|
||||
<< ", LifeTime: " << i->second.GetLifeTime().As(Time::S));
|
||||
}
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator rmItr =
|
||||
removedAddresses.begin();
|
||||
rmItr != removedAddresses.end();
|
||||
++rmItr)
|
||||
for (auto rmItr = removedAddresses.begin(); rmItr != removedAddresses.end(); ++rmItr)
|
||||
{
|
||||
DsdvHeader removedHeader;
|
||||
removedHeader.SetDst(rmItr->second.GetDestination());
|
||||
@@ -1143,9 +1116,7 @@ RoutingProtocol::NotifyRemoveAddress(uint32_t i, Ipv4InterfaceAddress address)
|
||||
Ptr<Socket>
|
||||
RoutingProtocol::FindSocketWithInterfaceAddress(Ipv4InterfaceAddress addr) const
|
||||
{
|
||||
for (std::map<Ptr<Socket>, Ipv4InterfaceAddress>::const_iterator j = m_socketAddresses.begin();
|
||||
j != m_socketAddresses.end();
|
||||
++j)
|
||||
for (auto j = m_socketAddresses.begin(); j != m_socketAddresses.end(); ++j)
|
||||
{
|
||||
Ptr<Socket> socket = j->first;
|
||||
Ipv4InterfaceAddress iface = j->second;
|
||||
@@ -1181,9 +1152,7 @@ RoutingProtocol::LookForQueuedPackets()
|
||||
Ptr<Ipv4Route> route;
|
||||
std::map<Ipv4Address, RoutingTableEntry> allRoutes;
|
||||
m_routingTable.GetListOfAllRoutes(allRoutes);
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin();
|
||||
i != allRoutes.end();
|
||||
++i)
|
||||
for (auto i = allRoutes.begin(); i != allRoutes.end(); ++i)
|
||||
{
|
||||
RoutingTableEntry rt;
|
||||
rt = i->second;
|
||||
@@ -1282,9 +1251,7 @@ RoutingProtocol::MergeTriggerPeriodicUpdates()
|
||||
m_advRoutingTable.GetListOfAllRoutes(allRoutes);
|
||||
if (!allRoutes.empty())
|
||||
{
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin();
|
||||
i != allRoutes.end();
|
||||
++i)
|
||||
for (auto i = allRoutes.begin(); i != allRoutes.end(); ++i)
|
||||
{
|
||||
RoutingTableEntry advEntry = i->second;
|
||||
if (advEntry.GetEntriesChanged() &&
|
||||
|
||||
@@ -80,7 +80,7 @@ RoutingTable::LookupRoute(Ipv4Address id, RoutingTableEntry& rt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = m_ipv4AddressEntry.find(id);
|
||||
auto i = m_ipv4AddressEntry.find(id);
|
||||
if (i == m_ipv4AddressEntry.end())
|
||||
{
|
||||
return false;
|
||||
@@ -96,7 +96,7 @@ RoutingTable::LookupRoute(Ipv4Address id, RoutingTableEntry& rt, bool forRouteIn
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = m_ipv4AddressEntry.find(id);
|
||||
auto i = m_ipv4AddressEntry.find(id);
|
||||
if (i == m_ipv4AddressEntry.end())
|
||||
{
|
||||
return false;
|
||||
@@ -124,16 +124,14 @@ RoutingTable::RoutingTableSize()
|
||||
bool
|
||||
RoutingTable::AddRoute(RoutingTableEntry& rt)
|
||||
{
|
||||
std::pair<std::map<Ipv4Address, RoutingTableEntry>::iterator, bool> result =
|
||||
m_ipv4AddressEntry.insert(std::make_pair(rt.GetDestination(), rt));
|
||||
auto result = m_ipv4AddressEntry.insert(std::make_pair(rt.GetDestination(), rt));
|
||||
return result.second;
|
||||
}
|
||||
|
||||
bool
|
||||
RoutingTable::Update(RoutingTableEntry& rt)
|
||||
{
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator i =
|
||||
m_ipv4AddressEntry.find(rt.GetDestination());
|
||||
auto i = m_ipv4AddressEntry.find(rt.GetDestination());
|
||||
if (i == m_ipv4AddressEntry.end())
|
||||
{
|
||||
return false;
|
||||
@@ -149,12 +147,11 @@ RoutingTable::DeleteAllRoutesFromInterface(Ipv4InterfaceAddress iface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end();)
|
||||
{
|
||||
if (i->second.GetInterface() == iface)
|
||||
{
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
|
||||
auto tmp = i;
|
||||
++i;
|
||||
m_ipv4AddressEntry.erase(tmp);
|
||||
}
|
||||
@@ -168,9 +165,7 @@ RoutingTable::DeleteAllRoutesFromInterface(Ipv4InterfaceAddress iface)
|
||||
void
|
||||
RoutingTable::GetListOfAllRoutes(std::map<Ipv4Address, RoutingTableEntry>& allRoutes)
|
||||
{
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();
|
||||
++i)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end(); ++i)
|
||||
{
|
||||
if (i->second.GetDestination() != Ipv4Address("127.0.0.1") && i->second.GetFlag() == VALID)
|
||||
{
|
||||
@@ -184,9 +179,7 @@ RoutingTable::GetListOfDestinationWithNextHop(Ipv4Address nextHop,
|
||||
std::map<Ipv4Address, RoutingTableEntry>& unreachable)
|
||||
{
|
||||
unreachable.clear();
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();
|
||||
++i)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end(); ++i)
|
||||
{
|
||||
if (i->second.GetNextHop() == nextHop)
|
||||
{
|
||||
@@ -234,19 +227,17 @@ RoutingTable::Purge(std::map<Ipv4Address, RoutingTableEntry>& removedAddresses)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end();)
|
||||
{
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator itmp = i;
|
||||
auto itmp = i;
|
||||
if (i->second.GetLifeTime() > m_holddownTime && (i->second.GetHop() > 0))
|
||||
{
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::iterator j = m_ipv4AddressEntry.begin();
|
||||
j != m_ipv4AddressEntry.end();)
|
||||
for (auto j = m_ipv4AddressEntry.begin(); j != m_ipv4AddressEntry.end();)
|
||||
{
|
||||
if ((j->second.GetNextHop() == i->second.GetDestination()) &&
|
||||
(i->second.GetHop() != j->second.GetHop()))
|
||||
{
|
||||
std::map<Ipv4Address, RoutingTableEntry>::iterator jtmp = j;
|
||||
auto jtmp = j;
|
||||
removedAddresses.insert(std::make_pair(j->first, j->second));
|
||||
++j;
|
||||
m_ipv4AddressEntry.erase(jtmp);
|
||||
@@ -291,9 +282,7 @@ RoutingTable::Print(Ptr<OutputStreamWrapper> stream, Time::Unit unit /*= Time::S
|
||||
*os << std::setw(16) << "SeqNum";
|
||||
*os << std::setw(16) << "LifeTime";
|
||||
*os << "SettlingTime" << std::endl;
|
||||
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = m_ipv4AddressEntry.begin();
|
||||
i != m_ipv4AddressEntry.end();
|
||||
++i)
|
||||
for (auto i = m_ipv4AddressEntry.begin(); i != m_ipv4AddressEntry.end(); ++i)
|
||||
{
|
||||
i->second.Print(stream, unit);
|
||||
}
|
||||
@@ -305,8 +294,7 @@ RoutingTable::Print(Ptr<OutputStreamWrapper> stream, Time::Unit unit /*= Time::S
|
||||
bool
|
||||
RoutingTable::AddIpv4Event(Ipv4Address address, EventId id)
|
||||
{
|
||||
std::pair<std::map<Ipv4Address, EventId>::iterator, bool> result =
|
||||
m_ipv4Events.insert(std::make_pair(address, id));
|
||||
auto result = m_ipv4Events.insert(std::make_pair(address, id));
|
||||
return result.second;
|
||||
}
|
||||
|
||||
@@ -314,7 +302,7 @@ bool
|
||||
RoutingTable::AnyRunningEvent(Ipv4Address address)
|
||||
{
|
||||
EventId event;
|
||||
std::map<Ipv4Address, EventId>::const_iterator i = m_ipv4Events.find(address);
|
||||
auto i = m_ipv4Events.find(address);
|
||||
if (m_ipv4Events.empty())
|
||||
{
|
||||
return false;
|
||||
@@ -331,7 +319,7 @@ bool
|
||||
RoutingTable::ForceDeleteIpv4Event(Ipv4Address address)
|
||||
{
|
||||
EventId event;
|
||||
std::map<Ipv4Address, EventId>::const_iterator i = m_ipv4Events.find(address);
|
||||
auto i = m_ipv4Events.find(address);
|
||||
if (m_ipv4Events.empty() || i == m_ipv4Events.end())
|
||||
{
|
||||
return false;
|
||||
@@ -346,7 +334,7 @@ bool
|
||||
RoutingTable::DeleteIpv4Event(Ipv4Address address)
|
||||
{
|
||||
EventId event;
|
||||
std::map<Ipv4Address, EventId>::const_iterator i = m_ipv4Events.find(address);
|
||||
auto i = m_ipv4Events.find(address);
|
||||
if (m_ipv4Events.empty() || i == m_ipv4Events.end())
|
||||
{
|
||||
return false;
|
||||
@@ -372,7 +360,7 @@ RoutingTable::DeleteIpv4Event(Ipv4Address address)
|
||||
EventId
|
||||
RoutingTable::GetEventId(Ipv4Address address)
|
||||
{
|
||||
std::map<Ipv4Address, EventId>::const_iterator i = m_ipv4Events.find(address);
|
||||
auto i = m_ipv4Events.find(address);
|
||||
if (m_ipv4Events.empty() || i == m_ipv4Events.end())
|
||||
{
|
||||
return EventId();
|
||||
|
||||
@@ -81,7 +81,7 @@ DsrMainHelper::Install(DsrHelper& dsrHelper, NodeContainer nodes)
|
||||
NS_LOG_DEBUG("Passed node container");
|
||||
delete m_dsrHelper;
|
||||
m_dsrHelper = dsrHelper.Copy();
|
||||
for (NodeContainer::Iterator i = nodes.Begin(); i != nodes.End(); ++i)
|
||||
for (auto i = nodes.Begin(); i != nodes.End(); ++i)
|
||||
{
|
||||
Install(*i);
|
||||
}
|
||||
|
||||
@@ -56,9 +56,7 @@ bool
|
||||
DsrErrorBuffer::Enqueue(DsrErrorBuffEntry& entry)
|
||||
{
|
||||
Purge();
|
||||
for (std::vector<DsrErrorBuffEntry>::const_iterator i = m_errorBuffer.begin();
|
||||
i != m_errorBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_errorBuffer.begin(); i != m_errorBuffer.end(); ++i)
|
||||
{
|
||||
NS_LOG_INFO("packet id " << i->GetPacket()->GetUid() << " " << entry.GetPacket()->GetUid()
|
||||
<< " source " << i->GetSource() << " " << entry.GetSource()
|
||||
@@ -101,9 +99,7 @@ DsrErrorBuffer::DropPacketForErrLink(Ipv4Address source, Ipv4Address nextHop)
|
||||
/*
|
||||
* Drop the packet with the error link source----------nextHop
|
||||
*/
|
||||
for (std::vector<DsrErrorBuffEntry>::iterator i = m_errorBuffer.begin();
|
||||
i != m_errorBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_errorBuffer.begin(); i != m_errorBuffer.end(); ++i)
|
||||
{
|
||||
if ((i->GetSource() == link[0]) && (i->GetNextHop() == link[1]))
|
||||
{
|
||||
@@ -127,9 +123,7 @@ DsrErrorBuffer::Dequeue(Ipv4Address dst, DsrErrorBuffEntry& entry)
|
||||
/*
|
||||
* Dequeue the entry with destination address dst
|
||||
*/
|
||||
for (std::vector<DsrErrorBuffEntry>::iterator i = m_errorBuffer.begin();
|
||||
i != m_errorBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_errorBuffer.begin(); i != m_errorBuffer.end(); ++i)
|
||||
{
|
||||
if (i->GetDestination() == dst)
|
||||
{
|
||||
@@ -148,9 +142,7 @@ DsrErrorBuffer::Find(Ipv4Address dst)
|
||||
/*
|
||||
* Make sure if the send buffer contains entry with certain dst
|
||||
*/
|
||||
for (std::vector<DsrErrorBuffEntry>::const_iterator i = m_errorBuffer.begin();
|
||||
i != m_errorBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_errorBuffer.begin(); i != m_errorBuffer.end(); ++i)
|
||||
{
|
||||
if (i->GetDestination() == dst)
|
||||
{
|
||||
@@ -184,9 +176,7 @@ DsrErrorBuffer::Purge()
|
||||
*/
|
||||
NS_LOG_DEBUG("The error buffer size " << m_errorBuffer.size());
|
||||
IsExpired pred;
|
||||
for (std::vector<DsrErrorBuffEntry>::iterator i = m_errorBuffer.begin();
|
||||
i != m_errorBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_errorBuffer.begin(); i != m_errorBuffer.end(); ++i)
|
||||
{
|
||||
if (pred(*i))
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ bool
|
||||
DsrGraReply::FindAndUpdate(Ipv4Address replyTo, Ipv4Address replyFrom, Time gratReplyHoldoff)
|
||||
{
|
||||
Purge(); // purge the gratuitous reply table
|
||||
for (std::vector<GraReplyEntry>::iterator i = m_graReply.begin(); i != m_graReply.end(); ++i)
|
||||
for (auto i = m_graReply.begin(); i != m_graReply.end(); ++i)
|
||||
{
|
||||
if ((i->m_replyTo == replyTo) && (i->m_hearFrom == replyFrom))
|
||||
{
|
||||
|
||||
@@ -56,9 +56,7 @@ bool
|
||||
DsrMaintainBuffer::Enqueue(DsrMaintainBuffEntry& entry)
|
||||
{
|
||||
Purge();
|
||||
for (std::vector<DsrMaintainBuffEntry>::const_iterator i = m_maintainBuffer.begin();
|
||||
i != m_maintainBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_maintainBuffer.begin(); i != m_maintainBuffer.end(); ++i)
|
||||
{
|
||||
// NS_LOG_INFO ("nexthop " << i->GetNextHop () << " " << entry.GetNextHop () << " our
|
||||
// add " << i->GetOurAdd () << " " << entry.GetOurAdd ()
|
||||
@@ -106,9 +104,7 @@ bool
|
||||
DsrMaintainBuffer::Dequeue(Ipv4Address nextHop, DsrMaintainBuffEntry& entry)
|
||||
{
|
||||
Purge();
|
||||
for (std::vector<DsrMaintainBuffEntry>::iterator i = m_maintainBuffer.begin();
|
||||
i != m_maintainBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_maintainBuffer.begin(); i != m_maintainBuffer.end(); ++i)
|
||||
{
|
||||
if (i->GetNextHop() == nextHop)
|
||||
{
|
||||
@@ -124,9 +120,7 @@ DsrMaintainBuffer::Dequeue(Ipv4Address nextHop, DsrMaintainBuffEntry& entry)
|
||||
bool
|
||||
DsrMaintainBuffer::Find(Ipv4Address nextHop)
|
||||
{
|
||||
for (std::vector<DsrMaintainBuffEntry>::const_iterator i = m_maintainBuffer.begin();
|
||||
i != m_maintainBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_maintainBuffer.begin(); i != m_maintainBuffer.end(); ++i)
|
||||
{
|
||||
if (i->GetNextHop() == nextHop)
|
||||
{
|
||||
@@ -140,9 +134,7 @@ DsrMaintainBuffer::Find(Ipv4Address nextHop)
|
||||
bool
|
||||
DsrMaintainBuffer::AllEqual(DsrMaintainBuffEntry& entry)
|
||||
{
|
||||
for (std::vector<DsrMaintainBuffEntry>::iterator i = m_maintainBuffer.begin();
|
||||
i != m_maintainBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_maintainBuffer.begin(); i != m_maintainBuffer.end(); ++i)
|
||||
{
|
||||
// NS_LOG_DEBUG ("nexthop " << i->GetNextHop () << " " << entry.GetNextHop () << " our
|
||||
// address " << i->GetOurAdd () << " " << entry.GetOurAdd ()
|
||||
@@ -166,9 +158,7 @@ DsrMaintainBuffer::AllEqual(DsrMaintainBuffEntry& entry)
|
||||
bool
|
||||
DsrMaintainBuffer::NetworkEqual(DsrMaintainBuffEntry& entry)
|
||||
{
|
||||
for (std::vector<DsrMaintainBuffEntry>::iterator i = m_maintainBuffer.begin();
|
||||
i != m_maintainBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_maintainBuffer.begin(); i != m_maintainBuffer.end(); ++i)
|
||||
{
|
||||
// NS_LOG_DEBUG ("nexthop " << i->GetNextHop () << " " << entry.GetNextHop () << " our
|
||||
// address " << i->GetOurAdd () << " " << entry.GetOurAdd ()
|
||||
@@ -193,9 +183,7 @@ bool
|
||||
DsrMaintainBuffer::PromiscEqual(DsrMaintainBuffEntry& entry)
|
||||
{
|
||||
NS_LOG_DEBUG("The maintenance buffer size " << m_maintainBuffer.size());
|
||||
for (std::vector<DsrMaintainBuffEntry>::iterator i = m_maintainBuffer.begin();
|
||||
i != m_maintainBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_maintainBuffer.begin(); i != m_maintainBuffer.end(); ++i)
|
||||
{
|
||||
// NS_LOG_DEBUG ("src " << i->GetSrc () << " " << entry.GetSrc () << " dst " <<
|
||||
// i->GetDst () << " " << entry.GetDst ()
|
||||
@@ -220,9 +208,7 @@ bool
|
||||
DsrMaintainBuffer::LinkEqual(DsrMaintainBuffEntry& entry)
|
||||
{
|
||||
NS_LOG_DEBUG("The maintenance buffer size " << m_maintainBuffer.size());
|
||||
for (std::vector<DsrMaintainBuffEntry>::iterator i = m_maintainBuffer.begin();
|
||||
i != m_maintainBuffer.end();
|
||||
++i)
|
||||
for (auto i = m_maintainBuffer.begin(); i != m_maintainBuffer.end(); ++i)
|
||||
{
|
||||
// NS_LOG_DEBUG ("src " << i->GetSrc () << " " << entry.GetSrc () << " dst " <<
|
||||
// i->GetDst () << " " << entry.GetDst ()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user