LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include <netinet/in.h> | 29 #include <netinet/in.h> |
30 #else | 30 #else |
31 #include <fcntl.h> | 31 #include <fcntl.h> |
32 #endif | 32 #endif |
33 | 33 |
34 // ns3 includes | 34 // ns3 includes |
35 #include "ns3/animation-interface.h" | 35 #include "ns3/animation-interface.h" |
36 #include "ns3/channel.h" | 36 #include "ns3/channel.h" |
37 #include "ns3/config.h" | 37 #include "ns3/config.h" |
38 #include "ns3/node.h" | 38 #include "ns3/node.h" |
39 #include "ns3/node-location.h" | 39 #include "ns3/canvas-location.h" |
40 #include "ns3/packet.h" | 40 #include "ns3/packet.h" |
41 #include "ns3/simulator.h" | 41 #include "ns3/simulator.h" |
42 | 42 |
43 using namespace std; | 43 using namespace std; |
44 | 44 |
45 NS_LOG_COMPONENT_DEFINE ("AnimationInterface"); | 45 NS_LOG_COMPONENT_DEFINE ("AnimationInterface"); |
46 | 46 |
47 namespace ns3 { | 47 namespace ns3 { |
48 | 48 |
49 AnimationInterface::AnimationInterface () | 49 AnimationInterface::AnimationInterface () |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return false; // never reached unless the above is disabled | 92 return false; // never reached unless the above is disabled |
93 // which is done to support a platform like MinGW | 93 // which is done to support a platform like MinGW |
94 } | 94 } |
95 | 95 |
96 void AnimationInterface::StartAnimation () | 96 void AnimationInterface::StartAnimation () |
97 { | 97 { |
98 // Dump the topology | 98 // Dump the topology |
99 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) | 99 for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i) |
100 { | 100 { |
101 Ptr<Node> n = *i; | 101 Ptr<Node> n = *i; |
102 Ptr<NodeLocation> loc = n->GetObject<NodeLocation> (); | 102 Ptr<CanvasLocation> loc = n->GetObject<CanvasLocation> (); |
103 if (loc) | 103 if (loc) |
104 { | 104 { |
105 // Location exists, dump it | 105 // Location exists, dump it |
106 Vector v = loc->GetLocation (); | 106 Vector v = loc->GetLocation (); |
107 ostringstream oss; | 107 ostringstream oss; |
108 oss << "0.0 N " << n->GetId ()· | 108 oss << "0.0 N " << n->GetId ()· |
109 << " " << v.x << " " << v.y << endl; | 109 << " " << v.x << " " << v.y << endl; |
110 WriteN (m_fHandle, oss.str ().c_str (), oss.str ().length ()); | 110 WriteN (m_fHandle, oss.str ().c_str (), oss.str ().length ()); |
111 } | 111 } |
112 } | 112 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 oss << now.GetSeconds() << " P " | 193 oss << now.GetSeconds() << " P " |
194 << tx->GetNode ()->GetId () << " " | 194 << tx->GetNode ()->GetId () << " " |
195 << rx->GetNode ()->GetId () << " " | 195 << rx->GetNode ()->GetId () << " " |
196 << (now + txTime).GetSeconds () << " " // last bit tx time | 196 << (now + txTime).GetSeconds () << " " // last bit tx time |
197 << (now + rxTime - txTime).GetSeconds() << " " // first bit rx time | 197 << (now + rxTime - txTime).GetSeconds() << " " // first bit rx time |
198 << (now + rxTime).GetSeconds () << endl; // last bit rx time | 198 << (now + rxTime).GetSeconds () << endl; // last bit rx time |
199 WriteN (m_fHandle, oss.str ().c_str (), oss.str ().length ()); | 199 WriteN (m_fHandle, oss.str ().c_str (), oss.str ().length ()); |
200 } | 200 } |
201 | 201 |
202 } // namespace ns3 | 202 } // namespace ns3 |
LEFT | RIGHT |