src/netanim/model/animation-interface.cc
changeset 10559 2c2e043d271f
parent 10492 1d330df83f70
child 10560 666b4bbc0348
--- a/src/netanim/model/animation-interface.cc	Fri Jan 10 17:26:22 2014 -0800
+++ b/src/netanim/model/animation-interface.cc	Sat Jan 11 06:26:58 2014 -0800
@@ -64,8 +64,8 @@
 Rectangle * AnimationInterface::userBoundary = 0;
 
 
-AnimationInterface::AnimationInterface (const std::string fn, uint64_t maxPktsPerFile, bool usingXML)
-  : m_routingF (0), m_xml (usingXML), m_mobilityPollInterval (Seconds (0.25)), 
+AnimationInterface::AnimationInterface (const std::string fn, uint64_t maxPktsPerFile)
+  : m_routingF (0), m_mobilityPollInterval (Seconds (0.25)), 
     m_outputFileName (fn),
     m_outputFileSet (false), gAnimUid (0), m_randomPosition (true),
     m_writeCallback (0), m_started (false), 
@@ -291,12 +291,6 @@
   Simulator::Schedule (m_routingPollInterval, &AnimationInterface::TrackIpv4Route, this);
 }
 
-void AnimationInterface::SetXMLOutput ()
-{
-  NS_LOG_INFO ("XML output set");
-  m_xml = true;
-}
-
 
 void AnimationInterface::StartNewTraceFile ()
 {
@@ -701,14 +695,7 @@
                       AddToIpv4AddressNodeIdTable (GetIpv4Address (dev), n1Id);
                       AddToIpv4AddressNodeIdTable (GetIpv4Address (chDev), n2Id);
                       std::ostringstream oss;
-                      if (m_xml)
-                        {
-                          oss << GetXMLOpenClose_link (0, n1Id, 0, n2Id);
-                        }
-                      else
-                        {
-                          oss << "0.0 L "  << n1Id << " " << n2Id << std::endl;
-                        }
+                      oss << GetXMLOpenClose_link (0, n1Id, 0, n2Id);
                       WriteN (oss.str (), m_f);
                     }
                 }
@@ -722,7 +709,7 @@
         }
     }
   linkProperties.clear ();
-  if (m_xml && !restart)
+  if (!restart)
     {
       WriteN (GetXMLClose ("topology"), m_f);
       Simulator::Schedule (m_mobilityPollInterval, &AnimationInterface::MobilityAutoCheck, this);
@@ -861,10 +848,8 @@
   ResetAnimWriteCallback ();
   if (m_f) 
     {
-      if (m_xml)
-        { // Terminate the anim element
-          WriteN (GetXMLClose ("anim"), m_f);
-        }
+      // Terminate the anim element
+      WriteN (GetXMLClose ("anim"), m_f);
       std::fclose (m_f);
     }
     m_outputFileSet = false;
@@ -999,23 +984,10 @@
   double lbTx = (now + txTime).GetSeconds ();
   double fbRx = (now + rxTime - txTime).GetSeconds ();
   double lbRx = (now + rxTime).GetSeconds ();
-  if (m_xml)
-    {
-      oss << GetXMLOpenClose_p ("p", tx->GetNode ()->GetId (), fbTx, lbTx, rx->GetNode ()->GetId (), 
-                                fbRx, lbRx, m_enablePacketMetadata? GetPacketMetadata (p):"");
-      StartNewTraceFile ();
-      ++m_currentPktCount;
-    }
-  else
-    {
-      oss << std::setprecision (10);
-      oss << now.GetSeconds () << " P "
-          << tx->GetNode ()->GetId () << " "
-          << rx->GetNode ()->GetId () << " "
-          << (now + txTime).GetSeconds () << " " // last bit tx time
-          << (now + rxTime - txTime).GetSeconds () << " " // first bit rx time
-          << (now + rxTime).GetSeconds () << std::endl;         // last bit rx time
-    }
+  oss << GetXMLOpenClose_p ("p", tx->GetNode ()->GetId (), fbTx, lbTx, rx->GetNode ()->GetId (), 
+         fbRx, lbRx, m_enablePacketMetadata? GetPacketMetadata (p):"");
+  StartNewTraceFile ();
+  ++m_currentPktCount;
   WriteN (oss.str (), m_f);
 }
 
@@ -1708,7 +1680,6 @@
 void AnimationInterface::OutputWirelessPacket (Ptr<const Packet> p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
 {
   StartNewTraceFile ();
-  NS_ASSERT (m_xml);
   std::ostringstream oss;
   uint32_t nodeId =  0;
   if (pktInfo.m_txnd)
@@ -1727,7 +1698,6 @@
 void AnimationInterface::OutputCsmaPacket (Ptr<const Packet> p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
 {
   StartNewTraceFile ();
-  NS_ASSERT (m_xml);
   std::ostringstream oss;
   NS_ASSERT (pktInfo.m_txnd);
   uint32_t nodeId = pktInfo.m_txnd->GetNode ()->GetId ();