A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
:
107
class
ObjectStore
108
{
109
public
:
110
virtual
~ObjectStore
() {}
111
virtual
Ptr<Object>
Get
(uint32_t i)
const
= 0;
112
};
113
void
ConfigNodesMovements
(
const
ObjectStore &store)
const
;
114
Ptr<ConstantVelocityMobilityModel>
GetMobilityModel
(std::string idString,
const
ObjectStore &store)
const
;
115
std::string
m_filename
;
116
};
117
118
}
// namespace ns3
119
120
namespace
ns3 {
121
122
template
<
typename
T>
123
void
124
Ns2MobilityHelper::Install
(T begin, T end)
const
125
{
126
class
MyObjectStore :
public
ObjectStore
127
{
128
public
:
129
MyObjectStore (T begin, T end)
130
: m_begin (begin),
131
m_end (end)
132
{}
133
virtual
Ptr<Object>
Get (uint32_t i)
const
{
134
T iterator = m_begin;
135
iterator += i;
136
if
(iterator >= m_end)
137
{
138
return
0;
139
}
140
return
*iterator;
141
}
142
private
:
143
T m_begin;
144
T m_end;
145
};
146
ConfigNodesMovements
(MyObjectStore (begin, end));
147
}
148
149
150
}
// namespace ns3
151
152
#endif
/* NS2_MOBILITY_HELPER_H */
ns3::Ns2MobilityHelper::ConfigNodesMovements
void ConfigNodesMovements(const ObjectStore &store) const
Definition:
ns2-mobility-helper.cc:180
ns3::Ptr< Object >
ns3::Ns2MobilityHelper::m_filename
std::string m_filename
Definition:
ns2-mobility-helper.h:115
ns3::Ns2MobilityHelper::ObjectStore::~ObjectStore
virtual ~ObjectStore()
Definition:
ns2-mobility-helper.h:110
ns3::Ns2MobilityHelper::GetMobilityModel
Ptr< ConstantVelocityMobilityModel > GetMobilityModel(std::string idString, const ObjectStore &store) const
Definition:
ns2-mobility-helper.cc:158
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:776
ns3::Ns2MobilityHelper
Helper class which can read ns-2 movement files and configure nodes mobility.
Definition:
ns2-mobility-helper.h:76
ns3::Ns2MobilityHelper::ObjectStore::Get
virtual Ptr< Object > Get(uint32_t i) const =0
ns3::Ns2MobilityHelper::Ns2MobilityHelper
Ns2MobilityHelper(std::string filename)
Definition:
ns2-mobility-helper.cc:150
ns3::Ns2MobilityHelper::ObjectStore
Definition:
ns2-mobility-helper.h:107
src
mobility
helper
ns2-mobility-helper.h
Generated on Sat Apr 19 2014 14:07:04 for ns-3 by
1.8.6