A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
mobility
helper
ns2-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) 2007 INRIA
4
* 2009,2010 Contributors
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20
* Contributors: Thomas Waldecker <twaldecker@rocketmail.com>
21
* MartÃn Giachino <martin.giachino@gmail.com>
22
*/
23
#ifndef NS2_MOBILITY_HELPER_H
24
#define NS2_MOBILITY_HELPER_H
25
26
#include <string>
27
#include <stdint.h>
28
#include "ns3/ptr.h"
29
#include "ns3/object.h"
30
31
namespace
ns3
{
32
33
class
ConstantVelocityMobilityModel;
34
76
class
Ns2MobilityHelper
77
{
78
public
:
83
Ns2MobilityHelper
(std::string filename);
84
91
void
Install
(
void
)
const
;
92
104
template
<
typename
T>
105
void
Install
(T begin, T end)
const
;
106
private
:
110
class
ObjectStore
111
{
112
public
:
113
virtual
~ObjectStore
() {}
119
virtual
Ptr<Object>
Get
(uint32_t i)
const
= 0;
120
};
125
void
ConfigNodesMovements
(
const
ObjectStore &store)
const
;
132
Ptr<ConstantVelocityMobilityModel>
GetMobilityModel
(std::string idString,
const
ObjectStore &store)
const
;
133
std::string
m_filename
;
134
};
135
136
}
// namespace ns3
137
138
namespace
ns3
{
139
140
template
<
typename
T>
141
void
142
Ns2MobilityHelper::Install
(T begin, T end)
const
143
{
144
class
MyObjectStore :
public
ObjectStore
145
{
146
public
:
147
MyObjectStore (T begin, T end)
148
: m_begin (begin),
149
m_end (end)
150
{}
151
virtual
Ptr<Object>
Get (uint32_t i)
const
{
152
T iterator = m_begin;
153
iterator += i;
154
if
(iterator >= m_end)
155
{
156
return
0;
157
}
158
return
*iterator;
159
}
160
private
:
161
T m_begin;
162
T m_end;
163
};
164
ConfigNodesMovements
(MyObjectStore (begin, end));
165
}
166
167
168
}
// namespace ns3
169
170
#endif
/* NS2_MOBILITY_HELPER_H */
ns3::Ptr< Object >
ns3::Ns2MobilityHelper::m_filename
std::string m_filename
filename of file containing ns-2 mobility trace
Definition:
ns2-mobility-helper.h:133
ns3::Ns2MobilityHelper::Install
void Install(void) const
Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3:...
Definition:
ns2-mobility-helper.cc:811
ns3::Ns2MobilityHelper::ObjectStore::~ObjectStore
virtual ~ObjectStore()
Definition:
ns2-mobility-helper.h:113
ns3::Ns2MobilityHelper
Helper class which can read ns-2 movement files and configure nodes mobility.
Definition:
ns2-mobility-helper.h:76
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:215
ns3::Ns2MobilityHelper::ObjectStore::Get
virtual Ptr< Object > Get(uint32_t i) const =0
Return ith object in store.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ns2MobilityHelper::Ns2MobilityHelper
Ns2MobilityHelper(std::string filename)
Definition:
ns2-mobility-helper.cc:185
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:193
ns3::Ns2MobilityHelper::ObjectStore
a class to hold input objects internally
Definition:
ns2-mobility-helper.h:110
Generated on Wed Nov 7 2018 10:02:05 for ns-3 by
1.8.14