author | Mitch Watrous <watrous@u.washington.edu> |
Fri, 28 Sep 2012 12:22:18 -0700 | |
changeset 9096 | 94215be61edf |
parent 8984 | 85eed149a0ea |
child 10411 | f5916669dbe7 |
permissions | -rw-r--r-- |
2833
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
2 |
/* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
4 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
7 |
* published by the Free Software Foundation; |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
8 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
12 |
* GNU General Public License for more details. |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
13 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
17 |
* |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
f3474fd850b2
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2700
diff
changeset
|
19 |
*/ |
2603
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
20 |
#include "ns3/mobility-helper.h" |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
21 |
#include "ns3/mobility-model.h" |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
22 |
#include "ns3/position-allocator.h" |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
23 |
#include "ns3/hierarchical-mobility-model.h" |
2521
15e8f12266da
add some debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2517
diff
changeset
|
24 |
#include "ns3/log.h" |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2897
diff
changeset
|
25 |
#include "ns3/pointer.h" |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
26 |
#include "ns3/config.h" |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
27 |
#include "ns3/simulator.h" |
4147
5d8530130930
rename object-names.{cc,h} to names.{cc,h} per convention
Craig Dowell <craigdo@ee.washington.edu>
parents:
4140
diff
changeset
|
28 |
#include "ns3/names.h" |
8983
91d4c78133a8
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 1)
Mitch Watrous
parents:
7252
diff
changeset
|
29 |
#include "ns3/string.h" |
3657
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
30 |
#include <iostream> |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
|
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
namespace ns3 { |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
|
2521
15e8f12266da
add some debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2517
diff
changeset
|
34 |
NS_LOG_COMPONENT_DEFINE ("MobilityHelper"); |
15e8f12266da
add some debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2517
diff
changeset
|
35 |
|
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
MobilityHelper::MobilityHelper () |
2517
c15129b75e3a
setup a working behavior by default
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
37 |
{ |
4554
b1940a738981
make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
38 |
m_position = CreateObjectWithAttributes<RandomRectanglePositionAllocator> |
8983
91d4c78133a8
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 1)
Mitch Watrous
parents:
7252
diff
changeset
|
39 |
("X", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"), |
91d4c78133a8
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 1)
Mitch Watrous
parents:
7252
diff
changeset
|
40 |
"Y", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]")); |
4257
3e8f8052e155
StaticMobilityModel -> ConstantPositionMobilityModel, StaticSpeedMobilityModel -> ConstantVelocityMobilityModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4201
diff
changeset
|
41 |
m_mobility.SetTypeId ("ns3::ConstantPositionMobilityModel"); |
2517
c15129b75e3a
setup a working behavior by default
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
42 |
} |
2897
cb427d45a011
avoid compilation warning about undefined MobilityModel class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
43 |
MobilityHelper::~MobilityHelper () |
7179
9d72cc013844
mobility coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6839
diff
changeset
|
44 |
{ |
9d72cc013844
mobility coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6839
diff
changeset
|
45 |
} |
9d72cc013844
mobility coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6839
diff
changeset
|
46 |
void |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
MobilityHelper::SetPositionAllocator (Ptr<PositionAllocator> allocator) |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
m_position = allocator; |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
} |
4201
511a086fde07
bug 506 -- remove name version of SetPositionAllocator
Craig Dowell <craigdo@ee.washington.edu>
parents:
4147
diff
changeset
|
51 |
|
7179
9d72cc013844
mobility coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6839
diff
changeset
|
52 |
void |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
MobilityHelper::SetPositionAllocator (std::string type, |
3786
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
54 |
std::string n1, const AttributeValue &v1, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
55 |
std::string n2, const AttributeValue &v2, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
56 |
std::string n3, const AttributeValue &v3, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
57 |
std::string n4, const AttributeValue &v4, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
58 |
std::string n5, const AttributeValue &v5, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
59 |
std::string n6, const AttributeValue &v6, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
60 |
std::string n7, const AttributeValue &v7, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
61 |
std::string n8, const AttributeValue &v8, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
62 |
std::string n9, const AttributeValue &v9) |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
63 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
ObjectFactory pos; |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
65 |
pos.SetTypeId (type); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
66 |
pos.Set (n1, v1); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
67 |
pos.Set (n2, v2); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
pos.Set (n3, v3); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
69 |
pos.Set (n4, v4); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
pos.Set (n5, v5); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
71 |
pos.Set (n6, v6); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
72 |
pos.Set (n7, v7); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
73 |
pos.Set (n8, v8); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
74 |
pos.Set (n9, v9); |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
75 |
m_position = pos.Create ()->GetObject<PositionAllocator> (); |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
|
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
void |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
79 |
MobilityHelper::SetMobilityModel (std::string type, |
3786
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
80 |
std::string n1, const AttributeValue &v1, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
81 |
std::string n2, const AttributeValue &v2, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
82 |
std::string n3, const AttributeValue &v3, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
83 |
std::string n4, const AttributeValue &v4, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
84 |
std::string n5, const AttributeValue &v5, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
85 |
std::string n6, const AttributeValue &v6, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
86 |
std::string n7, const AttributeValue &v7, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
87 |
std::string n8, const AttributeValue &v8, |
9f384deadb46
replace \t with 8 spaces.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3657
diff
changeset
|
88 |
std::string n9, const AttributeValue &v9) |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
89 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
90 |
m_mobility.SetTypeId (type); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
m_mobility.Set (n1, v1); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
m_mobility.Set (n2, v2); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
m_mobility.Set (n3, v3); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
94 |
m_mobility.Set (n4, v4); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
m_mobility.Set (n5, v5); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
m_mobility.Set (n6, v6); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
97 |
m_mobility.Set (n7, v7); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
98 |
m_mobility.Set (n8, v8); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
m_mobility.Set (n9, v9); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
|
2401
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
102 |
void |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
103 |
MobilityHelper::PushReferenceMobilityModel (Ptr<Object> reference) |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
104 |
{ |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
105 |
Ptr<MobilityModel> mobility = reference->GetObject<MobilityModel> (); |
2401
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
106 |
m_mobilityStack.push_back (mobility); |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
107 |
} |
4140
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
108 |
|
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
109 |
void |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
110 |
MobilityHelper::PushReferenceMobilityModel (std::string referenceName) |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
111 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
112 |
Ptr<MobilityModel> mobility = Names::Find<MobilityModel> (referenceName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
113 |
m_mobilityStack.push_back (mobility); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
114 |
} |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
115 |
|
2401
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
116 |
void |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
117 |
MobilityHelper::PopReferenceMobilityModel (void) |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
118 |
{ |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
119 |
m_mobilityStack.pop_back (); |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
120 |
} |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
121 |
|
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
122 |
|
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
123 |
std::string |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
124 |
MobilityHelper::GetMobilityModelType (void) const |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
125 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
126 |
return m_mobility.GetTypeId ().GetName (); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
127 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
|
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
129 |
void |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
130 |
MobilityHelper::Install (Ptr<Node> node) const |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
131 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
132 |
Ptr<Object> object = node; |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
133 |
Ptr<MobilityModel> model = object->GetObject<MobilityModel> (); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
134 |
if (model == 0) |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
135 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
136 |
model = m_mobility.Create ()->GetObject<MobilityModel> (); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
137 |
if (model == 0) |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
138 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
139 |
NS_FATAL_ERROR ("The requested mobility model is not a mobility model: \""<< |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
140 |
m_mobility.GetTypeId ().GetName ()<<"\""); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
141 |
} |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
142 |
if (m_mobilityStack.empty ()) |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
143 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
144 |
NS_LOG_DEBUG ("node="<<object<<", mob="<<model); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
145 |
object->AggregateObject (model); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
146 |
} |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
147 |
else |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
148 |
{ |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
149 |
// we need to setup a hierarchical mobility model |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
150 |
Ptr<MobilityModel> parent = m_mobilityStack.back (); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
151 |
Ptr<MobilityModel> hierarchical = |
4554
b1940a738981
make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4257
diff
changeset
|
152 |
CreateObjectWithAttributes<HierarchicalMobilityModel> ("Child", PointerValue (model), |
7179
9d72cc013844
mobility coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6839
diff
changeset
|
153 |
"Parent", PointerValue (parent)); |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
154 |
object->AggregateObject (hierarchical); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
155 |
NS_LOG_DEBUG ("node="<<object<<", mob="<<hierarchical); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
156 |
} |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
157 |
} |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
158 |
Vector position = m_position->GetNext (); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
159 |
model->SetPosition (position); |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
160 |
} |
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
161 |
|
4140
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
162 |
void |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
163 |
MobilityHelper::Install (std::string nodeName) const |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
164 |
{ |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
165 |
Ptr<Node> node = Names::Find<Node> (nodeName); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
166 |
Install (node); |
6bbf05bf4826
Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
3848
diff
changeset
|
167 |
} |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
168 |
void |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
169 |
MobilityHelper::Install (NodeContainer c) const |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
170 |
{ |
2700
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
171 |
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
172 |
{ |
3848
affd0834debc
address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents:
3786
diff
changeset
|
173 |
Install (*i); |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
174 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
175 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
176 |
|
2700
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
177 |
void |
2995
b72805b3ca69
Align helper API use of Install()
Tom Henderson <tomh@tomh.org>
parents:
2897
diff
changeset
|
178 |
MobilityHelper::InstallAll (void) |
2700
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
179 |
{ |
2995
b72805b3ca69
Align helper API use of Install()
Tom Henderson <tomh@tomh.org>
parents:
2897
diff
changeset
|
180 |
Install (NodeContainer::GetGlobal ()); |
2700
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
181 |
} |
3657
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
182 |
static double |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
183 |
DoRound (double v) |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
184 |
{ |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
185 |
if (v <= 1e-4 && v >= -1e-4) |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
186 |
{ |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
187 |
return 0.0; |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
188 |
} |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
189 |
else if (v <= 1e-3 && v >= 0) |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
190 |
{ |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
191 |
return 1e-3; |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
192 |
} |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
193 |
else if (v >= -1e-3 && v <= 0) |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
194 |
{ |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
195 |
return -1e-3; |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
196 |
} |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
197 |
else |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
198 |
{ |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
199 |
return v; |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
200 |
} |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
201 |
} |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
202 |
void |
9096
94215be61edf
Make MobilityHelper use an output stream wrapper
Mitch Watrous <watrous@u.washington.edu>
parents:
8984
diff
changeset
|
203 |
MobilityHelper::CourseChanged (Ptr<OutputStreamWrapper> stream, Ptr<const MobilityModel> mobility) |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
204 |
{ |
9096
94215be61edf
Make MobilityHelper use an output stream wrapper
Mitch Watrous <watrous@u.washington.edu>
parents:
8984
diff
changeset
|
205 |
std::ostream* os = stream->GetStream (); |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
206 |
Ptr<Node> node = mobility->GetObject<Node> (); |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
207 |
*os << "now=" << Simulator::Now () |
3657
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
208 |
<< " node=" << node->GetId (); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
209 |
Vector pos = mobility->GetPosition (); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
210 |
pos.x = DoRound (pos.x); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
211 |
pos.y = DoRound (pos.y); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
212 |
pos.z = DoRound (pos.z); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
213 |
Vector vel = mobility->GetVelocity (); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
214 |
vel.x = DoRound (vel.x); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
215 |
vel.y = DoRound (vel.y); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
216 |
vel.z = DoRound (vel.z); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
217 |
std::streamsize saved_precision = os->precision (); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
218 |
std::ios::fmtflags saved_flags = os->flags (); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
219 |
os->precision (3); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
220 |
os->setf (std::ios::fixed,std::ios::floatfield); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
221 |
*os << " pos=" << pos.x << ":" << pos.y << ":" << pos.z |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
222 |
<< " vel=" << vel.x << ":" << vel.y << ":" << vel.z |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
223 |
<< std::endl; |
3657
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
224 |
os->flags (saved_flags); |
67ca221a24bb
make mobility helper ascii output more robust to formatting portability problems.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3491
diff
changeset
|
225 |
os->precision (saved_precision); |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
226 |
} |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
227 |
|
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
228 |
void |
9096
94215be61edf
Make MobilityHelper use an output stream wrapper
Mitch Watrous <watrous@u.washington.edu>
parents:
8984
diff
changeset
|
229 |
MobilityHelper::EnableAscii (Ptr<OutputStreamWrapper> stream, uint32_t nodeid) |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
230 |
{ |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
231 |
std::ostringstream oss; |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
232 |
oss << "/NodeList/" << nodeid << "/$ns3::MobilityModel/CourseChange"; |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
233 |
Config::ConnectWithoutContext (oss.str (), |
9096
94215be61edf
Make MobilityHelper use an output stream wrapper
Mitch Watrous <watrous@u.washington.edu>
parents:
8984
diff
changeset
|
234 |
MakeBoundCallback (&MobilityHelper::CourseChanged, stream)); |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
235 |
} |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
236 |
void |
9096
94215be61edf
Make MobilityHelper use an output stream wrapper
Mitch Watrous <watrous@u.washington.edu>
parents:
8984
diff
changeset
|
237 |
MobilityHelper::EnableAscii (Ptr<OutputStreamWrapper> stream, NodeContainer n) |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
238 |
{ |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
239 |
for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i) |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
240 |
{ |
9096
94215be61edf
Make MobilityHelper use an output stream wrapper
Mitch Watrous <watrous@u.washington.edu>
parents:
8984
diff
changeset
|
241 |
EnableAscii (stream, (*i)->GetId ()); |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
242 |
} |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
243 |
} |
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
244 |
void |
9096
94215be61edf
Make MobilityHelper use an output stream wrapper
Mitch Watrous <watrous@u.washington.edu>
parents:
8984
diff
changeset
|
245 |
MobilityHelper::EnableAsciiAll (Ptr<OutputStreamWrapper> stream) |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
246 |
{ |
9096
94215be61edf
Make MobilityHelper use an output stream wrapper
Mitch Watrous <watrous@u.washington.edu>
parents:
8984
diff
changeset
|
247 |
EnableAscii (stream, NodeContainer::GetGlobal ()); |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
248 |
} |
8984
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
249 |
int64_t |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
250 |
MobilityHelper::AssignStreams (NodeContainer c, int64_t stream) |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
251 |
{ |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
252 |
int64_t currentStream = stream; |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
253 |
Ptr<Node> node; |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
254 |
Ptr<MobilityModel> mobility; |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
255 |
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
256 |
{ |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
257 |
node = (*i); |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
258 |
mobility = node->GetObject<MobilityModel> (); |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
259 |
if (mobility) |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
260 |
{ |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
261 |
currentStream += mobility->AssignStreams (currentStream); |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
262 |
} |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
263 |
} |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
264 |
return (currentStream - stream); |
85eed149a0ea
Replace src/mobility usage of RandomVariable with RandomVariableStream (Patch Set 2)
Mitch Watrous
parents:
8983
diff
changeset
|
265 |
} |
3491
b2de71af0e3f
bug 251: mobility helper has no ascii output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3021
diff
changeset
|
266 |
|
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
267 |
} // namespace ns3 |