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
waypoint.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 Phillip Sitbon
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Phillip Sitbon <phillip@sitbon.net>
7
*/
8
#include "
waypoint.h
"
9
10
namespace
ns3
11
{
12
13
ATTRIBUTE_HELPER_CPP
(
Waypoint
);
14
15
Waypoint::Waypoint
(
const
Time
&
waypointTime
,
const
Vector&
waypointPosition
)
16
: time(
waypointTime
),
17
position(
waypointPosition
)
18
{
19
}
20
21
Waypoint::Waypoint
()
22
: time(),
23
position(0, 0, 0)
24
{
25
}
26
27
/**
28
* @brief Stream insertion operator.
29
*
30
* @param os the stream
31
* @param waypoint the waypoint
32
* @returns a reference to the stream
33
*/
34
std::ostream&
35
operator<<
(std::ostream& os,
const
Waypoint
&
waypoint
)
36
{
37
os <<
waypoint
.time.GetSeconds() <<
"$"
<<
waypoint
.position;
38
return
os;
39
}
40
41
/**
42
* @brief Stream extraction operator.
43
*
44
* @param is the stream
45
* @param waypoint the waypoint
46
* @returns a reference to the stream
47
*/
48
std::istream&
49
operator>>
(std::istream& is,
Waypoint
&
waypoint
)
50
{
51
char
separator
;
52
is >>
waypoint
.time >>
separator
>>
waypoint
.position;
53
if
(
separator
!=
'$'
)
54
{
55
is.setstate(std::ios_base::failbit);
56
}
57
return
is;
58
}
59
60
}
// namespace ns3
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::Waypoint
a (time, location) pair.
Definition
waypoint.h:25
ns3::Waypoint::Waypoint
Waypoint()
Create a waypoint at time 0 and position (0,0,0).
Definition
waypoint.cc:21
ATTRIBUTE_HELPER_CPP
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type
Definition
attribute-helper.h:419
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition
angles.cc:148
ns3::operator>>
std::istream & operator>>(std::istream &is, Angles &a)
Definition
angles.cc:172
waypoint.h
src
mobility
model
waypoint.cc
Generated on Mon Dec 15 2025 15:22:00 for ns-3 by
1.9.8