NetAnim: Valgrind fixes
authorJohn Abraham
Sun, 29 Jun 2014 20:19:00 -0700
changeset 10827 d8fb41070290
parent 10826 45ae1e4cbe6e
child 10828 eca3cb80bc79
NetAnim: Valgrind fixes
src/netanim/model/animation-interface.cc
src/netanim/model/animation-interface.h
--- a/src/netanim/model/animation-interface.cc	Sat Jun 28 09:59:03 2014 -0700
+++ b/src/netanim/model/animation-interface.cc	Sun Jun 29 20:19:00 2014 -0700
@@ -1122,7 +1122,7 @@
     nodeId = pktInfo.m_txnd->GetNode ()->GetId ();
   else
     nodeId = pktInfo.m_txNodeId;
-  double lbTx = pktInfo.firstlastbitDelta + pktInfo.m_fbTx;
+  double lbTx = pktInfo.m_firstLastBitDelta + pktInfo.m_fbTx;
   WriteXmlPRef (animUid, nodeId, pktInfo.m_fbTx, lbTx, m_enablePacketMetadata? GetPacketMetadata (p):"");
 
 }
@@ -2006,7 +2006,8 @@
   std::ostringstream oss;
   oss << std::setprecision (10);
   oss << value;
-  m_elementString += attribute + "=\"" + oss.str () + "\" ";
+  m_elementString += attribute.c_str ();
+  m_elementString += "=\"" + oss.str () + "\" ";
 }
 
 void
@@ -2384,40 +2385,50 @@
   return m_AnimUid;
 }
 
-AnimationInterface::AnimPacketInfo::AnimPacketInfo()
-  : m_txnd (0), m_fbTx (0), m_lbTx (0), 
-    m_txLoc (Vector (0,0,0))
+AnimationInterface::AnimPacketInfo::AnimPacketInfo ()
+  : m_txnd (0), 
+    m_txNodeId (0),
+    m_fbTx (0), 
+    m_lbTx (0), 
+    m_txLoc (Vector (0,0,0)), 
+    m_firstLastBitDelta (0)
 {
 }
 
 AnimationInterface::AnimPacketInfo::AnimPacketInfo (const AnimPacketInfo & pInfo)
 {
   m_txnd = pInfo.m_txnd;
+  m_txNodeId = pInfo.m_txNodeId;
   m_fbTx = pInfo.m_fbTx;
   m_lbTx = pInfo.m_lbTx;
   m_txLoc = pInfo.m_txLoc;
+  m_firstLastBitDelta = pInfo.m_firstLastBitDelta;
 }
 
 AnimationInterface::AnimPacketInfo::AnimPacketInfo (Ptr <const NetDevice> txnd, 
-                                const Time& fbTx, 
-                                const Time& lbTx, 
+                                const Time fbTx, 
+                                const Time lbTx, 
                                 Vector txLoc, 
                                 uint32_t txNodeId)
-  : m_txnd (txnd), m_fbTx (fbTx.GetSeconds ()), m_lbTx (lbTx.GetSeconds ()), 
-    m_txLoc (txLoc)
+  : m_txnd (txnd), 
+    m_txNodeId (0),
+    m_fbTx (fbTx.GetSeconds ()), 
+    m_lbTx (lbTx.GetSeconds ()), 
+    m_txLoc (txLoc),
+    m_firstLastBitDelta (0)
 {
   if (!m_txnd)
     m_txNodeId = txNodeId;
 }
 
 void 
-AnimationInterface::AnimPacketInfo::ProcessRxBegin (Ptr<const NetDevice> nd, const Time& fbRx)
+AnimationInterface::AnimPacketInfo::ProcessRxBegin (Ptr<const NetDevice> nd, const Time fbRx)
 {
   m_rx[nd->GetNode ()->GetId ()] = AnimRxInfo (fbRx, nd, 0);
 }
 
 bool 
-AnimationInterface::AnimPacketInfo::ProcessRxEnd (Ptr<const NetDevice> nd, const Time& lbRx, Vector rxLoc)
+AnimationInterface::AnimPacketInfo::ProcessRxEnd (Ptr<const NetDevice> nd, const Time lbRx, Vector rxLoc)
 {
   uint32_t NodeId = nd->GetNode ()->GetId (); 
   // Find the RxInfo
@@ -2434,7 +2445,7 @@
   rxInfo.rxRange = CalculateDistance (m_txLoc, rxLoc);
   rxInfo.m_lbRx = lbRx.GetSeconds ();
   rxInfo.SetPhyRxComplete ();
-  firstlastbitDelta = rxInfo.m_lbRx - rxInfo.m_fbRx;
+  m_firstLastBitDelta = rxInfo.m_lbRx - rxInfo.m_fbRx;
   return true;
 }
 
--- a/src/netanim/model/animation-interface.h	Sat Jun 28 09:59:03 2014 -0700
+++ b/src/netanim/model/animation-interface.h	Sun Jun 29 20:19:00 2014 -0700
@@ -444,19 +444,19 @@
   public:
     AnimPacketInfo ();
     AnimPacketInfo (const AnimPacketInfo & pInfo);
-    AnimPacketInfo(Ptr <const NetDevice> tx_nd, const Time& fbTx, const Time& lbTx,Vector txLoc, uint32_t txNodeId = 0);
+    AnimPacketInfo(Ptr <const NetDevice> tx_nd, const Time fbTx, const Time lbTx, Vector txLoc, uint32_t txNodeId = 0);
     Ptr <const NetDevice> m_txnd;
     uint32_t m_txNodeId;
-    double   m_fbTx;     
-    double   m_lbTx;     
-    Vector   m_txLoc;
+    double m_fbTx;     
+    double m_lbTx;     
+    Vector m_txLoc;
+    double m_firstLastBitDelta;
     std::map<uint32_t,AnimRxInfo> m_rx;
-    void ProcessRxBegin (Ptr <const NetDevice> nd, const Time& fbRx);
-    bool ProcessRxEnd (Ptr <const NetDevice> nd, const Time& fbRx, Vector rxLoc);
+    void ProcessRxBegin (Ptr <const NetDevice> nd, const Time fbRx);
+    bool ProcessRxEnd (Ptr <const NetDevice> nd, const Time fbRx, Vector rxLoc);
     void ProcessRxDrop (Ptr <const NetDevice> nd);
     AnimRxInfo GetRxInfo (Ptr <const NetDevice> nd);
     void RemoveRxInfo (Ptr <const NetDevice> nd);
-    double firstlastbitDelta;
   
   };