A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
waypoint-mobility-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 Phillip Sitbon
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Phillip Sitbon <phillip@sitbon.net>
18
*/
19
#ifndef WAYPOINT_MOBILITY_MODEL_H
20
#define WAYPOINT_MOBILITY_MODEL_H
21
22
#include "
mobility-model.h
"
23
#include "
waypoint.h
"
24
25
#include "ns3/vector.h"
26
27
#include <deque>
28
#include <stdint.h>
29
30
class
WaypointMobilityModelNotifyTest
;
31
32
namespace
ns3
33
{
34
88
class
WaypointMobilityModel
:
public
MobilityModel
89
{
90
public
:
95
static
TypeId
GetTypeId
();
96
100
WaypointMobilityModel
();
101
~WaypointMobilityModel
()
override
;
102
112
void
AddWaypoint
(
const
Waypoint
& waypoint);
113
118
Waypoint
GetNextWaypoint
()
const
;
119
125
uint32_t
WaypointsLeft
()
const
;
126
133
void
EndMobility
();
134
135
private
:
136
friend
class ::WaypointMobilityModelNotifyTest;
// To allow Update() calls and access to
137
// m_current
138
142
virtual
void
Update
()
const
;
148
void
DoDispose
()
override
;
153
Vector
DoGetPosition
()
const override
;
158
void
DoSetPosition
(
const
Vector& position)
override
;
163
Vector
DoGetVelocity
()
const override
;
164
165
protected
:
169
bool
m_first
;
174
bool
m_lazyNotify
;
178
bool
m_initialPositionIsWaypoint
;
182
mutable
std::deque<Waypoint>
m_waypoints
;
186
mutable
Waypoint
m_current
;
190
mutable
Waypoint
m_next
;
194
mutable
Vector
m_velocity
;
195
};
196
197
}
// namespace ns3
198
199
#endif
/* WAYPOINT_MOBILITY_MODEL_H */
WaypointMobilityModelNotifyTest
Waypoint Mobility Model Notify Test.
Definition:
waypoint-mobility-model-test.cc:34
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition:
mobility-model.h:40
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::Waypoint
a (time, location) pair.
Definition:
waypoint.h:36
ns3::WaypointMobilityModel
Waypoint-based mobility model.
Definition:
waypoint-mobility-model.h:89
ns3::WaypointMobilityModel::m_velocity
Vector m_velocity
The current velocity vector.
Definition:
waypoint-mobility-model.h:194
ns3::WaypointMobilityModel::DoDispose
void DoDispose() override
The dispose method.
Definition:
waypoint-mobility-model.cc:83
ns3::WaypointMobilityModel::GetNextWaypoint
Waypoint GetNextWaypoint() const
Get the waypoint that this object is traveling towards.
Definition:
waypoint-mobility-model.cc:110
ns3::WaypointMobilityModel::m_initialPositionIsWaypoint
bool m_initialPositionIsWaypoint
If true, calling SetPosition with no waypoints creates a waypoint.
Definition:
waypoint-mobility-model.h:178
ns3::WaypointMobilityModel::Update
virtual void Update() const
Update the underlying state corresponding to the stored waypoints.
Definition:
waypoint-mobility-model.cc:124
ns3::WaypointMobilityModel::DoGetVelocity
Vector DoGetVelocity() const override
Returns the current velocity of a node.
Definition:
waypoint-mobility-model.cc:226
ns3::WaypointMobilityModel::WaypointMobilityModel
WaypointMobilityModel()
Create a path with no waypoints at location (0,0,0).
Definition:
waypoint-mobility-model.cc:71
ns3::WaypointMobilityModel::WaypointsLeft
uint32_t WaypointsLeft() const
Get the number of waypoints left for this object, excluding the next one.
Definition:
waypoint-mobility-model.cc:117
ns3::WaypointMobilityModel::m_current
Waypoint m_current
The ns3::Waypoint currently being used.
Definition:
waypoint-mobility-model.h:186
ns3::WaypointMobilityModel::m_first
bool m_first
This variable is set to true if there are no waypoints in the std::deque.
Definition:
waypoint-mobility-model.h:169
ns3::WaypointMobilityModel::m_waypoints
std::deque< Waypoint > m_waypoints
The double ended queue containing the ns3::Waypoint objects.
Definition:
waypoint-mobility-model.h:182
ns3::WaypointMobilityModel::m_lazyNotify
bool m_lazyNotify
If true, course change updates are only notified when position is calculated.
Definition:
waypoint-mobility-model.h:174
ns3::WaypointMobilityModel::EndMobility
void EndMobility()
Clear any existing waypoints and set the current waypoint time to infinity.
Definition:
waypoint-mobility-model.cc:217
ns3::WaypointMobilityModel::DoSetPosition
void DoSetPosition(const Vector &position) override
Sets a new position for the node.
Definition:
waypoint-mobility-model.cc:194
ns3::WaypointMobilityModel::DoGetPosition
Vector DoGetPosition() const override
Get current position.
Definition:
waypoint-mobility-model.cc:187
ns3::WaypointMobilityModel::m_next
Waypoint m_next
The next ns3::Waypoint in the deque.
Definition:
waypoint-mobility-model.h:190
ns3::WaypointMobilityModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition:
waypoint-mobility-model.cc:39
ns3::WaypointMobilityModel::AddWaypoint
void AddWaypoint(const Waypoint &waypoint)
Definition:
waypoint-mobility-model.cc:89
ns3::WaypointMobilityModel::~WaypointMobilityModel
~WaypointMobilityModel() override
Definition:
waypoint-mobility-model.cc:78
mobility-model.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
waypoint.h
src
mobility
model
waypoint-mobility-model.h
Generated on Sun Mar 3 2024 17:11:05 for ns-3 by
1.9.1