author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 10 May 2007 08:34:32 +0200 | |
changeset 564 | 4da6cc2af83f |
parent 562 | 1855299b67d4 |
child 573 | 0da9201a048e |
permissions | -rw-r--r-- |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
2 |
/* |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 INRIA |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
4 |
* All rights reserved. |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
5 |
* |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation; |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
9 |
* |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
14 |
* |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
18 |
* |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
19 |
* Authors: |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
20 |
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>, |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
21 |
*/ |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
22 |
|
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
23 |
#include "ns3/array-trace-resolver.h" |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
24 |
#include "ns3/trace-root.h" |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
25 |
#include "ns3/simulator.h" |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
26 |
#include "ns3/simulation-singleton.h" |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
27 |
#include "node-list.h" |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
28 |
#include "node.h" |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
29 |
|
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
30 |
namespace { |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
31 |
static class Initialization |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
32 |
{ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
33 |
public: |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
34 |
Initialization () |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
35 |
{ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
36 |
ns3::TraceRoot::Register ("nodes", ns3::MakeCallback (&ns3::NodeList::CreateTraceResolver)); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
37 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
38 |
} g_initialization; |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
39 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
40 |
|
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
41 |
namespace ns3 { |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
42 |
|
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
43 |
/** |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
44 |
* The private node list used by the static-based API |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
45 |
*/ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
46 |
class NodeListPriv |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
47 |
{ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
48 |
public: |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
49 |
NodeListPriv (); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
50 |
~NodeListPriv (); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
51 |
|
546
0b652c3eef96
Hacked arraytraceresolver to compile, but segfaults upon running simple-p2p
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
486
diff
changeset
|
52 |
uint32_t Add (Ptr<Node> node); |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
53 |
NodeList::Iterator Begin (void); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
54 |
NodeList::Iterator End (void); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
55 |
TraceResolver *CreateTraceResolver (TraceContext const &context); |
551
12ed30c77cab
revert Ipv4Interface * -> Ptr<Ipv4Interface>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
546
diff
changeset
|
56 |
Node *PeekNode (uint32_t n); |
564
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
57 |
Ptr<Node> GetNode (uint32_t n); |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
58 |
uint32_t GetNNodes (void); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
59 |
|
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
60 |
private: |
546
0b652c3eef96
Hacked arraytraceresolver to compile, but segfaults upon running simple-p2p
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
486
diff
changeset
|
61 |
std::vector<Ptr<Node> > m_nodes; |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
62 |
}; |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
63 |
|
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
64 |
NodeListPriv::NodeListPriv () |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
65 |
{} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
66 |
NodeListPriv::~NodeListPriv () |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
67 |
{ |
546
0b652c3eef96
Hacked arraytraceresolver to compile, but segfaults upon running simple-p2p
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
486
diff
changeset
|
68 |
for (std::vector<Ptr<Node> >::iterator i = m_nodes.begin (); |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
69 |
i != m_nodes.end (); i++) |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
70 |
{ |
546
0b652c3eef96
Hacked arraytraceresolver to compile, but segfaults upon running simple-p2p
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
486
diff
changeset
|
71 |
Ptr<Node> node = *i; |
485
152927527647
rename NodeList::GetNode to NodeList::PeekNode to avoid memory leaks. Call Dispose from NodeListPriv::~NodeListPriv
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
484
diff
changeset
|
72 |
node->Dispose (); |
551
12ed30c77cab
revert Ipv4Interface * -> Ptr<Ipv4Interface>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
546
diff
changeset
|
73 |
*i = 0; |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
74 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
75 |
m_nodes.erase (m_nodes.begin (), m_nodes.end ()); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
76 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
77 |
|
359
91b7ad7fa784
OnOffApplication functioning; some Node class cleanup
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
78 |
|
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
79 |
uint32_t |
546
0b652c3eef96
Hacked arraytraceresolver to compile, but segfaults upon running simple-p2p
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
486
diff
changeset
|
80 |
NodeListPriv::Add (Ptr<Node> node) |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
81 |
{ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
82 |
uint32_t index = m_nodes.size (); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
83 |
m_nodes.push_back (node); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
84 |
return index; |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
85 |
|
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
86 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
87 |
NodeList::Iterator |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
88 |
NodeListPriv::Begin (void) |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
89 |
{ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
90 |
return m_nodes.begin (); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
91 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
92 |
NodeList::Iterator |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
93 |
NodeListPriv::End (void) |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
94 |
{ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
95 |
return m_nodes.end (); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
96 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
97 |
uint32_t |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
98 |
NodeListPriv::GetNNodes (void) |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
99 |
{ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
100 |
return m_nodes.size (); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
101 |
} |
551
12ed30c77cab
revert Ipv4Interface * -> Ptr<Ipv4Interface>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
546
diff
changeset
|
102 |
Node * |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
103 |
NodeListPriv::PeekNode (uint32_t n) |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
104 |
{ |
551
12ed30c77cab
revert Ipv4Interface * -> Ptr<Ipv4Interface>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
546
diff
changeset
|
105 |
return m_nodes[n].Peek (); |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
106 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
107 |
|
564
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
108 |
Ptr<Node> |
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
109 |
NodeListPriv::GetNode (uint32_t n) |
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
110 |
{ |
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
111 |
return m_nodes[n]; |
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
112 |
} |
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
113 |
|
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
114 |
|
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
115 |
TraceResolver * |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
116 |
NodeListPriv::CreateTraceResolver (TraceContext const &context) |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
117 |
{ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
118 |
ArrayTraceResolver<Node> *resolver = |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
119 |
new ArrayTraceResolver<Node> |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
120 |
(context, |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
121 |
MakeCallback (&NodeListPriv::GetNNodes, this), |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
122 |
MakeCallback (&NodeListPriv::PeekNode, this)); |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
123 |
return resolver; |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
124 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
125 |
|
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
126 |
} |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
127 |
|
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
128 |
/** |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
129 |
* The implementation of the public static-based API |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
130 |
* which calls into the private implementation through |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
131 |
* the simulation singleton. |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
132 |
*/ |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
133 |
namespace ns3 { |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
134 |
|
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
135 |
uint32_t |
546
0b652c3eef96
Hacked arraytraceresolver to compile, but segfaults upon running simple-p2p
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
486
diff
changeset
|
136 |
NodeList::Add (Ptr<Node> node) |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
137 |
{ |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
138 |
return SimulationSingleton<NodeListPriv>::Get ()->Add (node); |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
139 |
} |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
140 |
NodeList::Iterator |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
141 |
NodeList::Begin (void) |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
142 |
{ |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
143 |
return SimulationSingleton<NodeListPriv>::Get ()->Begin (); |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
144 |
} |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
145 |
NodeList::Iterator |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
146 |
NodeList::End (void) |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
147 |
{ |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
148 |
return SimulationSingleton<NodeListPriv>::Get ()->End (); |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
149 |
} |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
150 |
TraceResolver * |
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
151 |
NodeList::CreateTraceResolver (TraceContext const &context) |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
152 |
{ |
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
153 |
return SimulationSingleton<NodeListPriv>::Get ()->CreateTraceResolver (context); |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
154 |
} |
546
0b652c3eef96
Hacked arraytraceresolver to compile, but segfaults upon running simple-p2p
Raj Bhattacharjea <raj.b@gatech.edu>
parents:
486
diff
changeset
|
155 |
Ptr<Node> |
562
1855299b67d4
rename NodeList::PeekNode to NodeList::GetNode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
551
diff
changeset
|
156 |
NodeList::GetNode (uint32_t n) |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
157 |
{ |
564
4da6cc2af83f
make sure that NodeList::GetNode is correctly implemented
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
562
diff
changeset
|
158 |
return SimulationSingleton<NodeListPriv>::Get ()->GetNode (n); |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
159 |
} |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
160 |
|
484
cf7fbb84d74b
rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
425
diff
changeset
|
161 |
|
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
162 |
|
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
163 |
}//namespace ns3 |