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 */
src
mobility
helper
ns2-mobility-helper.h
Generated on Fri Dec 21 2012 19:00:42 for ns-3 by
1.8.1.2