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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#include "
constant-velocity-mobility-model.h
"
9
10
#include "ns3/simulator.h"
11
12
namespace
ns3
13
{
14
15
NS_OBJECT_ENSURE_REGISTERED
(ConstantVelocityMobilityModel);
16
17
TypeId
18
ConstantVelocityMobilityModel::GetTypeId
()
19
{
20
static
TypeId
tid =
TypeId
(
"ns3::ConstantVelocityMobilityModel"
)
21
.
SetParent
<
MobilityModel
>()
22
.SetGroupName(
"Mobility"
)
23
.AddConstructor<
ConstantVelocityMobilityModel
>();
24
return
tid;
25
}
26
27
ConstantVelocityMobilityModel::ConstantVelocityMobilityModel
()
28
{
29
}
30
31
ConstantVelocityMobilityModel::~ConstantVelocityMobilityModel
()
32
{
33
}
34
35
void
36
ConstantVelocityMobilityModel::SetVelocity
(
const
Vector& speed)
37
{
38
m_helper
.
Update
();
39
m_helper
.
SetVelocity
(speed);
40
m_helper
.
Unpause
();
41
NotifyCourseChange
();
42
}
43
44
Vector
45
ConstantVelocityMobilityModel::DoGetPosition
()
const
46
{
47
m_helper
.
Update
();
48
return
m_helper
.
GetCurrentPosition
();
49
}
50
51
void
52
ConstantVelocityMobilityModel::DoSetPosition
(
const
Vector& position)
53
{
54
m_helper
.
SetPosition
(position);
55
NotifyCourseChange
();
56
}
57
58
Vector
59
ConstantVelocityMobilityModel::DoGetVelocity
()
const
60
{
61
return
m_helper
.
GetVelocity
();
62
}
63
64
}
// namespace ns3
ns3::ConstantVelocityHelper::GetCurrentPosition
Vector GetCurrentPosition() const
Get current position vector.
Definition
constant-velocity-helper.cc:52
ns3::ConstantVelocityHelper::GetVelocity
Vector GetVelocity() const
Get velocity; if paused, will return a zero vector.
Definition
constant-velocity-helper.cc:59
ns3::ConstantVelocityHelper::Update
void Update() const
Update position, if not paused, from last position and time of last update.
Definition
constant-velocity-helper.cc:74
ns3::ConstantVelocityHelper::Unpause
void Unpause()
Resume mobility from current position at current velocity.
Definition
constant-velocity-helper.cc:123
ns3::ConstantVelocityHelper::SetPosition
void SetPosition(const Vector &position)
Set position vector.
Definition
constant-velocity-helper.cc:43
ns3::ConstantVelocityHelper::SetVelocity
void SetVelocity(const Vector &vel)
Set new velocity vector.
Definition
constant-velocity-helper.cc:66
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:28
ns3::ConstantVelocityMobilityModel::DoGetPosition
Vector DoGetPosition() const override
Definition
constant-velocity-mobility-model.cc:45
ns3::ConstantVelocityMobilityModel::ConstantVelocityMobilityModel
ConstantVelocityMobilityModel()
Create position located at coordinates (0,0,0) with speed (0,0,0).
Definition
constant-velocity-mobility-model.cc:27
ns3::ConstantVelocityMobilityModel::DoSetPosition
void DoSetPosition(const Vector &position) override
Definition
constant-velocity-mobility-model.cc:52
ns3::ConstantVelocityMobilityModel::GetTypeId
static TypeId GetTypeId()
Register this type with the TypeId system.
Definition
constant-velocity-mobility-model.cc:18
ns3::ConstantVelocityMobilityModel::m_helper
ConstantVelocityHelper m_helper
helper object for this model
Definition
constant-velocity-mobility-model.h:54
ns3::ConstantVelocityMobilityModel::SetVelocity
void SetVelocity(const Vector &speed)
Definition
constant-velocity-mobility-model.cc:36
ns3::ConstantVelocityMobilityModel::~ConstantVelocityMobilityModel
~ConstantVelocityMobilityModel() override
Definition
constant-velocity-mobility-model.cc:31
ns3::ConstantVelocityMobilityModel::DoGetVelocity
Vector DoGetVelocity() const override
Definition
constant-velocity-mobility-model.cc:59
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition
mobility-model.h:29
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:101
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
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:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
mobility
model
constant-velocity-mobility-model.cc
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0