core,dsr,netanim: Remove redundant casts when comparing strings

This commit is contained in:
Eduardo Almeida
2023-06-04 23:34:40 +01:00
parent a7db1484ae
commit 3e95f4fbd5
3 changed files with 14 additions and 14 deletions

View File

@@ -137,43 +137,43 @@ Time::Time(const std::string& s)
double r;
iss >> r;
std::string trailer = s.substr(n, std::string::npos);
if (trailer == std::string("s"))
if (trailer == "s")
{
*this = Time::FromDouble(r, Time::S);
}
else if (trailer == std::string("ms"))
else if (trailer == "ms")
{
*this = Time::FromDouble(r, Time::MS);
}
else if (trailer == std::string("us"))
else if (trailer == "us")
{
*this = Time::FromDouble(r, Time::US);
}
else if (trailer == std::string("ns"))
else if (trailer == "ns")
{
*this = Time::FromDouble(r, Time::NS);
}
else if (trailer == std::string("ps"))
else if (trailer == "ps")
{
*this = Time::FromDouble(r, Time::PS);
}
else if (trailer == std::string("fs"))
else if (trailer == "fs")
{
*this = Time::FromDouble(r, Time::FS);
}
else if (trailer == std::string("min"))
else if (trailer == "min")
{
*this = Time::FromDouble(r, Time::MIN);
}
else if (trailer == std::string("h"))
else if (trailer == "h")
{
*this = Time::FromDouble(r, Time::H);
}
else if (trailer == std::string("d"))
else if (trailer == "d")
{
*this = Time::FromDouble(r, Time::D);
}
else if (trailer == std::string("y"))
else if (trailer == "y")
{
*this = Time::FromDouble(r, Time::Y);
}

View File

@@ -308,11 +308,11 @@ void
DsrRouteCache::SetCacheType(std::string type)
{
NS_LOG_FUNCTION(this << type);
if (type == std::string("LinkCache"))
if (type == "LinkCache")
{
m_isLinkCache = true;
}
else if (type == std::string("PathCache"))
else if (type == "PathCache")
{
m_isLinkCache = false;
}

View File

@@ -2007,7 +2007,7 @@ AnimationInterface::WriteLinkProperties()
}
NS_LOG_DEBUG("Got ChannelType" << channelType);
if (!ch || (channelType != std::string("ns3::PointToPointChannel")))
if (!ch || (channelType != "ns3::PointToPointChannel"))
{
NS_LOG_DEBUG("No channel can't be a p2p device");
/*
@@ -2042,7 +2042,7 @@ AnimationInterface::WriteLinkProperties()
continue;
}
else if (channelType == std::string("ns3::PointToPointChannel"))
else if (channelType == "ns3::PointToPointChannel")
{ // Since these are duplex links, we only need to dump
// if srcid < dstid
std::size_t nChDev = ch->GetNDevices();