--- a/src/netanim/examples/wireless-animation.cc Tue Dec 10 09:12:38 2013 +0400
+++ b/src/netanim/examples/wireless-animation.cc Tue Dec 10 09:12:38 2013 +0400
@@ -120,10 +120,10 @@
Ptr<BasicEnergySource> energySource = CreateObject<BasicEnergySource>();
Ptr<SimpleDeviceEnergyModel> energyModel = CreateObject<SimpleDeviceEnergyModel>();
- energySource->SetInitialEnergy(300);
+ energySource->SetInitialEnergy (300);
energyModel->SetEnergySource (energySource);
energySource->AppendDeviceEnergyModel (energyModel);
- energyModel->SetCurrentA(20);
+ energyModel->SetCurrentA (20);
// aggregate energy source to node
wifiApNode.Get (0)->AggregateObject (energySource);
@@ -175,7 +175,7 @@
AnimationInterface anim ("wireless-animation.xml"); // Mandatory
anim.EnablePacketMetadata (true); // Optional
- anim.EnableIpv4RouteTracking ("routingtable-wireless.xml", Seconds(0), Seconds(5), Seconds(0.25)); //Optional
+ anim.EnableIpv4RouteTracking ("routingtable-wireless.xml", Seconds (0), Seconds (5), Seconds (0.25)); //Optional
Simulator::Run ();
Simulator::Destroy ();
return 0;
--- a/src/netanim/model/animation-interface.cc Tue Dec 10 09:12:38 2013 +0400
+++ b/src/netanim/model/animation-interface.cc Tue Dec 10 09:12:38 2013 +0400
@@ -65,11 +65,11 @@
AnimationInterface::AnimationInterface (const std::string fn, uint64_t maxPktsPerFile, bool usingXML)
- : m_routingF (0), m_xml (usingXML), m_mobilityPollInterval (Seconds(0.25)),
+ : m_routingF (0), m_xml (usingXML), m_mobilityPollInterval (Seconds (0.25)),
m_outputFileName (fn),
m_outputFileSet (false), gAnimUid (0), m_randomPosition (true),
m_writeCallback (0), m_started (false),
- m_enablePacketMetadata (false), m_startTime (Seconds(0)), m_stopTime (Seconds(3600 * 1000)),
+ m_enablePacketMetadata (false), m_startTime (Seconds (0)), m_stopTime (Seconds (3600 * 1000)),
m_maxPktsPerFile (maxPktsPerFile), m_originalFileName (fn),
m_routingStopTime (Seconds (0)), m_routingFileName (""),
m_routingPollInterval (Seconds (5))
@@ -118,7 +118,7 @@
std::stringstream stream;
Ptr<OutputStreamWrapper> routingstream = Create<OutputStreamWrapper> (&stream);
ipv4->GetRoutingProtocol ()->PrintRoutingTable (routingstream);
- return stream.str();
+ return stream.str ();
}
@@ -470,9 +470,9 @@
Vector AnimationInterface::GetPosition (Ptr <Node> n)
{
#ifdef NS_LOG
- if (m_nodeLocation.find (n->GetId()) == m_nodeLocation.end ())
+ if (m_nodeLocation.find (n->GetId ()) == m_nodeLocation.end ())
{
- NS_FATAL_ERROR ("Node:" <<n->GetId() << " not found in Location table");
+ NS_FATAL_ERROR ("Node:" <<n->GetId () << " not found in Location table");
}
#endif
return m_nodeLocation[n->GetId ()];
@@ -588,7 +588,7 @@
std::string AnimationInterface::GetMacAddress (Ptr <NetDevice> nd)
{
- Address nodeAddr = nd->GetAddress();
+ Address nodeAddr = nd->GetAddress ();
std::ostringstream oss;
oss << nodeAddr;
return oss.str ().substr (6); // Skip the first 6 chars to get the Mac
@@ -798,7 +798,7 @@
uint32_t nDevices = n->GetNDevices ();
for (uint32_t devIndex = 0; devIndex < nDevices; ++devIndex)
{
- Ptr <NetDevice> nd = n->GetDevice(devIndex);
+ Ptr <NetDevice> nd = n->GetDevice (devIndex);
if (!nd)
continue;
Ptr<LteUeNetDevice> lteUeNetDevice = DynamicCast<LteUeNetDevice> (nd);
@@ -1027,7 +1027,7 @@
// where element [1] is the Node Id
std::vector <std::string> elements = GetElementsFromContext (context);
- Ptr <Node> n = NodeList::GetNode (atoi (elements.at(1).c_str ()));
+ Ptr <Node> n = NodeList::GetNode (atoi (elements.at (1).c_str ()));
NS_ASSERT (n);
return n;
@@ -1041,9 +1041,9 @@
// element [2] is the NetDevice Id
std::vector <std::string> elements = GetElementsFromContext (context);
- Ptr <Node> n = GetNodeFromContext(context);
+ Ptr <Node> n = GetNodeFromContext (context);
- return n->GetDevice (atoi (elements.at(3).c_str ()));
+ return n->GetDevice (atoi (elements.at (3).c_str ()));
}
void AnimationInterface::AddPendingUanPacket (uint64_t AnimUid, AnimPacketInfo &pktinfo)
@@ -1145,21 +1145,21 @@
if (!m_started || !IsInTimeWindow ())
return;
- const Ptr <const Node> node = GetNodeFromContext(context);
- const uint32_t nodeId = node->GetId();
+ const Ptr <const Node> node = GetNodeFromContext (context);
+ const uint32_t nodeId = node->GetId ();
NS_LOG_INFO ("Remaining energy on one of sources on node " << nodeId << ": " << currentEnergy);
const Ptr<EnergySource> energySource = node->GetObject<EnergySource> ();
- NS_ASSERT(energySource);
- // Don't call GetEnergyFraction() because of recursion
- const double energyFraction = currentEnergy / energySource->GetInitialEnergy();
+ NS_ASSERT (energySource);
+ // Don't call GetEnergyFraction () because of recursion
+ const double energyFraction = currentEnergy / energySource->GetInitialEnergy ();
NS_LOG_INFO ("Total energy fraction on node " << nodeId << ": " << energyFraction);
m_nodeEnergyFraction[nodeId] = energyFraction;
- WriteNodeUpdate(nodeId);
+ WriteNodeUpdate (nodeId);
}
void AnimationInterface::WifiPhyTxBeginTrace (std::string context,
@@ -1180,7 +1180,7 @@
AnimPacketInfo pktinfo (ndev, Simulator::Now (), Simulator::Now (), UpdatePosition (n));
AddPendingWifiPacket (gAnimUid, pktinfo);
Ptr<WifiNetDevice> netDevice = DynamicCast<WifiNetDevice> (ndev);
- Mac48Address nodeAddr = netDevice->GetMac()->GetAddress();
+ Mac48Address nodeAddr = netDevice->GetMac ()->GetAddress ();
std::ostringstream oss;
oss << nodeAddr;
m_macToNodeIdMap[oss.str ()] = n->GetId ();
@@ -1223,7 +1223,7 @@
NS_LOG_WARN ("WifiPhyRxBeginTrace: unknown Uid");
std::ostringstream oss;
WifiMacHeader hdr;
- if(!p->PeekHeader (hdr))
+ if (!p->PeekHeader (hdr))
{
NS_LOG_WARN ("WifiMacHeader not present");
return;
@@ -1629,9 +1629,9 @@
double AnimationInterface::GetNodeEnergyFraction (Ptr <const Node> node) const
{
- const EnergyFractionMap::const_iterator fractionIter = m_nodeEnergyFraction.find(node->GetId());
+ const EnergyFractionMap::const_iterator fractionIter = m_nodeEnergyFraction.find (node->GetId ());
- NS_ASSERT (fractionIter != m_nodeEnergyFraction.end());
+ NS_ASSERT (fractionIter != m_nodeEnergyFraction.end ());
return fractionIter->second;
}
@@ -1783,7 +1783,7 @@
{
NS_ASSERT (NodeList::GetNode (nodeId));
NS_LOG_INFO ("Setting node visibility for Node Id:" << nodeId);
- WriteNodeUpdate(nodeId);
+ WriteNodeUpdate (nodeId);
}
void AnimationInterface::ShowNode (Ptr <Node> n, bool show)
@@ -1809,7 +1809,7 @@
NS_LOG_INFO ("Setting node color for Node Id:" << nodeId);
struct Rgb rgb = {r, g, b};
nodeColors[nodeId] = rgb;
- WriteNodeUpdate(nodeId);
+ WriteNodeUpdate (nodeId);
}
@@ -1857,7 +1857,7 @@
/* DEBUG */
/*
for (std::map <P2pLinkNodeIdPair, LinkProperties>::const_iterator i = linkProperties.begin ();
- i != linkProperties.end(); ++i)
+ i != linkProperties.end (); ++i)
{
P2pLinkNodeIdPair ppair = i->first;
LinkProperties l = i->second;
@@ -1949,9 +1949,9 @@
oss << " visible=\"" << 1 << "\"";
else
oss << " visible=\"" << 0 << "\"";
- AppendXMLNodeDescription(oss, id);
- AppendXMLNodeColor(oss, nodeColors[id]);
- AppendXMLRemainingEnergy(oss, id);
+ AppendXMLNodeDescription (oss, id);
+ AppendXMLNodeColor (oss, nodeColors[id]);
+ AppendXMLRemainingEnergy (oss, id);
oss <<"/>\n";
@@ -1963,9 +1963,9 @@
{
std::ostringstream oss;
oss <<"<node id=\"" << id << "\"";
- AppendXMLNodeDescription(oss, id);
+ AppendXMLNodeDescription (oss, id);
oss << " locX = \"" << locX << "\" " << "locY = \"" << locY << "\"";
- AppendXMLRemainingEnergy(oss, id);
+ AppendXMLRemainingEnergy (oss, id);
oss <<"/>\n";
@@ -1976,10 +1976,10 @@
{
std::ostringstream oss;
oss <<"<node id = \"" << id << "\"";
- AppendXMLNodeDescription(oss, id);
+ AppendXMLNodeDescription (oss, id);
oss << " locX=\"" << locX << "\" " << "locY=\"" << locY << "\"";
- AppendXMLNodeColor(oss, rgb);
- AppendXMLRemainingEnergy(oss, id);
+ AppendXMLNodeColor (oss, rgb);
+ AppendXMLRemainingEnergy (oss, id);
oss <<"/>\n";
@@ -2014,11 +2014,11 @@
P2pLinkNodeIdPair p1 = { fromId, toId };
P2pLinkNodeIdPair p2 = { toId, fromId };
- if (linkProperties.find (p1) != linkProperties.end())
+ if (linkProperties.find (p1) != linkProperties.end ())
{
lprop = linkProperties[p1];
}
- else if (linkProperties.find (p2) != linkProperties.end())
+ else if (linkProperties.find (p2) != linkProperties.end ())
{
lprop = linkProperties[p2];
}
@@ -2038,7 +2038,7 @@
oss << "<p fId=\"" << fromId
<< "\" fbTx=\"" << fbTx
<< "\" lbTx=\"" << lbTx
- << (auxInfo.empty()?"":"\" aux=\"") << auxInfo.c_str () << "\">";
+ << (auxInfo.empty ()?"":"\" aux=\"") << auxInfo.c_str () << "\">";
return oss.str ();
}
@@ -2152,7 +2152,7 @@
return elements;
}
-void AnimationInterface::AppendXMLNodeDescription(std::ostream& ostream, uint32_t id) const
+void AnimationInterface::AppendXMLNodeDescription (std::ostream& ostream, uint32_t id) const
{
if (nodeDescriptions.find (id) != nodeDescriptions.end ())
{
@@ -2164,7 +2164,7 @@
}
}
-void AnimationInterface::AppendXMLNodeColor(std::ostream& ostream, const Rgb& color) const
+void AnimationInterface::AppendXMLNodeColor (std::ostream& ostream, const Rgb& color) const
{
const uint8_t r = color.r;
const uint8_t g = color.g;
@@ -2175,13 +2175,13 @@
<< " b=\"" << (uint32_t)b <<"\" ";
}
-void AnimationInterface::AppendXMLRemainingEnergy(std::ostream& ostream, uint32_t id) const
+void AnimationInterface::AppendXMLRemainingEnergy (std::ostream& ostream, uint32_t id) const
{
- const EnergyFractionMap::const_iterator fractionIter = m_nodeEnergyFraction.find(id);
+ const EnergyFractionMap::const_iterator fractionIter = m_nodeEnergyFraction.find (id);
- if(fractionIter != m_nodeEnergyFraction.end())
+ if (fractionIter != m_nodeEnergyFraction.end ())
ostream << "rc = \"" << fractionIter->second <<"\" ";
- else if(NodeList::GetNode (id)->GetObject<EnergySource>())
+ else if (NodeList::GetNode (id)->GetObject<EnergySource>())
ostream << "rc = \"1\" ";
}
--- a/src/netanim/model/animation-interface.h Tue Dec 10 09:12:38 2013 +0400
+++ b/src/netanim/model/animation-interface.h Tue Dec 10 09:12:38 2013 +0400
@@ -138,7 +138,7 @@
*
* \returns reference to this AnimationInterface object
*/
- AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, Time pollInterval = Seconds(5));
+ AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, Time pollInterval = Seconds (5));
/**
* \brief Enable tracking of the Ipv4 routing table for a set of Nodes
@@ -152,7 +152,7 @@
*
* \returns reference to this AnimationInterface object
*/
- AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, NodeContainer nc, Time pollInterval = Seconds(5));
+ AnimationInterface & EnableIpv4RouteTracking (std::string fileName, Time startTime, Time stopTime, NodeContainer nc, Time pollInterval = Seconds (5));
/**
* \brief Check if AnimationInterface is initialized
@@ -630,7 +630,7 @@
EnergyFractionMap m_nodeEnergyFraction;
uint64_t m_currentPktCount;
- void StartNewTraceFile();
+ void StartNewTraceFile ();
std::string GetMacAddress (Ptr <NetDevice> nd);
std::string GetIpv4Address (Ptr <NetDevice> nd);
@@ -669,9 +669,9 @@
std::string GetXMLOpenClose_routing (uint32_t id, std::string routingInfo);
std::string GetXMLOpenClose_rp (uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements);
- void AppendXMLNodeDescription(std::ostream& ostream, uint32_t id) const;
- void AppendXMLNodeColor(std::ostream& ostream, const Rgb& color) const;
- void AppendXMLRemainingEnergy(std::ostream& ostream, uint32_t id) const;
+ void AppendXMLNodeDescription (std::ostream& ostream, uint32_t id) const;
+ void AppendXMLNodeColor (std::ostream& ostream, const Rgb& color) const;
+ void AppendXMLRemainingEnergy (std::ostream& ostream, uint32_t id) const;
/// Provides uniform random variables.
Ptr<UniformRandomVariable> m_uniformRandomVariable;
--- a/src/netanim/test/netanim-test.cc Tue Dec 10 09:12:38 2013 +0400
+++ b/src/netanim/test/netanim-test.cc Tue Dec 10 09:12:38 2013 +0400
@@ -38,18 +38,18 @@
/**
* \brief Constructor.
*/
- AbstractAnimationInterfaceTestCase(std::string name);
+ AbstractAnimationInterfaceTestCase (std::string name);
/**
* \brief Destructor.
*/
virtual
- ~AbstractAnimationInterfaceTestCase();
+ ~AbstractAnimationInterfaceTestCase ();
/**
* \brief Run unit tests for this class.
* \return false if all tests have passed, false otherwise
*/
virtual void
- DoRun(void);
+ DoRun (void);
protected:
@@ -59,19 +59,19 @@
private:
virtual void
- PrepareNetwork() = 0;
+ PrepareNetwork () = 0;
virtual void
- CheckLogic() = 0;
+ CheckLogic () = 0;
virtual void
- CheckFileExistence();
+ CheckFileExistence ();
const char* m_traceFileName;
};
AbstractAnimationInterfaceTestCase::AbstractAnimationInterfaceTestCase (std::string name) :
- TestCase (name), m_anim(NULL), m_traceFileName("netanim-test.xml")
+ TestCase (name), m_anim (NULL), m_traceFileName ("netanim-test.xml")
{
}
@@ -83,18 +83,18 @@
void
AbstractAnimationInterfaceTestCase::DoRun (void)
{
- PrepareNetwork();
+ PrepareNetwork ();
- m_anim = new AnimationInterface(m_traceFileName);
+ m_anim = new AnimationInterface (m_traceFileName);
Simulator::Run ();
- CheckLogic();
- CheckFileExistence();
+ CheckLogic ();
+ CheckFileExistence ();
Simulator::Destroy ();
}
void
-AbstractAnimationInterfaceTestCase::CheckFileExistence()
+AbstractAnimationInterfaceTestCase::CheckFileExistence ()
{
FILE * fp = fopen (m_traceFileName, "r");
NS_TEST_ASSERT_MSG_NE (fp, 0, "Trace file was not created");
@@ -113,10 +113,10 @@
private:
virtual void
- PrepareNetwork();
+ PrepareNetwork ();
virtual void
- CheckLogic();
+ CheckLogic ();
};
@@ -180,10 +180,10 @@
private:
virtual void
- PrepareNetwork();
+ PrepareNetwork ();
virtual void
- CheckLogic();
+ CheckLogic ();
Ptr<BasicEnergySource> m_energySource;
Ptr<SimpleDeviceEnergyModel> m_energyModel;
@@ -191,8 +191,8 @@
};
AnimationRemainingEnergyTestCase::AnimationRemainingEnergyTestCase () :
- AbstractAnimationInterfaceTestCase("Verify Remaining energy tracing"),
- m_initialEnergy(100)
+ AbstractAnimationInterfaceTestCase ("Verify Remaining energy tracing"),
+ m_initialEnergy (100)
{
}
@@ -202,10 +202,10 @@
m_energySource = CreateObject<BasicEnergySource>();
m_energyModel = CreateObject<SimpleDeviceEnergyModel>();
- m_energySource->SetInitialEnergy(m_initialEnergy);
+ m_energySource->SetInitialEnergy (m_initialEnergy);
m_energyModel->SetEnergySource (m_energySource);
m_energySource->AppendDeviceEnergyModel (m_energyModel);
- m_energyModel->SetCurrentA(20);
+ m_energyModel->SetCurrentA (20);
m_nodes.Create (1);
AnimationInterface::SetConstantPosition (m_nodes.Get (0), 0 , 10);
@@ -219,10 +219,10 @@
void
AnimationRemainingEnergyTestCase::CheckLogic (void)
{
- const double remainingEnergy = m_energySource->GetRemainingEnergy();
+ const double remainingEnergy = m_energySource->GetRemainingEnergy ();
- NS_TEST_ASSERT_MSG_EQ((remainingEnergy < m_initialEnergy), true, "Energy hasn't depleted!");
- NS_TEST_ASSERT_MSG_EQ_TOL(m_anim->GetNodeEnergyFraction(m_nodes.Get (0)),
+ NS_TEST_ASSERT_MSG_EQ ((remainingEnergy < m_initialEnergy), true, "Energy hasn't depleted!");
+ NS_TEST_ASSERT_MSG_EQ_TOL (m_anim->GetNodeEnergyFraction (m_nodes.Get (0)),
remainingEnergy / m_initialEnergy,
1.0e-13,
"Wrong remaining energy value was traced");