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
constant-velocity-mobility-model.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006, 2007 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
#include "
constant-velocity-mobility-model.h
"
20
21
#include "ns3/simulator.h"
22
23
namespace
ns3
24
{
25
26
NS_OBJECT_ENSURE_REGISTERED
(ConstantVelocityMobilityModel);
27
28
TypeId
29
ConstantVelocityMobilityModel::GetTypeId
()
30
{
31
static
TypeId
tid =
TypeId
(
"ns3::ConstantVelocityMobilityModel"
)
32
.
SetParent
<
MobilityModel
>()
33
.SetGroupName(
"Mobility"
)
34
.AddConstructor<
ConstantVelocityMobilityModel
>();
35
return
tid;
36
}
37
38
ConstantVelocityMobilityModel::ConstantVelocityMobilityModel
()
39
{
40
}
41
42
ConstantVelocityMobilityModel::~ConstantVelocityMobilityModel
()
43
{
44
}
45
46
void
47
ConstantVelocityMobilityModel::SetVelocity
(
const
Vector& speed)
48
{
49
m_helper
.
Update
();
50
m_helper
.
SetVelocity
(speed);
51
m_helper
.
Unpause
();
52
NotifyCourseChange
();
53
}
54
55
Vector
56
ConstantVelocityMobilityModel::DoGetPosition
()
const
57
{
58
m_helper
.
Update
();
59
return
m_helper
.
GetCurrentPosition
();
60
}
61
62
void
63
ConstantVelocityMobilityModel::DoSetPosition
(
const
Vector& position)
64
{
65
m_helper
.
SetPosition
(position);
66
NotifyCourseChange
();
67
}
68
69
Vector
70
ConstantVelocityMobilityModel::DoGetVelocity
()
const
71
{
72
return
m_helper
.
GetVelocity
();
73
}
74
75
}
// namespace ns3
ns3::ConstantVelocityHelper::GetCurrentPosition
Vector GetCurrentPosition() const
Get current position vector.
Definition:
constant-velocity-helper.cc:62
ns3::ConstantVelocityHelper::GetVelocity
Vector GetVelocity() const
Get velocity; if paused, will return a zero vector.
Definition:
constant-velocity-helper.cc:69
ns3::ConstantVelocityHelper::Update
void Update() const
Update position, if not paused, from last position and time of last update.
Definition:
constant-velocity-helper.cc:84
ns3::ConstantVelocityHelper::Unpause
void Unpause()
Resume mobility from current position at current velocity.
Definition:
constant-velocity-helper.cc:133
ns3::ConstantVelocityHelper::SetPosition
void SetPosition(const Vector &position)
Set position vector.
Definition:
constant-velocity-helper.cc:53
ns3::ConstantVelocityHelper::SetVelocity
void SetVelocity(const Vector &vel)
Set new velocity vector.
Definition:
constant-velocity-helper.cc:76
ns3::ConstantVelocityMobilityModel
Mobility model for which the current speed does not change once it has been set and until it is set a...
Definition:
constant-velocity-mobility-model.h:39
ns3::ConstantVelocityMobilityModel::DoGetPosition
Vector DoGetPosition() const override
Definition:
constant-velocity-mobility-model.cc:56
ns3::ConstantVelocityMobilityModel::ConstantVelocityMobilityModel
ConstantVelocityMobilityModel()
Create position located at coordinates (0,0,0) with speed (0,0,0).
Definition:
constant-velocity-mobility-model.cc:38
ns3::ConstantVelocityMobilityModel::DoSetPosition
void DoSetPosition(const Vector &position) override
Definition:
constant-velocity-mobility-model.cc:63
ns3::ConstantVelocityMobilityModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition:
constant-velocity-mobility-model.cc:29
ns3::ConstantVelocityMobilityModel::m_helper
ConstantVelocityHelper m_helper
helper object for this model
Definition:
constant-velocity-mobility-model.h:65
ns3::ConstantVelocityMobilityModel::SetVelocity
void SetVelocity(const Vector &speed)
Definition:
constant-velocity-mobility-model.cc:47
ns3::ConstantVelocityMobilityModel::~ConstantVelocityMobilityModel
~ConstantVelocityMobilityModel() override
Definition:
constant-velocity-mobility-model.cc:42
ns3::ConstantVelocityMobilityModel::DoGetVelocity
Vector DoGetVelocity() const override
Definition:
constant-velocity-mobility-model.cc:70
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition:
mobility-model.h:40
ns3::MobilityModel::NotifyCourseChange
void NotifyCourseChange() const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
Definition:
mobility-model.cc:112
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:936
constant-velocity-mobility-model.h
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
mobility
model
constant-velocity-mobility-model.cc
Generated on Sun Jul 2 2023 18:21:55 for ns-3 by
1.9.6