author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 17 Apr 2008 13:42:25 -0700 | |
changeset 2965 | 4b28e9740e3b |
parent 2927 | 73b47ce1d805 |
child 2997 | caf9d364c6fc |
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/mobility-model-notifier.h" |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
23 |
#include "ns3/position-allocator.h" |
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
24 |
#include "ns3/hierarchical-mobility-model.h" |
2521
15e8f12266da
add some debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2517
diff
changeset
|
25 |
#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
|
26 |
#include "ns3/pointer.h" |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
|
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
namespace ns3 { |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
|
2521
15e8f12266da
add some debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2517
diff
changeset
|
30 |
NS_LOG_COMPONENT_DEFINE ("MobilityHelper"); |
15e8f12266da
add some debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2517
diff
changeset
|
31 |
|
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
MobilityHelper::MobilityHelper () |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
: m_notifierEnabled (false) |
2517
c15129b75e3a
setup a working behavior by default
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
34 |
{ |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
35 |
m_position = CreateObject<RandomRectanglePositionAllocator> |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
36 |
("X", RandomVariableValue (ConstantVariable (0.0)), |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
37 |
"Y", RandomVariableValue (ConstantVariable (0.0))); |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2592
diff
changeset
|
38 |
m_mobility.SetTypeId ("ns3::StaticMobilityModel"); |
2517
c15129b75e3a
setup a working behavior by default
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2433
diff
changeset
|
39 |
} |
2897
cb427d45a011
avoid compilation warning about undefined MobilityModel class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
40 |
MobilityHelper::~MobilityHelper () |
cb427d45a011
avoid compilation warning about undefined MobilityModel class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
41 |
{} |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
void |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
43 |
MobilityHelper::EnableNotifier (void) |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
m_notifierEnabled = true; |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
void |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
MobilityHelper::DisableNotifier (void) |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
m_notifierEnabled = false; |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
void |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
MobilityHelper::SetPositionAllocator (Ptr<PositionAllocator> allocator) |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
m_position = allocator; |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
57 |
void |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
MobilityHelper::SetPositionAllocator (std::string type, |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
59 |
std::string n1, const AttributeValue &v1, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
60 |
std::string n2, const AttributeValue &v2, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
61 |
std::string n3, const AttributeValue &v3, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
62 |
std::string n4, const AttributeValue &v4, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
63 |
std::string n5, const AttributeValue &v5, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
64 |
std::string n6, const AttributeValue &v6, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
65 |
std::string n7, const AttributeValue &v7, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
66 |
std::string n8, const AttributeValue &v8, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
67 |
std::string n9, const AttributeValue &v9) |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
69 |
ObjectFactory pos; |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
pos.SetTypeId (type); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
71 |
pos.Set (n1, v1); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
72 |
pos.Set (n2, v2); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
73 |
pos.Set (n3, v3); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
74 |
pos.Set (n4, v4); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
pos.Set (n5, v5); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
pos.Set (n6, v6); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
pos.Set (n7, v7); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
pos.Set (n8, v8); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
79 |
pos.Set (n9, v9); |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
80 |
m_position = pos.Create ()->GetObject<PositionAllocator> (); |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
81 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
82 |
|
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
83 |
void |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
84 |
MobilityHelper::SetMobilityModel (std::string type, |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
85 |
std::string n1, const AttributeValue &v1, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
86 |
std::string n2, const AttributeValue &v2, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
87 |
std::string n3, const AttributeValue &v3, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
88 |
std::string n4, const AttributeValue &v4, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
89 |
std::string n5, const AttributeValue &v5, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
90 |
std::string n6, const AttributeValue &v6, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
91 |
std::string n7, const AttributeValue &v7, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
92 |
std::string n8, const AttributeValue &v8, |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
93 |
std::string n9, const AttributeValue &v9) |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
94 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
m_mobility.SetTypeId (type); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
m_mobility.Set (n1, v1); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
97 |
m_mobility.Set (n2, v2); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
98 |
m_mobility.Set (n3, v3); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
m_mobility.Set (n4, v4); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
m_mobility.Set (n5, v5); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
m_mobility.Set (n6, v6); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
m_mobility.Set (n7, v7); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
103 |
m_mobility.Set (n8, v8); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
104 |
m_mobility.Set (n9, v9); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
105 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
|
2401
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
107 |
void |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
108 |
MobilityHelper::PushReferenceMobilityModel (Ptr<Object> reference) |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
109 |
{ |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
110 |
Ptr<MobilityModel> mobility = reference->GetObject<MobilityModel> (); |
2401
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
111 |
m_mobilityStack.push_back (mobility); |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
112 |
} |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
113 |
void |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
114 |
MobilityHelper::PopReferenceMobilityModel (void) |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
115 |
{ |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
116 |
m_mobilityStack.pop_back (); |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
117 |
} |
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 |
|
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
120 |
std::string |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
121 |
MobilityHelper::GetMobilityModelType (void) const |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
122 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
123 |
return m_mobility.GetTypeId ().GetName (); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
124 |
} |
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 |
void |
2700
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
127 |
MobilityHelper::Layout (NodeContainer c) |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
{ |
2700
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
129 |
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
|
130 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
Ptr<Object> object = *i; |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
132 |
Ptr<MobilityModel> model = object->GetObject<MobilityModel> (); |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
133 |
if (model == 0) |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
134 |
{ |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
135 |
model = m_mobility.Create ()->GetObject<MobilityModel> (); |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
136 |
if (model == 0) |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
137 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
138 |
NS_FATAL_ERROR ("The requested mobility model is not a mobility model: \""<< |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
139 |
m_mobility.GetTypeId ().GetName ()<<"\""); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
140 |
} |
2401
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
141 |
if (m_mobilityStack.empty ()) |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
142 |
{ |
2521
15e8f12266da
add some debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2517
diff
changeset
|
143 |
NS_LOG_DEBUG ("node="<<object<<", mob="<<model); |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
144 |
object->AggregateObject (model); |
2401
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
145 |
} |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
146 |
else |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
147 |
{ |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
148 |
// we need to setup a hierarchical mobility model |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
149 |
Ptr<MobilityModel> parent = m_mobilityStack.back (); |
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
150 |
Ptr<MobilityModel> hierarchical = |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
151 |
CreateObject<HierarchicalMobilityModel> ("Child", PointerValue (model), |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
152 |
"Parent", PointerValue (parent)); |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
153 |
object->AggregateObject (hierarchical); |
2521
15e8f12266da
add some debugging output
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2517
diff
changeset
|
154 |
NS_LOG_DEBUG ("node="<<object<<", mob="<<hierarchical); |
2401
281ea8b13525
add hierarchical support to MobilityHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2399
diff
changeset
|
155 |
} |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
156 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
157 |
Vector position = m_position->GetNext (); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
158 |
model->SetPosition (position); |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
159 |
if (m_notifierEnabled) |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
160 |
{ |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
161 |
Ptr<MobilityModelNotifier> notifier = |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
162 |
object->GetObject<MobilityModelNotifier> (); |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
163 |
if (notifier == 0) |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
164 |
{ |
2402
0950067d70a2
merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2401
diff
changeset
|
165 |
object->AggregateObject (CreateObject<MobilityModelNotifier> ()); |
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
166 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
167 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
168 |
} |
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
169 |
} |
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 |
void |
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
172 |
MobilityHelper::LayoutAll (void) |
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
173 |
{ |
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
174 |
Layout (NodeContainer::GetGlobal ()); |
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
175 |
} |
c54fbae72e8f
change signature of MobilityHelper::Layout and MobilityHelper::LayoutAll.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2603
diff
changeset
|
176 |
|
2399
fd9d94d518d2
convert Mobility subsystem to Value framework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
177 |
} // namespace ns3 |