From 7ec65a18166322a1d7329ae5e0b19d085170cd06 Mon Sep 17 00:00:00 2001 From: John Abraham Date: Sun, 29 Jun 2014 20:19:00 -0700 Subject: [PATCH] NetAnim: Valgrind fixes --- src/netanim/model/animation-interface.cc | 35 ++++++++++++++++-------- src/netanim/model/animation-interface.h | 14 +++++----- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/netanim/model/animation-interface.cc b/src/netanim/model/animation-interface.cc index 12bd14f50..ca7bde8ee 100644 --- a/src/netanim/model/animation-interface.cc +++ b/src/netanim/model/animation-interface.cc @@ -1122,7 +1122,7 @@ AnimationInterface::OutputWirelessPacketTxInfo (Ptr p, AnimPacketI 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 @@ AnimationInterface::AnimXmlElement::AddAttribute (std::string attribute, T value 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 @@ AnimByteTag::Get (void) const 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 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 nd, const Time& fbRx) +AnimationInterface::AnimPacketInfo::ProcessRxBegin (Ptr nd, const Time fbRx) { m_rx[nd->GetNode ()->GetId ()] = AnimRxInfo (fbRx, nd, 0); } bool -AnimationInterface::AnimPacketInfo::ProcessRxEnd (Ptr nd, const Time& lbRx, Vector rxLoc) +AnimationInterface::AnimPacketInfo::ProcessRxEnd (Ptr nd, const Time lbRx, Vector rxLoc) { uint32_t NodeId = nd->GetNode ()->GetId (); // Find the RxInfo @@ -2434,7 +2445,7 @@ AnimationInterface::AnimPacketInfo::ProcessRxEnd (Ptr nd, const 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; } diff --git a/src/netanim/model/animation-interface.h b/src/netanim/model/animation-interface.h index c7c5a905f..cdb8a04fd 100644 --- a/src/netanim/model/animation-interface.h +++ b/src/netanim/model/animation-interface.h @@ -444,19 +444,19 @@ private: public: AnimPacketInfo (); AnimPacketInfo (const AnimPacketInfo & pInfo); - AnimPacketInfo(Ptr tx_nd, const Time& fbTx, const Time& lbTx,Vector txLoc, uint32_t txNodeId = 0); + AnimPacketInfo(Ptr tx_nd, const Time fbTx, const Time lbTx, Vector txLoc, uint32_t txNodeId = 0); Ptr 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 m_rx; - void ProcessRxBegin (Ptr nd, const Time& fbRx); - bool ProcessRxEnd (Ptr nd, const Time& fbRx, Vector rxLoc); + void ProcessRxBegin (Ptr nd, const Time fbRx); + bool ProcessRxEnd (Ptr nd, const Time fbRx, Vector rxLoc); void ProcessRxDrop (Ptr nd); AnimRxInfo GetRxInfo (Ptr nd); void RemoveRxInfo (Ptr nd); - double firstlastbitDelta; };