A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
ns2-mobility-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007 INRIA
3
* 2009,2010 Contributors
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
* Contributors: Thomas Waldecker <twaldecker@rocketmail.com>
20
* MartÃn Giachino <martin.giachino@gmail.com>
21
*/
22
#ifndef NS2_MOBILITY_HELPER_H
23
#define NS2_MOBILITY_HELPER_H
24
25
#include "ns3/object.h"
26
#include "ns3/ptr.h"
27
28
#include <stdint.h>
29
#include <string>
30
31
namespace
ns3
32
{
33
34
class
ConstantVelocityMobilityModel;
35
77
class
Ns2MobilityHelper
78
{
79
public
:
84
Ns2MobilityHelper
(std::string filename);
85
92
void
Install
()
const
;
93
105
template
<
typename
T>
106
void
Install
(T begin, T end)
const
;
107
108
private
:
112
class
ObjectStore
113
{
114
public
:
115
virtual
~ObjectStore
()
116
{
117
}
118
124
virtual
Ptr<Object>
Get
(
uint32_t
i)
const
= 0;
125
};
126
131
void
ConfigNodesMovements
(
const
ObjectStore
& store)
const
;
138
Ptr<ConstantVelocityMobilityModel>
GetMobilityModel
(std::string idString,
139
const
ObjectStore
& store)
const
;
140
std::string
m_filename
;
141
};
142
143
}
// namespace ns3
144
145
namespace
ns3
146
{
147
148
template
<
typename
T>
149
void
150
Ns2MobilityHelper::Install
(T begin, T end)
const
151
{
152
class
MyObjectStore :
public
ObjectStore
153
{
154
public
:
155
MyObjectStore(T begin, T end)
156
: m_begin(begin),
157
m_end(end)
158
{
159
}
160
161
Ptr<Object>
Get(
uint32_t
i)
const override
162
{
163
T iterator = m_begin;
164
iterator += i;
165
if
(iterator >= m_end)
166
{
167
return
nullptr
;
168
}
169
return
*iterator;
170
}
171
172
private
:
173
T m_begin;
174
T m_end;
175
};
176
177
ConfigNodesMovements
(MyObjectStore(begin, end));
178
}
179
180
}
// namespace ns3
181
182
#endif
/* NS2_MOBILITY_HELPER_H */
ns3::Ns2MobilityHelper::ObjectStore
a class to hold input objects internally
Definition:
ns2-mobility-helper.h:113
ns3::Ns2MobilityHelper::ObjectStore::Get
virtual Ptr< Object > Get(uint32_t i) const =0
Return ith object in store.
ns3::Ns2MobilityHelper::ObjectStore::~ObjectStore
virtual ~ObjectStore()
Definition:
ns2-mobility-helper.h:115
ns3::Ns2MobilityHelper
Helper class which can read ns-2 movement files and configure nodes mobility.
Definition:
ns2-mobility-helper.h:78
ns3::Ns2MobilityHelper::ConfigNodesMovements
void ConfigNodesMovements(const ObjectStore &store) const
Parses ns-2 mobility file to create ns-3 mobility events.
Definition:
ns2-mobility-helper.cc:266
ns3::Ns2MobilityHelper::Install
void Install() const
Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3:...
Definition:
ns2-mobility-helper.cc:864
ns3::Ns2MobilityHelper::m_filename
std::string m_filename
filename of file containing ns-2 mobility trace
Definition:
ns2-mobility-helper.h:140
ns3::Ns2MobilityHelper::GetMobilityModel
Ptr< ConstantVelocityMobilityModel > GetMobilityModel(std::string idString, const ObjectStore &store) const
Get or create a ConstantVelocityMobilityModel corresponding to idString.
Definition:
ns2-mobility-helper.cc:245
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:78
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
mobility
helper
ns2-mobility-helper.h
Generated on Sun Jul 2 2023 18:21:55 for ns-3 by
1.9.6