A Discrete-Event Network Simulator
API
mobility-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef MOBILITY_HELPER_H
22 #define MOBILITY_HELPER_H
23 
24 #include <vector>
25 #include "ns3/object-factory.h"
26 #include "ns3/attribute.h"
27 #include "ns3/output-stream-wrapper.h"
28 #include "ns3/position-allocator.h"
29 #include "node-container.h"
30 
31 namespace ns3 {
32 
33 class PositionAllocator;
34 class MobilityModel;
35 
43 {
44 public:
49  MobilityHelper ();
50 
54  ~MobilityHelper ();
55 
63 
85  void SetPositionAllocator (std::string type,
86  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
87  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
88  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
89  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
90  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
91  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
92  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue (),
93  std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue (),
94  std::string n9 = "", const AttributeValue &v9 = EmptyAttributeValue ());
95 
120  void SetMobilityModel (std::string type,
121  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
122  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
123  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
124  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
125  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
126  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
127  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue (),
128  std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue (),
129  std::string n9 = "", const AttributeValue &v9 = EmptyAttributeValue ());
130 
168  void PushReferenceMobilityModel (std::string referenceName);
173  void PopReferenceMobilityModel (void);
174 
179  std::string GetMobilityModelType (void) const;
180 
191  void Install (Ptr<Node> node) const;
202  void Install (std::string nodeName) const;
203 
215  void Install (NodeContainer container) const;
216 
221  void InstallAll (void);
222 
232  static void EnableAscii (Ptr<OutputStreamWrapper> stream, uint32_t nodeid);
242  static void EnableAscii (Ptr<OutputStreamWrapper> stream, NodeContainer n);
251  static void EnableAsciiAll (Ptr<OutputStreamWrapper> stream);
270  int64_t AssignStreams (NodeContainer c, int64_t stream);
271 
277  static double GetDistanceSquaredBetween (Ptr<Node> n1, Ptr<Node> n2);
278 
279 private:
280 
287  std::vector<Ptr<MobilityModel> > m_mobilityStack;
290 };
291 
292 } // namespace ns3
293 
294 #endif /* MOBILITY_HELPER_H */
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MobilityHelper::SetMobilityModel
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
Definition: mobility-helper.cc:79
ns3::MobilityHelper::Install
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
Definition: mobility-helper.cc:130
ns3::AttributeValue
Hold a value for an Attribute.
Definition: attribute.h:69
ns3::MobilityHelper::PushReferenceMobilityModel
void PushReferenceMobilityModel(Ptr< Object > reference)
Definition: mobility-helper.cc:103
anonymous_namespace{print-introspected-doxygen.cc}::reference
std::string reference
reference tag
Definition: print-introspected-doxygen.cc:87
ns3::MobilityHelper::InstallAll
void InstallAll(void)
Perform the work of MobilityHelper::Install on all nodes which exist in the simulation.
Definition: mobility-helper.cc:178
ns3::MobilityHelper::m_mobilityStack
std::vector< Ptr< MobilityModel > > m_mobilityStack
Internal stack of mobility models.
Definition: mobility-helper.h:287
ns3::MobilityHelper::m_mobility
ObjectFactory m_mobility
Object factory to create mobility objects.
Definition: mobility-helper.h:288
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::MobilityHelper::CourseChanged
static void CourseChanged(Ptr< OutputStreamWrapper > stream, Ptr< const MobilityModel > mobility)
Output course change events from mobility model to output stream.
Definition: mobility-helper.cc:209
ns3::MobilityHelper::SetPositionAllocator
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
Definition: mobility-helper.cc:47
ns3::MobilityHelper::EnableAsciiAll
static void EnableAsciiAll(Ptr< OutputStreamWrapper > stream)
Definition: mobility-helper.cc:250
ns3::MobilityHelper::GetDistanceSquaredBetween
static double GetDistanceSquaredBetween(Ptr< Node > n1, Ptr< Node > n2)
Definition: mobility-helper.cc:273
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition: object-factory.h:48
ns3::MobilityHelper::PopReferenceMobilityModel
void PopReferenceMobilityModel(void)
Remove the top item from the top of the stack of "reference mobility models".
Definition: mobility-helper.cc:117
node-container.h
ns3::MobilityHelper::AssignStreams
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the mobility models on t...
Definition: mobility-helper.cc:255
ns3::MobilityHelper::MobilityHelper
MobilityHelper()
Construct a Mobility Helper which is used to make life easier when working with mobility models.
Definition: mobility-helper.cc:36
ns3::EmptyAttributeValue
A class for an empty attribute value.
Definition: attribute.h:233
ns3::MobilityHelper::m_position
Ptr< PositionAllocator > m_position
Position allocator for use in hierarchical mobility model.
Definition: mobility-helper.h:289
ns3::MobilityHelper::GetMobilityModelType
std::string GetMobilityModelType(void) const
Definition: mobility-helper.cc:124
ns3::MobilityHelper::EnableAscii
static void EnableAscii(Ptr< OutputStreamWrapper > stream, uint32_t nodeid)
Definition: mobility-helper.cc:234
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::MobilityHelper::~MobilityHelper
~MobilityHelper()
Destroy a Mobility Helper.
Definition: mobility-helper.cc:43
ns3::MobilityHelper
Helper class used to assign positions and mobility models to nodes.
Definition: mobility-helper.h:43
sample-rng-plot.n
n
Definition: sample-rng-plot.py:37
third.mobility
mobility
Definition: third.py:108